2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 #ifndef _SCIC_SGPIO_H_
55 #define _SCIC_SGPIO_H_
60 * @brief This file contains all of the interface methods that can be called
61 * by an SCI user on an Serialized General Purpose IO (SGPIO) object.
68 #include <dev/isci/scil/sci_types.h>
70 //Programmable Blink Pattern Durations
71 #define SGPIO_BLINK_DURATION_125 0x0
72 #define SGPIO_BLINK_DURATION_250 0x1
73 #define SGPIO_BLINK_DURATION_375 0x2
74 #define SGPIO_BLINK_DURATION_500 0x3
75 #define SGPIO_BLINK_DURATION_625 0x4
76 #define SGPIO_BLINK_DURATION_750 0x5
77 #define SGPIO_BLINK_DURATION_875 0x6
78 #define SGPIO_BLINK_DURATION_1000 0x7
79 #define SGPIO_BLINK_DURATION_1250 0x8
80 #define SGPIO_BLINK_DURATION_1375 0x9
81 #define SGPIO_BLINK_DURATION_1500 0xA
82 #define SGPIO_BLINK_DURATION_1625 0xB
83 #define SGPIO_BLINK_DURATION_1750 0xC
84 #define SGPIO_BLINK_DURATION_1875 0xD
85 #define SGPIO_BLINK_DURATION_2000 0xF
87 #define ENABLE_SGPIO_FUNCTIONALITY 1
88 #define DISABLE_SGPIO_FUNCTIONALITY 0
90 #define SGPIO_HARDWARE_CONTROL 0x00000443
91 #define SGPIO_SOFTWARE_CONTROL 0x00000444
93 #define PHY_0_MASK 0x01
94 #define PHY_1_MASK 0x02
95 #define PHY_2_MASK 0x04
96 #define PHY_3_MASK 0x08
98 #define SGODSR_INVERT_BIT 0x4
100 #define SGODSR_ERROR_LED_SHIFT 8
101 #define SGODSR_LOCATE_LED_SHIFT 4
102 #define SGODSR_ACTIVITY_LED_SHIFT 0
104 #define SGPIO_BLINK_PATTERN_A 0x1
105 #define SGPIO_BLINK_PATTERN_B 0x2
108 * @brief This will set the vendor specific code in the SGPIO Vendor Specific Code
109 * register that is sent on the sLoad wire at the start of each
112 * @param[in] SCI_CONTROLLER_HANDLE_T controller
113 * @param]in] vendor_specific_sequence - Vendor specific sequence set in the
117 void scic_sgpio_set_vendor_code(
118 SCI_CONTROLLER_HANDLE_T controller,
119 U8 vendor_specific_sequence
123 * @brief Use this to set both programmable blink patterns A & B in the
124 * SGPBR(Programmable Blink Register). Will set identical patterns
125 * on both SGPIO units.
127 * @param[in] SCI_CONTROLLER_HANDLE_T controller
128 * @param[in] pattern_a_high - High(LED on) duration time for pattern A
129 * @param[in] pattern_a_low - Low(LED off) duration time for pattern A
130 * @param[in] pattern_b_high - High(LED on) duration time for pattern B
131 * @param[in] pattern_b_low - Low(LED off) duration time for pattern B
134 void scic_sgpio_set_blink_patterns(
135 SCI_CONTROLLER_HANDLE_T controller,
144 * @brief This will set the functionality enable bit in the SGPIO interface
145 * control register, when set the bus pins will be used for SGPIO
146 * signaling, if not the bus pins are used for direct led control.
148 * @param[in] SCI_CONTROLLER_HANDLE_T controller
149 * @param[in] BOOL sgpio_mode - indication for SGPIO signaling.
152 void scic_sgpio_set_functionality(
153 SCI_CONTROLLER_HANDLE_T controller,
158 * @brief Communicates with hardware to set the blink pattern
159 * of the error, locate, and activity LED's for phys
160 * specified by the phy_mask parameter.
161 * Function intend to be used to LEDs management
162 * in non-inteligent backplanes.
164 * @param[in] SCI_CONTROLLER_HANDLE_T controller
165 * @param[in] phy_mask - This field is a bit mask that specifies the phys
167 * @param[in] error - If TRUE, apply pattern for the error LED
168 * @param[in] locate - If TRUE, apply pattern for the locate LED
169 * @param[in] activity - If TRUE, apply pattern for the activity LED
170 * @param[in] pattern_selection - One of two patterns (A or B).
171 * "A" and "B" patterns should be previously defined
172 * by scic_sgpio_set_blink_patterns()
176 void scic_sgpio_apply_led_blink_pattern(
177 SCI_CONTROLLER_HANDLE_T controller,
186 * @brief Communicates with hardware to set the blink pattern
187 * of the error, locate, and activity LED's for all
188 * phys in the port. Function intend to be used to LEDs
189 * management in non-inteligent backplanes.
191 * @param[in] SCI_CONTROLLER_HANDLE_T controller
192 * @param[in] port_handle - port handle is used to identify SGPIO bay
193 * @param[in] error - If TRUE, apply pattern for the error LED
194 * @param[in] locate - If TRUE, apply pattern for the locate LED
195 * @param[in] activity - If TRUE, apply pattern for the activity LED
196 * @param[in] pattern_selection - One of two patterns (A or B).
197 * "A" and "B" patterns should be previously defined
198 * by scic_sgpio_set_blink_patterns()
202 void scic_sgpio_set_led_blink_pattern(
203 SCI_CONTROLLER_HANDLE_T controller,
204 SCI_PORT_HANDLE_T port_handle,
212 * @brief Communicates with hardware to set the state of the error, locate,
213 * and activity LED's.
215 * @param[in] SCI_CONTROLLER_HANDLE_T controller
216 * @param[in] phy_mask - This field is a bit mask that specifies the phys
218 * @param[in] error - State to be set for the error LED
219 * @param[in] locate - State to be set for the locate LED
220 * @param[in] activity - State to be set for the activity LED
224 void scic_sgpio_update_led_state(
225 SCI_CONTROLLER_HANDLE_T controller,
233 * @brief Communicates with hardware to set the state of the error, locate,
234 * and activity LED's for all phys in the port.
236 * @param[in] SCI_CONTROLLER_HANDLE_T controller
237 * @param[in] port_handle - port handle is used to identify SGPIO bay
238 * @param[in] error - State to be set for the error LED
239 * @param[in] locate - State to be set for the locate LED
240 * @param[in] activity - State to be set for the activity LED
244 void scic_sgpio_set_led_state(
245 SCI_CONTROLLER_HANDLE_T controller,
246 SCI_PORT_HANDLE_T port_handle,
253 * @brief This will set all Activity LED's to hardware controlled
255 * @param[in] BOOL is_hardware_controlled - indication for the Activity LED's
256 * to be hardware controlled or driver controlled.
259 void scic_sgpio_set_to_hardware_control(
260 SCI_CONTROLLER_HANDLE_T controller,
261 BOOL is_hardware_controlled
265 * @brief Reads and returns the data-in from the SGPIO port for the specified controller.
266 * Bits 00:02 - Drive 0 input data
267 * Bits 04:06 - Drive 1 input data
268 * Bits 08:10 - Drive 2 input data
269 * Bits 12:14 - Drive 3 input data
271 * @param[in] SCI_CONTROLLER_HANDLE_T controller
272 * @return U32 - Value read from SGPIO, 0xffffffff indicates hardware not readable
275 SCI_CONTROLLER_HANDLE_T controller
279 * @brief Initializes the SCU for Hardware SGPIO LED control.
281 * @param[in] SCI_CONTROLLER_HANDLE_T controller
283 void scic_sgpio_hardware_initialize(
284 SCI_CONTROLLER_HANDLE_T controller
287 * @brief Initializes the SCU for Software SGPIO signaling of LED control.
289 * @param[in] SCI_CONTROLLER_HANDLE_T controller
291 void scic_sgpio_initialize(
292 SCI_CONTROLLER_HANDLE_T controller
297 #endif // __cplusplus
299 #endif // _SCIC_SGPIO_H_