Skip to contentSkip to conversation

ARM: SAMSUNG: Move GPIO common functions to plat-samsung

PATCH New Kukjin Kim 1 participant 1 message Jan 19, 2010

Subsystems (3)
lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH v3 1/1 ARM: SAMSUNG: Move GPIO common functions to plat-samsung

This patch moves GPIO common functions (from plat-s3c64xx) into plat-samsung. and adds the config option to build the plat-samsung/gpiolib for Samsung SoCs.

---
 arch/arm/plat-s3c/include/plat/gpio-core.h |   28 ++++
 arch/arm/plat-s3c64xx/Kconfig              |    1 +
 arch/arm/plat-s3c64xx/gpiolib.c            |  162 +----------------------
 arch/arm/plat-samsung/Kconfig              |    7 +
 arch/arm/plat-samsung/Makefile             |    1 +
 arch/arm/plat-samsung/gpiolib.c            |  197 ++++++++++++++++++++++++++++
 6 files changed, 236 insertions(+), 160 deletions(-)
 create mode 100644 arch/arm/plat-samsung/gpiolib.c
arch/arm/plat-s3c/include/plat/gpio-core.h +28 -0
index 32af612..94fed58 100644
@@ -11,6 +11,11 @@
  * published by the Free Software Foundation.
 */
 
+#define GPIOCON_OFF	(0x00)
+#define GPIODAT_OFF	(0x04)
+
+#define con_4bit_shift(__off) ((__off) * 4)
+
 /* Define the core gpiolib support functions that the s3c platforms may
  * need to extend or change depending on the hardware and the s3c chip
  * selected at build or found at run time.
@@ -80,6 +85,29 @@ extern void s3c_gpiolib_add(struct s3c_gpio_chip *chip);
  * and any other necessary functions.
  */
 
+/**
+ * samsung_gpiolib_add_4bit_chips - 4bit single register GPIO config.
+ * @chip: The gpio chip that is being configured.
+ * @nr_chips: The no of chips (gpio ports) for the GPIO being configured.
+ *
+ * This helper deal with the GPIO cases where the control register has 4 bits
+ * of control per GPIO, generally in the form of:
+ * 0000 = Input
+ * 0001 = Output
+ * others = Special functions (dependant on bank)
+ *
+ * Note, since the code to deal with the case where there are two control
+ * registers instead of one, we do not have a seperate set of function
+ * (samsung_gpiolib_add_4bit2_chips)for each case.
+ */
+extern void samsung_gpiolib_add_4bit_chips(struct s3c_gpio_chip *chip,
+					   int nr_chips);
+extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
+					    int nr_chips);
+
+extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip);
+extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip);
+
 #ifdef CONFIG_S3C_GPIO_TRACK
 extern struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END];
 
arch/arm/plat-s3c64xx/Kconfig +1 -0
index 0fba1f9..37b4519 100644
@@ -22,6 +22,7 @@ config PLAT_S3C64XX
 	select S3C_GPIO_CFG_S3C64XX
 	select S3C_DEV_NAND
 	select USB_ARCH_HAS_OHCI
+	select SAMSUNG_GPIOLIB_4BIT
 	help
 	  Base platform code for any Samsung S3C64XX device
 
arch/arm/plat-s3c64xx/gpiolib.c +2 -160

182 lines not on this page · raw message

arch/arm/plat-samsung/Kconfig +7 -0
index e6c1229..6484b5b 100644
@@ -33,6 +33,13 @@ config SAMSUNG_IRQ_UART
 
 # options for gpio configuration support
 
+config SAMSUNG_GPIOLIB_4BIT
+	bool
+	help
+	  GPIOlib file contains the 4 bit modification functions for gpio
+	  configuration. GPIOlib shall be compiled only for S3C64XX and S5P
+	  series of processors.
+
 config S3C_GPIO_CFG_S3C24XX
 	bool
 	help
arch/arm/plat-samsung/Makefile +1 -0
index ceac416..1fc8d47 100644
@@ -15,6 +15,7 @@ obj-y				+= clock.o
 obj-y				+= pwm-clock.o
 obj-y				+= gpio-config.o
 
+obj-$(CONFIG_SAMSUNG_GPIOLIB_4BIT)	+= gpiolib.o
 obj-$(CONFIG_SAMSUNG_CLKSRC)	+= clock-clksrc.o
 
 obj-$(CONFIG_SAMSUNG_IRQ_UART)	+= irq-uart.o
arch/arm/plat-samsung/gpiolib.c new file +197 -0

197 lines not on this page · raw message

Signature · 1 line
1.6.2.5