Skip to contentSkip to conversation

Move Qualcomm gpio drivers into drivers dir

PATCH Superseded David Brown 6 participants 39 messages May 18, 2011 – Jun 6, 2011

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

cover Move Qualcomm gpio drivers into drivers dir

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

David Brown (7):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

 arch/arm/mach-msm/Kconfig                       |    4 +
 arch/arm/mach-msm/Makefile                      |    8 -
 arch/arm/mach-msm/gpio-v2.c                     |  427 -----------------------
 arch/arm/mach-msm/gpio.c                        |  376 --------------------
 arch/arm/mach-msm/gpio_hw.h                     |  278 ---------------
 arch/arm/mach-msm/gpiomux.h                     |   17 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap.h      |    2 +
 arch/arm/mach-msm/io.c                          |   12 +-
 drivers/gpio/Kconfig                            |   16 +
 drivers/gpio/Makefile                           |    2 +
 drivers/gpio/msm_v1.c                           |  387 ++++++++++++++++++++
 drivers/gpio/msm_v1.h                           |  271 ++++++++++++++
 drivers/gpio/msm_v2.c                           |  427 +++++++++++++++++++++++
 include/linux/msm_gpiomux.h                     |   38 ++
 17 files changed, 1166 insertions(+), 1129 deletions(-)
 delete mode 100644 arch/arm/mach-msm/gpio-v2.c
 delete mode 100644 arch/arm/mach-msm/gpio.c
 delete mode 100644 arch/arm/mach-msm/gpio_hw.h
 create mode 100644 drivers/gpio/msm_v1.c
 create mode 100644 drivers/gpio/msm_v1.h
 create mode 100644 drivers/gpio/msm_v2.c
 create mode 100644 include/linux/msm_gpiomux.h
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw

PATCH 1/7 msm: gpio: Remove unsupported devices

The MSM7x25 and MSM7x27 devices are not yet supported in the kernel. Remove #ifdef-based tables supporting these chips for now.

---
 arch/arm/mach-msm/gpio.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
arch/arm/mach-msm/gpio.c +0 -7
index 5ea273b..c358ced 100644
@@ -197,13 +197,6 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(3,  68,  94),
 	MSM_GPIO_BANK(4,  95, 106),
 	MSM_GPIO_BANK(5, 107, 121),
-#elif defined(CONFIG_ARCH_MSM7X25) || defined(CONFIG_ARCH_MSM7X27)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 132),
 #elif defined(CONFIG_ARCH_MSM7X30)
 	MSM_GPIO_BANK(0,   0,  15),
 	MSM_GPIO_BANK(1,  16,  43),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#2 lore raw

PATCH 2/7 msm: Remove chip-ifdefs for GPIO io mappings

In reply to David Brown

The two GPIO controllers are always mapped to the same virtual address across all MSM devices. Instead of selecting this at compile time, determine the physical address at runtime, eliminating yet something else preventing multiple MSM targets from being compiled into the same kernel.

---
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap.h      |    2 ++
 arch/arm/mach-msm/io.c                          |   12 ++++++------
 5 files changed, 20 insertions(+), 24 deletions(-)
arch/arm/mach-msm/include/mach/msm_iomap-7x00.h +4 -6
index d6540e1..04bca83 100644
@@ -54,13 +54,11 @@
 #define MSM7X00_DMOV_PHYS     0xA9700000
 #define MSM7X00_DMOV_SIZE     SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xA9200000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define MSM7X00_GPIO1_PHYS        0xA9200000
+#define MSM7X00_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xA9300000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define MSM7X00_GPIO2_PHYS        0xA9300000
+#define MSM7X00_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xA8600000
arch/arm/mach-msm/include/mach/msm_iomap-7x30.h +4 -6
index 23912e5..7357ed6 100644
@@ -45,13 +45,11 @@
 #define MSM7X30_DMOV_PHYS     0xAC400000
 #define MSM7X30_DMOV_SIZE     SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xAC001000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define MSM7X30_GPIO1_PHYS        0xAC001000
+#define MSM7X30_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xAC101000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define MSM7X30_GPIO2_PHYS        0xAC101000
+#define MSM7X30_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xAB800000
arch/arm/mach-msm/include/mach/msm_iomap-8x50.h +4 -6
index fc36b82..38f37ed 100644
@@ -45,13 +45,11 @@
 #define QSD8X50_DMOV_PHYS     0xA9700000
 #define QSD8X50_DMOV_SIZE     SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xA9000000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define QSD8X50_GPIO1_PHYS        0xA9000000
+#define QSD8X50_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xA9100000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define QSD8X50_GPIO2_PHYS        0xA9100000
+#define QSD8X50_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xA8600000
arch/arm/mach-msm/include/mach/msm_iomap.h +2 -0
index c98c759..3c4ef35 100644
@@ -61,5 +61,7 @@
 #define MSM_QGIC_CPU_BASE	IOMEM(0xF0001000)
 #define MSM_TMR_BASE		IOMEM(0xF0200000)
 #define MSM_TMR0_BASE		IOMEM(0xF0201000)
+#define MSM_GPIO1_BASE		IOMEM(0xE0003000)
+#define MSM_GPIO2_BASE		IOMEM(0xE0004000)
 
 #endif
arch/arm/mach-msm/io.c +6 -6
index 1c86cda..067653a 100644
@@ -42,8 +42,8 @@
 static struct map_desc msm_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, MSM7X00),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, MSM7X00),
+	MSM_CHIP_DEVICE(GPIO2, MSM7X00),
 	MSM_DEVICE(CLK_CTL),
 #ifdef CONFIG_MSM_DEBUG_UART
 	MSM_DEVICE(DEBUG_UART),
@@ -74,8 +74,8 @@ void __init msm_map_common_io(void)
 static struct map_desc qsd8x50_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, QSD8X50),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, QSD8X50),
+	MSM_CHIP_DEVICE(GPIO2, QSD8X50),
 	MSM_DEVICE(CLK_CTL),
 	MSM_DEVICE(SIRC),
 	MSM_DEVICE(SCPLL),
@@ -132,8 +132,8 @@ void __init msm_map_msm8960_io(void)
 static struct map_desc msm7x30_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, MSM7X30),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, MSM7X30),
+	MSM_CHIP_DEVICE(GPIO2, MSM7X30),
 	MSM_DEVICE(CLK_CTL),
 	MSM_DEVICE(CLK_CTL_SH2),
 	MSM_DEVICE(AD5),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#3 lore raw

PATCH 3/7 msm: gpio: Remove chip-specific register definitions

In reply to David Brown

Put an SOC prefix on each GPIO register definition, eliminating the need to have SOC ifdefs around the definitions.

---
 arch/arm/mach-msm/gpio.c    |   62 ++++----
 arch/arm/mach-msm/gpio_hw.h |  384 +++++++++++++++++++++----------------------
 2 files changed, 220 insertions(+), 226 deletions(-)
