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