xref: /openbmc/u-boot/board/buffalo/lsxl/lsxl.h (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
2f214a20eSMichael Walle /*
3f214a20eSMichael Walle  * Copyright (c) 2012 Michael Walle
4f214a20eSMichael Walle  * Michael Walle <michael@walle.cc>
5f214a20eSMichael Walle  */
6f214a20eSMichael Walle 
7f214a20eSMichael Walle #ifndef __LSXL_H
8f214a20eSMichael Walle #define __LSXL_H
9f214a20eSMichael Walle 
10f214a20eSMichael Walle #define GPIO_HDD_POWER		10
11f214a20eSMichael Walle #define GPIO_USB_VBUS		11
12f214a20eSMichael Walle #define GPIO_FAN_HIGH		18
13f214a20eSMichael Walle #define GPIO_FAN_LOW		19
14f214a20eSMichael Walle #define GPIO_FUNC_LED		36
15f214a20eSMichael Walle #define GPIO_ALARM_LED		37
16f214a20eSMichael Walle #define GPIO_INFO_LED		38
17f214a20eSMichael Walle #define GPIO_POWER_LED		39
18f214a20eSMichael Walle #define GPIO_FAN_LOCK		40
19f214a20eSMichael Walle #define GPIO_FUNC_BUTTON	41
20f214a20eSMichael Walle #define GPIO_POWER_SWITCH	42
21f214a20eSMichael Walle #define GPIO_POWER_AUTO_SWITCH	43
22f214a20eSMichael Walle #define GPIO_FUNC_RED_LED	48
23f214a20eSMichael Walle 
24f214a20eSMichael Walle #define _BIT(x) (1<<(x))
25f214a20eSMichael Walle 
26f214a20eSMichael Walle #define LSXL_OE_LOW (~(_BIT(GPIO_HDD_POWER)		    \
27f214a20eSMichael Walle 			| _BIT(GPIO_USB_VBUS)		    \
28f214a20eSMichael Walle 			| _BIT(GPIO_FAN_HIGH)		    \
29f214a20eSMichael Walle 			| _BIT(GPIO_FAN_LOW)))
30f214a20eSMichael Walle 
31f214a20eSMichael Walle #define LSXL_OE_HIGH (~(_BIT(GPIO_FUNC_LED - 32)	    \
32f214a20eSMichael Walle 			| _BIT(GPIO_ALARM_LED - 32)	    \
33f214a20eSMichael Walle 			| _BIT(GPIO_INFO_LED - 32)	    \
34f214a20eSMichael Walle 			| _BIT(GPIO_POWER_LED - 32)	    \
35f214a20eSMichael Walle 			| _BIT(GPIO_FUNC_RED_LED - 32)))
36f214a20eSMichael Walle 
37f214a20eSMichael Walle #define LSXL_OE_VAL_LOW (_BIT(GPIO_HDD_POWER)		    \
38f214a20eSMichael Walle 			| _BIT(GPIO_USB_VBUS))
39f214a20eSMichael Walle 
40f214a20eSMichael Walle #define LSXL_OE_VAL_HIGH (_BIT(GPIO_FUNC_LED - 32)	    \
41f214a20eSMichael Walle 			| _BIT(GPIO_ALARM_LED - 32)	    \
42f214a20eSMichael Walle 			| _BIT(GPIO_INFO_LED - 32)	    \
43f214a20eSMichael Walle 			| _BIT(GPIO_POWER_LED - 32)	    \
44f214a20eSMichael Walle 			| _BIT(GPIO_FUNC_RED_LED - 32))
45f214a20eSMichael Walle 
46f214a20eSMichael Walle #define LSXL_POL_VAL_LOW (_BIT(GPIO_FAN_HIGH)		    \
47f214a20eSMichael Walle 			| _BIT(GPIO_FAN_LOW))
48f214a20eSMichael Walle 
49f214a20eSMichael Walle #define LSXL_POL_VAL_HIGH (_BIT(GPIO_FUNC_LED - 32)	    \
50f214a20eSMichael Walle 			| _BIT(GPIO_ALARM_LED - 32)	    \
51f214a20eSMichael Walle 			| _BIT(GPIO_INFO_LED - 32)	    \
52f214a20eSMichael Walle 			| _BIT(GPIO_POWER_LED - 32)	    \
53f214a20eSMichael Walle 			| _BIT(GPIO_FUNC_BUTTON - 32)	    \
54f214a20eSMichael Walle 			| _BIT(GPIO_POWER_SWITCH - 32)	    \
55f214a20eSMichael Walle 			| _BIT(GPIO_POWER_AUTO_SWITCH - 32) \
56f214a20eSMichael Walle 			| _BIT(GPIO_FUNC_RED_LED - 32))
57f214a20eSMichael Walle 
58f214a20eSMichael Walle #endif /* __LSXL_H */
59