arch/arm/mach-msm/gpio.c +31 -31
index c358ced..335afbd 100644
@@ -25,17 +25,17 @@
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
-#define MSM_GPIO_BANK(bank, first, last)				\
+#define MSM_GPIO_BANK(soc, bank, first, last)				\
 	{								\
 		.regs = {						\
-			.out =         MSM_GPIO_OUT_##bank,		\
-			.in =          MSM_GPIO_IN_##bank,		\
-			.int_status =  MSM_GPIO_INT_STATUS_##bank,	\
-			.int_clear =   MSM_GPIO_INT_CLEAR_##bank,	\
-			.int_en =      MSM_GPIO_INT_EN_##bank,		\
-			.int_edge =    MSM_GPIO_INT_EDGE_##bank,	\
-			.int_pos =     MSM_GPIO_INT_POS_##bank,		\
-			.oe =          MSM_GPIO_OE_##bank,		\
+			.out =         soc##_GPIO_OUT_##bank,		\
+			.in =          soc##_GPIO_IN_##bank,		\
+			.int_status =  soc##_GPIO_INT_STATUS_##bank,	\
+			.int_clear =   soc##_GPIO_INT_CLEAR_##bank,	\
+			.int_en =      soc##_GPIO_INT_EN_##bank,	\
+			.int_edge =    soc##_GPIO_INT_EDGE_##bank,	\
+			.int_pos =     soc##_GPIO_INT_POS_##bank,	\
+			.oe =          soc##_GPIO_OE_##bank,		\
 		},							\
 		.chip = {						\
 			.base = (first),				\
@@ -191,30 +191,30 @@ static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
 
 struct msm_gpio_chip msm_gpio_chips[] = {
 #if defined(CONFIG_ARCH_MSM7X00A)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 121),
+	MSM_GPIO_BANK(MSM7X00, 0,   0,  15),
+	MSM_GPIO_BANK(MSM7X00, 1,  16,  42),
+	MSM_GPIO_BANK(MSM7X00, 2,  43,  67),
+	MSM_GPIO_BANK(MSM7X00, 3,  68,  94),
+	MSM_GPIO_BANK(MSM7X00, 4,  95, 106),
+	MSM_GPIO_BANK(MSM7X00, 5, 107, 121),
 #elif defined(CONFIG_ARCH_MSM7X30)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  43),
-	MSM_GPIO_BANK(2,  44,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 133),
-	MSM_GPIO_BANK(6, 134, 150),
-	MSM_GPIO_BANK(7, 151, 181),
+	MSM_GPIO_BANK(MSM7X30, 0,   0,  15),
+	MSM_GPIO_BANK(MSM7X30, 1,  16,  43),
+	MSM_GPIO_BANK(MSM7X30, 2,  44,  67),
+	MSM_GPIO_BANK(MSM7X30, 3,  68,  94),
+	MSM_GPIO_BANK(MSM7X30, 4,  95, 106),
+	MSM_GPIO_BANK(MSM7X30, 5, 107, 133),
+	MSM_GPIO_BANK(MSM7X30, 6, 134, 150),
+	MSM_GPIO_BANK(MSM7X30, 7, 151, 181),
 #elif defined(CONFIG_ARCH_QSD8X50)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 103),
-	MSM_GPIO_BANK(5, 104, 121),
-	MSM_GPIO_BANK(6, 122, 152),
-	MSM_GPIO_BANK(7, 153, 164),
+	MSM_GPIO_BANK(QSD8X50, 0,   0,  15),
+	MSM_GPIO_BANK(QSD8X50, 1,  16,  42),
+	MSM_GPIO_BANK(QSD8X50, 2,  43,  67),
+	MSM_GPIO_BANK(QSD8X50, 3,  68,  94),
+	MSM_GPIO_BANK(QSD8X50, 4,  95, 103),
+	MSM_GPIO_BANK(QSD8X50, 5, 104, 121),
+	MSM_GPIO_BANK(QSD8X50, 6, 122, 152),
+	MSM_GPIO_BANK(QSD8X50, 7, 153, 164),
 #endif
 };
 
arch/arm/mach-msm/gpio_hw.h +189 -195

437 lines not on this page · raw message

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#4 lore raw

PATCH 4/7 msm: gpio: Remove ifdefs on gpio chip registers

In reply to David Brown

Select the GPIO register configuration at runtime rather than through idefs.

---
 arch/arm/mach-msm/gpio.c |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)
arch/arm/mach-msm/gpio.c +26 -7
index 335afbd..e96199d 100644
@@ -20,6 +20,7 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <mach/cpu.h>
 #include "gpio_hw.h"
 #include "gpiomux.h"
 
@@ -189,15 +190,19 @@ static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
 #define msm_gpio_free NULL
 #endif
 
-struct msm_gpio_chip msm_gpio_chips[] = {
-#if defined(CONFIG_ARCH_MSM7X00A)
+static struct msm_gpio_chip *msm_gpio_chips;
+static int msm_gpio_count;
+
+static struct msm_gpio_chip msm_gpio_chips_msm7x01[] = {
 	MSM_GPIO_BANK(MSM7X00, 0,   0,  15),
 	MSM_GPIO_BANK(MSM7X00, 1,  16,  42),
 	MSM_GPIO_BANK(MSM7X00, 2,  43,  67),
 	MSM_GPIO_BANK(MSM7X00, 3,  68,  94),
 	MSM_GPIO_BANK(MSM7X00, 4,  95, 106),
 	MSM_GPIO_BANK(MSM7X00, 5, 107, 121),
-#elif defined(CONFIG_ARCH_MSM7X30)
+};
+
+static struct msm_gpio_chip msm_gpio_chips_msm7x30[] = {
 	MSM_GPIO_BANK(MSM7X30, 0,   0,  15),
 	MSM_GPIO_BANK(MSM7X30, 1,  16,  43),
 	MSM_GPIO_BANK(MSM7X30, 2,  44,  67),
@@ -206,7 +211,9 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(MSM7X30, 5, 107, 133),
 	MSM_GPIO_BANK(MSM7X30, 6, 134, 150),
 	MSM_GPIO_BANK(MSM7X30, 7, 151, 181),
-#elif defined(CONFIG_ARCH_QSD8X50)
+};
+
+static struct msm_gpio_chip msm_gpio_chips_qsd8x50[] = {
 	MSM_GPIO_BANK(QSD8X50, 0,   0,  15),
 	MSM_GPIO_BANK(QSD8X50, 1,  16,  42),
 	MSM_GPIO_BANK(QSD8X50, 2,  43,  67),
@@ -215,7 +222,6 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(QSD8X50, 5, 104, 121),
 	MSM_GPIO_BANK(QSD8X50, 6, 122, 152),
 	MSM_GPIO_BANK(QSD8X50, 7, 153, 164),
-#endif
 };
 
 static void msm_gpio_irq_ack(struct irq_data *d)
@@ -311,7 +317,7 @@ static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 	int i, j, mask;
 	unsigned val;
 
-	for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
+	for (i = 0; i < msm_gpio_count; i++) {
 		struct msm_gpio_chip *msm_chip = &msm_gpio_chips[i];
 		val = readl(msm_chip->regs.int_status);
 		val &= msm_chip->int_enable[0];
@@ -342,6 +348,19 @@ static int __init msm_init_gpio(void)
 {
 	int i, j = 0;
 
+	if (cpu_is_msm7x01()) {
+		msm_gpio_chips = msm_gpio_chips_msm7x01;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_msm7x01);
+	} else if (cpu_is_msm7x30()) {
+		msm_gpio_chips = msm_gpio_chips_msm7x30;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_msm7x30);
+	} else if (cpu_is_qsd8x50()) {
+		msm_gpio_chips = msm_gpio_chips_qsd8x50;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_qsd8x50);
+	} else {
+		return 0;
+	}
+
 	for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) {
 		if (i - FIRST_GPIO_IRQ >=
 			msm_gpio_chips[j].chip.base +
@@ -353,7 +372,7 @@ static int __init msm_init_gpio(void)
 		set_irq_flags(i, IRQF_VALID);
 	}
 
-	for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
+	for (i = 0; i < msm_gpio_count; i++) {
 		spin_lock_init(&msm_gpio_chips[i].lock);
 		writel(0, msm_gpio_chips[i].regs.int_en);
 		gpiochip_add(&msm_gpio_chips[i].chip);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#5 lore raw

PATCH 5/7 msm: gpiomux: Move public API to public header

In reply to David Brown

The gpiomux.h header contains some SOC ifdefs. However, the API that is actually used by the GPIO driver only uses two functions that are general. Move these general definitions into a public header file.

---
 arch/arm/mach-msm/gpio.c    |    2 +-
 arch/arm/mach-msm/gpiomux.h |   17 +----------------
 include/linux/msm_gpiomux.h |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 17 deletions(-)
 create mode 100644 include/linux/msm_gpiomux.h
arch/arm/mach-msm/gpio.c +1 -1
index e96199d..2ac3a0f 100644
@@ -21,8 +21,8 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <mach/cpu.h>
+#include <linux/msm_gpiomux.h>
 #include "gpio_hw.h"
-#include "gpiomux.h"
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
arch/arm/mach-msm/gpiomux.h +1 -16
index b178d9c..a5290ed 100644
@@ -19,6 +19,7 @@
 
 #include <linux/bitops.h>
 #include <linux/errno.h>
+#include <linux/msm_gpiomux.h>
 
 #if defined(CONFIG_MSM_V2_TLMM)
 #include "gpiomux-v2.h"
@@ -71,12 +72,6 @@ enum {
  */
 extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
 
-/* Increment a gpio's reference count, possibly activating the line. */
-int __must_check msm_gpiomux_get(unsigned gpio);
-
-/* Decrement a gpio's reference count, possibly suspending the line. */
-int msm_gpiomux_put(unsigned gpio);
-
 /* Install a new configuration to the gpio line.  To avoid overwriting
  * a configuration, leave the VALID bit out.
  */
@@ -94,16 +89,6 @@ int msm_gpiomux_write(unsigned gpio,
  */
 void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val);
 #else
-static inline int __must_check msm_gpiomux_get(unsigned gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int msm_gpiomux_put(unsigned gpio)
-{
-	return -ENOSYS;
-}
-
 static inline int msm_gpiomux_write(unsigned gpio,
 				    gpiomux_config_t active,
 				    gpiomux_config_t suspended)
include/linux/msm_gpiomux.h new file +38 -0
new file mode 100644
index 0000000..0c7d393
@@ -0,0 +1,38 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_MSM_GPIOMUX_H
+#define _LINUX_MSM_GPIOMUX_H
+
+#ifdef CONFIG_MSM_GPIOMUX
+
+/* Increment a gpio's reference count, possibly activating the line. */
+int __must_check msm_gpiomux_get(unsigned gpio);
+
+/* Decrement a gpio's reference count, possibly suspending the line. */
+int msm_gpiomux_put(unsigned gpio);
+
+#else
+
+static inline int __must_check msm_gpiomux_get(unsigned gpio)
+{
+	return -ENOSYS;
+}
+
+static inline int msm_gpiomux_put(unsigned gpio)
+{
+	return -ENOSYS;
+}
+
+#endif
+
+#endif /* _LINUX_MSM_GPIOMUX_H */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#8 lore raw

PATCH 6/7 gpio_msm: Move Qualcomm v6 MSM driver into drivers

In reply to David Brown

Migrate the driver for the v6-based MSM chips into drivers/gpio. The driver is unchanged, only moved.

---
 arch/arm/mach-msm/Kconfig                          |    3 +++
 arch/arm/mach-msm/Makefile                         |    2 --
 drivers/gpio/Kconfig                               |    8 ++++++++
 drivers/gpio/Makefile                              |    1 +
 arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c  |    7 +++----
 .../mach-msm/gpio_hw.h => drivers/gpio/msm_v1.h    |    9 ++++-----
 6 files changed, 19 insertions(+), 11 deletions(-)
 rename arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c (98%)
 rename arch/arm/mach-msm/gpio_hw.h => drivers/gpio/msm_v1.h (98%)
arch/arm/mach-msm/Kconfig +3 -0
index 1516896..cc7c0b2 100644
@@ -11,6 +11,7 @@ config ARCH_MSM7X00A
 	select MSM_SMD
 	select MSM_SMD_PKG3
 	select CPU_V6
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
@@ -22,6 +23,7 @@ config ARCH_MSM7X30
 	select MSM_VIC
 	select CPU_V7
 	select MSM_GPIOMUX
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
@@ -33,6 +35,7 @@ config ARCH_QSD8X50
 	select MSM_VIC
 	select CPU_V7
 	select MSM_GPIOMUX
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
arch/arm/mach-msm/Makefile +0 -2
index c72cb8e..edb6659 100644
@@ -37,6 +37,4 @@ ifndef CONFIG_ARCH_MSM8960
 # TODO: TLMM Mapping issues need to be resolved
 obj-y	+= gpio-v2.o
 endif
-else
-obj-y	+= gpio.o
 endif
drivers/gpio/Kconfig +8 -0
index d3b2953..aa5a3f9 100644
@@ -131,6 +131,14 @@ config GPIO_VX855
 	  additional drivers must be enabled in order to use the
 	  functionality of the device.
 
+config GPIO_MSM_V1
+	tristate "Qualcomm MSM GPIO v1"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM v6 based
+	  Qualcomm MSM chips.  Most of the pins on the MSM can be
+	  selected for GPIO, and are controlled by this driver.
+
 comment "I2C GPIO expanders:"
 
 config GPIO_MAX7300
drivers/gpio/Makefile +1 -0
index becef59..b6386e4 100644
@@ -41,5 +41,6 @@ obj-$(CONFIG_GPIO_RDC321X)	+= rdc321x-gpio.o
 obj-$(CONFIG_GPIO_JANZ_TTL)	+= janz-ttl.o
 obj-$(CONFIG_GPIO_SX150X)	+= sx150x.o
 obj-$(CONFIG_GPIO_VX855)	+= vx855_gpio.o
+obj-$(CONFIG_GPIO_MSM_V1)	+= msm_v1.o
 obj-$(CONFIG_GPIO_ML_IOH)	+= ml_ioh_gpio.o
 obj-$(CONFIG_AB8500_GPIO)       += ab8500-gpio.o
drivers/gpio/msm_v1.c renamed from arch/arm/mach-msm/gpio.c +3 -4
similarity index 98%
rename from arch/arm/mach-msm/gpio.c
rename to drivers/gpio/msm_v1.c
index 2ac3a0f..4ba2067 100644
@@ -1,7 +1,6 @@
-/* linux/arch/arm/mach-msm/gpio.c
- *
+/*
  * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -22,7 +21,7 @@
 #include <linux/module.h>
 #include <mach/cpu.h>
 #include <linux/msm_gpiomux.h>
-#include "gpio_hw.h"
+#include "msm_v1.h"
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
drivers/gpio/msm_v1.h renamed from arch/arm/mach-msm/gpio_hw.h +4 -5
similarity index 98%
rename from arch/arm/mach-msm/gpio_hw.h
rename to drivers/gpio/msm_v1.h
index ba7972a..a3e3cb2 100644
@@ -1,8 +1,7 @@
-/* arch/arm/mach-msm/gpio_hw.h
- *
+/*
  * Copyright (C) 2007 Google, Inc.
  * Author: Brian Swetland <[email protected]>
- * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -15,8 +14,8 @@
  *
  */
 
-#ifndef __ARCH_ARM_MACH_MSM_GPIO_HW_H
-#define __ARCH_ARM_MACH_MSM_GPIO_HW_H
+#ifndef _MSM_GPIO_V1_H
+#define _MSM_GPIO_V1_H
 
 #include <mach/msm_iomap.h>
 
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#9 lore raw

PATCH 7/7 gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

In reply to David Brown

Migrate the driver for the v7-based MSM chips into drivers/gpio. The driver is unchanged, only moved.

---
 arch/arm/mach-msm/Kconfig                          |    1 +
 arch/arm/mach-msm/Makefile                         |    6 ------
 drivers/gpio/Kconfig                               |    8 ++++++++
 drivers/gpio/Makefile                              |    1 +
 .../mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c    |    2 +-
 5 files changed, 11 insertions(+), 7 deletions(-)
 rename arch/arm/mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c (99%)
arch/arm/mach-msm/Kconfig +1 -0
index cc7c0b2..f5cce3f 100644
@@ -47,6 +47,7 @@ config ARCH_MSM8X60
 	select ARM_GIC
 	select CPU_V7
 	select MSM_V2_TLMM
+	select GPIO_MSM_V2
 	select MSM_GPIOMUX
 	select MSM_SCM if SMP
 
arch/arm/mach-msm/Makefile +0 -6
index edb6659..7e58b45 100644
@@ -32,9 +32,3 @@ obj-$(CONFIG_ARCH_MSM8960) += board-msm8960.o devices-msm8960.o
 obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
-ifdef CONFIG_MSM_V2_TLMM
-ifndef CONFIG_ARCH_MSM8960
-# TODO: TLMM Mapping issues need to be resolved
-obj-y	+= gpio-v2.o
-endif
-endif
drivers/gpio/Kconfig +8 -0
index aa5a3f9..235b6c9 100644
@@ -139,6 +139,14 @@ config GPIO_MSM_V1
 	  Qualcomm MSM chips.  Most of the pins on the MSM can be
 	  selected for GPIO, and are controlled by this driver.
 
+config GPIO_MSM_V2
+	tristate "Qualcomm MSM GPIO v2"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM many v7
+	  based Qualcomm MSM chips.  Most of the pins on the MSM can
+	  be selected for GPIO, and are controlled by this driver.
+
 comment "I2C GPIO expanders:"
 
 config GPIO_MAX7300
drivers/gpio/Makefile +1 -0
index b6386e4..c2f2d3f 100644
@@ -42,5 +42,6 @@ obj-$(CONFIG_GPIO_JANZ_TTL)	+= janz-ttl.o
 obj-$(CONFIG_GPIO_SX150X)	+= sx150x.o
 obj-$(CONFIG_GPIO_VX855)	+= vx855_gpio.o
 obj-$(CONFIG_GPIO_MSM_V1)	+= msm_v1.o
+obj-$(CONFIG_GPIO_MSM_V2)	+= msm_v2.o
 obj-$(CONFIG_GPIO_ML_IOH)	+= ml_ioh_gpio.o
 obj-$(CONFIG_AB8500_GPIO)       += ab8500-gpio.o
drivers/gpio/msm_v2.c renamed from arch/arm/mach-msm/gpio-v2.c +1 -1
similarity index 99%
rename from arch/arm/mach-msm/gpio-v2.c
rename to drivers/gpio/msm_v2.c
index 56a964e..62193bf 100644
@@ -27,8 +27,8 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
+#include <linux/msm_gpiomux.h>
 #include <mach/msm_iomap.h>
-#include "gpiomux.h"
 
 /* Bits of interest in the GPIO_IN_OUT register.
  */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#10 lore raw

Re: [PATCH 7/7] gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

In reply to David Brown

drivers/gpio/Kconfig config GPIO_MSM_V1 · line 146

Quoted 13 lines · David Brown
drivers/gpio/Kconfig +5 -0
index aa5a3f9..235b6c9 100644
@@ -139,6 +139,14 @@ config GPIO_MSM_V1
 	  Qualcomm MSM chips.  Most of the pins on the MSM can be
 	  selected for GPIO, and are controlled by this driver.
 
+config GPIO_MSM_V2
+	tristate "Qualcomm MSM GPIO v2"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM many v7

s/many// ?

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#11 lore raw

Re: [PATCH 7/7] gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

Quoted 9 lines · Stephen Boyd
Quoted 8 lines · David Brown
drivers/gpio/Kconfig +0 -0
index aa5a3f9..235b6c9 100644
@@ -139,6 +139,14 @@ config GPIO_MSM_V1
 	  Qualcomm MSM chips.  Most of the pins on the MSM can be
 	  selected for GPIO, and are controlled by this driver.
 
Quoted 7 lines

drivers/gpio/Kconfig config GPIO_MSM_V1 · line 146

Quoted 5 lines
drivers/gpio/Kconfig +5 -0
+config GPIO_MSM_V2
+	tristate "Qualcomm MSM GPIO v2"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM many v7

s/many// ?

My intent was 'on many ARM v7 based Qualcomm MSM chips'. I suppose I can say just on 'v7' based chips, but the future is hard to predict. I'll just take out the many.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#6 lore raw

RE: [PATCH 5/7] msm: gpiomux: Move public API to public header

In reply to David Brown
Quoted 5 lines · David Brown

The gpiomux.h header contains some SOC ifdefs. However, the API that is actually used by the GPIO driver only uses two functions that are general. Move these general definitions into a public header file.

Quoted 7 lines
---
 arch/arm/mach-msm/gpio.c    |    2 +-
 arch/arm/mach-msm/gpiomux.h |   17 +----------------
 include/linux/msm_gpiomux.h |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 17 deletions(-)
 create mode 100644 include/linux/msm_gpiomux.h

The msm_gpiomux.h header appears to be very "msm" specific, especially with the #ifdef CONFIG_MSM_GPIOMUX in it. Wouldn't it be cleaner to just move it to arch/arm/mach-msm/include/mach/msm_gpiomux.h?

I don't see a reason why this header needs/should be available for the general public in /include/linux.

Regards,
Hartley

#7 lore raw

Re: [PATCH 5/7] msm: gpiomux: Move public API to public header

Quoted 14 lines · H Hartley Sweeten
Quoted 5 lines · David Brown

The gpiomux.h header contains some SOC ifdefs. However, the API that is actually used by the GPIO driver only uses two functions that are general. Move these general definitions into a public header file.

Quoted 7 lines
---
 arch/arm/mach-msm/gpio.c    |    2 +-
 arch/arm/mach-msm/gpiomux.h |   17 +----------------
 include/linux/msm_gpiomux.h |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 17 deletions(-)
 create mode 100644 include/linux/msm_gpiomux.h
Quoted 6 lines

The msm_gpiomux.h header appears to be very "msm" specific, especially with the #ifdef CONFIG_MSM_GPIOMUX in it. Wouldn't it be cleaner to just move it to arch/arm/mach-msm/include/mach/msm_gpiomux.h?

I don't see a reason why this header needs/should be available for the general public in /include/linux.

Agreed.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Acked-by on the v1 series
#13 lore raw
In reply to David Brown
Quoted 11 lines · David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

Looks good.

Nicolas

#14 lore raw
In reply to David Brown
Quoted 12 lines · David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

Quoted 8 lines

David Brown (7):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

What's the status of this series. I only got cc'd on the last two patches; did you want me to pick up the whole lot, or is it being merged via the msm tree?

Alternately, if there is a git branch with these patches in it, then I can merge that instead of applying individually.

g.

Quoted 31 lines
 arch/arm/mach-msm/Kconfig                       |    4 +
 arch/arm/mach-msm/Makefile                      |    8 -
 arch/arm/mach-msm/gpio-v2.c                     |  427 -----------------------
 arch/arm/mach-msm/gpio.c                        |  376 --------------------
 arch/arm/mach-msm/gpio_hw.h                     |  278 ---------------
 arch/arm/mach-msm/gpiomux.h                     |   17 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap.h      |    2 +
 arch/arm/mach-msm/io.c                          |   12 +-
 drivers/gpio/Kconfig                            |   16 +
 drivers/gpio/Makefile                           |    2 +
 drivers/gpio/msm_v1.c                           |  387 ++++++++++++++++++++
 drivers/gpio/msm_v1.h                           |  271 ++++++++++++++
 drivers/gpio/msm_v2.c                           |  427 +++++++++++++++++++++++
 include/linux/msm_gpiomux.h                     |   38 ++
 17 files changed, 1166 insertions(+), 1129 deletions(-)
 delete mode 100644 arch/arm/mach-msm/gpio-v2.c
 delete mode 100644 arch/arm/mach-msm/gpio.c
 delete mode 100644 arch/arm/mach-msm/gpio_hw.h
 create mode 100644 drivers/gpio/msm_v1.c
 create mode 100644 drivers/gpio/msm_v1.h
 create mode 100644 drivers/gpio/msm_v2.c
 create mode 100644 include/linux/msm_gpiomux.h
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#15 lore raw
Quoted 22 lines · Grant Likely
Quoted 12 lines · David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

Quoted 8 lines

David Brown (7):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

Quoted 3 lines

What's the status of this series. I only got cc'd on the last two patches; did you want me to pick up the whole lot, or is it being merged via the msm tree?

Let me send out an update, incorporating the suggestions. I need to rebase these changes off of the current MSM code, since the msm-next tree contains changes that aren't going into the merge window because of extra ARM scrutiny.

Quoted 2 lines

Alternately, if there is a git branch with these patches in it, then I can merge that instead of applying individually.

I'll send you a pull request after I send out the updates.

Thanks,
David

Quoted 33 lines

g.

Quoted 31 lines
 arch/arm/mach-msm/Kconfig                       |    4 +
 arch/arm/mach-msm/Makefile                      |    8 -
 arch/arm/mach-msm/gpio-v2.c                     |  427 -----------------------
 arch/arm/mach-msm/gpio.c                        |  376 --------------------
 arch/arm/mach-msm/gpio_hw.h                     |  278 ---------------
 arch/arm/mach-msm/gpiomux.h                     |   17 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap.h      |    2 +
 arch/arm/mach-msm/io.c                          |   12 +-
 drivers/gpio/Kconfig                            |   16 +
 drivers/gpio/Makefile                           |    2 +
 drivers/gpio/msm_v1.c                           |  387 ++++++++++++++++++++
 drivers/gpio/msm_v1.h                           |  271 ++++++++++++++
 drivers/gpio/msm_v2.c                           |  427 +++++++++++++++++++++++
 include/linux/msm_gpiomux.h                     |   38 ++
 17 files changed, 1166 insertions(+), 1129 deletions(-)
 delete mode 100644 arch/arm/mach-msm/gpio-v2.c
 delete mode 100644 arch/arm/mach-msm/gpio.c
 delete mode 100644 arch/arm/mach-msm/gpio_hw.h
 create mode 100644 drivers/gpio/msm_v1.c
 create mode 100644 drivers/gpio/msm_v1.h
 create mode 100644 drivers/gpio/msm_v2.c
 create mode 100644 include/linux/msm_gpiomux.h
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#16 lore raw
Quoted 33 lines · David Brown
Quoted 22 lines · Grant Likely
Quoted 12 lines · David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

Quoted 8 lines

David Brown (7):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

Quoted 3 lines

What's the status of this series. I only got cc'd on the last two patches; did you want me to pick up the whole lot, or is it being merged via the msm tree?

Let me send out an update, incorporating the suggestions. I need to rebase these changes off of the current MSM code, since the msm-next tree contains changes that aren't going into the merge window because of extra ARM scrutiny.

Quoted 4 lines
Quoted 2 lines

Alternately, if there is a git branch with these patches in it, then I can merge that instead of applying individually.

I'll send you a pull request after I send out the updates.

Oh, and in case it isn't clear, I wasn't expecting these to make it into this merge window.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#17 lore raw
Quoted 35 lines · David Brown
Quoted 33 lines · David Brown
Quoted 22 lines · Grant Likely
Quoted 12 lines · David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

Quoted 8 lines

David Brown (7):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

Quoted 3 lines

What's the status of this series. I only got cc'd on the last two patches; did you want me to pick up the whole lot, or is it being merged via the msm tree?

Let me send out an update, incorporating the suggestions. I need to rebase these changes off of the current MSM code, since the msm-next tree contains changes that aren't going into the merge window because of extra ARM scrutiny.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Alternately, if there is a git branch with these patches in it, then I can merge that instead of applying individually.

I'll send you a pull request after I send out the updates.

Oh, and in case it isn't clear, I wasn't expecting these to make it into this merge window.

Why not?

Nicolas

#18 lore raw
Quoted 37 lines · Nicolas Pitre
Quoted 36 lines · David Brown
Quoted 35 lines · David Brown
Quoted 22 lines · Grant Likely
Quoted 12 lines · David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

Quoted 8 lines

David Brown (7):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

Quoted 3 lines

What's the status of this series. I only got cc'd on the last two patches; did you want me to pick up the whole lot, or is it being merged via the msm tree?

Let me send out an update, incorporating the suggestions. I need to rebase these changes off of the current MSM code, since the msm-next tree contains changes that aren't going into the merge window because of extra ARM scrutiny.

Quoted 2 lines

Alternately, if there is a git branch with these patches in it, then I can merge that instead of applying individually.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I'll send you a pull request after I send out the updates.

Oh, and in case it isn't clear, I wasn't expecting these to make it into this merge window.

Why not?

They haven't been tested in linux-next for one, but more importantly, I have to redo them to not include the msm-core changes that aren't going to be going in.

I'm probably not going to be able to get to this until next week.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#19 lore raw

v2 cover Move Qualcomm gpio drivers into drivers dir

In reply to David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

patch history:
------
v2 - Move header to mach-msm mach dir
- Fix Kconfig description
- Base off of Linus tree instead of linux-next (postponed for ARM issues)

David Brown (7):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

 arch/arm/mach-msm/Kconfig                          |    4 +
 arch/arm/mach-msm/Makefile                         |    8 -
 arch/arm/mach-msm/gpio_hw.h                        |  278 --------------------
 arch/arm/mach-msm/gpiomux.h                        |   17 +--
 arch/arm/mach-msm/include/mach/msm_gpiomux.h       |   38 +++
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap.h         |    2 +
 arch/arm/mach-msm/io.c                             |   12 +-
 drivers/gpio/Kconfig                               |   16 ++
 drivers/gpio/Makefile                              |    2 +
 arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c  |  111 +++++----
 drivers/gpio/msm_v1.h                              |  271 +++++++++++++++++++
 .../mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c    |    2 +-
 15 files changed, 414 insertions(+), 377 deletions(-)
 delete mode 100644 arch/arm/mach-msm/gpio_hw.h
 create mode 100644 arch/arm/mach-msm/include/mach/msm_gpiomux.h
 rename arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c (82%)
 create mode 100644 drivers/gpio/msm_v1.h
 rename arch/arm/mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c (99%)
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#20 lore raw

PATCH v2 1/7 msm: gpio: Remove unsupported devices

The MSM7x25 and MSM7x27 devices are not yet supported in the kernel. Remove #ifdef-based tables supporting these chips for now.

---
 arch/arm/mach-msm/gpio.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
arch/arm/mach-msm/gpio.c +0 -7
index 5ea273b..c358ced 100644
@@ -197,13 +197,6 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(3,  68,  94),
 	MSM_GPIO_BANK(4,  95, 106),
 	MSM_GPIO_BANK(5, 107, 121),
-#elif defined(CONFIG_ARCH_MSM7X25) || defined(CONFIG_ARCH_MSM7X27)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 132),
 #elif defined(CONFIG_ARCH_MSM7X30)
 	MSM_GPIO_BANK(0,   0,  15),
 	MSM_GPIO_BANK(1,  16,  43),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#21 lore raw

PATCH v2 2/7 msm: Remove chip-ifdefs for GPIO io mappings

In reply to David Brown

The two GPIO controllers are always mapped to the same virtual address across all MSM devices. Instead of selecting this at compile time, determine the physical address at runtime, eliminating yet something else preventing multiple MSM targets from being compiled into the same kernel.

---
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap.h      |    2 ++
 arch/arm/mach-msm/io.c                          |   12 ++++++------
 5 files changed, 20 insertions(+), 24 deletions(-)
arch/arm/mach-msm/include/mach/msm_iomap-7x00.h +4 -6
index 8f99d97..94fe9fe 100644
@@ -55,13 +55,11 @@
 #define MSM_DMOV_PHYS         0xA9700000
 #define MSM_DMOV_SIZE         SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xA9200000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define MSM7X00_GPIO1_PHYS        0xA9200000
+#define MSM7X00_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xA9300000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define MSM7X00_GPIO2_PHYS        0xA9300000
+#define MSM7X00_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xA8600000
arch/arm/mach-msm/include/mach/msm_iomap-7x30.h +4 -6
index 4d84be1..3769444 100644
@@ -46,13 +46,11 @@
 #define MSM_DMOV_PHYS         0xAC400000
 #define MSM_DMOV_SIZE         SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xAC001000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define MSM7X30_GPIO1_PHYS        0xAC001000
+#define MSM7X30_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xAC101000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define MSM7X30_GPIO2_PHYS        0xAC101000
+#define MSM7X30_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xAB800000
arch/arm/mach-msm/include/mach/msm_iomap-8x50.h +4 -6
index d414320..d67cd73 100644
@@ -46,13 +46,11 @@
 #define MSM_DMOV_PHYS         0xA9700000
 #define MSM_DMOV_SIZE         SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xA9000000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define QSD8X50_GPIO1_PHYS        0xA9000000
+#define QSD8X50_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xA9100000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define QSD8X50_GPIO2_PHYS        0xA9100000
+#define QSD8X50_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xA8600000
arch/arm/mach-msm/include/mach/msm_iomap.h +2 -0
index 2f494b6..4ded152 100644
@@ -61,5 +61,7 @@
 #define MSM_QGIC_CPU_BASE	IOMEM(0xF0001000)
 #define MSM_TMR_BASE		IOMEM(0xF0200000)
 #define MSM_TMR0_BASE		IOMEM(0xF0201000)
+#define MSM_GPIO1_BASE		IOMEM(0xE0003000)
+#define MSM_GPIO2_BASE		IOMEM(0xE0004000)
 
 #endif
arch/arm/mach-msm/io.c +6 -6
index cec6ed1..140ddbb 100644
@@ -43,8 +43,8 @@ static struct map_desc msm_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, MSM7X00),
 	MSM_DEVICE(DMOV),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, MSM7X00),
+	MSM_CHIP_DEVICE(GPIO2, MSM7X00),
 	MSM_DEVICE(CLK_CTL),
 #ifdef CONFIG_MSM_DEBUG_UART
 	MSM_DEVICE(DEBUG_UART),
@@ -76,8 +76,8 @@ static struct map_desc qsd8x50_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, QSD8X50),
 	MSM_DEVICE(DMOV),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, QSD8X50),
