aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap1/gpio15xx.c3
-rw-r--r--arch/arm/mach-omap1/gpio16xx.c6
-rw-r--r--arch/arm/mach-omap1/gpio7xx.c8
-rw-r--r--arch/arm/mach-omap2/gpio.c2
-rw-r--r--arch/arm/plat-omap/include/plat/gpio.h8
-rw-r--r--drivers/gpio/gpio-omap.c38
6 files changed, 10 insertions, 55 deletions
diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index 950e467361d0..634903ef8292 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -47,7 +47,7 @@ static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
47 47
48static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { 48static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
49 .virtual_irq_start = IH_MPUIO_BASE, 49 .virtual_irq_start = IH_MPUIO_BASE,
50 .bank_type = METHOD_MPUIO, 50 .is_mpuio = true,
51 .bank_width = 16, 51 .bank_width = 16,
52 .bank_stride = 1, 52 .bank_stride = 1,
53 .regs = &omap15xx_mpuio_regs, 53 .regs = &omap15xx_mpuio_regs,
@@ -90,7 +90,6 @@ static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
90 90
91static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { 91static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
92 .virtual_irq_start = IH_GPIO_BASE, 92 .virtual_irq_start = IH_GPIO_BASE,
93 .bank_type = METHOD_GPIO_1510,
94 .bank_width = 16, 93 .bank_width = 16,
95 .regs = &omap15xx_gpio_regs, 94 .regs = &omap15xx_gpio_regs,
96}; 95};
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index 86ac41544a21..1c5f90e17427 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -53,7 +53,7 @@ static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
53 53
54static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { 54static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
55 .virtual_irq_start = IH_MPUIO_BASE, 55 .virtual_irq_start = IH_MPUIO_BASE,
56 .bank_type = METHOD_MPUIO, 56 .is_mpuio = true,
57 .bank_width = 16, 57 .bank_width = 16,
58 .bank_stride = 1, 58 .bank_stride = 1,
59 .regs = &omap16xx_mpuio_regs, 59 .regs = &omap16xx_mpuio_regs,
@@ -100,7 +100,6 @@ static struct omap_gpio_reg_offs omap16xx_gpio_regs = {
100 100
101static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { 101static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
102 .virtual_irq_start = IH_GPIO_BASE, 102 .virtual_irq_start = IH_GPIO_BASE,
103 .bank_type = METHOD_GPIO_1610,
104 .bank_width = 16, 103 .bank_width = 16,
105 .regs = &omap16xx_gpio_regs, 104 .regs = &omap16xx_gpio_regs,
106}; 105};
@@ -130,7 +129,6 @@ static struct __initdata resource omap16xx_gpio2_resources[] = {
130 129
131static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { 130static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
132 .virtual_irq_start = IH_GPIO_BASE + 16, 131 .virtual_irq_start = IH_GPIO_BASE + 16,
133 .bank_type = METHOD_GPIO_1610,
134 .bank_width = 16, 132 .bank_width = 16,
135 .regs = &omap16xx_gpio_regs, 133 .regs = &omap16xx_gpio_regs,
136}; 134};
@@ -160,7 +158,6 @@ static struct __initdata resource omap16xx_gpio3_resources[] = {
160 158
161static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { 159static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
162 .virtual_irq_start = IH_GPIO_BASE + 32, 160 .virtual_irq_start = IH_GPIO_BASE + 32,
163 .bank_type = METHOD_GPIO_1610,
164 .bank_width = 16, 161 .bank_width = 16,
165 .regs = &omap16xx_gpio_regs, 162 .regs = &omap16xx_gpio_regs,
166}; 163};
@@ -190,7 +187,6 @@ static struct __initdata resource omap16xx_gpio4_resources[] = {
190 187
191static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = { 188static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = {
192 .virtual_irq_start = IH_GPIO_BASE + 48, 189 .virtual_irq_start = IH_GPIO_BASE + 48,
193 .bank_type = METHOD_GPIO_1610,
194 .bank_width = 16, 190 .bank_width = 16,
195 .regs = &omap16xx_gpio_regs, 191 .regs = &omap16xx_gpio_regs,
196}; 192};
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
index 207a23cfa1a0..433491cb73fa 100644
--- a/arch/arm/mach-omap1/gpio7xx.c
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -52,8 +52,8 @@ static struct omap_gpio_reg_offs omap7xx_mpuio_regs = {
52 52
53static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { 53static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
54 .virtual_irq_start = IH_MPUIO_BASE, 54 .virtual_irq_start = IH_MPUIO_BASE,
55 .bank_type = METHOD_MPUIO,
56 .bank_width = 32, 55 .bank_width = 32,
56 .is_mpuio = true,
57 .bank_stride = 2, 57 .bank_stride = 2,
58 .regs = &omap7xx_mpuio_regs, 58 .regs = &omap7xx_mpuio_regs,
59}; 59};
@@ -94,7 +94,6 @@ static struct omap_gpio_reg_offs omap7xx_gpio_regs = {
94 94
95static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { 95static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
96 .virtual_irq_start = IH_GPIO_BASE, 96 .virtual_irq_start = IH_GPIO_BASE,
97 .bank_type = METHOD_GPIO_7XX,
98 .bank_width = 32, 97 .bank_width = 32,
99 .regs = &omap7xx_gpio_regs, 98 .regs = &omap7xx_gpio_regs,
100}; 99};
@@ -124,7 +123,6 @@ static struct __initdata resource omap7xx_gpio2_resources[] = {
124 123
125static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { 124static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = {
126 .virtual_irq_start = IH_GPIO_BASE + 32, 125 .virtual_irq_start = IH_GPIO_BASE + 32,
127 .bank_type = METHOD_GPIO_7XX,
128 .bank_width = 32, 126 .bank_width = 32,
129 .regs = &omap7xx_gpio_regs, 127 .regs = &omap7xx_gpio_regs,
130}; 128};
@@ -154,7 +152,6 @@ static struct __initdata resource omap7xx_gpio3_resources[] = {
154 152
155static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { 153static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = {
156 .virtual_irq_start = IH_GPIO_BASE + 64, 154 .virtual_irq_start = IH_GPIO_BASE + 64,
157 .bank_type = METHOD_GPIO_7XX,
158 .bank_width = 32, 155 .bank_width = 32,
159 .regs = &omap7xx_gpio_regs, 156 .regs = &omap7xx_gpio_regs,
160}; 157};
@@ -184,7 +181,6 @@ static struct __initdata resource omap7xx_gpio4_resources[] = {
184 181
185static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = { 182static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = {
186 .virtual_irq_start = IH_GPIO_BASE + 96, 183 .virtual_irq_start = IH_GPIO_BASE + 96,
187 .bank_type = METHOD_GPIO_7XX,
188 .bank_width = 32, 184 .bank_width = 32,
189 .regs = &omap7xx_gpio_regs, 185 .regs = &omap7xx_gpio_regs,
190}; 186};
@@ -214,7 +210,6 @@ static struct __initdata resource omap7xx_gpio5_resources[] = {
214 210
215static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = { 211static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = {
216 .virtual_irq_start = IH_GPIO_BASE + 128, 212 .virtual_irq_start = IH_GPIO_BASE + 128,
217 .bank_type = METHOD_GPIO_7XX,
218 .bank_width = 32, 213 .bank_width = 32,
219 .regs = &omap7xx_gpio_regs, 214 .regs = &omap7xx_gpio_regs,
220}; 215};
@@ -244,7 +239,6 @@ static struct __initdata resource omap7xx_gpio6_resources[] = {
244 239
245static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = { 240static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = {
246 .virtual_irq_start = IH_GPIO_BASE + 160, 241 .virtual_irq_start = IH_GPIO_BASE + 160,
247 .bank_type = METHOD_GPIO_7XX,
248 .bank_width = 32, 242 .bank_width = 32,
249 .regs = &omap7xx_gpio_regs, 243 .regs = &omap7xx_gpio_regs,
250}; 244};
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index f4c45ca2cc59..dfda6b3478b2 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -74,7 +74,6 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
74 /* fall through */ 74 /* fall through */
75 75
76 case 1: 76 case 1:
77 pdata->bank_type = METHOD_GPIO_24XX;
78 pdata->regs->revision = OMAP24XX_GPIO_REVISION; 77 pdata->regs->revision = OMAP24XX_GPIO_REVISION;
79 pdata->regs->direction = OMAP24XX_GPIO_OE; 78 pdata->regs->direction = OMAP24XX_GPIO_OE;
80 pdata->regs->datain = OMAP24XX_GPIO_DATAIN; 79 pdata->regs->datain = OMAP24XX_GPIO_DATAIN;
@@ -97,7 +96,6 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
97 pdata->regs->fallingdetect = OMAP24XX_GPIO_FALLINGDETECT; 96 pdata->regs->fallingdetect = OMAP24XX_GPIO_FALLINGDETECT;
98 break; 97 break;
99 case 2: 98 case 2:
100 pdata->bank_type = METHOD_GPIO_44XX;
101 pdata->regs->revision = OMAP4_GPIO_REVISION; 99 pdata->regs->revision = OMAP4_GPIO_REVISION;
102 pdata->regs->direction = OMAP4_GPIO_OE; 100 pdata->regs->direction = OMAP4_GPIO_OE;
103 pdata->regs->datain = OMAP4_GPIO_DATAIN; 101 pdata->regs->datain = OMAP4_GPIO_DATAIN;
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 8be165108aad..cb75b657b04b 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -162,13 +162,6 @@
162 IH_MPUIO_BASE + ((nr) & 0x0f) : \ 162 IH_MPUIO_BASE + ((nr) & 0x0f) : \
163 IH_GPIO_BASE + (nr)) 163 IH_GPIO_BASE + (nr))
164 164
165#define METHOD_MPUIO 0
166#define METHOD_GPIO_1510 1
167#define METHOD_GPIO_1610 2
168#define METHOD_GPIO_7XX 3
169#define METHOD_GPIO_24XX 5
170#define METHOD_GPIO_44XX 6
171
172struct omap_gpio_dev_attr { 165struct omap_gpio_dev_attr {
173 int bank_width; /* GPIO bank width */ 166 int bank_width; /* GPIO bank width */
174 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ 167 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */
@@ -210,6 +203,7 @@ struct omap_gpio_platform_data {
210 int bank_stride; /* Only needed for omap1 MPUIO */ 203 int bank_stride; /* Only needed for omap1 MPUIO */
211 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ 204 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */
212 bool loses_context; /* whether the bank would ever lose context */ 205 bool loses_context; /* whether the bank would ever lose context */
206 bool is_mpuio; /* whether the bank is of type MPUIO */
213 u32 non_wakeup_gpios; 207 u32 non_wakeup_gpios;
214 208
215 struct omap_gpio_reg_offs *regs; 209 struct omap_gpio_reg_offs *regs;
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 38beccc9e655..951d78435812 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -49,7 +49,6 @@ struct gpio_bank {
49 void __iomem *base; 49 void __iomem *base;
50 u16 irq; 50 u16 irq;
51 u16 virtual_irq_start; 51 u16 virtual_irq_start;
52 int method;
53 u32 suspend_wakeup; 52 u32 suspend_wakeup;
54 u32 saved_wakeup; 53 u32 saved_wakeup;
55 u32 non_wakeup_gpios; 54 u32 non_wakeup_gpios;
@@ -66,6 +65,7 @@ struct gpio_bank {
66 u32 mod_usage; 65 u32 mod_usage;
67 u32 dbck_enable_mask; 66 u32 dbck_enable_mask;
68 struct device *dev; 67 struct device *dev;
68 bool is_mpuio;
69 bool dbck_flag; 69 bool dbck_flag;
70 bool loses_context; 70 bool loses_context;
71 int stride; 71 int stride;
@@ -693,14 +693,6 @@ static struct irq_chip gpio_irq_chip = {
693 693
694/*---------------------------------------------------------------------*/ 694/*---------------------------------------------------------------------*/
695 695
696#ifdef CONFIG_ARCH_OMAP1
697
698#define bank_is_mpuio(bank) ((bank)->method == METHOD_MPUIO)
699
700#ifdef CONFIG_ARCH_OMAP16XX
701
702#include <linux/platform_device.h>
703
704static int omap_mpuio_suspend_noirq(struct device *dev) 696static int omap_mpuio_suspend_noirq(struct device *dev)
705{ 697{
706 struct platform_device *pdev = to_platform_device(dev); 698 struct platform_device *pdev = to_platform_device(dev);
@@ -762,23 +754,8 @@ static inline void mpuio_init(struct gpio_bank *bank)
762 (void) platform_device_register(&omap_mpuio_device); 754 (void) platform_device_register(&omap_mpuio_device);
763} 755}
764 756
765#else
766static inline void mpuio_init(struct gpio_bank *bank) {}
767#endif /* 16xx */
768
769#else
770
771#define bank_is_mpuio(bank) 0
772static inline void mpuio_init(struct gpio_bank *bank) {}
773
774#endif
775
776/*---------------------------------------------------------------------*/ 757/*---------------------------------------------------------------------*/
777 758
778/* REVISIT these are stupid implementations! replace by ones that
779 * don't switch on METHOD_* and which mostly avoid spinlocks
780 */
781
782static int gpio_input(struct gpio_chip *chip, unsigned offset) 759static int gpio_input(struct gpio_chip *chip, unsigned offset)
783{ 760{
784 struct gpio_bank *bank; 761 struct gpio_bank *bank;
@@ -899,7 +876,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank)
899 if (bank->width == 16) 876 if (bank->width == 16)
900 l = 0xffff; 877 l = 0xffff;
901 878
902 if (bank_is_mpuio(bank)) { 879 if (bank->is_mpuio) {
903 __raw_writel(l, bank->base + bank->regs->irqenable); 880 __raw_writel(l, bank->base + bank->regs->irqenable);
904 return; 881 return;
905 } 882 }
@@ -951,7 +928,6 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank)
951 int j; 928 int j;
952 static int gpio; 929 static int gpio;
953 930
954 bank->mod_usage = 0;
955 /* 931 /*
956 * REVISIT eventually switch from OMAP-specific gpio structs 932 * REVISIT eventually switch from OMAP-specific gpio structs
957 * over to the generic ones 933 * over to the generic ones
@@ -964,12 +940,10 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank)
964 bank->chip.set_debounce = gpio_debounce; 940 bank->chip.set_debounce = gpio_debounce;
965 bank->chip.set = gpio_set; 941 bank->chip.set = gpio_set;
966 bank->chip.to_irq = gpio_2irq; 942 bank->chip.to_irq = gpio_2irq;
967 if (bank_is_mpuio(bank)) { 943 if (bank->is_mpuio) {
968 bank->chip.label = "mpuio"; 944 bank->chip.label = "mpuio";
969#ifdef CONFIG_ARCH_OMAP16XX
970 if (bank->regs->wkup_en) 945 if (bank->regs->wkup_en)
971 bank->chip.dev = &omap_mpuio_device.dev; 946 bank->chip.dev = &omap_mpuio_device.dev;
972#endif
973 bank->chip.base = OMAP_MPUIO(0); 947 bank->chip.base = OMAP_MPUIO(0);
974 } else { 948 } else {
975 bank->chip.label = "gpio"; 949 bank->chip.label = "gpio";
@@ -984,7 +958,7 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank)
984 j < bank->virtual_irq_start + bank->width; j++) { 958 j < bank->virtual_irq_start + bank->width; j++) {
985 irq_set_lockdep_class(j, &gpio_lock_class); 959 irq_set_lockdep_class(j, &gpio_lock_class);
986 irq_set_chip_data(j, bank); 960 irq_set_chip_data(j, bank);
987 if (bank_is_mpuio(bank)) { 961 if (bank->is_mpuio) {
988 omap_mpuio_alloc_gc(bank, j, bank->width); 962 omap_mpuio_alloc_gc(bank, j, bank->width);
989 } else { 963 } else {
990 irq_set_chip(j, &gpio_irq_chip); 964 irq_set_chip(j, &gpio_irq_chip);
@@ -1028,11 +1002,11 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
1028 1002
1029 pdata = pdev->dev.platform_data; 1003 pdata = pdev->dev.platform_data;
1030 bank->virtual_irq_start = pdata->virtual_irq_start; 1004 bank->virtual_irq_start = pdata->virtual_irq_start;
1031 bank->method = pdata->bank_type;
1032 bank->dev = &pdev->dev; 1005 bank->dev = &pdev->dev;
1033 bank->dbck_flag = pdata->dbck_flag; 1006 bank->dbck_flag = pdata->dbck_flag;
1034 bank->stride = pdata->bank_stride; 1007 bank->stride = pdata->bank_stride;
1035 bank->width = pdata->bank_width; 1008 bank->width = pdata->bank_width;
1009 bank->is_mpuio = pdata->is_mpuio;
1036 bank->non_wakeup_gpios = pdata->non_wakeup_gpios; 1010 bank->non_wakeup_gpios = pdata->non_wakeup_gpios;
1037 bank->loses_context = pdata->loses_context; 1011 bank->loses_context = pdata->loses_context;
1038 bank->get_context_loss_count = pdata->get_context_loss_count; 1012 bank->get_context_loss_count = pdata->get_context_loss_count;
@@ -1065,7 +1039,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
1065 pm_runtime_enable(bank->dev); 1039 pm_runtime_enable(bank->dev);
1066 pm_runtime_get_sync(bank->dev); 1040 pm_runtime_get_sync(bank->dev);
1067 1041
1068 if (bank_is_mpuio(bank)) 1042 if (bank->is_mpuio)
1069 mpuio_init(bank); 1043 mpuio_init(bank);
1070 1044
1071 omap_gpio_mod_init(bank); 1045 omap_gpio_mod_init(bank);