Skip to contentSkip to conversation

powerpc/mpc512x: Add gpio driver

PATCH New Matthias Fuchs 1 participant 1 message Mar 5, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/mpc512x: Add gpio driver

This patch adds a gpio driver for MPC512X PowerPCs.

It has been tested on our CAN-CBX-CPU5201 module that uses a MPC5121 CPU. This platform comes with a couple of LEDs and configuration switches that have been used for testing.

---
v2: - move driver to arch/powerpc/platforms/512x directory
- Kconfig changes are now in arch/powerpc/platform/512x/Kconfig
- put struct mpc512x_gpio_regs in driver's .c file
- rename GPIO_MASK into MPC512x_GPIO_MASK
- use shadow registers instead of r/m/w-operations
- don't use arch_initcall but call mpc512x_add_gpiochips() from mpc512x platform setup code.

 arch/powerpc/platforms/512x/Kconfig          |    9 ++
 arch/powerpc/platforms/512x/Makefile         |    1 +
 arch/powerpc/platforms/512x/mpc512x.h        |    3 +
 arch/powerpc/platforms/512x/mpc512x_gpio.c   |  198 ++++++++++++++++++++++++++
 arch/powerpc/platforms/512x/mpc512x_shared.c |    3 +
 5 files changed, 214 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/platforms/512x/mpc512x_gpio.c
arch/powerpc/platforms/512x/Kconfig +9 -0
index 4dac9b0..840c6b4 100644
@@ -10,6 +10,15 @@ config PPC_MPC5121
 	bool
 	select PPC_MPC512x
 
+config MPC512x_GPIO
+	bool "MPC512x GPIO support"
+	depends on PPC_MPC512x
+	select GENERIC_GPIO
+	select ARCH_REQUIRE_GPIOLIB
+	help
+	  Say Y here if you're going to use hardware that connects to the
+	  MPC512x GPIOs.
+
 config MPC5121_ADS
 	bool "Freescale MPC5121E ADS"
 	depends on 6xx
arch/powerpc/platforms/512x/Makefile +1 -0
index 90be2f5..12518e3 100644
@@ -4,3 +4,4 @@
 obj-y				+= clock.o mpc512x_shared.o
 obj-$(CONFIG_MPC5121_ADS)	+= mpc5121_ads.o mpc5121_ads_cpld.o
 obj-$(CONFIG_MPC5121_GENERIC)	+= mpc5121_generic.o
+obj-$(CONFIG_MPC512x_GPIO)	+= mpc512x_gpio.o
arch/powerpc/platforms/512x/mpc512x.h +3 -0
index b2daca0..4c67990 100644
@@ -16,4 +16,7 @@ extern void __init mpc512x_init(void);
 extern int __init mpc5121_clk_init(void);
 void __init mpc512x_declare_of_platform_devices(void);
 extern void mpc512x_restart(char *cmd);
+#ifdef CONFIG_MPC512x_GPIO
+extern int __init mpc512x_add_gpiochips(void);
+#endif
 #endif				/* __MPC512X_H__ */
arch/powerpc/platforms/512x/mpc512x_gpio.c new file +198 -0

198 lines not on this page · raw message

arch/powerpc/platforms/512x/mpc512x_shared.c +3 -0
index b7f518a..42320ab 100644
@@ -100,4 +100,7 @@ void __init mpc512x_init(void)
 	mpc512x_declare_of_platform_devices();
 	mpc5121_clk_init();
 	mpc512x_restart_init();
+#ifdef CONFIG_MPC512x_GPIO
+	mpc512x_add_gpiochips();
+#endif
 }
Signature · 1 line
1.6.1