+	MSM_CHIP_DEVICE(GPIO2, QSD8X50),
 	MSM_DEVICE(CLK_CTL),
 	MSM_DEVICE(SIRC),
 	MSM_DEVICE(SCPLL),
@@ -135,8 +135,8 @@ static struct map_desc msm7x30_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, MSM7X30),
 	MSM_DEVICE(DMOV),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, MSM7X30),
+	MSM_CHIP_DEVICE(GPIO2, MSM7X30),
 	MSM_DEVICE(CLK_CTL),
 	MSM_DEVICE(CLK_CTL_SH2),
 	MSM_DEVICE(AD5),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#22 lore raw

PATCH v2 3/7 msm: gpio: Remove chip-specific register definitions

In reply to David Brown

Put an SOC prefix on each GPIO register definition, eliminating the need to have SOC ifdefs around the definitions.

---
 arch/arm/mach-msm/gpio.c    |   62 ++++----
 arch/arm/mach-msm/gpio_hw.h |  384 +++++++++++++++++++++----------------------
 2 files changed, 220 insertions(+), 226 deletions(-)
arch/arm/mach-msm/gpio.c +31 -31
index c358ced..335afbd 100644
@@ -25,17 +25,17 @@
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
-#define MSM_GPIO_BANK(bank, first, last)				\
+#define MSM_GPIO_BANK(soc, bank, first, last)				\
 	{								\
 		.regs = {						\
-			.out =         MSM_GPIO_OUT_##bank,		\
-			.in =          MSM_GPIO_IN_##bank,		\
-			.int_status =  MSM_GPIO_INT_STATUS_##bank,	\
-			.int_clear =   MSM_GPIO_INT_CLEAR_##bank,	\
-			.int_en =      MSM_GPIO_INT_EN_##bank,		\
-			.int_edge =    MSM_GPIO_INT_EDGE_##bank,	\
-			.int_pos =     MSM_GPIO_INT_POS_##bank,		\
-			.oe =          MSM_GPIO_OE_##bank,		\
+			.out =         soc##_GPIO_OUT_##bank,		\
+			.in =          soc##_GPIO_IN_##bank,		\
+			.int_status =  soc##_GPIO_INT_STATUS_##bank,	\
+			.int_clear =   soc##_GPIO_INT_CLEAR_##bank,	\
+			.int_en =      soc##_GPIO_INT_EN_##bank,	\
+			.int_edge =    soc##_GPIO_INT_EDGE_##bank,	\
+			.int_pos =     soc##_GPIO_INT_POS_##bank,	\
+			.oe =          soc##_GPIO_OE_##bank,		\
 		},							\
 		.chip = {						\
 			.base = (first),				\
@@ -191,30 +191,30 @@ static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
 
 struct msm_gpio_chip msm_gpio_chips[] = {
 #if defined(CONFIG_ARCH_MSM7X00A)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 121),
+	MSM_GPIO_BANK(MSM7X00, 0,   0,  15),
+	MSM_GPIO_BANK(MSM7X00, 1,  16,  42),
+	MSM_GPIO_BANK(MSM7X00, 2,  43,  67),
+	MSM_GPIO_BANK(MSM7X00, 3,  68,  94),
+	MSM_GPIO_BANK(MSM7X00, 4,  95, 106),
+	MSM_GPIO_BANK(MSM7X00, 5, 107, 121),
 #elif defined(CONFIG_ARCH_MSM7X30)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  43),
-	MSM_GPIO_BANK(2,  44,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 133),
-	MSM_GPIO_BANK(6, 134, 150),
-	MSM_GPIO_BANK(7, 151, 181),
+	MSM_GPIO_BANK(MSM7X30, 0,   0,  15),
+	MSM_GPIO_BANK(MSM7X30, 1,  16,  43),
+	MSM_GPIO_BANK(MSM7X30, 2,  44,  67),
+	MSM_GPIO_BANK(MSM7X30, 3,  68,  94),
+	MSM_GPIO_BANK(MSM7X30, 4,  95, 106),
+	MSM_GPIO_BANK(MSM7X30, 5, 107, 133),
+	MSM_GPIO_BANK(MSM7X30, 6, 134, 150),
+	MSM_GPIO_BANK(MSM7X30, 7, 151, 181),
 #elif defined(CONFIG_ARCH_QSD8X50)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 103),
-	MSM_GPIO_BANK(5, 104, 121),
-	MSM_GPIO_BANK(6, 122, 152),
-	MSM_GPIO_BANK(7, 153, 164),
+	MSM_GPIO_BANK(QSD8X50, 0,   0,  15),
+	MSM_GPIO_BANK(QSD8X50, 1,  16,  42),
+	MSM_GPIO_BANK(QSD8X50, 2,  43,  67),
+	MSM_GPIO_BANK(QSD8X50, 3,  68,  94),
+	MSM_GPIO_BANK(QSD8X50, 4,  95, 103),
+	MSM_GPIO_BANK(QSD8X50, 5, 104, 121),
+	MSM_GPIO_BANK(QSD8X50, 6, 122, 152),
+	MSM_GPIO_BANK(QSD8X50, 7, 153, 164),
 #endif
 };
 
arch/arm/mach-msm/gpio_hw.h +189 -195

437 lines not on this page · raw message

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#23 lore raw

PATCH v2 4/7 msm: gpio: Remove ifdefs on gpio chip registers

In reply to David Brown

Select the GPIO register configuration at runtime rather than through idefs.

---
 arch/arm/mach-msm/gpio.c |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)
arch/arm/mach-msm/gpio.c +26 -7
index 335afbd..e96199d 100644
@@ -20,6 +20,7 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <mach/cpu.h>
 #include "gpio_hw.h"
 #include "gpiomux.h"
 
@@ -189,15 +190,19 @@ static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
 #define msm_gpio_free NULL
 #endif
 
-struct msm_gpio_chip msm_gpio_chips[] = {
-#if defined(CONFIG_ARCH_MSM7X00A)
+static struct msm_gpio_chip *msm_gpio_chips;
+static int msm_gpio_count;
+
+static struct msm_gpio_chip msm_gpio_chips_msm7x01[] = {
 	MSM_GPIO_BANK(MSM7X00, 0,   0,  15),
 	MSM_GPIO_BANK(MSM7X00, 1,  16,  42),
 	MSM_GPIO_BANK(MSM7X00, 2,  43,  67),
 	MSM_GPIO_BANK(MSM7X00, 3,  68,  94),
 	MSM_GPIO_BANK(MSM7X00, 4,  95, 106),
 	MSM_GPIO_BANK(MSM7X00, 5, 107, 121),
-#elif defined(CONFIG_ARCH_MSM7X30)
+};
+
+static struct msm_gpio_chip msm_gpio_chips_msm7x30[] = {
 	MSM_GPIO_BANK(MSM7X30, 0,   0,  15),
 	MSM_GPIO_BANK(MSM7X30, 1,  16,  43),
 	MSM_GPIO_BANK(MSM7X30, 2,  44,  67),
@@ -206,7 +211,9 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(MSM7X30, 5, 107, 133),
 	MSM_GPIO_BANK(MSM7X30, 6, 134, 150),
 	MSM_GPIO_BANK(MSM7X30, 7, 151, 181),
-#elif defined(CONFIG_ARCH_QSD8X50)
+};
+
+static struct msm_gpio_chip msm_gpio_chips_qsd8x50[] = {
 	MSM_GPIO_BANK(QSD8X50, 0,   0,  15),
 	MSM_GPIO_BANK(QSD8X50, 1,  16,  42),
 	MSM_GPIO_BANK(QSD8X50, 2,  43,  67),
@@ -215,7 +222,6 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(QSD8X50, 5, 104, 121),
 	MSM_GPIO_BANK(QSD8X50, 6, 122, 152),
 	MSM_GPIO_BANK(QSD8X50, 7, 153, 164),
-#endif
 };
 
 static void msm_gpio_irq_ack(struct irq_data *d)
@@ -311,7 +317,7 @@ static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 	int i, j, mask;
 	unsigned val;
 
-	for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
+	for (i = 0; i < msm_gpio_count; i++) {
 		struct msm_gpio_chip *msm_chip = &msm_gpio_chips[i];
 		val = readl(msm_chip->regs.int_status);
 		val &= msm_chip->int_enable[0];
@@ -342,6 +348,19 @@ static int __init msm_init_gpio(void)
 {
 	int i, j = 0;
 
+	if (cpu_is_msm7x01()) {
+		msm_gpio_chips = msm_gpio_chips_msm7x01;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_msm7x01);
+	} else if (cpu_is_msm7x30()) {
+		msm_gpio_chips = msm_gpio_chips_msm7x30;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_msm7x30);
+	} else if (cpu_is_qsd8x50()) {
+		msm_gpio_chips = msm_gpio_chips_qsd8x50;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_qsd8x50);
+	} else {
+		return 0;
+	}
+
 	for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) {
 		if (i - FIRST_GPIO_IRQ >=
 			msm_gpio_chips[j].chip.base +
@@ -353,7 +372,7 @@ static int __init msm_init_gpio(void)
 		set_irq_flags(i, IRQF_VALID);
 	}
 
-	for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
+	for (i = 0; i < msm_gpio_count; i++) {
 		spin_lock_init(&msm_gpio_chips[i].lock);
 		writel(0, msm_gpio_chips[i].regs.int_en);
 		gpiochip_add(&msm_gpio_chips[i].chip);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#24 lore raw

PATCH v2 5/7 msm: gpiomux: Move public API to public header

In reply to David Brown

The gpiomux.h header contains some SOC ifdefs. However, the API that is actually used by the GPIO driver only uses two functions that are general. Move these general definitions into a public header file.

---
 arch/arm/mach-msm/gpio.c                     |    2 +-
 arch/arm/mach-msm/gpiomux.h                  |   17 +-----------
 arch/arm/mach-msm/include/mach/msm_gpiomux.h |   38 ++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/mach-msm/include/mach/msm_gpiomux.h
arch/arm/mach-msm/gpio.c +1 -1
index e96199d..6767deb 100644
@@ -21,8 +21,8 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <mach/cpu.h>
+#include <mach/msm_gpiomux.h>
 #include "gpio_hw.h"
-#include "gpiomux.h"
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
arch/arm/mach-msm/gpiomux.h +1 -16
index b178d9c..00459f6 100644
@@ -19,6 +19,7 @@
 
 #include <linux/bitops.h>
 #include <linux/errno.h>
+#include <mach/msm_gpiomux.h>
 
 #if defined(CONFIG_MSM_V2_TLMM)
 #include "gpiomux-v2.h"
@@ -71,12 +72,6 @@ enum {
  */
 extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
 
-/* Increment a gpio's reference count, possibly activating the line. */
-int __must_check msm_gpiomux_get(unsigned gpio);
-
-/* Decrement a gpio's reference count, possibly suspending the line. */
-int msm_gpiomux_put(unsigned gpio);
-
 /* Install a new configuration to the gpio line.  To avoid overwriting
  * a configuration, leave the VALID bit out.
  */
@@ -94,16 +89,6 @@ int msm_gpiomux_write(unsigned gpio,
  */
 void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val);
 #else
-static inline int __must_check msm_gpiomux_get(unsigned gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int msm_gpiomux_put(unsigned gpio)
-{
-	return -ENOSYS;
-}
-
 static inline int msm_gpiomux_write(unsigned gpio,
 				    gpiomux_config_t active,
 				    gpiomux_config_t suspended)
arch/arm/mach-msm/include/mach/msm_gpiomux.h new file +38 -0
new file mode 100644
index 0000000..0c7d393
@@ -0,0 +1,38 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_MSM_GPIOMUX_H
+#define _LINUX_MSM_GPIOMUX_H
+
+#ifdef CONFIG_MSM_GPIOMUX
+
+/* Increment a gpio's reference count, possibly activating the line. */
+int __must_check msm_gpiomux_get(unsigned gpio);
+
+/* Decrement a gpio's reference count, possibly suspending the line. */
+int msm_gpiomux_put(unsigned gpio);
+
+#else
+
+static inline int __must_check msm_gpiomux_get(unsigned gpio)
+{
+	return -ENOSYS;
+}
+
+static inline int msm_gpiomux_put(unsigned gpio)
+{
+	return -ENOSYS;
+}
+
+#endif
+
+#endif /* _LINUX_MSM_GPIOMUX_H */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#25 lore raw

PATCH v2 6/7 gpio_msm: Move Qualcomm v6 MSM driver into drivers

In reply to David Brown

Migrate the driver for the v6-based MSM chips into drivers/gpio. The driver is unchanged, only moved.

---
 arch/arm/mach-msm/Kconfig                          |    3 +++
 arch/arm/mach-msm/Makefile                         |    2 --
 drivers/gpio/Kconfig                               |    8 ++++++++
 drivers/gpio/Makefile                              |    1 +
 arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c  |    7 +++----
 .../mach-msm/gpio_hw.h => drivers/gpio/msm_v1.h    |    9 ++++-----
 6 files changed, 19 insertions(+), 11 deletions(-)
 rename arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c (98%)
 rename arch/arm/mach-msm/gpio_hw.h => drivers/gpio/msm_v1.h (98%)
arch/arm/mach-msm/Kconfig +3 -0
index 1516896..cc7c0b2 100644
@@ -11,6 +11,7 @@ config ARCH_MSM7X00A
 	select MSM_SMD
 	select MSM_SMD_PKG3
 	select CPU_V6
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
@@ -22,6 +23,7 @@ config ARCH_MSM7X30
 	select MSM_VIC
 	select CPU_V7
 	select MSM_GPIOMUX
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
@@ -33,6 +35,7 @@ config ARCH_QSD8X50
 	select MSM_VIC
 	select CPU_V7
 	select MSM_GPIOMUX
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
arch/arm/mach-msm/Makefile +0 -2
index 9519fd2..c0709af 100644
@@ -34,6 +34,4 @@ ifndef CONFIG_ARCH_MSM8960
 # TODO: TLMM Mapping issues need to be resolved
 obj-y	+= gpio-v2.o
 endif
-else
-obj-y	+= gpio.o
 endif
drivers/gpio/Kconfig +8 -0
index 4a7f631..c19ecd6a 100644
@@ -164,6 +164,14 @@ config GPIO_VX855
 	  additional drivers must be enabled in order to use the
 	  functionality of the device.
 
+config GPIO_MSM_V1
+	tristate "Qualcomm MSM GPIO v1"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM v6 based
+	  Qualcomm MSM chips.  Most of the pins on the MSM can be
+	  selected for GPIO, and are controlled by this driver.
+
 comment "I2C GPIO expanders:"
 
 config GPIO_MAX7300
drivers/gpio/Makefile +1 -0
index b605f8e..2a7c24c 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_GPIO_RDC321X)	+= rdc321x-gpio.o
 obj-$(CONFIG_GPIO_JANZ_TTL)	+= janz-ttl.o
 obj-$(CONFIG_GPIO_SX150X)	+= sx150x.o
 obj-$(CONFIG_GPIO_VX855)	+= vx855_gpio.o
+obj-$(CONFIG_GPIO_MSM_V1)	+= msm_v1.o
 obj-$(CONFIG_GPIO_ML_IOH)	+= ml_ioh_gpio.o
 obj-$(CONFIG_AB8500_GPIO)       += ab8500-gpio.o
 obj-$(CONFIG_GPIO_TPS65910)	+= tps65910-gpio.o
drivers/gpio/msm_v1.c renamed from arch/arm/mach-msm/gpio.c +3 -4
similarity index 98%
rename from arch/arm/mach-msm/gpio.c
rename to drivers/gpio/msm_v1.c
index 6767deb..89ed35b 100644
@@ -1,7 +1,6 @@
-/* linux/arch/arm/mach-msm/gpio.c
- *
+/*
  * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -22,7 +21,7 @@
 #include <linux/module.h>
 #include <mach/cpu.h>
 #include <mach/msm_gpiomux.h>
-#include "gpio_hw.h"
+#include "msm_v1.h"
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
drivers/gpio/msm_v1.h renamed from arch/arm/mach-msm/gpio_hw.h +4 -5
similarity index 98%
rename from arch/arm/mach-msm/gpio_hw.h
rename to drivers/gpio/msm_v1.h
index ba7972a..a3e3cb2 100644
@@ -1,8 +1,7 @@
-/* arch/arm/mach-msm/gpio_hw.h
- *
+/*
  * Copyright (C) 2007 Google, Inc.
  * Author: Brian Swetland <[email protected]>
- * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -15,8 +14,8 @@
  *
  */
 
-#ifndef __ARCH_ARM_MACH_MSM_GPIO_HW_H
-#define __ARCH_ARM_MACH_MSM_GPIO_HW_H
+#ifndef _MSM_GPIO_V1_H
+#define _MSM_GPIO_V1_H
 
 #include <mach/msm_iomap.h>
 
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#27 lore raw

PATCH v2 7/7 gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

In reply to David Brown

Migrate the driver for the v7-based MSM chips into drivers/gpio. The driver is unchanged, only moved.

---
 arch/arm/mach-msm/Kconfig                          |    1 +
 arch/arm/mach-msm/Makefile                         |    6 ------
 drivers/gpio/Kconfig                               |    8 ++++++++
 drivers/gpio/Makefile                              |    1 +
 .../mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c    |    2 +-
 5 files changed, 11 insertions(+), 7 deletions(-)
 rename arch/arm/mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c (99%)
arch/arm/mach-msm/Kconfig +1 -0
index cc7c0b2..f5cce3f 100644
@@ -47,6 +47,7 @@ config ARCH_MSM8X60
 	select ARM_GIC
 	select CPU_V7
 	select MSM_V2_TLMM
+	select GPIO_MSM_V2
 	select MSM_GPIOMUX
 	select MSM_SCM if SMP
 
arch/arm/mach-msm/Makefile +0 -6
index c0709af..7a227d1 100644
@@ -29,9 +29,3 @@ obj-$(CONFIG_ARCH_MSM8960) += board-msm8960.o devices-msm8960.o
 obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
-ifdef CONFIG_MSM_V2_TLMM
-ifndef CONFIG_ARCH_MSM8960
-# TODO: TLMM Mapping issues need to be resolved
-obj-y	+= gpio-v2.o
-endif
-endif
drivers/gpio/Kconfig +8 -0
index c19ecd6a..e415661 100644
@@ -172,6 +172,14 @@ config GPIO_MSM_V1
 	  Qualcomm MSM chips.  Most of the pins on the MSM can be
 	  selected for GPIO, and are controlled by this driver.
 
+config GPIO_MSM_V2
+	tristate "Qualcomm MSM GPIO v2"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM v7 based
+	  Qualcomm MSM chips.  Most of the pins on the MSM can be
+	  selected for GPIO, and are controlled by this driver.
+
 comment "I2C GPIO expanders:"
 
 config GPIO_MAX7300
drivers/gpio/Makefile +1 -0
index 2a7c24c..d85cb9e 100644
@@ -46,6 +46,7 @@ obj-$(CONFIG_GPIO_JANZ_TTL)	+= janz-ttl.o
 obj-$(CONFIG_GPIO_SX150X)	+= sx150x.o
 obj-$(CONFIG_GPIO_VX855)	+= vx855_gpio.o
 obj-$(CONFIG_GPIO_MSM_V1)	+= msm_v1.o
+obj-$(CONFIG_GPIO_MSM_V2)	+= msm_v2.o
 obj-$(CONFIG_GPIO_ML_IOH)	+= ml_ioh_gpio.o
 obj-$(CONFIG_AB8500_GPIO)       += ab8500-gpio.o
 obj-$(CONFIG_GPIO_TPS65910)	+= tps65910-gpio.o
drivers/gpio/msm_v2.c renamed from arch/arm/mach-msm/gpio-v2.c +1 -1
similarity index 99%
rename from arch/arm/mach-msm/gpio-v2.c
rename to drivers/gpio/msm_v2.c
index cc9c4fd..822a449 100644
@@ -30,8 +30,8 @@
 
 #include <asm/mach/irq.h>
 
+#include <mach/msm_gpiomux.h>
 #include <mach/msm_iomap.h>
-#include "gpiomux.h"
 
 /* Bits of interest in the GPIO_IN_OUT register.
  */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#29 lore raw
In reply to David Brown
Quoted 2 lines · David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

Grant, feel free to pull these changes from my git repo if you'd like. (assuming there are no additional objections to the change).

Thanks,
David

The following changes since commit 55922c9d1b84b89cb946c777fddccb3247e7df2c:

Linux 3.0-rc1 (2011-05-29 17:43:36 -0700)

are available in the git repository at:
git://codeaurora.org/quic/kernel/davidb/linux-msm.git msm-move-gpio

David Brown (7):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

 arch/arm/mach-msm/Kconfig                          |    4 +
 arch/arm/mach-msm/Makefile                         |    8 -
 arch/arm/mach-msm/gpio_hw.h                        |  278 --------------------
 arch/arm/mach-msm/gpiomux.h                        |   17 +--
 arch/arm/mach-msm/include/mach/msm_gpiomux.h       |   38 +++
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap.h         |    2 +
 arch/arm/mach-msm/io.c                             |   12 +-
 drivers/gpio/Kconfig                               |   16 ++
 drivers/gpio/Makefile                              |    2 +
 arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c  |  111 +++++----
 drivers/gpio/msm_v1.h                              |  271 +++++++++++++++++++
 .../mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c    |    2 +-
 15 files changed, 414 insertions(+), 377 deletions(-)
 delete mode 100644 arch/arm/mach-msm/gpio_hw.h
 create mode 100644 arch/arm/mach-msm/include/mach/msm_gpiomux.h
 rename arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c (82%)
 create mode 100644 drivers/gpio/msm_v1.h
 rename arch/arm/mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c (99%)
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#26 lore raw

Re: [PATCH v2 6/7] gpio_msm: Move Qualcomm v6 MSM driver into drivers

In reply to David Brown
Quoted 6 lines · David Brown

Migrate the driver for the v6-based MSM chips into drivers/gpio. The driver is unchanged, only moved.

Hi David,

Comments below. When you repost, please cc me on the entire series, not just the last 2.

Quoted 6 lines
---
 arch/arm/mach-msm/Kconfig                          |    3 +++
 arch/arm/mach-msm/Makefile                         |    2 --
 drivers/gpio/Kconfig                               |    8 ++++++++
 drivers/gpio/Makefile                              |    1 +
 arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c  |    7 +++----

drivers/gpio/gpio-msm-v1.c please. I'm now enforcing a gpio-*.c naming convention in this directory. The other drivers will be renamed soon.

Quoted 50 lines
 .../mach-msm/gpio_hw.h => drivers/gpio/msm_v1.h    |    9 ++++-----
 6 files changed, 19 insertions(+), 11 deletions(-)
 rename arch/arm/mach-msm/gpio.c => drivers/gpio/msm_v1.c (98%)
 rename arch/arm/mach-msm/gpio_hw.h => drivers/gpio/msm_v1.h (98%)
arch/arm/mach-msm/Kconfig +3 -0
index 1516896..cc7c0b2 100644
@@ -11,6 +11,7 @@ config ARCH_MSM7X00A
 	select MSM_SMD
 	select MSM_SMD_PKG3
 	select CPU_V6
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
@@ -22,6 +23,7 @@ config ARCH_MSM7X30
 	select MSM_VIC
 	select CPU_V7
 	select MSM_GPIOMUX
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
@@ -33,6 +35,7 @@ config ARCH_QSD8X50
 	select MSM_VIC
 	select CPU_V7
 	select MSM_GPIOMUX
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
arch/arm/mach-msm/Makefile +0 -2
index 9519fd2..c0709af 100644
@@ -34,6 +34,4 @@ ifndef CONFIG_ARCH_MSM8960
 # TODO: TLMM Mapping issues need to be resolved
 obj-y	+= gpio-v2.o
 endif
-else
-obj-y	+= gpio.o
 endif
drivers/gpio/Kconfig +0 -0
index 4a7f631..c19ecd6a 100644
@@ -164,6 +164,14 @@ config GPIO_VX855
 	  additional drivers must be enabled in order to use the

drivers/gpio/Kconfig config GPIO_VX855 · line 174

Quoted 10 lines
drivers/gpio/Kconfig +8 -0
 	  functionality of the device.
 
+config GPIO_MSM_V1
+	tristate "Qualcomm MSM GPIO v1"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM v6 based
+	  Qualcomm MSM chips.  Most of the pins on the MSM can be
+	  selected for GPIO, and are controlled by this driver.
+

The kconfig entries are pseudo-alphabetically sorted. This entry should be higher in the list.

drivers/gpio/Makefile obj-$(CONFIG_GPIO_RDC321X) += rdc321x-gpio.o · line 48

Quoted 12 lines
drivers/gpio/Kconfig +0 -0
 comment "I2C GPIO expanders:"
 
 config GPIO_MAX7300
drivers/gpio/Makefile +1 -0
index b605f8e..2a7c24c 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_GPIO_RDC321X)	+= rdc321x-gpio.o
 obj-$(CONFIG_GPIO_JANZ_TTL)	+= janz-ttl.o
 obj-$(CONFIG_GPIO_SX150X)	+= sx150x.o
 obj-$(CONFIG_GPIO_VX855)	+= vx855_gpio.o
+obj-$(CONFIG_GPIO_MSM_V1)	+= msm_v1.o

Ditto

Quoted 21 lines
drivers/gpio/Makefile +0 -0
 obj-$(CONFIG_GPIO_ML_IOH)	+= ml_ioh_gpio.o
 obj-$(CONFIG_AB8500_GPIO)       += ab8500-gpio.o
 obj-$(CONFIG_GPIO_TPS65910)	+= tps65910-gpio.o
drivers/gpio/msm_v1.c renamed from arch/arm/mach-msm/gpio.c +2 -3
similarity index 98%
rename from arch/arm/mach-msm/gpio.c
rename to drivers/gpio/msm_v1.c
index 6767deb..89ed35b 100644
@@ -1,7 +1,6 @@
-/* linux/arch/arm/mach-msm/gpio.c
- *
+/*
  * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and

drivers/gpio/msm_v1.c line 24

Quoted 5 lines
drivers/gpio/msm_v1.c renamed from arch/arm/mach-msm/gpio.c +1 -1
@@ -22,7 +21,7 @@
 #include <linux/module.h>
 #include <mach/cpu.h>
 #include <mach/msm_gpiomux.h>
-#include "gpio_hw.h"
+#include "msm_v1.h"

What is the purpose of this header? Does anything else include it? If not, then it should be squashed into the .c file.

Quoted 36 lines
drivers/gpio/msm_v1.c renamed from arch/arm/mach-msm/gpio.c +0 -0
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
drivers/gpio/msm_v1.h renamed from arch/arm/mach-msm/gpio_hw.h +4 -5
similarity index 98%
rename from arch/arm/mach-msm/gpio_hw.h
rename to drivers/gpio/msm_v1.h
index ba7972a..a3e3cb2 100644
@@ -1,8 +1,7 @@
-/* arch/arm/mach-msm/gpio_hw.h
- *
+/*
  * Copyright (C) 2007 Google, Inc.
  * Author: Brian Swetland <[email protected]>
- * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -15,8 +14,8 @@
  *
  */
 
-#ifndef __ARCH_ARM_MACH_MSM_GPIO_HW_H
-#define __ARCH_ARM_MACH_MSM_GPIO_HW_H
+#ifndef _MSM_GPIO_V1_H
+#define _MSM_GPIO_V1_H
 
 #include <mach/msm_iomap.h>
 
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#28 lore raw

Re: [PATCH v2 7/7] gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

In reply to David Brown
Quoted 6 lines · David Brown

Migrate the driver for the v7-based MSM chips into drivers/gpio. The driver is unchanged, only moved.

Similar to patch 6, some comments below.

Quoted 6 lines
---
 arch/arm/mach-msm/Kconfig                          |    1 +
 arch/arm/mach-msm/Makefile                         |    6 ------
 drivers/gpio/Kconfig                               |    8 ++++++++
 drivers/gpio/Makefile                              |    1 +
 .../mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c    |    2 +-

drivers/gpio/gpio-msm-v2.c

Quoted 35 lines
 5 files changed, 11 insertions(+), 7 deletions(-)
 rename arch/arm/mach-msm/gpio-v2.c => drivers/gpio/msm_v2.c (99%)
arch/arm/mach-msm/Kconfig +1 -0
index cc7c0b2..f5cce3f 100644
@@ -47,6 +47,7 @@ config ARCH_MSM8X60
 	select ARM_GIC
 	select CPU_V7
 	select MSM_V2_TLMM
+	select GPIO_MSM_V2
 	select MSM_GPIOMUX
 	select MSM_SCM if SMP
 
arch/arm/mach-msm/Makefile +0 -6
index c0709af..7a227d1 100644
@@ -29,9 +29,3 @@ obj-$(CONFIG_ARCH_MSM8960) += board-msm8960.o devices-msm8960.o
 obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
-ifdef CONFIG_MSM_V2_TLMM
-ifndef CONFIG_ARCH_MSM8960
-# TODO: TLMM Mapping issues need to be resolved
-obj-y	+= gpio-v2.o
-endif
-endif
drivers/gpio/Kconfig +0 -0
index c19ecd6a..e415661 100644
@@ -172,6 +172,14 @@ config GPIO_MSM_V1
 	  Qualcomm MSM chips.  Most of the pins on the MSM can be

drivers/gpio/Kconfig config GPIO_MSM_V1 · line 182

Quoted 10 lines
drivers/gpio/Kconfig +8 -0
 	  selected for GPIO, and are controlled by this driver.
 
+config GPIO_MSM_V2
+	tristate "Qualcomm MSM GPIO v2"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM v7 based
+	  Qualcomm MSM chips.  Most of the pins on the MSM can be
+	  selected for GPIO, and are controlled by this driver.
+

Keep list sorted.

drivers/gpio/Makefile obj-$(CONFIG_GPIO_JANZ_TTL) += janz-ttl.o · line 49

Quoted 12 lines
drivers/gpio/Kconfig +0 -0
 comment "I2C GPIO expanders:"
 
 config GPIO_MAX7300
drivers/gpio/Makefile +1 -0
index 2a7c24c..d85cb9e 100644
@@ -46,6 +46,7 @@ obj-$(CONFIG_GPIO_JANZ_TTL)	+= janz-ttl.o
 obj-$(CONFIG_GPIO_SX150X)	+= sx150x.o
 obj-$(CONFIG_GPIO_VX855)	+= vx855_gpio.o
 obj-$(CONFIG_GPIO_MSM_V1)	+= msm_v1.o
+obj-$(CONFIG_GPIO_MSM_V2)	+= msm_v2.o

ditto

Quoted 24 lines
drivers/gpio/Makefile +0 -0
 obj-$(CONFIG_GPIO_ML_IOH)	+= ml_ioh_gpio.o
 obj-$(CONFIG_AB8500_GPIO)       += ab8500-gpio.o
 obj-$(CONFIG_GPIO_TPS65910)	+= tps65910-gpio.o
drivers/gpio/msm_v2.c renamed from arch/arm/mach-msm/gpio-v2.c +1 -1
similarity index 99%
rename from arch/arm/mach-msm/gpio-v2.c
rename to drivers/gpio/msm_v2.c
index cc9c4fd..822a449 100644
@@ -30,8 +30,8 @@
 
 #include <asm/mach/irq.h>
 
+#include <mach/msm_gpiomux.h>
 #include <mach/msm_iomap.h>
-#include "gpiomux.h"
 
 /* Bits of interest in the GPIO_IN_OUT register.
  */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#30 lore raw

v3 cover Move Qualcomm gpio drivers into drivers dir

In reply to David Brown

This patch series moves the Qualcomm MSM gpio device drivers into the drivers/gpio directory.

The MSM's have two flavors of gpio driver. The one for the newer v7-based chips is a bit cleaner, and can just be moved. The one for the older v6-based chips took some cleanup to get rid of numerous ifdefs based on the particular machine. Both drivers can now be selected and will be used on appropriate targets.

There is still a minor entanglement with the MSM-specific gpiomux code. This will be cleaned up as MSM moves to use pinmux.

patch history:
------
v2 - Move header to mach-msm mach dir
- Fix Kconfig description
- Base off of Linus tree instead of linux-next (postponed for ARM issues)
v3 - Use gpio-* naming for drivers
- Maintain order in Kconfig/Makefile
- Fold register defs into C file

David Brown (8):
msm: gpio: Remove unsupported devices
msm: Remove chip-ifdefs for GPIO io mappings
msm: gpio: Remove chip-specific register definitions
msm: gpio: Remove ifdefs on gpio chip registers
msm: gpiomux: Move public API to public header
msm: gpio: Fold register defs into C file
gpio_msm: Move Qualcomm v6 MSM driver into drivers
gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

 arch/arm/mach-msm/Kconfig                          |    4 +
 arch/arm/mach-msm/Makefile                         |    8 -
 arch/arm/mach-msm/gpio.c                           |  375 ------------
 arch/arm/mach-msm/gpio_hw.h                        |  278 ---------
 arch/arm/mach-msm/gpiomux.h                        |   17 +-
 arch/arm/mach-msm/include/mach/msm_gpiomux.h       |   38 ++
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h    |   10 +-
 arch/arm/mach-msm/include/mach/msm_iomap.h         |    2 +
 arch/arm/mach-msm/io.c                             |   12 +-
 drivers/gpio/Kconfig                               |   16 +
 drivers/gpio/Makefile                              |    2 +
 drivers/gpio/gpio-msm-v1.c                         |  636 ++++++++++++++++++++
 .../gpio-v2.c => drivers/gpio/gpio-msm-v2.c        |    4 +-
 15 files changed, 719 insertions(+), 704 deletions(-)
 delete mode 100644 arch/arm/mach-msm/gpio.c
 delete mode 100644 arch/arm/mach-msm/gpio_hw.h
 create mode 100644 arch/arm/mach-msm/include/mach/msm_gpiomux.h
 create mode 100644 drivers/gpio/gpio-msm-v1.c
 rename arch/arm/mach-msm/gpio-v2.c => drivers/gpio/gpio-msm-v2.c (99%)
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#31 lore raw

PATCH v3 1/8 msm: gpio: Remove unsupported devices

The MSM7x25 and MSM7x27 devices are not yet supported in the kernel. Remove #ifdef-based tables supporting these chips for now.

---
 arch/arm/mach-msm/gpio.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
arch/arm/mach-msm/gpio.c +0 -7
index 5ea273b..c358ced 100644
@@ -197,13 +197,6 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(3,  68,  94),
 	MSM_GPIO_BANK(4,  95, 106),
 	MSM_GPIO_BANK(5, 107, 121),
-#elif defined(CONFIG_ARCH_MSM7X25) || defined(CONFIG_ARCH_MSM7X27)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 132),
 #elif defined(CONFIG_ARCH_MSM7X30)
 	MSM_GPIO_BANK(0,   0,  15),
 	MSM_GPIO_BANK(1,  16,  43),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#32 lore raw

PATCH v3 2/8 msm: Remove chip-ifdefs for GPIO io mappings

In reply to David Brown

The two GPIO controllers are always mapped to the same virtual address across all MSM devices. Instead of selecting this at compile time, determine the physical address at runtime, eliminating yet something else preventing multiple MSM targets from being compiled into the same kernel.

---
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |   10 ++++------
 arch/arm/mach-msm/include/mach/msm_iomap.h      |    2 ++
 arch/arm/mach-msm/io.c                          |   12 ++++++------
 5 files changed, 20 insertions(+), 24 deletions(-)
arch/arm/mach-msm/include/mach/msm_iomap-7x00.h +4 -6
index 8f99d97..94fe9fe 100644
@@ -55,13 +55,11 @@
 #define MSM_DMOV_PHYS         0xA9700000
 #define MSM_DMOV_SIZE         SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xA9200000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define MSM7X00_GPIO1_PHYS        0xA9200000
+#define MSM7X00_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xA9300000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define MSM7X00_GPIO2_PHYS        0xA9300000
+#define MSM7X00_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xA8600000
arch/arm/mach-msm/include/mach/msm_iomap-7x30.h +4 -6
index 4d84be1..3769444 100644
@@ -46,13 +46,11 @@
 #define MSM_DMOV_PHYS         0xAC400000
 #define MSM_DMOV_SIZE         SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xAC001000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define MSM7X30_GPIO1_PHYS        0xAC001000
+#define MSM7X30_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xAC101000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define MSM7X30_GPIO2_PHYS        0xAC101000
+#define MSM7X30_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xAB800000
arch/arm/mach-msm/include/mach/msm_iomap-8x50.h +4 -6
index d414320..d67cd73 100644
@@ -46,13 +46,11 @@
 #define MSM_DMOV_PHYS         0xA9700000
 #define MSM_DMOV_SIZE         SZ_4K
 
-#define MSM_GPIO1_BASE        IOMEM(0xE0003000)
-#define MSM_GPIO1_PHYS        0xA9000000
-#define MSM_GPIO1_SIZE        SZ_4K
+#define QSD8X50_GPIO1_PHYS        0xA9000000
+#define QSD8X50_GPIO1_SIZE        SZ_4K
 
-#define MSM_GPIO2_BASE        IOMEM(0xE0004000)
-#define MSM_GPIO2_PHYS        0xA9100000
-#define MSM_GPIO2_SIZE        SZ_4K
+#define QSD8X50_GPIO2_PHYS        0xA9100000
+#define QSD8X50_GPIO2_SIZE        SZ_4K
 
 #define MSM_CLK_CTL_BASE      IOMEM(0xE0005000)
 #define MSM_CLK_CTL_PHYS      0xA8600000
arch/arm/mach-msm/include/mach/msm_iomap.h +2 -0
index 2f494b6..4ded152 100644
@@ -61,5 +61,7 @@
 #define MSM_QGIC_CPU_BASE	IOMEM(0xF0001000)
 #define MSM_TMR_BASE		IOMEM(0xF0200000)
 #define MSM_TMR0_BASE		IOMEM(0xF0201000)
+#define MSM_GPIO1_BASE		IOMEM(0xE0003000)
+#define MSM_GPIO2_BASE		IOMEM(0xE0004000)
 
 #endif
arch/arm/mach-msm/io.c +6 -6
index cec6ed1..140ddbb 100644
@@ -43,8 +43,8 @@ static struct map_desc msm_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, MSM7X00),
 	MSM_DEVICE(DMOV),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, MSM7X00),
