diff options
author | David Wu <david.wu@rock-chips.com> | 2017-09-05 18:16:13 +0800 |
---|---|---|
committer | Huang, Tao <huangtao@rock-chips.com> | 2017-09-20 14:45:39 +0800 |
commit | 3b7424f3327304988431eca44adf92e59999aa2b (patch) | |
tree | becc0363f58bc75e9a764eb7412b5778c3a20d51 /include/asm-generic | |
parent | 4548e24e06a1b76eeb604f1bbbe9116ee88a688d (diff) |
pinctrl: rockchip: Make the gpio base started from 1000
If the gpio base is started from 1000, the "gpio = 0" will
be invalid, that can avoid something unforeseen. The real
pin number is "gpio number - 1000".
If you cat the gpio log, you will see the log like this:
rk3399:/ # cat d/gpio
GPIOs 1000-1031, platform/pinctrl, gpio0:
gpio-1004 ( |bt_default_wake_host) in lo
gpio-1005 ( |power ) in hi
gpio-1009 ( |bt_default_reset ) out lo
gpio-1010 ( |reset ) out lo
gpio-1011 ( |? ) out hi
GPIOs 1032-1063, platform/pinctrl, gpio1:
gpio-1034 ( |int-n ) in hi
gpio-1035 ( |vbus-5v ) out lo
gpio-1036 ( |vbus-5v ) out lo
gpio-1045 ( |enable ) out hi
gpio-1046 ( |vsel ) out lo
gpio-1049 ( |vsel ) out lo
gpio-1056 ( |int-n ) in hi
GPIOs 1064-1095, platform/pinctrl, gpio2:
gpio-1083 ( |bt_default_rts ) in hi
gpio-1090 ( |bt_default_wake ) in hi
GPIOs 1096-1127, platform/pinctrl, gpio3:
gpio-1111 ( |mdio-reset ) out hi
GPIOs 1128-1159, platform/pinctrl, gpio4:
gpio-1150 ( |? ) out hi
gpio-1153 ( |vcc5v0_host ) out hi
gpio-1156 ( |hp det ) in hi
Change-Id: I744ddc1df6075b0a044d65c65622e2a59f3a332e
Signed-off-by: David Wu <david.wu@rock-chips.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/gpio.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 40ec1433f05d..56bfbb4e497f 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -25,6 +25,8 @@ * actually an estimate of a board-specific value. */ +#define ARCH_GPIO_BASE 1000 + #ifndef ARCH_NR_GPIOS #define ARCH_NR_GPIOS 512 #endif @@ -40,7 +42,7 @@ static inline bool gpio_is_valid(int number) { - return number >= 0 && number < ARCH_NR_GPIOS; + return number >= ARCH_GPIO_BASE && number < ARCH_NR_GPIOS + ARCH_GPIO_BASE; } struct device; |