summaryrefslogtreecommitdiff
path: root/arch/arm/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-01-21 14:53:34 -0700
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2019-02-01 16:59:13 +0100
commitaa48c94ca87e9831738238128385472be41b148e (patch)
tree34dd4f90286d9f92a9014f4dda99cba633a92b53 /arch/arm/include
parent3ec6f11c7d192856b65217317ff5ba52827f7a3c (diff)
rockchip: Implement spl_gpio in the GPIO driver
Allow rockchip boards to use GPIOs before driver model is ready. This is really only useful for setting GPIOs to enable the early debug console, if needed on some platforms. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/arch-rockchip/gpio.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-rockchip/gpio.h b/arch/arm/include/asm/arch-rockchip/gpio.h
index 0e3b57d0ef..1aaec5faec 100644
--- a/arch/arm/include/asm/arch-rockchip/gpio.h
+++ b/arch/arm/include/asm/arch-rockchip/gpio.h
@@ -31,4 +31,27 @@ enum gpio_pu_pd {
GPIO_PULL_REPEAT,
};
+/* These defines are only used by spl_gpio.h */
+enum {
+ /* Banks have 8 GPIOs, so 3 bits, and there are 4 banks, so 2 bits */
+ GPIO_BANK_SHIFT = 3,
+ GPIO_BANK_MASK = 3 << GPIO_BANK_SHIFT,
+
+ GPIO_OFFSET_MASK = 0x1f,
+};
+
+#define GPIO(bank, offset) ((bank) << GPIO_BANK_SHIFT | (offset))
+
+enum gpio_bank_t {
+ BANK_A = 0,
+ BANK_B,
+ BANK_C,
+ BANK_D,
+};
+
+enum gpio_dir_t {
+ GPIO_INPUT = 0,
+ GPIO_OUTPUT,
+};
+
#endif