+	MSM_CHIP_DEVICE(GPIO2, MSM7X00),
 	MSM_DEVICE(CLK_CTL),
 #ifdef CONFIG_MSM_DEBUG_UART
 	MSM_DEVICE(DEBUG_UART),
@@ -76,8 +76,8 @@ static struct map_desc qsd8x50_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, QSD8X50),
 	MSM_DEVICE(DMOV),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, QSD8X50),
+	MSM_CHIP_DEVICE(GPIO2, QSD8X50),
 	MSM_DEVICE(CLK_CTL),
 	MSM_DEVICE(SIRC),
 	MSM_DEVICE(SCPLL),
@@ -135,8 +135,8 @@ static struct map_desc msm7x30_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
 	MSM_CHIP_DEVICE(CSR, MSM7X30),
 	MSM_DEVICE(DMOV),
-	MSM_DEVICE(GPIO1),
-	MSM_DEVICE(GPIO2),
+	MSM_CHIP_DEVICE(GPIO1, MSM7X30),
+	MSM_CHIP_DEVICE(GPIO2, MSM7X30),
 	MSM_DEVICE(CLK_CTL),
 	MSM_DEVICE(CLK_CTL_SH2),
 	MSM_DEVICE(AD5),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#33 lore raw

PATCH v3 3/8 msm: gpio: Remove chip-specific register definitions

