[U-Boot] [PATCH 4/5] gpio: uniphier: import dt-binginds header from Linux
Masahiro Yamada
yamada.masahiro at socionext.com
Fri Nov 24 15:25:34 UTC 2017
Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---
drivers/gpio/gpio-uniphier.c | 3 +--
include/dt-bindings/gpio/uniphier-gpio.h | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
create mode 100644 include/dt-bindings/gpio/uniphier-gpio.h
diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c
index 107c3fc..8d72ab8 100644
--- a/drivers/gpio/gpio-uniphier.c
+++ b/drivers/gpio/gpio-uniphier.c
@@ -13,8 +13,7 @@
#include <linux/errno.h>
#include <asm/global_data.h>
#include <asm/gpio.h>
-
-#define UNIPHIER_GPIO_LINES_PER_BANK 8
+#include <dt-bindings/gpio/uniphier-gpio.h>
#define UNIPHIER_GPIO_PORT_DATA 0x0 /* data */
#define UNIPHIER_GPIO_PORT_DIR 0x4 /* direction (1:in, 0:out) */
diff --git a/include/dt-bindings/gpio/uniphier-gpio.h b/include/dt-bindings/gpio/uniphier-gpio.h
new file mode 100644
index 0000000..9f0ad17
--- /dev/null
+++ b/include/dt-bindings/gpio/uniphier-gpio.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2017 Socionext Inc.
+ * Author: Masahiro Yamada <yamada.masahiro at socionext.com>
+ */
+
+#ifndef _DT_BINDINGS_GPIO_UNIPHIER_H
+#define _DT_BINDINGS_GPIO_UNIPHIER_H
+
+#define UNIPHIER_GPIO_LINES_PER_BANK 8
+
+#define UNIPHIER_GPIO_IRQ_OFFSET ((UNIPHIER_GPIO_LINES_PER_BANK) * 15)
+
+#define UNIPHIER_GPIO_PORT(bank, line) \
+ ((UNIPHIER_GPIO_LINES_PER_BANK) * (bank) + (line))
+
+#define UNIPHIER_GPIO_IRQ(n) ((UNIPHIER_GPIO_IRQ_OFFSET) + (n))
+
+#endif /* _DT_BINDINGS_GPIO_UNIPHIER_H */
--
2.7.4
More information about the U-Boot
mailing list