Skip to contentSkip to conversation

sh: use gpiolib

PATCH In review Magnus Damm 1 participant 1 message Dec 25, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 sh: use gpiolib

From: Magnus Damm <[email protected]>

This patch updates the SuperH gpio code to make use of gpiolib. The gpiolib callbacks get() and set() are lockless, but we use our own spinlock for the other operations to make sure hardware register bitfield accesses stay atomic.

---

r2dplus builds both with and without CONFIG_GENERIC_GPIO. Migo-R builds and works well.

 arch/sh/Kconfig            |    7 ++
 arch/sh/boards/Kconfig     |    4 -
 arch/sh/include/asm/gpio.h |   61 ++++++++++++++-----------
 arch/sh/kernel/Makefile_32 |    2 
 arch/sh/kernel/Makefile_64 |    2 
 arch/sh/kernel/gpio.c      |  106 ++++++++++++++++++++++----------------------
 drivers/serial/sh-sci.h    |    2 
 7 files changed, 100 insertions(+), 84 deletions(-)
arch/sh/Kconfig +7 -0
@@ -126,6 +126,13 @@ config ARCH_HAS_ILOG2_U64
 config ARCH_NO_VIRT_TO_BUS
 	def_bool y
 
+config ARCH_WANT_OPTIONAL_GPIOLIB
+	def_bool y
+	depends on !ARCH_REQUIRE_GPIOLIB
+
+config ARCH_REQUIRE_GPIOLIB
+	def_bool n
+
 config IO_TRAPPED
 	bool
 
arch/sh/boards/Kconfig +2 -2
@@ -165,7 +165,7 @@ config SH_SH7785LCR_29BIT_PHYSMAPS
 config SH_MIGOR
 	bool "Migo-R"
 	depends on CPU_SUBTYPE_SH7722
-	select GENERIC_GPIO
+	select ARCH_REQUIRE_GPIOLIB
 	help
 	  Select Migo-R if configuring for the SH7722 Migo-R platform
           by Renesas System Solutions Asia Pte. Ltd.
@@ -173,7 +173,7 @@ config SH_MIGOR
 config SH_AP325RXA
 	bool "AP-325RXA"
 	depends on CPU_SUBTYPE_SH7723
-	select GENERIC_GPIO
+	select ARCH_REQUIRE_GPIOLIB
 	help
 	  Renesas "AP-325RXA" support.
 	  Compatible with ALGO SYSTEM CO.,LTD. "AP-320A"
arch/sh/include/asm/gpio.h +35 -26

75 lines not on this page · raw message

arch/sh/kernel/Makefile_32 +1 -1
@@ -27,7 +27,7 @@ obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-$(CONFIG_IO_TRAPPED)	+= io_trapped.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
-obj-$(CONFIG_GENERIC_GPIO)	+= gpio.o
+obj-$(CONFIG_ARCH_REQUIRE_GPIOLIB)	+= gpio.o
 obj-$(CONFIG_DYNAMIC_FTRACE)	+= ftrace.o
 obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 
arch/sh/kernel/Makefile_64 +1 -1
@@ -15,6 +15,6 @@ obj-$(CONFIG_KEXEC)		+= machine_kexec.o 
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-$(CONFIG_IO_TRAPPED)	+= io_trapped.o
-obj-$(CONFIG_GENERIC_GPIO)	+= gpio.o
+obj-$(CONFIG_ARCH_REQUIRE_GPIOLIB)	+= gpio.o
 
 EXTRA_CFLAGS += -Werror
arch/sh/kernel/gpio.c +53 -53

206 lines not on this page · raw message

drivers/serial/sh-sci.h +1 -1
@@ -1,6 +1,6 @@
 #include <linux/serial_core.h>
 #include <asm/io.h>
-#include <asm/gpio.h>
+#include <linux/gpio.h>
 
 #if defined(CONFIG_H83007) || defined(CONFIG_H83068)
 #include <asm/regs306x.h>