In reply to David Brown

Put an SOC prefix on each GPIO register definition, eliminating the need to have SOC ifdefs around the definitions.

---
 arch/arm/mach-msm/gpio.c    |   62 ++++----
 arch/arm/mach-msm/gpio_hw.h |  384 +++++++++++++++++++++----------------------
 2 files changed, 220 insertions(+), 226 deletions(-)
arch/arm/mach-msm/gpio.c +31 -31
index c358ced..335afbd 100644
@@ -25,17 +25,17 @@
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
-#define MSM_GPIO_BANK(bank, first, last)				\
+#define MSM_GPIO_BANK(soc, bank, first, last)				\
 	{								\
 		.regs = {						\
-			.out =         MSM_GPIO_OUT_##bank,		\
-			.in =          MSM_GPIO_IN_##bank,		\
-			.int_status =  MSM_GPIO_INT_STATUS_##bank,	\
-			.int_clear =   MSM_GPIO_INT_CLEAR_##bank,	\
-			.int_en =      MSM_GPIO_INT_EN_##bank,		\
-			.int_edge =    MSM_GPIO_INT_EDGE_##bank,	\
-			.int_pos =     MSM_GPIO_INT_POS_##bank,		\
-			.oe =          MSM_GPIO_OE_##bank,		\
+			.out =         soc##_GPIO_OUT_##bank,		\
+			.in =          soc##_GPIO_IN_##bank,		\
+			.int_status =  soc##_GPIO_INT_STATUS_##bank,	\
+			.int_clear =   soc##_GPIO_INT_CLEAR_##bank,	\
+			.int_en =      soc##_GPIO_INT_EN_##bank,	\
+			.int_edge =    soc##_GPIO_INT_EDGE_##bank,	\
+			.int_pos =     soc##_GPIO_INT_POS_##bank,	\
+			.oe =          soc##_GPIO_OE_##bank,		\
 		},							\
 		.chip = {						\
 			.base = (first),				\
@@ -191,30 +191,30 @@ static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
 
 struct msm_gpio_chip msm_gpio_chips[] = {
 #if defined(CONFIG_ARCH_MSM7X00A)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 121),
+	MSM_GPIO_BANK(MSM7X00, 0,   0,  15),
+	MSM_GPIO_BANK(MSM7X00, 1,  16,  42),
+	MSM_GPIO_BANK(MSM7X00, 2,  43,  67),
+	MSM_GPIO_BANK(MSM7X00, 3,  68,  94),
+	MSM_GPIO_BANK(MSM7X00, 4,  95, 106),
+	MSM_GPIO_BANK(MSM7X00, 5, 107, 121),
 #elif defined(CONFIG_ARCH_MSM7X30)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  43),
-	MSM_GPIO_BANK(2,  44,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 106),
-	MSM_GPIO_BANK(5, 107, 133),
-	MSM_GPIO_BANK(6, 134, 150),
-	MSM_GPIO_BANK(7, 151, 181),
+	MSM_GPIO_BANK(MSM7X30, 0,   0,  15),
+	MSM_GPIO_BANK(MSM7X30, 1,  16,  43),
+	MSM_GPIO_BANK(MSM7X30, 2,  44,  67),
+	MSM_GPIO_BANK(MSM7X30, 3,  68,  94),
+	MSM_GPIO_BANK(MSM7X30, 4,  95, 106),
+	MSM_GPIO_BANK(MSM7X30, 5, 107, 133),
+	MSM_GPIO_BANK(MSM7X30, 6, 134, 150),
+	MSM_GPIO_BANK(MSM7X30, 7, 151, 181),
 #elif defined(CONFIG_ARCH_QSD8X50)
-	MSM_GPIO_BANK(0,   0,  15),
-	MSM_GPIO_BANK(1,  16,  42),
-	MSM_GPIO_BANK(2,  43,  67),
-	MSM_GPIO_BANK(3,  68,  94),
-	MSM_GPIO_BANK(4,  95, 103),
-	MSM_GPIO_BANK(5, 104, 121),
-	MSM_GPIO_BANK(6, 122, 152),
-	MSM_GPIO_BANK(7, 153, 164),
+	MSM_GPIO_BANK(QSD8X50, 0,   0,  15),
+	MSM_GPIO_BANK(QSD8X50, 1,  16,  42),
+	MSM_GPIO_BANK(QSD8X50, 2,  43,  67),
+	MSM_GPIO_BANK(QSD8X50, 3,  68,  94),
+	MSM_GPIO_BANK(QSD8X50, 4,  95, 103),
+	MSM_GPIO_BANK(QSD8X50, 5, 104, 121),
+	MSM_GPIO_BANK(QSD8X50, 6, 122, 152),
+	MSM_GPIO_BANK(QSD8X50, 7, 153, 164),
 #endif
 };
 
arch/arm/mach-msm/gpio_hw.h +189 -195

437 lines not on this page · raw message

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#34 lore raw

PATCH v3 4/8 msm: gpio: Remove ifdefs on gpio chip registers

In reply to David Brown

Select the GPIO register configuration at runtime rather than through idefs.

---
 arch/arm/mach-msm/gpio.c |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)
arch/arm/mach-msm/gpio.c +26 -7
index 335afbd..e96199d 100644
@@ -20,6 +20,7 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <mach/cpu.h>
 #include "gpio_hw.h"
 #include "gpiomux.h"
 
@@ -189,15 +190,19 @@ static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
 #define msm_gpio_free NULL
 #endif
 
-struct msm_gpio_chip msm_gpio_chips[] = {
-#if defined(CONFIG_ARCH_MSM7X00A)
+static struct msm_gpio_chip *msm_gpio_chips;
+static int msm_gpio_count;
+
+static struct msm_gpio_chip msm_gpio_chips_msm7x01[] = {
 	MSM_GPIO_BANK(MSM7X00, 0,   0,  15),
 	MSM_GPIO_BANK(MSM7X00, 1,  16,  42),
 	MSM_GPIO_BANK(MSM7X00, 2,  43,  67),
 	MSM_GPIO_BANK(MSM7X00, 3,  68,  94),
 	MSM_GPIO_BANK(MSM7X00, 4,  95, 106),
 	MSM_GPIO_BANK(MSM7X00, 5, 107, 121),
-#elif defined(CONFIG_ARCH_MSM7X30)
+};
+
+static struct msm_gpio_chip msm_gpio_chips_msm7x30[] = {
 	MSM_GPIO_BANK(MSM7X30, 0,   0,  15),
 	MSM_GPIO_BANK(MSM7X30, 1,  16,  43),
 	MSM_GPIO_BANK(MSM7X30, 2,  44,  67),
@@ -206,7 +211,9 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(MSM7X30, 5, 107, 133),
 	MSM_GPIO_BANK(MSM7X30, 6, 134, 150),
 	MSM_GPIO_BANK(MSM7X30, 7, 151, 181),
-#elif defined(CONFIG_ARCH_QSD8X50)
+};
+
+static struct msm_gpio_chip msm_gpio_chips_qsd8x50[] = {
 	MSM_GPIO_BANK(QSD8X50, 0,   0,  15),
 	MSM_GPIO_BANK(QSD8X50, 1,  16,  42),
 	MSM_GPIO_BANK(QSD8X50, 2,  43,  67),
@@ -215,7 +222,6 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 	MSM_GPIO_BANK(QSD8X50, 5, 104, 121),
 	MSM_GPIO_BANK(QSD8X50, 6, 122, 152),
 	MSM_GPIO_BANK(QSD8X50, 7, 153, 164),
-#endif
 };
 
 static void msm_gpio_irq_ack(struct irq_data *d)
@@ -311,7 +317,7 @@ static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 	int i, j, mask;
 	unsigned val;
 
-	for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
+	for (i = 0; i < msm_gpio_count; i++) {
 		struct msm_gpio_chip *msm_chip = &msm_gpio_chips[i];
 		val = readl(msm_chip->regs.int_status);
 		val &= msm_chip->int_enable[0];
@@ -342,6 +348,19 @@ static int __init msm_init_gpio(void)
 {
 	int i, j = 0;
 
+	if (cpu_is_msm7x01()) {
+		msm_gpio_chips = msm_gpio_chips_msm7x01;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_msm7x01);
+	} else if (cpu_is_msm7x30()) {
+		msm_gpio_chips = msm_gpio_chips_msm7x30;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_msm7x30);
+	} else if (cpu_is_qsd8x50()) {
+		msm_gpio_chips = msm_gpio_chips_qsd8x50;
+		msm_gpio_count = ARRAY_SIZE(msm_gpio_chips_qsd8x50);
+	} else {
+		return 0;
+	}
+
 	for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) {
 		if (i - FIRST_GPIO_IRQ >=
 			msm_gpio_chips[j].chip.base +
@@ -353,7 +372,7 @@ static int __init msm_init_gpio(void)
 		set_irq_flags(i, IRQF_VALID);
 	}
 
-	for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
+	for (i = 0; i < msm_gpio_count; i++) {
 		spin_lock_init(&msm_gpio_chips[i].lock);
 		writel(0, msm_gpio_chips[i].regs.int_en);
 		gpiochip_add(&msm_gpio_chips[i].chip);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#35 lore raw

PATCH v3 5/8 msm: gpiomux: Move public API to public header

In reply to David Brown

The gpiomux.h header contains some SOC ifdefs. However, the API that is actually used by the GPIO driver only uses two functions that are general. Move these general definitions into a public header file.

---
 arch/arm/mach-msm/gpio.c                     |    2 +-
 arch/arm/mach-msm/gpiomux.h                  |   17 +-----------
 arch/arm/mach-msm/include/mach/msm_gpiomux.h |   38 ++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/mach-msm/include/mach/msm_gpiomux.h
arch/arm/mach-msm/gpio.c +1 -1
index e96199d..6767deb 100644
@@ -21,8 +21,8 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <mach/cpu.h>
+#include <mach/msm_gpiomux.h>
 #include "gpio_hw.h"
-#include "gpiomux.h"
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
arch/arm/mach-msm/gpiomux.h +1 -16
index b178d9c..00459f6 100644
@@ -19,6 +19,7 @@
 
 #include <linux/bitops.h>
 #include <linux/errno.h>
+#include <mach/msm_gpiomux.h>
 
 #if defined(CONFIG_MSM_V2_TLMM)
 #include "gpiomux-v2.h"
@@ -71,12 +72,6 @@ enum {
  */
 extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
 
-/* Increment a gpio's reference count, possibly activating the line. */
-int __must_check msm_gpiomux_get(unsigned gpio);
-
-/* Decrement a gpio's reference count, possibly suspending the line. */
-int msm_gpiomux_put(unsigned gpio);
-
 /* Install a new configuration to the gpio line.  To avoid overwriting
  * a configuration, leave the VALID bit out.
  */
@@ -94,16 +89,6 @@ int msm_gpiomux_write(unsigned gpio,
  */
 void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val);
 #else
-static inline int __must_check msm_gpiomux_get(unsigned gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int msm_gpiomux_put(unsigned gpio)
-{
-	return -ENOSYS;
-}
-
 static inline int msm_gpiomux_write(unsigned gpio,
 				    gpiomux_config_t active,
 				    gpiomux_config_t suspended)
arch/arm/mach-msm/include/mach/msm_gpiomux.h new file +38 -0
new file mode 100644
index 0000000..0c7d393
@@ -0,0 +1,38 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_MSM_GPIOMUX_H
+#define _LINUX_MSM_GPIOMUX_H
+
+#ifdef CONFIG_MSM_GPIOMUX
+
+/* Increment a gpio's reference count, possibly activating the line. */
+int __must_check msm_gpiomux_get(unsigned gpio);
+
+/* Decrement a gpio's reference count, possibly suspending the line. */
+int msm_gpiomux_put(unsigned gpio);
+
+#else
+
+static inline int __must_check msm_gpiomux_get(unsigned gpio)
+{
+	return -ENOSYS;
+}
+
+static inline int msm_gpiomux_put(unsigned gpio)
+{
+	return -ENOSYS;
+}
+
+#endif
+
+#endif /* _LINUX_MSM_GPIOMUX_H */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#36 lore raw

PATCH v3 6/8 msm: gpio: Fold register defs into C file

In reply to David Brown

No need to have a separate header file containing only register definitions that are used by a single driver. Fold these into the gpio driver.

---
 arch/arm/mach-msm/gpio.c    |  251 +++++++++++++++++++++++++++++++++++++++-
 arch/arm/mach-msm/gpio_hw.h |  272 -------------------------------------------
 2 files changed, 250 insertions(+), 273 deletions(-)
 delete mode 100644 arch/arm/mach-msm/gpio_hw.h
arch/arm/mach-msm/gpio.c +250 -1
index 6767deb..3bbf50e 100644
@@ -22,7 +22,256 @@
 #include <linux/module.h>
 #include <mach/cpu.h>
 #include <mach/msm_gpiomux.h>
-#include "gpio_hw.h"
+#include <mach/msm_iomap.h>
+
+/* see 80-VA736-2 Rev C pp 695-751
+**
+** These are actually the *shadow* gpio registers, since the
+** real ones (which allow full access) are only available to the
+** ARM9 side of the world.
+**
+** Since the _BASE need to be page-aligned when we're mapping them
+** to virtual addresses, adjust for the additional offset in these
+** macros.
+*/
+
+#define MSM_GPIO1_REG(off) (MSM_GPIO1_BASE + (off))
+#define MSM_GPIO2_REG(off) (MSM_GPIO2_BASE + 0x400 + (off))
+#define MSM_GPIO1_SHADOW_REG(off) (MSM_GPIO1_BASE + 0x800 + (off))
+#define MSM_GPIO2_SHADOW_REG(off) (MSM_GPIO2_BASE + 0xC00 + (off))
+
+/*
+ * MSM7X00 registers
+ */
+/* output value */
+#define MSM7X00_GPIO_OUT_0	MSM_GPIO1_SHADOW_REG(0x00)  /* gpio  15-0  */
+#define MSM7X00_GPIO_OUT_1	MSM_GPIO2_SHADOW_REG(0x00)  /* gpio  42-16 */
+#define MSM7X00_GPIO_OUT_2	MSM_GPIO1_SHADOW_REG(0x04)  /* gpio  67-43 */
+#define MSM7X00_GPIO_OUT_3	MSM_GPIO1_SHADOW_REG(0x08)  /* gpio  94-68 */
+#define MSM7X00_GPIO_OUT_4	MSM_GPIO1_SHADOW_REG(0x0C)  /* gpio 106-95 */
+#define MSM7X00_GPIO_OUT_5	MSM_GPIO1_SHADOW_REG(0x50)  /* gpio 107-121 */
+
+/* same pin map as above, output enable */
+#define MSM7X00_GPIO_OE_0	MSM_GPIO1_SHADOW_REG(0x10)
+#define MSM7X00_GPIO_OE_1	MSM_GPIO2_SHADOW_REG(0x08)
+#define MSM7X00_GPIO_OE_2	MSM_GPIO1_SHADOW_REG(0x14)
+#define MSM7X00_GPIO_OE_3	MSM_GPIO1_SHADOW_REG(0x18)
+#define MSM7X00_GPIO_OE_4	MSM_GPIO1_SHADOW_REG(0x1C)
+#define MSM7X00_GPIO_OE_5	MSM_GPIO1_SHADOW_REG(0x54)
+
+/* same pin map as above, input read */
+#define MSM7X00_GPIO_IN_0	MSM_GPIO1_SHADOW_REG(0x34)
+#define MSM7X00_GPIO_IN_1	MSM_GPIO2_SHADOW_REG(0x20)
+#define MSM7X00_GPIO_IN_2	MSM_GPIO1_SHADOW_REG(0x38)
+#define MSM7X00_GPIO_IN_3	MSM_GPIO1_SHADOW_REG(0x3C)
+#define MSM7X00_GPIO_IN_4	MSM_GPIO1_SHADOW_REG(0x40)
+#define MSM7X00_GPIO_IN_5	MSM_GPIO1_SHADOW_REG(0x44)
+
+/* same pin map as above, 1=edge 0=level interrup */
+#define MSM7X00_GPIO_INT_EDGE_0	MSM_GPIO1_SHADOW_REG(0x60)
+#define MSM7X00_GPIO_INT_EDGE_1	MSM_GPIO2_SHADOW_REG(0x50)
+#define MSM7X00_GPIO_INT_EDGE_2	MSM_GPIO1_SHADOW_REG(0x64)
+#define MSM7X00_GPIO_INT_EDGE_3	MSM_GPIO1_SHADOW_REG(0x68)
+#define MSM7X00_GPIO_INT_EDGE_4	MSM_GPIO1_SHADOW_REG(0x6C)
+#define MSM7X00_GPIO_INT_EDGE_5	MSM_GPIO1_SHADOW_REG(0xC0)
+
+/* same pin map as above, 1=positive 0=negative */
+#define MSM7X00_GPIO_INT_POS_0	MSM_GPIO1_SHADOW_REG(0x70)
+#define MSM7X00_GPIO_INT_POS_1	MSM_GPIO2_SHADOW_REG(0x58)
+#define MSM7X00_GPIO_INT_POS_2	MSM_GPIO1_SHADOW_REG(0x74)
+#define MSM7X00_GPIO_INT_POS_3	MSM_GPIO1_SHADOW_REG(0x78)
+#define MSM7X00_GPIO_INT_POS_4	MSM_GPIO1_SHADOW_REG(0x7C)
+#define MSM7X00_GPIO_INT_POS_5	MSM_GPIO1_SHADOW_REG(0xBC)
+
+/* same pin map as above, interrupt enable */
+#define MSM7X00_GPIO_INT_EN_0	MSM_GPIO1_SHADOW_REG(0x80)
+#define MSM7X00_GPIO_INT_EN_1	MSM_GPIO2_SHADOW_REG(0x60)
+#define MSM7X00_GPIO_INT_EN_2	MSM_GPIO1_SHADOW_REG(0x84)
+#define MSM7X00_GPIO_INT_EN_3	MSM_GPIO1_SHADOW_REG(0x88)
+#define MSM7X00_GPIO_INT_EN_4	MSM_GPIO1_SHADOW_REG(0x8C)
+#define MSM7X00_GPIO_INT_EN_5	MSM_GPIO1_SHADOW_REG(0xB8)
+
+/* same pin map as above, write 1 to clear interrupt */
+#define MSM7X00_GPIO_INT_CLEAR_0	MSM_GPIO1_SHADOW_REG(0x90)
+#define MSM7X00_GPIO_INT_CLEAR_1	MSM_GPIO2_SHADOW_REG(0x68)
+#define MSM7X00_GPIO_INT_CLEAR_2	MSM_GPIO1_SHADOW_REG(0x94)
+#define MSM7X00_GPIO_INT_CLEAR_3	MSM_GPIO1_SHADOW_REG(0x98)
+#define MSM7X00_GPIO_INT_CLEAR_4	MSM_GPIO1_SHADOW_REG(0x9C)
+#define MSM7X00_GPIO_INT_CLEAR_5	MSM_GPIO1_SHADOW_REG(0xB4)
+
+/* same pin map as above, 1=interrupt pending */
+#define MSM7X00_GPIO_INT_STATUS_0	MSM_GPIO1_SHADOW_REG(0xA0)
+#define MSM7X00_GPIO_INT_STATUS_1	MSM_GPIO2_SHADOW_REG(0x70)
+#define MSM7X00_GPIO_INT_STATUS_2	MSM_GPIO1_SHADOW_REG(0xA4)
+#define MSM7X00_GPIO_INT_STATUS_3	MSM_GPIO1_SHADOW_REG(0xA8)
+#define MSM7X00_GPIO_INT_STATUS_4	MSM_GPIO1_SHADOW_REG(0xAC)
+#define MSM7X00_GPIO_INT_STATUS_5	MSM_GPIO1_SHADOW_REG(0xB0)
+
+/*
+ * QSD8X50 registers
+ */
+/* output value */
+#define QSD8X50_GPIO_OUT_0	MSM_GPIO1_SHADOW_REG(0x00)  /* gpio  15-0   */
+#define QSD8X50_GPIO_OUT_1	MSM_GPIO2_SHADOW_REG(0x00)  /* gpio  42-16  */
+#define QSD8X50_GPIO_OUT_2	MSM_GPIO1_SHADOW_REG(0x04)  /* gpio  67-43  */
+#define QSD8X50_GPIO_OUT_3	MSM_GPIO1_SHADOW_REG(0x08)  /* gpio  94-68  */
+#define QSD8X50_GPIO_OUT_4	MSM_GPIO1_SHADOW_REG(0x0C)  /* gpio 103-95  */
+#define QSD8X50_GPIO_OUT_5	MSM_GPIO1_SHADOW_REG(0x10)  /* gpio 121-104 */
+#define QSD8X50_GPIO_OUT_6	MSM_GPIO1_SHADOW_REG(0x14)  /* gpio 152-122 */
+#define QSD8X50_GPIO_OUT_7	MSM_GPIO1_SHADOW_REG(0x18)  /* gpio 164-153 */
+
+/* same pin map as above, output enable */
+#define QSD8X50_GPIO_OE_0	MSM_GPIO1_SHADOW_REG(0x20)
+#define QSD8X50_GPIO_OE_1	MSM_GPIO2_SHADOW_REG(0x08)
+#define QSD8X50_GPIO_OE_2	MSM_GPIO1_SHADOW_REG(0x24)
+#define QSD8X50_GPIO_OE_3	MSM_GPIO1_SHADOW_REG(0x28)
+#define QSD8X50_GPIO_OE_4	MSM_GPIO1_SHADOW_REG(0x2C)
+#define QSD8X50_GPIO_OE_5	MSM_GPIO1_SHADOW_REG(0x30)
+#define QSD8X50_GPIO_OE_6	MSM_GPIO1_SHADOW_REG(0x34)
+#define QSD8X50_GPIO_OE_7	MSM_GPIO1_SHADOW_REG(0x38)
+
+/* same pin map as above, input read */
+#define QSD8X50_GPIO_IN_0	MSM_GPIO1_SHADOW_REG(0x50)
+#define QSD8X50_GPIO_IN_1	MSM_GPIO2_SHADOW_REG(0x20)
+#define QSD8X50_GPIO_IN_2	MSM_GPIO1_SHADOW_REG(0x54)
+#define QSD8X50_GPIO_IN_3	MSM_GPIO1_SHADOW_REG(0x58)
+#define QSD8X50_GPIO_IN_4	MSM_GPIO1_SHADOW_REG(0x5C)
+#define QSD8X50_GPIO_IN_5	MSM_GPIO1_SHADOW_REG(0x60)
+#define QSD8X50_GPIO_IN_6	MSM_GPIO1_SHADOW_REG(0x64)
+#define QSD8X50_GPIO_IN_7	MSM_GPIO1_SHADOW_REG(0x68)
+
+/* same pin map as above, 1=edge 0=level interrup */
+#define QSD8X50_GPIO_INT_EDGE_0	MSM_GPIO1_SHADOW_REG(0x70)
+#define QSD8X50_GPIO_INT_EDGE_1	MSM_GPIO2_SHADOW_REG(0x50)
+#define QSD8X50_GPIO_INT_EDGE_2	MSM_GPIO1_SHADOW_REG(0x74)
+#define QSD8X50_GPIO_INT_EDGE_3	MSM_GPIO1_SHADOW_REG(0x78)
+#define QSD8X50_GPIO_INT_EDGE_4	MSM_GPIO1_SHADOW_REG(0x7C)
+#define QSD8X50_GPIO_INT_EDGE_5	MSM_GPIO1_SHADOW_REG(0x80)
+#define QSD8X50_GPIO_INT_EDGE_6	MSM_GPIO1_SHADOW_REG(0x84)
+#define QSD8X50_GPIO_INT_EDGE_7	MSM_GPIO1_SHADOW_REG(0x88)
+
+/* same pin map as above, 1=positive 0=negative */
+#define QSD8X50_GPIO_INT_POS_0	MSM_GPIO1_SHADOW_REG(0x90)
+#define QSD8X50_GPIO_INT_POS_1	MSM_GPIO2_SHADOW_REG(0x58)
+#define QSD8X50_GPIO_INT_POS_2	MSM_GPIO1_SHADOW_REG(0x94)
+#define QSD8X50_GPIO_INT_POS_3	MSM_GPIO1_SHADOW_REG(0x98)
+#define QSD8X50_GPIO_INT_POS_4	MSM_GPIO1_SHADOW_REG(0x9C)
+#define QSD8X50_GPIO_INT_POS_5	MSM_GPIO1_SHADOW_REG(0xA0)
+#define QSD8X50_GPIO_INT_POS_6	MSM_GPIO1_SHADOW_REG(0xA4)
+#define QSD8X50_GPIO_INT_POS_7	MSM_GPIO1_SHADOW_REG(0xA8)
+
+/* same pin map as above, interrupt enable */
+#define QSD8X50_GPIO_INT_EN_0	MSM_GPIO1_SHADOW_REG(0xB0)
+#define QSD8X50_GPIO_INT_EN_1	MSM_GPIO2_SHADOW_REG(0x60)
+#define QSD8X50_GPIO_INT_EN_2	MSM_GPIO1_SHADOW_REG(0xB4)
+#define QSD8X50_GPIO_INT_EN_3	MSM_GPIO1_SHADOW_REG(0xB8)
+#define QSD8X50_GPIO_INT_EN_4	MSM_GPIO1_SHADOW_REG(0xBC)
+#define QSD8X50_GPIO_INT_EN_5	MSM_GPIO1_SHADOW_REG(0xC0)
+#define QSD8X50_GPIO_INT_EN_6	MSM_GPIO1_SHADOW_REG(0xC4)
+#define QSD8X50_GPIO_INT_EN_7	MSM_GPIO1_SHADOW_REG(0xC8)
+
+/* same pin map as above, write 1 to clear interrupt */
+#define QSD8X50_GPIO_INT_CLEAR_0	MSM_GPIO1_SHADOW_REG(0xD0)
+#define QSD8X50_GPIO_INT_CLEAR_1	MSM_GPIO2_SHADOW_REG(0x68)
+#define QSD8X50_GPIO_INT_CLEAR_2	MSM_GPIO1_SHADOW_REG(0xD4)
+#define QSD8X50_GPIO_INT_CLEAR_3	MSM_GPIO1_SHADOW_REG(0xD8)
+#define QSD8X50_GPIO_INT_CLEAR_4	MSM_GPIO1_SHADOW_REG(0xDC)
+#define QSD8X50_GPIO_INT_CLEAR_5	MSM_GPIO1_SHADOW_REG(0xE0)
+#define QSD8X50_GPIO_INT_CLEAR_6	MSM_GPIO1_SHADOW_REG(0xE4)
+#define QSD8X50_GPIO_INT_CLEAR_7	MSM_GPIO1_SHADOW_REG(0xE8)
+
+/* same pin map as above, 1=interrupt pending */
+#define QSD8X50_GPIO_INT_STATUS_0	MSM_GPIO1_SHADOW_REG(0xF0)
+#define QSD8X50_GPIO_INT_STATUS_1	MSM_GPIO2_SHADOW_REG(0x70)
+#define QSD8X50_GPIO_INT_STATUS_2	MSM_GPIO1_SHADOW_REG(0xF4)
+#define QSD8X50_GPIO_INT_STATUS_3	MSM_GPIO1_SHADOW_REG(0xF8)
+#define QSD8X50_GPIO_INT_STATUS_4	MSM_GPIO1_SHADOW_REG(0xFC)
+#define QSD8X50_GPIO_INT_STATUS_5	MSM_GPIO1_SHADOW_REG(0x100)
+#define QSD8X50_GPIO_INT_STATUS_6	MSM_GPIO1_SHADOW_REG(0x104)
+#define QSD8X50_GPIO_INT_STATUS_7	MSM_GPIO1_SHADOW_REG(0x108)
+
+/*
+ * MSM7X30 registers
+ */
+/* output value */
+#define MSM7X30_GPIO_OUT_0	MSM_GPIO1_REG(0x00)   /* gpio  15-0   */
+#define MSM7X30_GPIO_OUT_1	MSM_GPIO2_REG(0x00)   /* gpio  43-16  */
+#define MSM7X30_GPIO_OUT_2	MSM_GPIO1_REG(0x04)   /* gpio  67-44  */
+#define MSM7X30_GPIO_OUT_3	MSM_GPIO1_REG(0x08)   /* gpio  94-68  */
+#define MSM7X30_GPIO_OUT_4	MSM_GPIO1_REG(0x0C)   /* gpio 106-95  */
+#define MSM7X30_GPIO_OUT_5	MSM_GPIO1_REG(0x50)   /* gpio 133-107 */
+#define MSM7X30_GPIO_OUT_6	MSM_GPIO1_REG(0xC4)   /* gpio 150-134 */
+#define MSM7X30_GPIO_OUT_7	MSM_GPIO1_REG(0x214)  /* gpio 181-151 */
+
+/* same pin map as above, output enable */
+#define MSM7X30_GPIO_OE_0	MSM_GPIO1_REG(0x10)
+#define MSM7X30_GPIO_OE_1	MSM_GPIO2_REG(0x08)
+#define MSM7X30_GPIO_OE_2	MSM_GPIO1_REG(0x14)
+#define MSM7X30_GPIO_OE_3	MSM_GPIO1_REG(0x18)
+#define MSM7X30_GPIO_OE_4	MSM_GPIO1_REG(0x1C)
+#define MSM7X30_GPIO_OE_5	MSM_GPIO1_REG(0x54)
+#define MSM7X30_GPIO_OE_6	MSM_GPIO1_REG(0xC8)
+#define MSM7X30_GPIO_OE_7	MSM_GPIO1_REG(0x218)
+
+/* same pin map as above, input read */
+#define MSM7X30_GPIO_IN_0	MSM_GPIO1_REG(0x34)
+#define MSM7X30_GPIO_IN_1	MSM_GPIO2_REG(0x20)
+#define MSM7X30_GPIO_IN_2	MSM_GPIO1_REG(0x38)
+#define MSM7X30_GPIO_IN_3	MSM_GPIO1_REG(0x3C)
+#define MSM7X30_GPIO_IN_4	MSM_GPIO1_REG(0x40)
+#define MSM7X30_GPIO_IN_5	MSM_GPIO1_REG(0x44)
+#define MSM7X30_GPIO_IN_6	MSM_GPIO1_REG(0xCC)
+#define MSM7X30_GPIO_IN_7	MSM_GPIO1_REG(0x21C)
+
+/* same pin map as above, 1=edge 0=level interrup */
+#define MSM7X30_GPIO_INT_EDGE_0	MSM_GPIO1_REG(0x60)
+#define MSM7X30_GPIO_INT_EDGE_1	MSM_GPIO2_REG(0x50)
+#define MSM7X30_GPIO_INT_EDGE_2	MSM_GPIO1_REG(0x64)
+#define MSM7X30_GPIO_INT_EDGE_3	MSM_GPIO1_REG(0x68)
+#define MSM7X30_GPIO_INT_EDGE_4	MSM_GPIO1_REG(0x6C)
+#define MSM7X30_GPIO_INT_EDGE_5	MSM_GPIO1_REG(0xC0)
+#define MSM7X30_GPIO_INT_EDGE_6	MSM_GPIO1_REG(0xD0)
+#define MSM7X30_GPIO_INT_EDGE_7	MSM_GPIO1_REG(0x240)
+
+/* same pin map as above, 1=positive 0=negative */
+#define MSM7X30_GPIO_INT_POS_0	MSM_GPIO1_REG(0x70)
+#define MSM7X30_GPIO_INT_POS_1	MSM_GPIO2_REG(0x58)
+#define MSM7X30_GPIO_INT_POS_2	MSM_GPIO1_REG(0x74)
+#define MSM7X30_GPIO_INT_POS_3	MSM_GPIO1_REG(0x78)
+#define MSM7X30_GPIO_INT_POS_4	MSM_GPIO1_REG(0x7C)
+#define MSM7X30_GPIO_INT_POS_5	MSM_GPIO1_REG(0xBC)
+#define MSM7X30_GPIO_INT_POS_6	MSM_GPIO1_REG(0xD4)
+#define MSM7X30_GPIO_INT_POS_7	MSM_GPIO1_REG(0x228)
+
+/* same pin map as above, interrupt enable */
+#define MSM7X30_GPIO_INT_EN_0	MSM_GPIO1_REG(0x80)
+#define MSM7X30_GPIO_INT_EN_1	MSM_GPIO2_REG(0x60)
+#define MSM7X30_GPIO_INT_EN_2	MSM_GPIO1_REG(0x84)
+#define MSM7X30_GPIO_INT_EN_3	MSM_GPIO1_REG(0x88)
+#define MSM7X30_GPIO_INT_EN_4	MSM_GPIO1_REG(0x8C)
+#define MSM7X30_GPIO_INT_EN_5	MSM_GPIO1_REG(0xB8)
+#define MSM7X30_GPIO_INT_EN_6	MSM_GPIO1_REG(0xD8)
+#define MSM7X30_GPIO_INT_EN_7	MSM_GPIO1_REG(0x22C)
+
+/* same pin map as above, write 1 to clear interrupt */
+#define MSM7X30_GPIO_INT_CLEAR_0	MSM_GPIO1_REG(0x90)
+#define MSM7X30_GPIO_INT_CLEAR_1	MSM_GPIO2_REG(0x68)
+#define MSM7X30_GPIO_INT_CLEAR_2	MSM_GPIO1_REG(0x94)
+#define MSM7X30_GPIO_INT_CLEAR_3	MSM_GPIO1_REG(0x98)
+#define MSM7X30_GPIO_INT_CLEAR_4	MSM_GPIO1_REG(0x9C)
+#define MSM7X30_GPIO_INT_CLEAR_5	MSM_GPIO1_REG(0xB4)
+#define MSM7X30_GPIO_INT_CLEAR_6	MSM_GPIO1_REG(0xDC)
+#define MSM7X30_GPIO_INT_CLEAR_7	MSM_GPIO1_REG(0x230)
+
+/* same pin map as above, 1=interrupt pending */
+#define MSM7X30_GPIO_INT_STATUS_0	MSM_GPIO1_REG(0xA0)
+#define MSM7X30_GPIO_INT_STATUS_1	MSM_GPIO2_REG(0x70)
+#define MSM7X30_GPIO_INT_STATUS_2	MSM_GPIO1_REG(0xA4)
+#define MSM7X30_GPIO_INT_STATUS_3	MSM_GPIO1_REG(0xA8)
+#define MSM7X30_GPIO_INT_STATUS_4	MSM_GPIO1_REG(0xAC)
+#define MSM7X30_GPIO_INT_STATUS_5	MSM_GPIO1_REG(0xB0)
+#define MSM7X30_GPIO_INT_STATUS_6	MSM_GPIO1_REG(0xE0)
+#define MSM7X30_GPIO_INT_STATUS_7	MSM_GPIO1_REG(0x234)
 
 #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
 
arch/arm/mach-msm/gpio_hw.h deleted +0 -272

272 lines not on this page · raw message

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#37 lore raw

PATCH v3 7/8 gpio_msm: Move Qualcomm v6 MSM driver into drivers

In reply to David Brown

Migrate the driver for the v6-based MSM chips into drivers/gpio. The driver is unchanged, only moved.

---
 arch/arm/mach-msm/Kconfig                          |    3 +++
 arch/arm/mach-msm/Makefile                         |    2 --
 drivers/gpio/Kconfig                               |    8 ++++++++
 drivers/gpio/Makefile                              |    1 +
 .../mach-msm/gpio.c => drivers/gpio/gpio-msm-v1.c  |    5 ++---
 5 files changed, 14 insertions(+), 5 deletions(-)
 rename arch/arm/mach-msm/gpio.c => drivers/gpio/gpio-msm-v1.c (99%)
arch/arm/mach-msm/Kconfig +3 -0
index 1516896..cc7c0b2 100644
@@ -11,6 +11,7 @@ config ARCH_MSM7X00A
 	select MSM_SMD
 	select MSM_SMD_PKG3
 	select CPU_V6
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
@@ -22,6 +23,7 @@ config ARCH_MSM7X30
 	select MSM_VIC
 	select CPU_V7
 	select MSM_GPIOMUX
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
@@ -33,6 +35,7 @@ config ARCH_QSD8X50
 	select MSM_VIC
 	select CPU_V7
 	select MSM_GPIOMUX
+	select GPIO_MSM_V1
 	select MSM_PROC_COMM
 	select HAS_MSM_DEBUG_UART_PHYS
 
arch/arm/mach-msm/Makefile +0 -2
index 9519fd2..c0709af 100644
@@ -34,6 +34,4 @@ ifndef CONFIG_ARCH_MSM8960
 # TODO: TLMM Mapping issues need to be resolved
 obj-y	+= gpio-v2.o
 endif
-else
-obj-y	+= gpio.o
 endif
drivers/gpio/Kconfig +8 -0
index 4a7f631..00a02bb 100644
@@ -93,6 +93,14 @@ config GPIO_EXYNOS4
 	help
 	  Say yes here to support Samsung Exynos4 series SoCs GPIO library
 
+config GPIO_MSM_V1
+	tristate "Qualcomm MSM GPIO v1"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM v6 based
+	  Qualcomm MSM chips.  Most of the pins on the MSM can be
+	  selected for GPIO, and are controlled by this driver.
+
 config GPIO_PLAT_SAMSUNG
 	bool "Samsung SoCs GPIO library support"
 	default y if SAMSUNG_GPIOLIB_4BIT
drivers/gpio/Makefile +1 -0
index b605f8e..72d4e50 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_GPIO_MAX7301)	+= max7301.o
 obj-$(CONFIG_GPIO_MAX732X)	+= max732x.o
 obj-$(CONFIG_GPIO_MC33880)	+= mc33880.o
 obj-$(CONFIG_GPIO_MCP23S08)	+= mcp23s08.o
+obj-$(CONFIG_GPIO_MSM_V1)	+= gpio-msm-v1.o
 obj-$(CONFIG_GPIO_74X164)	+= 74x164.o
 obj-$(CONFIG_ARCH_OMAP)         += gpio-omap.o
 obj-$(CONFIG_GPIO_PCA953X)	+= pca953x.o
drivers/gpio/gpio-msm-v1.c renamed from arch/arm/mach-msm/gpio.c +2 -3
similarity index 99%
rename from arch/arm/mach-msm/gpio.c
rename to drivers/gpio/gpio-msm-v1.c
index 3bbf50e..52a4d42 100644
@@ -1,7 +1,6 @@
-/* linux/arch/arm/mach-msm/gpio.c
- *
+/*
  * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#38 lore raw

PATCH v3 8/8 gpio_msm: Move Qualcomm MSM v2 gpio driver into drivers

In reply to David Brown

Migrate the driver for the v7-based MSM chips into drivers/gpio. The driver is unchanged, only moved.

---
 arch/arm/mach-msm/Kconfig                          |    1 +
 arch/arm/mach-msm/Makefile                         |    6 ------
 drivers/gpio/Kconfig                               |    8 ++++++++
 drivers/gpio/Makefile                              |    1 +
 .../gpio-v2.c => drivers/gpio/gpio-msm-v2.c        |    4 ++--
 5 files changed, 12 insertions(+), 8 deletions(-)
 rename arch/arm/mach-msm/gpio-v2.c => drivers/gpio/gpio-msm-v2.c (99%)
arch/arm/mach-msm/Kconfig +1 -0
index cc7c0b2..f5cce3f 100644
@@ -47,6 +47,7 @@ config ARCH_MSM8X60
 	select ARM_GIC
 	select CPU_V7
 	select MSM_V2_TLMM
+	select GPIO_MSM_V2
 	select MSM_GPIOMUX
 	select MSM_SCM if SMP
 
arch/arm/mach-msm/Makefile +0 -6
index c0709af..7a227d1 100644
@@ -29,9 +29,3 @@ obj-$(CONFIG_ARCH_MSM8960) += board-msm8960.o devices-msm8960.o
 obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
-ifdef CONFIG_MSM_V2_TLMM
-ifndef CONFIG_ARCH_MSM8960
-# TODO: TLMM Mapping issues need to be resolved
-obj-y	+= gpio-v2.o
-endif
-endif
drivers/gpio/Kconfig +8 -0
index 00a02bb..f21e141 100644
@@ -101,6 +101,14 @@ config GPIO_MSM_V1
 	  Qualcomm MSM chips.  Most of the pins on the MSM can be
 	  selected for GPIO, and are controlled by this driver.
 
+config GPIO_MSM_V2
+	tristate "Qualcomm MSM GPIO v2"
+	depends on GPIOLIB && ARCH_MSM
+	help
+	  Say yes here to support the GPIO interface on ARM v7 based
+	  Qualcomm MSM chips.  Most of the pins on the MSM can be
+	  selected for GPIO, and are controlled by this driver.
+
 config GPIO_PLAT_SAMSUNG
 	bool "Samsung SoCs GPIO library support"
 	default y if SAMSUNG_GPIOLIB_4BIT
drivers/gpio/Makefile +1 -0
index 72d4e50..3efbb99 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_GPIO_MAX732X)	+= max732x.o
 obj-$(CONFIG_GPIO_MC33880)	+= mc33880.o
 obj-$(CONFIG_GPIO_MCP23S08)	+= mcp23s08.o
 obj-$(CONFIG_GPIO_MSM_V1)	+= gpio-msm-v1.o
+obj-$(CONFIG_GPIO_MSM_V2)	+= gpio-msm-v2.o
 obj-$(CONFIG_GPIO_74X164)	+= 74x164.o
 obj-$(CONFIG_ARCH_OMAP)         += gpio-omap.o
 obj-$(CONFIG_GPIO_PCA953X)	+= pca953x.o
drivers/gpio/gpio-msm-v2.c renamed from arch/arm/mach-msm/gpio-v2.c +2 -2
similarity index 99%
rename from arch/arm/mach-msm/gpio-v2.c
rename to drivers/gpio/gpio-msm-v2.c
index cc9c4fd..5cb1227 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -30,8 +30,8 @@
 
 #include <asm/mach/irq.h>
 
+#include <mach/msm_gpiomux.h>
 #include <mach/msm_iomap.h>
-#include "gpiomux.h"
 
 /* Bits of interest in the GPIO_IN_OUT register.
  */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.