diff options
author | Kevin Hilman <khilman@ti.com> | 2011-04-20 19:31:23 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-06-16 14:13:42 -0400 |
commit | fa87931acb8203a1f40a3c637863ad238f70cd40 (patch) | |
tree | fd79e56fb9819bbb1096c9d3904f0ba04bec832a /arch/arm/mach-omap1/gpio7xx.c | |
parent | a8be8dafd00e3ccf4f85e2f30babf42be5076324 (diff) |
gpio/omap: consolidate direction, input, output, remove #ifdefs
Add register offset fields to GPIO platform_data for registers.
This patch adds registers that control direction, input and output
data. Using these register offsets in the common driver allows
removal of #ifdefs and greatly improves readability.
Also create dedicated data out functions: one for banks with dedicated
set/clear registers, and another for banks with a single mask
register.
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap1/gpio7xx.c')
-rw-r--r-- | arch/arm/mach-omap1/gpio7xx.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c index 1204c8b871af..efe4dccaa4f2 100644 --- a/arch/arm/mach-omap1/gpio7xx.c +++ b/arch/arm/mach-omap1/gpio7xx.c | |||
@@ -39,11 +39,18 @@ static struct __initdata resource omap7xx_mpu_gpio_resources[] = { | |||
39 | }, | 39 | }, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static struct omap_gpio_reg_offs omap7xx_mpuio_regs = { | ||
43 | .direction = OMAP_MPUIO_IO_CNTL / 2, | ||
44 | .datain = OMAP_MPUIO_INPUT_LATCH / 2, | ||
45 | .dataout = OMAP_MPUIO_OUTPUT / 2, | ||
46 | }; | ||
47 | |||
42 | static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { | 48 | static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { |
43 | .virtual_irq_start = IH_MPUIO_BASE, | 49 | .virtual_irq_start = IH_MPUIO_BASE, |
44 | .bank_type = METHOD_MPUIO, | 50 | .bank_type = METHOD_MPUIO, |
45 | .bank_width = 32, | 51 | .bank_width = 32, |
46 | .bank_stride = 2, | 52 | .bank_stride = 2, |
53 | .regs = &omap7xx_mpuio_regs, | ||
47 | }; | 54 | }; |
48 | 55 | ||
49 | static struct __initdata platform_device omap7xx_mpu_gpio = { | 56 | static struct __initdata platform_device omap7xx_mpu_gpio = { |
@@ -69,10 +76,17 @@ static struct __initdata resource omap7xx_gpio1_resources[] = { | |||
69 | }, | 76 | }, |
70 | }; | 77 | }; |
71 | 78 | ||
79 | static struct omap_gpio_reg_offs omap7xx_gpio_regs = { | ||
80 | .direction = OMAP7XX_GPIO_DIR_CONTROL, | ||
81 | .datain = OMAP7XX_GPIO_DATA_INPUT, | ||
82 | .dataout = OMAP7XX_GPIO_DATA_OUTPUT, | ||
83 | }; | ||
84 | |||
72 | static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { | 85 | static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { |
73 | .virtual_irq_start = IH_GPIO_BASE, | 86 | .virtual_irq_start = IH_GPIO_BASE, |
74 | .bank_type = METHOD_GPIO_7XX, | 87 | .bank_type = METHOD_GPIO_7XX, |
75 | .bank_width = 32, | 88 | .bank_width = 32, |
89 | .regs = &omap7xx_gpio_regs, | ||
76 | }; | 90 | }; |
77 | 91 | ||
78 | static struct __initdata platform_device omap7xx_gpio1 = { | 92 | static struct __initdata platform_device omap7xx_gpio1 = { |
@@ -102,6 +116,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { | |||
102 | .virtual_irq_start = IH_GPIO_BASE + 32, | 116 | .virtual_irq_start = IH_GPIO_BASE + 32, |
103 | .bank_type = METHOD_GPIO_7XX, | 117 | .bank_type = METHOD_GPIO_7XX, |
104 | .bank_width = 32, | 118 | .bank_width = 32, |
119 | .regs = &omap7xx_gpio_regs, | ||
105 | }; | 120 | }; |
106 | 121 | ||
107 | static struct __initdata platform_device omap7xx_gpio2 = { | 122 | static struct __initdata platform_device omap7xx_gpio2 = { |
@@ -131,6 +146,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { | |||
131 | .virtual_irq_start = IH_GPIO_BASE + 64, | 146 | .virtual_irq_start = IH_GPIO_BASE + 64, |
132 | .bank_type = METHOD_GPIO_7XX, | 147 | .bank_type = METHOD_GPIO_7XX, |
133 | .bank_width = 32, | 148 | .bank_width = 32, |
149 | .regs = &omap7xx_gpio_regs, | ||
134 | }; | 150 | }; |
135 | 151 | ||
136 | static struct __initdata platform_device omap7xx_gpio3 = { | 152 | static struct __initdata platform_device omap7xx_gpio3 = { |
@@ -160,6 +176,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = { | |||
160 | .virtual_irq_start = IH_GPIO_BASE + 96, | 176 | .virtual_irq_start = IH_GPIO_BASE + 96, |
161 | .bank_type = METHOD_GPIO_7XX, | 177 | .bank_type = METHOD_GPIO_7XX, |
162 | .bank_width = 32, | 178 | .bank_width = 32, |
179 | .regs = &omap7xx_gpio_regs, | ||
163 | }; | 180 | }; |
164 | 181 | ||
165 | static struct __initdata platform_device omap7xx_gpio4 = { | 182 | static struct __initdata platform_device omap7xx_gpio4 = { |
@@ -189,6 +206,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = { | |||
189 | .virtual_irq_start = IH_GPIO_BASE + 128, | 206 | .virtual_irq_start = IH_GPIO_BASE + 128, |
190 | .bank_type = METHOD_GPIO_7XX, | 207 | .bank_type = METHOD_GPIO_7XX, |
191 | .bank_width = 32, | 208 | .bank_width = 32, |
209 | .regs = &omap7xx_gpio_regs, | ||
192 | }; | 210 | }; |
193 | 211 | ||
194 | static struct __initdata platform_device omap7xx_gpio5 = { | 212 | static struct __initdata platform_device omap7xx_gpio5 = { |
@@ -218,6 +236,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = { | |||
218 | .virtual_irq_start = IH_GPIO_BASE + 160, | 236 | .virtual_irq_start = IH_GPIO_BASE + 160, |
219 | .bank_type = METHOD_GPIO_7XX, | 237 | .bank_type = METHOD_GPIO_7XX, |
220 | .bank_width = 32, | 238 | .bank_width = 32, |
239 | .regs = &omap7xx_gpio_regs, | ||
221 | }; | 240 | }; |
222 | 241 | ||
223 | static struct __initdata platform_device omap7xx_gpio6 = { | 242 | static struct __initdata platform_device omap7xx_gpio6 = { |