aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2011-04-20 19:31:23 -0400
committerKevin Hilman <khilman@ti.com>2011-06-16 14:13:42 -0400
commitfa87931acb8203a1f40a3c637863ad238f70cd40 (patch)
treefd79e56fb9819bbb1096c9d3904f0ba04bec832a /arch/arm/mach-omap1
parenta8be8dafd00e3ccf4f85e2f30babf42be5076324 (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')
-rw-r--r--arch/arm/mach-omap1/gpio15xx.c14
-rw-r--r--arch/arm/mach-omap1/gpio16xx.c19
-rw-r--r--arch/arm/mach-omap1/gpio7xx.c19
3 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index 04c4b04cf54e..a622d567b53e 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -34,11 +34,18 @@ static struct __initdata resource omap15xx_mpu_gpio_resources[] = {
34 }, 34 },
35}; 35};
36 36
37static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
38 .direction = OMAP_MPUIO_IO_CNTL,
39 .datain = OMAP_MPUIO_INPUT_LATCH,
40 .dataout = OMAP_MPUIO_OUTPUT,
41};
42
37static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { 43static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
38 .virtual_irq_start = IH_MPUIO_BASE, 44 .virtual_irq_start = IH_MPUIO_BASE,
39 .bank_type = METHOD_MPUIO, 45 .bank_type = METHOD_MPUIO,
40 .bank_width = 16, 46 .bank_width = 16,
41 .bank_stride = 1, 47 .bank_stride = 1,
48 .regs = &omap15xx_mpuio_regs,
42}; 49};
43 50
44static struct __initdata platform_device omap15xx_mpu_gpio = { 51static struct __initdata platform_device omap15xx_mpu_gpio = {
@@ -64,10 +71,17 @@ static struct __initdata resource omap15xx_gpio_resources[] = {
64 }, 71 },
65}; 72};
66 73
74static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
75 .direction = OMAP1510_GPIO_DIR_CONTROL,
76 .datain = OMAP1510_GPIO_DATA_INPUT,
77 .dataout = OMAP1510_GPIO_DATA_OUTPUT,
78};
79
67static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { 80static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
68 .virtual_irq_start = IH_GPIO_BASE, 81 .virtual_irq_start = IH_GPIO_BASE,
69 .bank_type = METHOD_GPIO_1510, 82 .bank_type = METHOD_GPIO_1510,
70 .bank_width = 16, 83 .bank_width = 16,
84 .regs = &omap15xx_gpio_regs,
71}; 85};
72 86
73static struct __initdata platform_device omap15xx_gpio = { 87static struct __initdata platform_device omap15xx_gpio = {
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index 5dd0d4c82b24..4ff6ff36ab73 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -37,11 +37,18 @@ static struct __initdata resource omap16xx_mpu_gpio_resources[] = {
37 }, 37 },
38}; 38};
39 39
40static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
41 .direction = OMAP_MPUIO_IO_CNTL,
42 .datain = OMAP_MPUIO_INPUT_LATCH,
43 .dataout = OMAP_MPUIO_OUTPUT,
44};
45
40static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { 46static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
41 .virtual_irq_start = IH_MPUIO_BASE, 47 .virtual_irq_start = IH_MPUIO_BASE,
42 .bank_type = METHOD_MPUIO, 48 .bank_type = METHOD_MPUIO,
43 .bank_width = 16, 49 .bank_width = 16,
44 .bank_stride = 1, 50 .bank_stride = 1,
51 .regs = &omap16xx_mpuio_regs,
45}; 52};
46 53
47static struct __initdata platform_device omap16xx_mpu_gpio = { 54static struct __initdata platform_device omap16xx_mpu_gpio = {
@@ -67,10 +74,19 @@ static struct __initdata resource omap16xx_gpio1_resources[] = {
67 }, 74 },
68}; 75};
69 76
77static struct omap_gpio_reg_offs omap16xx_gpio_regs = {
78 .direction = OMAP1610_GPIO_DIRECTION,
79 .set_dataout = OMAP1610_GPIO_SET_DATAOUT,
80 .clr_dataout = OMAP1610_GPIO_CLEAR_DATAOUT,
81 .datain = OMAP1610_GPIO_DATAIN,
82 .dataout = OMAP1610_GPIO_DATAOUT,
83};
84
70static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { 85static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
71 .virtual_irq_start = IH_GPIO_BASE, 86 .virtual_irq_start = IH_GPIO_BASE,
72 .bank_type = METHOD_GPIO_1610, 87 .bank_type = METHOD_GPIO_1610,
73 .bank_width = 16, 88 .bank_width = 16,
89 .regs = &omap16xx_gpio_regs,
74}; 90};
75 91
76static struct __initdata platform_device omap16xx_gpio1 = { 92static struct __initdata platform_device omap16xx_gpio1 = {
@@ -100,6 +116,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
100 .virtual_irq_start = IH_GPIO_BASE + 16, 116 .virtual_irq_start = IH_GPIO_BASE + 16,
101 .bank_type = METHOD_GPIO_1610, 117 .bank_type = METHOD_GPIO_1610,
102 .bank_width = 16, 118 .bank_width = 16,
119 .regs = &omap16xx_gpio_regs,
103}; 120};
104 121
105static struct __initdata platform_device omap16xx_gpio2 = { 122static struct __initdata platform_device omap16xx_gpio2 = {
@@ -129,6 +146,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
129 .virtual_irq_start = IH_GPIO_BASE + 32, 146 .virtual_irq_start = IH_GPIO_BASE + 32,
130 .bank_type = METHOD_GPIO_1610, 147 .bank_type = METHOD_GPIO_1610,
131 .bank_width = 16, 148 .bank_width = 16,
149 .regs = &omap16xx_gpio_regs,
132}; 150};
133 151
134static struct __initdata platform_device omap16xx_gpio3 = { 152static struct __initdata platform_device omap16xx_gpio3 = {
@@ -158,6 +176,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = {
158 .virtual_irq_start = IH_GPIO_BASE + 48, 176 .virtual_irq_start = IH_GPIO_BASE + 48,
159 .bank_type = METHOD_GPIO_1610, 177 .bank_type = METHOD_GPIO_1610,
160 .bank_width = 16, 178 .bank_width = 16,
179 .regs = &omap16xx_gpio_regs,
161}; 180};
162 181
163static struct __initdata platform_device omap16xx_gpio4 = { 182static struct __initdata platform_device omap16xx_gpio4 = {
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
42static 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
42static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { 48static 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
49static struct __initdata platform_device omap7xx_mpu_gpio = { 56static struct __initdata platform_device omap7xx_mpu_gpio = {
@@ -69,10 +76,17 @@ static struct __initdata resource omap7xx_gpio1_resources[] = {
69 }, 76 },
70}; 77};
71 78
79static 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
72static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { 85static 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
78static struct __initdata platform_device omap7xx_gpio1 = { 92static 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
107static struct __initdata platform_device omap7xx_gpio2 = { 122static 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
136static struct __initdata platform_device omap7xx_gpio3 = { 152static 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
165static struct __initdata platform_device omap7xx_gpio4 = { 182static 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
194static struct __initdata platform_device omap7xx_gpio5 = { 212static 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
223static struct __initdata platform_device omap7xx_gpio6 = { 242static struct __initdata platform_device omap7xx_gpio6 = {