[PATCH v2 11/11] ARM i.MX6: add imx-gpio devices
Steffen Trumtrar
s.trumtrar at pengutronix.de
Mon Sep 3 04:18:18 EDT 2012
Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
---
arch/arm/mach-imx/Kconfig | 1 +
arch/arm/mach-imx/imx6.c | 26 ++++++++++++++------------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 0c09b57..eb4c2ae 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -194,6 +194,7 @@ config ARCH_IMX53
config ARCH_IMX6
bool "i.MX6"
select ARCH_HAS_FEC_IMX
+ select GPIOLIB
select CPU_V7
endchoice
diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index a443343..80f558e 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -23,18 +23,6 @@
#include "gpio.h"
-void *imx_gpio_base[] = {
- (void *)MX6_GPIO1_BASE_ADDR,
- (void *)MX6_GPIO2_BASE_ADDR,
- (void *)MX6_GPIO3_BASE_ADDR,
- (void *)MX6_GPIO4_BASE_ADDR,
- (void *)MX6_GPIO5_BASE_ADDR,
- (void *)MX6_GPIO6_BASE_ADDR,
- (void *)MX6_GPIO7_BASE_ADDR,
-};
-
-int imx_gpio_count = ARRAY_SIZE(imx_gpio_base) * 32;
-
void imx6_init_lowlevel(void)
{
void __iomem *aips1 = (void *)MX6_AIPS1_ON_BASE_ADDR;
@@ -69,3 +57,17 @@ void imx6_init_lowlevel(void)
writel(0xffffffff, 0x020c407c);
writel(0xffffffff, 0x020c4080);
}
+
+static int imx6_init(void)
+{
+ add_generic_device("imx-gpio", 0, NULL, MX6_GPIO1_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx-gpio", 1, NULL, MX6_GPIO2_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx-gpio", 2, NULL, MX6_GPIO3_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx-gpio", 3, NULL, MX6_GPIO4_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx-gpio", 4, NULL, MX6_GPIO5_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx-gpio", 5, NULL, MX6_GPIO6_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx-gpio", 6, NULL, MX6_GPIO7_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+
+ return 0;
+}
+coredevice_initcall(imx6_init);
--
1.7.10.4
More information about the barebox
mailing list