xref: /openbmc/u-boot/board/buffalo/lsxl/lsxl.h (revision e76cd5d4)
1 /*
2  * Copyright (c) 2012 Michael Walle
3  * Michael Walle <michael@walle.cc>
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
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 Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
22  */
23 
24 #ifndef __LSXL_H
25 #define __LSXL_H
26 
27 #define GPIO_HDD_POWER		10
28 #define GPIO_USB_VBUS		11
29 #define GPIO_FAN_HIGH		18
30 #define GPIO_FAN_LOW		19
31 #define GPIO_FUNC_LED		36
32 #define GPIO_ALARM_LED		37
33 #define GPIO_INFO_LED		38
34 #define GPIO_POWER_LED		39
35 #define GPIO_FAN_LOCK		40
36 #define GPIO_FUNC_BUTTON	41
37 #define GPIO_POWER_SWITCH	42
38 #define GPIO_POWER_AUTO_SWITCH	43
39 #define GPIO_FUNC_RED_LED	48
40 
41 #define _BIT(x) (1<<(x))
42 
43 #define LSXL_OE_LOW (~(_BIT(GPIO_HDD_POWER)		    \
44 			| _BIT(GPIO_USB_VBUS)		    \
45 			| _BIT(GPIO_FAN_HIGH)		    \
46 			| _BIT(GPIO_FAN_LOW)))
47 
48 #define LSXL_OE_HIGH (~(_BIT(GPIO_FUNC_LED - 32)	    \
49 			| _BIT(GPIO_ALARM_LED - 32)	    \
50 			| _BIT(GPIO_INFO_LED - 32)	    \
51 			| _BIT(GPIO_POWER_LED - 32)	    \
52 			| _BIT(GPIO_FUNC_RED_LED - 32)))
53 
54 #define LSXL_OE_VAL_LOW (_BIT(GPIO_HDD_POWER)		    \
55 			| _BIT(GPIO_USB_VBUS))
56 
57 #define LSXL_OE_VAL_HIGH (_BIT(GPIO_FUNC_LED - 32)	    \
58 			| _BIT(GPIO_ALARM_LED - 32)	    \
59 			| _BIT(GPIO_INFO_LED - 32)	    \
60 			| _BIT(GPIO_POWER_LED - 32)	    \
61 			| _BIT(GPIO_FUNC_RED_LED - 32))
62 
63 #define LSXL_POL_VAL_LOW (_BIT(GPIO_FAN_HIGH)		    \
64 			| _BIT(GPIO_FAN_LOW))
65 
66 #define LSXL_POL_VAL_HIGH (_BIT(GPIO_FUNC_LED - 32)	    \
67 			| _BIT(GPIO_ALARM_LED - 32)	    \
68 			| _BIT(GPIO_INFO_LED - 32)	    \
69 			| _BIT(GPIO_POWER_LED - 32)	    \
70 			| _BIT(GPIO_FUNC_BUTTON - 32)	    \
71 			| _BIT(GPIO_POWER_SWITCH - 32)	    \
72 			| _BIT(GPIO_POWER_AUTO_SWITCH - 32) \
73 			| _BIT(GPIO_FUNC_RED_LED - 32))
74 
75 #endif /* __LSXL_H */
76