diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2011-06-05 12:07:55 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-06-06 12:01:19 -0400 |
commit | b78d8e59a6f611e229fab8ec3014c58eba975000 (patch) | |
tree | aaf1a09f8b0dd9b8dff8a8625b5f5df3bfcd01aa | |
parent | d37a65bb4663bde7cf3dbc51aec7f264fa4d0ebf (diff) |
gpio/mxc: Change gpio-mxc into an upstanding gpio driver
The patch makes necessary changes on gpio-mxc as below to turn it
into an upstanding gpio driver.
* Add a list to save all mx2 ports references, so that
mx2_gpio_irq_handler can walk through all interrupt status
registers
* Use readl/writel to replace mach-specific accessors
__raw_readl/__raw_writel
* Change mxc_gpio_init into mxc_gpio_probe function
* Move "struct mxc_gpio_port" into gpio-mxc.c, as it needs not to
be public at all, and also make some other cleanup on
plat-mxc/include/mach/gpio.h at the same time
And the patch then migrates mach-imx and mach-mx5 to the updated
driver by adding corresponding platform devices.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
55 files changed, 358 insertions, 237 deletions
diff --git a/arch/arm/mach-imx/mach-apf9328.c b/arch/arm/mach-imx/mach-apf9328.c index 15e45c84e371..59d2a3b137d9 100644 --- a/arch/arm/mach-imx/mach-apf9328.c +++ b/arch/arm/mach-imx/mach-apf9328.c | |||
@@ -115,6 +115,8 @@ static struct platform_device *devices[] __initdata = { | |||
115 | 115 | ||
116 | static void __init apf9328_init(void) | 116 | static void __init apf9328_init(void) |
117 | { | 117 | { |
118 | imx1_soc_init(); | ||
119 | |||
118 | mxc_gpio_setup_multiple_pins(apf9328_pins, | 120 | mxc_gpio_setup_multiple_pins(apf9328_pins, |
119 | ARRAY_SIZE(apf9328_pins), | 121 | ARRAY_SIZE(apf9328_pins), |
120 | "APF9328"); | 122 | "APF9328"); |
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c index ffb40ff619b1..ede2710f8b76 100644 --- a/arch/arm/mach-imx/mach-armadillo5x0.c +++ b/arch/arm/mach-imx/mach-armadillo5x0.c | |||
@@ -490,6 +490,8 @@ static struct platform_device *devices[] __initdata = { | |||
490 | */ | 490 | */ |
491 | static void __init armadillo5x0_init(void) | 491 | static void __init armadillo5x0_init(void) |
492 | { | 492 | { |
493 | imx31_soc_init(); | ||
494 | |||
493 | mxc_iomux_setup_multiple_pins(armadillo5x0_pins, | 495 | mxc_iomux_setup_multiple_pins(armadillo5x0_pins, |
494 | ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); | 496 | ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); |
495 | 497 | ||
diff --git a/arch/arm/mach-imx/mach-bug.c b/arch/arm/mach-imx/mach-bug.c index 42e4f078a19c..f49470553bdf 100644 --- a/arch/arm/mach-imx/mach-bug.c +++ b/arch/arm/mach-imx/mach-bug.c | |||
@@ -42,6 +42,8 @@ static const unsigned int bug_pins[] __initconst = { | |||
42 | 42 | ||
43 | static void __init bug_board_init(void) | 43 | static void __init bug_board_init(void) |
44 | { | 44 | { |
45 | imx31_soc_init(); | ||
46 | |||
45 | mxc_iomux_setup_multiple_pins(bug_pins, | 47 | mxc_iomux_setup_multiple_pins(bug_pins, |
46 | ARRAY_SIZE(bug_pins), "uart-4"); | 48 | ARRAY_SIZE(bug_pins), "uart-4"); |
47 | imx31_add_imx_uart4(&uart_pdata); | 49 | imx31_add_imx_uart4(&uart_pdata); |
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c index 46a2e41d43d2..87887ac5806b 100644 --- a/arch/arm/mach-imx/mach-cpuimx27.c +++ b/arch/arm/mach-imx/mach-cpuimx27.c | |||
@@ -250,6 +250,8 @@ __setup("otg_mode=", eukrea_cpuimx27_otg_mode); | |||
250 | 250 | ||
251 | static void __init eukrea_cpuimx27_init(void) | 251 | static void __init eukrea_cpuimx27_init(void) |
252 | { | 252 | { |
253 | imx27_soc_init(); | ||
254 | |||
253 | mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins, | 255 | mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins, |
254 | ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27"); | 256 | ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27"); |
255 | 257 | ||
diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c index 3f8ef825fa6f..f39a478ba1a6 100644 --- a/arch/arm/mach-imx/mach-cpuimx35.c +++ b/arch/arm/mach-imx/mach-cpuimx35.c | |||
@@ -156,6 +156,8 @@ __setup("otg_mode=", eukrea_cpuimx35_otg_mode); | |||
156 | */ | 156 | */ |
157 | static void __init eukrea_cpuimx35_init(void) | 157 | static void __init eukrea_cpuimx35_init(void) |
158 | { | 158 | { |
159 | imx35_soc_init(); | ||
160 | |||
159 | mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads, | 161 | mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads, |
160 | ARRAY_SIZE(eukrea_cpuimx35_pads)); | 162 | ARRAY_SIZE(eukrea_cpuimx35_pads)); |
161 | 163 | ||
diff --git a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c index 148cff2819b9..da36da52969d 100644 --- a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c +++ b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c | |||
@@ -125,6 +125,8 @@ __setup("otg_mode=", eukrea_cpuimx25_otg_mode); | |||
125 | 125 | ||
126 | static void __init eukrea_cpuimx25_init(void) | 126 | static void __init eukrea_cpuimx25_init(void) |
127 | { | 127 | { |
128 | imx25_soc_init(); | ||
129 | |||
128 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, | 130 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, |
129 | ARRAY_SIZE(eukrea_cpuimx25_pads))) | 131 | ARRAY_SIZE(eukrea_cpuimx25_pads))) |
130 | printk(KERN_ERR "error setting cpuimx25 pads !\n"); | 132 | printk(KERN_ERR "error setting cpuimx25 pads !\n"); |
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c index 7ae43b1ec517..c6269d60ddbc 100644 --- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c +++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c | |||
@@ -231,6 +231,8 @@ static void __init visstrim_m10_board_init(void) | |||
231 | { | 231 | { |
232 | int ret; | 232 | int ret; |
233 | 233 | ||
234 | imx27_soc_init(); | ||
235 | |||
234 | ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins, | 236 | ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins, |
235 | ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10"); | 237 | ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10"); |
236 | if (ret) | 238 | if (ret) |
diff --git a/arch/arm/mach-imx/mach-imx27ipcam.c b/arch/arm/mach-imx/mach-imx27ipcam.c index 9be6cd6fbf8c..272f793e9247 100644 --- a/arch/arm/mach-imx/mach-imx27ipcam.c +++ b/arch/arm/mach-imx/mach-imx27ipcam.c | |||
@@ -50,6 +50,8 @@ static const int mx27ipcam_pins[] __initconst = { | |||
50 | 50 | ||
51 | static void __init mx27ipcam_init(void) | 51 | static void __init mx27ipcam_init(void) |
52 | { | 52 | { |
53 | imx27_soc_init(); | ||
54 | |||
53 | mxc_gpio_setup_multiple_pins(mx27ipcam_pins, ARRAY_SIZE(mx27ipcam_pins), | 55 | mxc_gpio_setup_multiple_pins(mx27ipcam_pins, ARRAY_SIZE(mx27ipcam_pins), |
54 | "mx27ipcam"); | 56 | "mx27ipcam"); |
55 | 57 | ||
diff --git a/arch/arm/mach-imx/mach-imx27lite.c b/arch/arm/mach-imx/mach-imx27lite.c index 841140516ede..d81a769fe895 100644 --- a/arch/arm/mach-imx/mach-imx27lite.c +++ b/arch/arm/mach-imx/mach-imx27lite.c | |||
@@ -59,6 +59,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = { | |||
59 | 59 | ||
60 | static void __init mx27lite_init(void) | 60 | static void __init mx27lite_init(void) |
61 | { | 61 | { |
62 | imx27_soc_init(); | ||
63 | |||
62 | mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins), | 64 | mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins), |
63 | "imx27lite"); | 65 | "imx27lite"); |
64 | imx27_add_imx_uart0(&uart_pdata); | 66 | imx27_add_imx_uart0(&uart_pdata); |
diff --git a/arch/arm/mach-imx/mach-kzm_arm11_01.c b/arch/arm/mach-imx/mach-kzm_arm11_01.c index 1ecae20cf4e3..e472a1d88058 100644 --- a/arch/arm/mach-imx/mach-kzm_arm11_01.c +++ b/arch/arm/mach-imx/mach-kzm_arm11_01.c | |||
@@ -223,6 +223,8 @@ static int kzm_pins[] __initdata = { | |||
223 | */ | 223 | */ |
224 | static void __init kzm_board_init(void) | 224 | static void __init kzm_board_init(void) |
225 | { | 225 | { |
226 | imx31_soc_init(); | ||
227 | |||
226 | mxc_iomux_setup_multiple_pins(kzm_pins, | 228 | mxc_iomux_setup_multiple_pins(kzm_pins, |
227 | ARRAY_SIZE(kzm_pins), "kzm"); | 229 | ARRAY_SIZE(kzm_pins), "kzm"); |
228 | kzm_init_ext_uart(); | 230 | kzm_init_ext_uart(); |
diff --git a/arch/arm/mach-imx/mach-mx1ads.c b/arch/arm/mach-imx/mach-mx1ads.c index 38ec5cbbda9b..5cd8bee46960 100644 --- a/arch/arm/mach-imx/mach-mx1ads.c +++ b/arch/arm/mach-imx/mach-mx1ads.c | |||
@@ -115,6 +115,8 @@ static struct i2c_board_info mx1ads_i2c_devices[] = { | |||
115 | */ | 115 | */ |
116 | static void __init mx1ads_init(void) | 116 | static void __init mx1ads_init(void) |
117 | { | 117 | { |
118 | imx1_soc_init(); | ||
119 | |||
118 | mxc_gpio_setup_multiple_pins(mx1ads_pins, | 120 | mxc_gpio_setup_multiple_pins(mx1ads_pins, |
119 | ARRAY_SIZE(mx1ads_pins), "mx1ads"); | 121 | ARRAY_SIZE(mx1ads_pins), "mx1ads"); |
120 | 122 | ||
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c index 74ac88978ddd..d389ecf9b5a8 100644 --- a/arch/arm/mach-imx/mach-mx21ads.c +++ b/arch/arm/mach-imx/mach-mx21ads.c | |||
@@ -279,6 +279,8 @@ static struct platform_device *platform_devices[] __initdata = { | |||
279 | 279 | ||
280 | static void __init mx21ads_board_init(void) | 280 | static void __init mx21ads_board_init(void) |
281 | { | 281 | { |
282 | imx21_soc_init(); | ||
283 | |||
282 | mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins), | 284 | mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins), |
283 | "mx21ads"); | 285 | "mx21ads"); |
284 | 286 | ||
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c index 58ea3fdf0911..01534bb61305 100644 --- a/arch/arm/mach-imx/mach-mx25_3ds.c +++ b/arch/arm/mach-imx/mach-mx25_3ds.c | |||
@@ -219,6 +219,8 @@ static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = { | |||
219 | 219 | ||
220 | static void __init mx25pdk_init(void) | 220 | static void __init mx25pdk_init(void) |
221 | { | 221 | { |
222 | imx25_soc_init(); | ||
223 | |||
222 | mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, | 224 | mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, |
223 | ARRAY_SIZE(mx25pdk_pads)); | 225 | ARRAY_SIZE(mx25pdk_pads)); |
224 | 226 | ||
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 6e1accf93f81..117ce0a50f4e 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -267,6 +267,8 @@ static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { | |||
267 | 267 | ||
268 | static void __init mx27pdk_init(void) | 268 | static void __init mx27pdk_init(void) |
269 | { | 269 | { |
270 | imx27_soc_init(); | ||
271 | |||
270 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), | 272 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), |
271 | "mx27pdk"); | 273 | "mx27pdk"); |
272 | mx27_3ds_sdhc1_enable_level_translator(); | 274 | mx27_3ds_sdhc1_enable_level_translator(); |
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c index 1db79506f5e4..fc26ed71b9ed 100644 --- a/arch/arm/mach-imx/mach-mx27ads.c +++ b/arch/arm/mach-imx/mach-mx27ads.c | |||
@@ -288,6 +288,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = { | |||
288 | 288 | ||
289 | static void __init mx27ads_board_init(void) | 289 | static void __init mx27ads_board_init(void) |
290 | { | 290 | { |
291 | imx27_soc_init(); | ||
292 | |||
291 | mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins), | 293 | mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins), |
292 | "mx27ads"); | 294 | "mx27ads"); |
293 | 295 | ||
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c index 9b982449cb52..ab2a6268b50b 100644 --- a/arch/arm/mach-imx/mach-mx31_3ds.c +++ b/arch/arm/mach-imx/mach-mx31_3ds.c | |||
@@ -689,6 +689,8 @@ static void __init mx31_3ds_init(void) | |||
689 | { | 689 | { |
690 | int ret; | 690 | int ret; |
691 | 691 | ||
692 | imx31_soc_init(); | ||
693 | |||
692 | mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins), | 694 | mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins), |
693 | "mx31_3ds"); | 695 | "mx31_3ds"); |
694 | 696 | ||
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c index f4dee0254634..0ce49478a479 100644 --- a/arch/arm/mach-imx/mach-mx31ads.c +++ b/arch/arm/mach-imx/mach-mx31ads.c | |||
@@ -516,6 +516,8 @@ static void __init mx31ads_init_irq(void) | |||
516 | 516 | ||
517 | static void __init mx31ads_init(void) | 517 | static void __init mx31ads_init(void) |
518 | { | 518 | { |
519 | imx31_soc_init(); | ||
520 | |||
519 | mxc_init_extuart(); | 521 | mxc_init_extuart(); |
520 | mxc_init_imx_uart(); | 522 | mxc_init_imx_uart(); |
521 | mxc_init_i2c(); | 523 | mxc_init_i2c(); |
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c index 410e676ae087..750368ddf0f9 100644 --- a/arch/arm/mach-imx/mach-mx31lilly.c +++ b/arch/arm/mach-imx/mach-mx31lilly.c | |||
@@ -243,6 +243,8 @@ core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444); | |||
243 | 243 | ||
244 | static void __init mx31lilly_board_init(void) | 244 | static void __init mx31lilly_board_init(void) |
245 | { | 245 | { |
246 | imx31_soc_init(); | ||
247 | |||
246 | switch (mx31lilly_baseboard) { | 248 | switch (mx31lilly_baseboard) { |
247 | case MX31LILLY_NOBOARD: | 249 | case MX31LILLY_NOBOARD: |
248 | break; | 250 | break; |
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c index ac9b4cad320e..4b47fd9fdd89 100644 --- a/arch/arm/mach-imx/mach-mx31lite.c +++ b/arch/arm/mach-imx/mach-mx31lite.c | |||
@@ -230,6 +230,8 @@ static void __init mx31lite_init(void) | |||
230 | { | 230 | { |
231 | int ret; | 231 | int ret; |
232 | 232 | ||
233 | imx31_soc_init(); | ||
234 | |||
233 | switch (mx31lite_baseboard) { | 235 | switch (mx31lite_baseboard) { |
234 | case MX31LITE_NOBOARD: | 236 | case MX31LITE_NOBOARD: |
235 | break; | 237 | break; |
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c index eaa51e49ca95..a52fd36e2b52 100644 --- a/arch/arm/mach-imx/mach-mx31moboard.c +++ b/arch/arm/mach-imx/mach-mx31moboard.c | |||
@@ -507,6 +507,8 @@ core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444); | |||
507 | */ | 507 | */ |
508 | static void __init mx31moboard_init(void) | 508 | static void __init mx31moboard_init(void) |
509 | { | 509 | { |
510 | imx31_soc_init(); | ||
511 | |||
510 | mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins), | 512 | mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins), |
511 | "moboard"); | 513 | "moboard"); |
512 | 514 | ||
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c index 882880ac1bbc..48b3c6fd5cf0 100644 --- a/arch/arm/mach-imx/mach-mx35_3ds.c +++ b/arch/arm/mach-imx/mach-mx35_3ds.c | |||
@@ -179,6 +179,8 @@ static const struct imxi2c_platform_data mx35_3ds_i2c0_data __initconst = { | |||
179 | */ | 179 | */ |
180 | static void __init mx35_3ds_init(void) | 180 | static void __init mx35_3ds_init(void) |
181 | { | 181 | { |
182 | imx35_soc_init(); | ||
183 | |||
182 | mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads)); | 184 | mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads)); |
183 | 185 | ||
184 | imx35_add_fec(NULL); | 186 | imx35_add_fec(NULL); |
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c index 2774541511e7..c85876fed663 100644 --- a/arch/arm/mach-imx/mach-mxt_td60.c +++ b/arch/arm/mach-imx/mach-mxt_td60.c | |||
@@ -233,6 +233,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = { | |||
233 | 233 | ||
234 | static void __init mxt_td60_board_init(void) | 234 | static void __init mxt_td60_board_init(void) |
235 | { | 235 | { |
236 | imx27_soc_init(); | ||
237 | |||
236 | mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins), | 238 | mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins), |
237 | "MXT_TD60"); | 239 | "MXT_TD60"); |
238 | 240 | ||
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c index bbddc5a11c43..71083aa16038 100644 --- a/arch/arm/mach-imx/mach-pca100.c +++ b/arch/arm/mach-imx/mach-pca100.c | |||
@@ -357,6 +357,8 @@ static void __init pca100_init(void) | |||
357 | { | 357 | { |
358 | int ret; | 358 | int ret; |
359 | 359 | ||
360 | imx27_soc_init(); | ||
361 | |||
360 | /* SSI unit */ | 362 | /* SSI unit */ |
361 | mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, | 363 | mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, |
362 | MXC_AUDMUX_V1_PCR_SYN | /* 4wire mode */ | 364 | MXC_AUDMUX_V1_PCR_SYN | /* 4wire mode */ |
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c index 89c213b81295..f45b7cd72c8a 100644 --- a/arch/arm/mach-imx/mach-pcm037.c +++ b/arch/arm/mach-imx/mach-pcm037.c | |||
@@ -576,6 +576,8 @@ static void __init pcm037_init(void) | |||
576 | { | 576 | { |
577 | int ret; | 577 | int ret; |
578 | 578 | ||
579 | imx31_soc_init(); | ||
580 | |||
579 | mxc_iomux_set_gpr(MUX_PGP_UH2, 1); | 581 | mxc_iomux_set_gpr(MUX_PGP_UH2, 1); |
580 | 582 | ||
581 | mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins), | 583 | mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins), |
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c index 853bb871c7ed..2d6a64bbac44 100644 --- a/arch/arm/mach-imx/mach-pcm038.c +++ b/arch/arm/mach-imx/mach-pcm038.c | |||
@@ -295,6 +295,8 @@ static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { | |||
295 | 295 | ||
296 | static void __init pcm038_init(void) | 296 | static void __init pcm038_init(void) |
297 | { | 297 | { |
298 | imx27_soc_init(); | ||
299 | |||
298 | mxc_gpio_setup_multiple_pins(pcm038_pins, ARRAY_SIZE(pcm038_pins), | 300 | mxc_gpio_setup_multiple_pins(pcm038_pins, ARRAY_SIZE(pcm038_pins), |
299 | "PCM038"); | 301 | "PCM038"); |
300 | 302 | ||
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c index 026441628dfa..163cc318cafb 100644 --- a/arch/arm/mach-imx/mach-pcm043.c +++ b/arch/arm/mach-imx/mach-pcm043.c | |||
@@ -356,6 +356,8 @@ static struct esdhc_platform_data sd1_pdata = { | |||
356 | */ | 356 | */ |
357 | static void __init pcm043_init(void) | 357 | static void __init pcm043_init(void) |
358 | { | 358 | { |
359 | imx35_soc_init(); | ||
360 | |||
359 | mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads)); | 361 | mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads)); |
360 | 362 | ||
361 | mxc_audmux_v2_configure_port(3, | 363 | mxc_audmux_v2_configure_port(3, |
diff --git a/arch/arm/mach-imx/mach-qong.c b/arch/arm/mach-imx/mach-qong.c index c16328715939..3626f486498a 100644 --- a/arch/arm/mach-imx/mach-qong.c +++ b/arch/arm/mach-imx/mach-qong.c | |||
@@ -244,6 +244,8 @@ static void __init qong_init_fpga(void) | |||
244 | */ | 244 | */ |
245 | static void __init qong_init(void) | 245 | static void __init qong_init(void) |
246 | { | 246 | { |
247 | imx31_soc_init(); | ||
248 | |||
247 | mxc_init_imx_uart(); | 249 | mxc_init_imx_uart(); |
248 | qong_init_nor_mtd(); | 250 | qong_init_nor_mtd(); |
249 | qong_init_fpga(); | 251 | qong_init_fpga(); |
diff --git a/arch/arm/mach-imx/mach-scb9328.c b/arch/arm/mach-imx/mach-scb9328.c index dcaee043628e..82805260e19c 100644 --- a/arch/arm/mach-imx/mach-scb9328.c +++ b/arch/arm/mach-imx/mach-scb9328.c | |||
@@ -129,6 +129,8 @@ static struct platform_device *devices[] __initdata = { | |||
129 | */ | 129 | */ |
130 | static void __init scb9328_init(void) | 130 | static void __init scb9328_init(void) |
131 | { | 131 | { |
132 | imx1_soc_init(); | ||
133 | |||
132 | imx1_add_imx_uart0(&uart_pdata); | 134 | imx1_add_imx_uart0(&uart_pdata); |
133 | 135 | ||
134 | printk(KERN_INFO"Scb9328: Adding devices\n"); | 136 | printk(KERN_INFO"Scb9328: Adding devices\n"); |
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c index d74e3473d236..7d8e012a6335 100644 --- a/arch/arm/mach-imx/mach-vpr200.c +++ b/arch/arm/mach-imx/mach-vpr200.c | |||
@@ -267,6 +267,8 @@ static struct platform_device *devices[] __initdata = { | |||
267 | */ | 267 | */ |
268 | static void __init vpr200_board_init(void) | 268 | static void __init vpr200_board_init(void) |
269 | { | 269 | { |
270 | imx35_soc_init(); | ||
271 | |||
270 | mxc_iomux_v3_setup_multiple_pads(vpr200_pads, ARRAY_SIZE(vpr200_pads)); | 272 | mxc_iomux_v3_setup_multiple_pads(vpr200_pads, ARRAY_SIZE(vpr200_pads)); |
271 | 273 | ||
272 | imx35_add_fec(NULL); | 274 | imx35_add_fec(NULL); |
diff --git a/arch/arm/mach-imx/mm-imx1.c b/arch/arm/mach-imx/mm-imx1.c index 2e482ba5a0e7..b486595701b7 100644 --- a/arch/arm/mach-imx/mm-imx1.c +++ b/arch/arm/mach-imx/mm-imx1.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include <mach/common.h> | 24 | #include <mach/common.h> |
25 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | #include <mach/gpio.h> | ||
27 | #include <mach/irqs.h> | 26 | #include <mach/irqs.h> |
28 | #include <mach/iomux-v1.h> | 27 | #include <mach/iomux-v1.h> |
29 | 28 | ||
@@ -44,15 +43,15 @@ void __init imx1_init_early(void) | |||
44 | MX1_NUM_GPIO_PORT); | 43 | MX1_NUM_GPIO_PORT); |
45 | } | 44 | } |
46 | 45 | ||
47 | static struct mxc_gpio_port imx1_gpio_ports[] = { | ||
48 | DEFINE_IMX_GPIO_PORT_IRQ(MX1, 0, 1, MX1_GPIO_INT_PORTA), | ||
49 | DEFINE_IMX_GPIO_PORT_IRQ(MX1, 1, 2, MX1_GPIO_INT_PORTB), | ||
50 | DEFINE_IMX_GPIO_PORT_IRQ(MX1, 2, 3, MX1_GPIO_INT_PORTC), | ||
51 | DEFINE_IMX_GPIO_PORT_IRQ(MX1, 3, 4, MX1_GPIO_INT_PORTD), | ||
52 | }; | ||
53 | |||
54 | void __init mx1_init_irq(void) | 46 | void __init mx1_init_irq(void) |
55 | { | 47 | { |
56 | mxc_init_irq(MX1_IO_ADDRESS(MX1_AVIC_BASE_ADDR)); | 48 | mxc_init_irq(MX1_IO_ADDRESS(MX1_AVIC_BASE_ADDR)); |
57 | mxc_gpio_init(imx1_gpio_ports, ARRAY_SIZE(imx1_gpio_ports)); | 49 | } |
50 | |||
51 | void __init imx1_soc_init(void) | ||
52 | { | ||
53 | mxc_register_gpio(0, MX1_GPIO1_BASE_ADDR, SZ_4K, MX1_GPIO_INT_PORTA, 0); | ||
54 | mxc_register_gpio(1, MX1_GPIO2_BASE_ADDR, SZ_4K, MX1_GPIO_INT_PORTB, 0); | ||
55 | mxc_register_gpio(2, MX1_GPIO3_BASE_ADDR, SZ_4K, MX1_GPIO_INT_PORTC, 0); | ||
56 | mxc_register_gpio(3, MX1_GPIO4_BASE_ADDR, SZ_4K, MX1_GPIO_INT_PORTD, 0); | ||
58 | } | 57 | } |
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c index 7a0c500ac2c8..f0fb8bcce6f9 100644 --- a/arch/arm/mach-imx/mm-imx21.c +++ b/arch/arm/mach-imx/mm-imx21.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <mach/common.h> | 24 | #include <mach/common.h> |
25 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
26 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
27 | #include <mach/gpio.h> | ||
28 | #include <mach/irqs.h> | 27 | #include <mach/irqs.h> |
29 | #include <mach/iomux-v1.h> | 28 | #include <mach/iomux-v1.h> |
30 | 29 | ||
@@ -70,17 +69,17 @@ void __init imx21_init_early(void) | |||
70 | MX21_NUM_GPIO_PORT); | 69 | MX21_NUM_GPIO_PORT); |
71 | } | 70 | } |
72 | 71 | ||
73 | static struct mxc_gpio_port imx21_gpio_ports[] = { | ||
74 | DEFINE_IMX_GPIO_PORT_IRQ(MX21, 0, 1, MX21_INT_GPIO), | ||
75 | DEFINE_IMX_GPIO_PORT(MX21, 1, 2), | ||
76 | DEFINE_IMX_GPIO_PORT(MX21, 2, 3), | ||
77 | DEFINE_IMX_GPIO_PORT(MX21, 3, 4), | ||
78 | DEFINE_IMX_GPIO_PORT(MX21, 4, 5), | ||
79 | DEFINE_IMX_GPIO_PORT(MX21, 5, 6), | ||
80 | }; | ||
81 | |||
82 | void __init mx21_init_irq(void) | 72 | void __init mx21_init_irq(void) |
83 | { | 73 | { |
84 | mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR)); | 74 | mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR)); |
85 | mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports)); | 75 | } |
76 | |||
77 | void __init imx21_soc_init(void) | ||
78 | { | ||
79 | mxc_register_gpio(0, MX21_GPIO1_BASE_ADDR, SZ_4K, MX21_INT_GPIO, 0); | ||
80 | mxc_register_gpio(1, MX21_GPIO2_BASE_ADDR, SZ_4K, MX21_INT_GPIO, 0); | ||
81 | mxc_register_gpio(2, MX21_GPIO3_BASE_ADDR, SZ_4K, MX21_INT_GPIO, 0); | ||
82 | mxc_register_gpio(3, MX21_GPIO4_BASE_ADDR, SZ_4K, MX21_INT_GPIO, 0); | ||
83 | mxc_register_gpio(4, MX21_GPIO5_BASE_ADDR, SZ_4K, MX21_INT_GPIO, 0); | ||
84 | mxc_register_gpio(5, MX21_GPIO6_BASE_ADDR, SZ_4K, MX21_INT_GPIO, 0); | ||
86 | } | 85 | } |
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c index 02f7b5c7fa8e..1b6d583f750a 100644 --- a/arch/arm/mach-imx/mm-imx25.c +++ b/arch/arm/mach-imx/mm-imx25.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
28 | #include <mach/mx25.h> | 28 | #include <mach/mx25.h> |
29 | #include <mach/iomux-v3.h> | 29 | #include <mach/iomux-v3.h> |
30 | #include <mach/gpio.h> | ||
31 | #include <mach/irqs.h> | 30 | #include <mach/irqs.h> |
32 | 31 | ||
33 | /* | 32 | /* |
@@ -57,16 +56,15 @@ void __init imx25_init_early(void) | |||
57 | mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR)); | 56 | mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR)); |
58 | } | 57 | } |
59 | 58 | ||
60 | static struct mxc_gpio_port imx25_gpio_ports[] = { | ||
61 | DEFINE_IMX_GPIO_PORT_IRQ(MX25, 0, 1, MX25_INT_GPIO1), | ||
62 | DEFINE_IMX_GPIO_PORT_IRQ(MX25, 1, 2, MX25_INT_GPIO2), | ||
63 | DEFINE_IMX_GPIO_PORT_IRQ(MX25, 2, 3, MX25_INT_GPIO3), | ||
64 | DEFINE_IMX_GPIO_PORT_IRQ(MX25, 3, 4, MX25_INT_GPIO4), | ||
65 | }; | ||
66 | |||
67 | void __init mx25_init_irq(void) | 59 | void __init mx25_init_irq(void) |
68 | { | 60 | { |
69 | mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR)); | 61 | mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR)); |
70 | mxc_gpio_init(imx25_gpio_ports, ARRAY_SIZE(imx25_gpio_ports)); | ||
71 | } | 62 | } |
72 | 63 | ||
64 | void __init imx25_soc_init(void) | ||
65 | { | ||
66 | mxc_register_gpio(0, MX25_GPIO1_BASE_ADDR, SZ_16K, MX25_INT_GPIO1, 0); | ||
67 | mxc_register_gpio(1, MX25_GPIO2_BASE_ADDR, SZ_16K, MX25_INT_GPIO2, 0); | ||
68 | mxc_register_gpio(2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0); | ||
69 | mxc_register_gpio(3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0); | ||
70 | } | ||
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c index a6761a39f08c..d3700cec8ec5 100644 --- a/arch/arm/mach-imx/mm-imx27.c +++ b/arch/arm/mach-imx/mm-imx27.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <mach/common.h> | 24 | #include <mach/common.h> |
25 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
26 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
27 | #include <mach/gpio.h> | ||
28 | #include <mach/irqs.h> | 27 | #include <mach/irqs.h> |
29 | #include <mach/iomux-v1.h> | 28 | #include <mach/iomux-v1.h> |
30 | 29 | ||
@@ -70,17 +69,17 @@ void __init imx27_init_early(void) | |||
70 | MX27_NUM_GPIO_PORT); | 69 | MX27_NUM_GPIO_PORT); |
71 | } | 70 | } |
72 | 71 | ||
73 | static struct mxc_gpio_port imx27_gpio_ports[] = { | ||
74 | DEFINE_IMX_GPIO_PORT_IRQ(MX27, 0, 1, MX27_INT_GPIO), | ||
75 | DEFINE_IMX_GPIO_PORT(MX27, 1, 2), | ||
76 | DEFINE_IMX_GPIO_PORT(MX27, 2, 3), | ||
77 | DEFINE_IMX_GPIO_PORT(MX27, 3, 4), | ||
78 | DEFINE_IMX_GPIO_PORT(MX27, 4, 5), | ||
79 | DEFINE_IMX_GPIO_PORT(MX27, 5, 6), | ||
80 | }; | ||
81 | |||
82 | void __init mx27_init_irq(void) | 72 | void __init mx27_init_irq(void) |
83 | { | 73 | { |
84 | mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR)); | 74 | mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR)); |
85 | mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports)); | 75 | } |
76 | |||
77 | void __init imx27_soc_init(void) | ||
78 | { | ||
79 | mxc_register_gpio(0, MX27_GPIO1_BASE_ADDR, SZ_4K, MX27_INT_GPIO, 0); | ||
80 | mxc_register_gpio(1, MX27_GPIO2_BASE_ADDR, SZ_4K, MX27_INT_GPIO, 0); | ||
81 | mxc_register_gpio(2, MX27_GPIO3_BASE_ADDR, SZ_4K, MX27_INT_GPIO, 0); | ||
82 | mxc_register_gpio(3, MX27_GPIO4_BASE_ADDR, SZ_4K, MX27_INT_GPIO, 0); | ||
83 | mxc_register_gpio(4, MX27_GPIO5_BASE_ADDR, SZ_4K, MX27_INT_GPIO, 0); | ||
84 | mxc_register_gpio(5, MX27_GPIO6_BASE_ADDR, SZ_4K, MX27_INT_GPIO, 0); | ||
86 | } | 85 | } |
diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c index 86b9b45864d2..cb16ac661776 100644 --- a/arch/arm/mach-imx/mm-imx31.c +++ b/arch/arm/mach-imx/mm-imx31.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <mach/common.h> | 26 | #include <mach/common.h> |
27 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
28 | #include <mach/iomux-v3.h> | 28 | #include <mach/iomux-v3.h> |
29 | #include <mach/gpio.h> | ||
30 | #include <mach/irqs.h> | 29 | #include <mach/irqs.h> |
31 | 30 | ||
32 | static struct map_desc mx31_io_desc[] __initdata = { | 31 | static struct map_desc mx31_io_desc[] __initdata = { |
@@ -53,14 +52,14 @@ void __init imx31_init_early(void) | |||
53 | mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); | 52 | mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); |
54 | } | 53 | } |
55 | 54 | ||
56 | static struct mxc_gpio_port imx31_gpio_ports[] = { | ||
57 | DEFINE_IMX_GPIO_PORT_IRQ(MX31, 0, 1, MX31_INT_GPIO1), | ||
58 | DEFINE_IMX_GPIO_PORT_IRQ(MX31, 1, 2, MX31_INT_GPIO2), | ||
59 | DEFINE_IMX_GPIO_PORT_IRQ(MX31, 2, 3, MX31_INT_GPIO3), | ||
60 | }; | ||
61 | |||
62 | void __init mx31_init_irq(void) | 55 | void __init mx31_init_irq(void) |
63 | { | 56 | { |
64 | mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR)); | 57 | mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR)); |
65 | mxc_gpio_init(imx31_gpio_ports, ARRAY_SIZE(imx31_gpio_ports)); | 58 | } |
59 | |||
60 | void __init imx31_soc_init(void) | ||
61 | { | ||
62 | mxc_register_gpio(0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0); | ||
63 | mxc_register_gpio(1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0); | ||
64 | mxc_register_gpio(2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0); | ||
66 | } | 65 | } |
diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c index c880e6d1ae55..648bfca0163e 100644 --- a/arch/arm/mach-imx/mm-imx35.c +++ b/arch/arm/mach-imx/mm-imx35.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <mach/common.h> | 27 | #include <mach/common.h> |
28 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
29 | #include <mach/iomux-v3.h> | 29 | #include <mach/iomux-v3.h> |
30 | #include <mach/gpio.h> | ||
31 | #include <mach/irqs.h> | 30 | #include <mach/irqs.h> |
32 | 31 | ||
33 | static struct map_desc mx35_io_desc[] __initdata = { | 32 | static struct map_desc mx35_io_desc[] __initdata = { |
@@ -50,14 +49,14 @@ void __init imx35_init_early(void) | |||
50 | mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); | 49 | mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); |
51 | } | 50 | } |
52 | 51 | ||
53 | static struct mxc_gpio_port imx35_gpio_ports[] = { | ||
54 | DEFINE_IMX_GPIO_PORT_IRQ(MX35, 0, 1, MX35_INT_GPIO1), | ||
55 | DEFINE_IMX_GPIO_PORT_IRQ(MX35, 1, 2, MX35_INT_GPIO2), | ||
56 | DEFINE_IMX_GPIO_PORT_IRQ(MX35, 2, 3, MX35_INT_GPIO3), | ||
57 | }; | ||
58 | |||
59 | void __init mx35_init_irq(void) | 52 | void __init mx35_init_irq(void) |
60 | { | 53 | { |
61 | mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR)); | 54 | mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR)); |
62 | mxc_gpio_init(imx35_gpio_ports, ARRAY_SIZE(imx35_gpio_ports)); | 55 | } |
56 | |||
57 | void __init imx35_soc_init(void) | ||
58 | { | ||
59 | mxc_register_gpio(0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0); | ||
60 | mxc_register_gpio(1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0); | ||
61 | mxc_register_gpio(2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0); | ||
63 | } | 62 | } |
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c index 4efa02ee1639..add0d42de7af 100644 --- a/arch/arm/mach-mx5/board-cpuimx51.c +++ b/arch/arm/mach-mx5/board-cpuimx51.c | |||
@@ -245,6 +245,8 @@ __setup("otg_mode=", eukrea_cpuimx51_otg_mode); | |||
245 | */ | 245 | */ |
246 | static void __init eukrea_cpuimx51_init(void) | 246 | static void __init eukrea_cpuimx51_init(void) |
247 | { | 247 | { |
248 | imx51_soc_init(); | ||
249 | |||
248 | mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads, | 250 | mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads, |
249 | ARRAY_SIZE(eukrea_cpuimx51_pads)); | 251 | ARRAY_SIZE(eukrea_cpuimx51_pads)); |
250 | 252 | ||
diff --git a/arch/arm/mach-mx5/board-cpuimx51sd.c b/arch/arm/mach-mx5/board-cpuimx51sd.c index 5ef25a596143..ff096d587299 100644 --- a/arch/arm/mach-mx5/board-cpuimx51sd.c +++ b/arch/arm/mach-mx5/board-cpuimx51sd.c | |||
@@ -264,6 +264,8 @@ static struct platform_device *platform_devices[] __initdata = { | |||
264 | 264 | ||
265 | static void __init eukrea_cpuimx51sd_init(void) | 265 | static void __init eukrea_cpuimx51sd_init(void) |
266 | { | 266 | { |
267 | imx51_soc_init(); | ||
268 | |||
267 | mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads, | 269 | mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads, |
268 | ARRAY_SIZE(eukrea_cpuimx51sd_pads)); | 270 | ARRAY_SIZE(eukrea_cpuimx51sd_pads)); |
269 | 271 | ||
diff --git a/arch/arm/mach-mx5/board-mx50_rdp.c b/arch/arm/mach-mx5/board-mx50_rdp.c index 11210e1ae42a..7de25c6712eb 100644 --- a/arch/arm/mach-mx5/board-mx50_rdp.c +++ b/arch/arm/mach-mx5/board-mx50_rdp.c | |||
@@ -192,6 +192,8 @@ static const struct imxi2c_platform_data i2c_data __initconst = { | |||
192 | */ | 192 | */ |
193 | static void __init mx50_rdp_board_init(void) | 193 | static void __init mx50_rdp_board_init(void) |
194 | { | 194 | { |
195 | imx50_soc_init(); | ||
196 | |||
195 | mxc_iomux_v3_setup_multiple_pads(mx50_rdp_pads, | 197 | mxc_iomux_v3_setup_multiple_pads(mx50_rdp_pads, |
196 | ARRAY_SIZE(mx50_rdp_pads)); | 198 | ARRAY_SIZE(mx50_rdp_pads)); |
197 | 199 | ||
diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c index 63dfbeafbc1e..3112d15feebc 100644 --- a/arch/arm/mach-mx5/board-mx51_3ds.c +++ b/arch/arm/mach-mx5/board-mx51_3ds.c | |||
@@ -135,6 +135,8 @@ static struct spi_board_info mx51_3ds_spi_nor_device[] = { | |||
135 | */ | 135 | */ |
136 | static void __init mx51_3ds_init(void) | 136 | static void __init mx51_3ds_init(void) |
137 | { | 137 | { |
138 | imx51_soc_init(); | ||
139 | |||
138 | mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads, | 140 | mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads, |
139 | ARRAY_SIZE(mx51_3ds_pads)); | 141 | ARRAY_SIZE(mx51_3ds_pads)); |
140 | 142 | ||
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c index c7b3fabf50f9..6021dd00ec75 100644 --- a/arch/arm/mach-mx5/board-mx51_babbage.c +++ b/arch/arm/mach-mx5/board-mx51_babbage.c | |||
@@ -340,6 +340,8 @@ static void __init mx51_babbage_init(void) | |||
340 | iomux_v3_cfg_t power_key = _MX51_PAD_EIM_A27__GPIO2_21 | | 340 | iomux_v3_cfg_t power_key = _MX51_PAD_EIM_A27__GPIO2_21 | |
341 | MUX_PAD_CTRL(PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP); | 341 | MUX_PAD_CTRL(PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP); |
342 | 342 | ||
343 | imx51_soc_init(); | ||
344 | |||
343 | #if defined(CONFIG_CPU_FREQ_IMX) | 345 | #if defined(CONFIG_CPU_FREQ_IMX) |
344 | get_cpu_op = mx51_get_cpu_op; | 346 | get_cpu_op = mx51_get_cpu_op; |
345 | #endif | 347 | #endif |
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c index 6e362315291b..3be603b9075a 100644 --- a/arch/arm/mach-mx5/board-mx51_efikamx.c +++ b/arch/arm/mach-mx5/board-mx51_efikamx.c | |||
@@ -236,6 +236,8 @@ late_initcall(mx51_efikamx_power_init); | |||
236 | 236 | ||
237 | static void __init mx51_efikamx_init(void) | 237 | static void __init mx51_efikamx_init(void) |
238 | { | 238 | { |
239 | imx51_soc_init(); | ||
240 | |||
239 | mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads, | 241 | mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads, |
240 | ARRAY_SIZE(mx51efikamx_pads)); | 242 | ARRAY_SIZE(mx51efikamx_pads)); |
241 | efika_board_common_init(); | 243 | efika_board_common_init(); |
diff --git a/arch/arm/mach-mx5/board-mx51_efikasb.c b/arch/arm/mach-mx5/board-mx51_efikasb.c index 474fc6e4c6df..4b2e522de0f8 100644 --- a/arch/arm/mach-mx5/board-mx51_efikasb.c +++ b/arch/arm/mach-mx5/board-mx51_efikasb.c | |||
@@ -248,6 +248,8 @@ static void __init mx51_efikasb_board_id(void) | |||
248 | 248 | ||
249 | static void __init efikasb_board_init(void) | 249 | static void __init efikasb_board_init(void) |
250 | { | 250 | { |
251 | imx51_soc_init(); | ||
252 | |||
251 | mxc_iomux_v3_setup_multiple_pads(mx51efikasb_pads, | 253 | mxc_iomux_v3_setup_multiple_pads(mx51efikasb_pads, |
252 | ARRAY_SIZE(mx51efikasb_pads)); | 254 | ARRAY_SIZE(mx51efikasb_pads)); |
253 | efika_board_common_init(); | 255 | efika_board_common_init(); |
diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c index f87d571882c6..0d9218a6e2d2 100644 --- a/arch/arm/mach-mx5/board-mx53_evk.c +++ b/arch/arm/mach-mx5/board-mx53_evk.c | |||
@@ -117,6 +117,8 @@ static const struct spi_imx_master mx53_evk_spi_data __initconst = { | |||
117 | 117 | ||
118 | static void __init mx53_evk_board_init(void) | 118 | static void __init mx53_evk_board_init(void) |
119 | { | 119 | { |
120 | imx53_soc_init(); | ||
121 | |||
120 | mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads, | 122 | mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads, |
121 | ARRAY_SIZE(mx53_evk_pads)); | 123 | ARRAY_SIZE(mx53_evk_pads)); |
122 | mx53_evk_init_uart(); | 124 | mx53_evk_init_uart(); |
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c index 1b947e8c9c0c..359c3e248add 100644 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c | |||
@@ -227,6 +227,8 @@ static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst = { | |||
227 | 227 | ||
228 | static void __init mx53_loco_board_init(void) | 228 | static void __init mx53_loco_board_init(void) |
229 | { | 229 | { |
230 | imx53_soc_init(); | ||
231 | |||
230 | mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads, | 232 | mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads, |
231 | ARRAY_SIZE(mx53_loco_pads)); | 233 | ARRAY_SIZE(mx53_loco_pads)); |
232 | imx53_add_imx_uart(0, NULL); | 234 | imx53_add_imx_uart(0, NULL); |
diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c index 817c08938f55..bc02894eafef 100644 --- a/arch/arm/mach-mx5/board-mx53_smd.c +++ b/arch/arm/mach-mx5/board-mx53_smd.c | |||
@@ -113,6 +113,8 @@ static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = { | |||
113 | 113 | ||
114 | static void __init mx53_smd_board_init(void) | 114 | static void __init mx53_smd_board_init(void) |
115 | { | 115 | { |
116 | imx53_soc_init(); | ||
117 | |||
116 | mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads, | 118 | mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads, |
117 | ARRAY_SIZE(mx53_smd_pads)); | 119 | ARRAY_SIZE(mx53_smd_pads)); |
118 | mx53_smd_init_uart(); | 120 | mx53_smd_init_uart(); |
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c index 153ada53e575..371ca8c8414c 100644 --- a/arch/arm/mach-mx5/devices.c +++ b/arch/arm/mach-mx5/devices.c | |||
@@ -12,7 +12,6 @@ | |||
12 | 12 | ||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/gpio.h> | ||
16 | #include <mach/hardware.h> | 15 | #include <mach/hardware.h> |
17 | #include <mach/imx-uart.h> | 16 | #include <mach/imx-uart.h> |
18 | #include <mach/irqs.h> | 17 | #include <mach/irqs.h> |
@@ -119,66 +118,3 @@ struct platform_device mxc_usbh2_device = { | |||
119 | .coherent_dma_mask = DMA_BIT_MASK(32), | 118 | .coherent_dma_mask = DMA_BIT_MASK(32), |
120 | }, | 119 | }, |
121 | }; | 120 | }; |
122 | |||
123 | static struct mxc_gpio_port mxc_gpio_ports[] = { | ||
124 | { | ||
125 | .chip.label = "gpio-0", | ||
126 | .base = MX51_IO_ADDRESS(MX51_GPIO1_BASE_ADDR), | ||
127 | .irq = MX51_MXC_INT_GPIO1_LOW, | ||
128 | .irq_high = MX51_MXC_INT_GPIO1_HIGH, | ||
129 | .virtual_irq_start = MXC_GPIO_IRQ_START | ||
130 | }, | ||
131 | { | ||
132 | .chip.label = "gpio-1", | ||
133 | .base = MX51_IO_ADDRESS(MX51_GPIO2_BASE_ADDR), | ||
134 | .irq = MX51_MXC_INT_GPIO2_LOW, | ||
135 | .irq_high = MX51_MXC_INT_GPIO2_HIGH, | ||
136 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 1 | ||
137 | }, | ||
138 | { | ||
139 | .chip.label = "gpio-2", | ||
140 | .base = MX51_IO_ADDRESS(MX51_GPIO3_BASE_ADDR), | ||
141 | .irq = MX51_MXC_INT_GPIO3_LOW, | ||
142 | .irq_high = MX51_MXC_INT_GPIO3_HIGH, | ||
143 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2 | ||
144 | }, | ||
145 | { | ||
146 | .chip.label = "gpio-3", | ||
147 | .base = MX51_IO_ADDRESS(MX51_GPIO4_BASE_ADDR), | ||
148 | .irq = MX51_MXC_INT_GPIO4_LOW, | ||
149 | .irq_high = MX51_MXC_INT_GPIO4_HIGH, | ||
150 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 3 | ||
151 | }, | ||
152 | { | ||
153 | .chip.label = "gpio-4", | ||
154 | .base = MX53_IO_ADDRESS(MX53_GPIO5_BASE_ADDR), | ||
155 | .irq = MX53_INT_GPIO5_LOW, | ||
156 | .irq_high = MX53_INT_GPIO5_HIGH, | ||
157 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 4 | ||
158 | }, | ||
159 | { | ||
160 | .chip.label = "gpio-5", | ||
161 | .base = MX53_IO_ADDRESS(MX53_GPIO6_BASE_ADDR), | ||
162 | .irq = MX53_INT_GPIO6_LOW, | ||
163 | .irq_high = MX53_INT_GPIO6_HIGH, | ||
164 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 5 | ||
165 | }, | ||
166 | { | ||
167 | .chip.label = "gpio-6", | ||
168 | .base = MX53_IO_ADDRESS(MX53_GPIO7_BASE_ADDR), | ||
169 | .irq = MX53_INT_GPIO7_LOW, | ||
170 | .irq_high = MX53_INT_GPIO7_HIGH, | ||
171 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 6 | ||
172 | }, | ||
173 | }; | ||
174 | |||
175 | int __init imx51_register_gpios(void) | ||
176 | { | ||
177 | return mxc_gpio_init(mxc_gpio_ports, 4); | ||
178 | } | ||
179 | |||
180 | int __init imx53_register_gpios(void) | ||
181 | { | ||
182 | return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports)); | ||
183 | } | ||
184 | |||
diff --git a/arch/arm/mach-mx5/mm-mx50.c b/arch/arm/mach-mx5/mm-mx50.c index b9c363b514a9..28c3f60f734f 100644 --- a/arch/arm/mach-mx5/mm-mx50.c +++ b/arch/arm/mach-mx5/mm-mx50.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
27 | #include <mach/common.h> | 27 | #include <mach/common.h> |
28 | #include <mach/iomux-v3.h> | 28 | #include <mach/iomux-v3.h> |
29 | #include <mach/gpio.h> | ||
30 | #include <mach/irqs.h> | 29 | #include <mach/irqs.h> |
31 | 30 | ||
32 | /* | 31 | /* |
@@ -56,17 +55,17 @@ void __init imx50_init_early(void) | |||
56 | mxc_arch_reset_init(MX50_IO_ADDRESS(MX50_WDOG_BASE_ADDR)); | 55 | mxc_arch_reset_init(MX50_IO_ADDRESS(MX50_WDOG_BASE_ADDR)); |
57 | } | 56 | } |
58 | 57 | ||
59 | static struct mxc_gpio_port imx50_gpio_ports[] = { | ||
60 | DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 0, 1, MX50_INT_GPIO1_LOW, MX50_INT_GPIO1_HIGH), | ||
61 | DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 1, 2, MX50_INT_GPIO2_LOW, MX50_INT_GPIO2_HIGH), | ||
62 | DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 2, 3, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH), | ||
63 | DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 3, 4, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH), | ||
64 | DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 4, 5, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH), | ||
65 | DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 5, 6, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH), | ||
66 | }; | ||
67 | |||
68 | void __init mx50_init_irq(void) | 58 | void __init mx50_init_irq(void) |
69 | { | 59 | { |
70 | tzic_init_irq(MX50_IO_ADDRESS(MX50_TZIC_BASE_ADDR)); | 60 | tzic_init_irq(MX50_IO_ADDRESS(MX50_TZIC_BASE_ADDR)); |
71 | mxc_gpio_init(imx50_gpio_ports, ARRAY_SIZE(imx50_gpio_ports)); | 61 | } |
62 | |||
63 | void __init imx50_soc_init(void) | ||
64 | { | ||
65 | mxc_register_gpio(0, MX50_GPIO1_BASE_ADDR, SZ_16K, MX50_INT_GPIO1_LOW, MX50_INT_GPIO1_HIGH); | ||
66 | mxc_register_gpio(1, MX50_GPIO2_BASE_ADDR, SZ_16K, MX50_INT_GPIO2_LOW, MX50_INT_GPIO2_HIGH); | ||
67 | mxc_register_gpio(2, MX50_GPIO3_BASE_ADDR, SZ_16K, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH); | ||
68 | mxc_register_gpio(3, MX50_GPIO4_BASE_ADDR, SZ_16K, MX50_INT_GPIO4_LOW, MX50_INT_GPIO4_HIGH); | ||
69 | mxc_register_gpio(4, MX50_GPIO5_BASE_ADDR, SZ_16K, MX50_INT_GPIO5_LOW, MX50_INT_GPIO5_HIGH); | ||
70 | mxc_register_gpio(5, MX50_GPIO6_BASE_ADDR, SZ_16K, MX50_INT_GPIO6_LOW, MX50_INT_GPIO6_HIGH); | ||
72 | } | 71 | } |
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c index ff557301b42b..800bb8b21081 100644 --- a/arch/arm/mach-mx5/mm.c +++ b/arch/arm/mach-mx5/mm.c | |||
@@ -69,8 +69,6 @@ void __init imx53_init_early(void) | |||
69 | mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR)); | 69 | mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR)); |
70 | } | 70 | } |
71 | 71 | ||
72 | int imx51_register_gpios(void); | ||
73 | |||
74 | void __init mx51_init_irq(void) | 72 | void __init mx51_init_irq(void) |
75 | { | 73 | { |
76 | unsigned long tzic_addr; | 74 | unsigned long tzic_addr; |
@@ -86,11 +84,8 @@ void __init mx51_init_irq(void) | |||
86 | panic("unable to map TZIC interrupt controller\n"); | 84 | panic("unable to map TZIC interrupt controller\n"); |
87 | 85 | ||
88 | tzic_init_irq(tzic_virt); | 86 | tzic_init_irq(tzic_virt); |
89 | imx51_register_gpios(); | ||
90 | } | 87 | } |
91 | 88 | ||
92 | int imx53_register_gpios(void); | ||
93 | |||
94 | void __init mx53_init_irq(void) | 89 | void __init mx53_init_irq(void) |
95 | { | 90 | { |
96 | unsigned long tzic_addr; | 91 | unsigned long tzic_addr; |
@@ -103,5 +98,23 @@ void __init mx53_init_irq(void) | |||
103 | panic("unable to map TZIC interrupt controller\n"); | 98 | panic("unable to map TZIC interrupt controller\n"); |
104 | 99 | ||
105 | tzic_init_irq(tzic_virt); | 100 | tzic_init_irq(tzic_virt); |
106 | imx53_register_gpios(); | 101 | } |
102 | |||
103 | void __init imx51_soc_init(void) | ||
104 | { | ||
105 | mxc_register_gpio(0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO1_LOW, MX51_MXC_INT_GPIO1_HIGH); | ||
106 | mxc_register_gpio(1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO2_LOW, MX51_MXC_INT_GPIO2_HIGH); | ||
107 | mxc_register_gpio(2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH); | ||
108 | mxc_register_gpio(3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH); | ||
109 | } | ||
110 | |||
111 | void __init imx53_soc_init(void) | ||
112 | { | ||
113 | mxc_register_gpio(0, MX53_GPIO1_BASE_ADDR, SZ_16K, MX53_INT_GPIO1_LOW, MX53_INT_GPIO1_HIGH); | ||
114 | mxc_register_gpio(1, MX53_GPIO2_BASE_ADDR, SZ_16K, MX53_INT_GPIO2_LOW, MX53_INT_GPIO2_HIGH); | ||
115 | mxc_register_gpio(2, MX53_GPIO3_BASE_ADDR, SZ_16K, MX53_INT_GPIO3_LOW, MX53_INT_GPIO3_HIGH); | ||
116 | mxc_register_gpio(3, MX53_GPIO4_BASE_ADDR, SZ_16K, MX53_INT_GPIO4_LOW, MX53_INT_GPIO4_HIGH); | ||
117 | mxc_register_gpio(4, MX53_GPIO5_BASE_ADDR, SZ_16K, MX53_INT_GPIO5_LOW, MX53_INT_GPIO5_HIGH); | ||
118 | mxc_register_gpio(5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH); | ||
119 | mxc_register_gpio(6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH); | ||
107 | } | 120 | } |
diff --git a/arch/arm/plat-mxc/devices.c b/arch/arm/plat-mxc/devices.c index eee1b6096a08..fb166b20f60f 100644 --- a/arch/arm/plat-mxc/devices.c +++ b/arch/arm/plat-mxc/devices.c | |||
@@ -89,3 +89,14 @@ err: | |||
89 | 89 | ||
90 | return pdev; | 90 | return pdev; |
91 | } | 91 | } |
92 | |||
93 | struct device mxc_aips_bus = { | ||
94 | .init_name = "mxc_aips", | ||
95 | .parent = &platform_bus, | ||
96 | }; | ||
97 | |||
98 | static int __init mxc_device_init(void) | ||
99 | { | ||
100 | return device_register(&mxc_aips_bus); | ||
101 | } | ||
102 | core_initcall(mxc_device_init); | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index ad2922acf480..b41bf972b54b 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -2,6 +2,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o | |||
2 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | 2 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o |
3 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o | 3 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o |
4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o | 4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o |
5 | obj-y += platform-gpio-mxc.o | ||
5 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o | 6 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o |
6 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o | 7 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o |
7 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o | 8 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o |
diff --git a/arch/arm/plat-mxc/devices/platform-gpio-mxc.c b/arch/arm/plat-mxc/devices/platform-gpio-mxc.c new file mode 100644 index 000000000000..cf1b7fdfa20d --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-gpio-mxc.c | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * Copyright 2011 Linaro Limited | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <mach/devices-common.h> | ||
10 | |||
11 | struct platform_device *__init mxc_register_gpio(int id, | ||
12 | resource_size_t iobase, resource_size_t iosize, int irq, int irq_high) | ||
13 | { | ||
14 | struct resource res[] = { | ||
15 | { | ||
16 | .start = iobase, | ||
17 | .end = iobase + iosize - 1, | ||
18 | .flags = IORESOURCE_MEM, | ||
19 | }, { | ||
20 | .start = irq, | ||
21 | .end = irq, | ||
22 | .flags = IORESOURCE_IRQ, | ||
23 | }, { | ||
24 | .start = irq_high, | ||
25 | .end = irq_high, | ||
26 | .flags = IORESOURCE_IRQ, | ||
27 | }, | ||
28 | }; | ||
29 | |||
30 | return platform_device_register_resndata(&mxc_aips_bus, | ||
31 | "gpio-mxc", id, res, ARRAY_SIZE(res), NULL, 0); | ||
32 | } | ||
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h index da7991832af6..91fa2632aa5e 100644 --- a/arch/arm/plat-mxc/include/mach/common.h +++ b/arch/arm/plat-mxc/include/mach/common.h | |||
@@ -43,6 +43,15 @@ extern void mx35_init_irq(void); | |||
43 | extern void mx50_init_irq(void); | 43 | extern void mx50_init_irq(void); |
44 | extern void mx51_init_irq(void); | 44 | extern void mx51_init_irq(void); |
45 | extern void mx53_init_irq(void); | 45 | extern void mx53_init_irq(void); |
46 | extern void imx1_soc_init(void); | ||
47 | extern void imx21_soc_init(void); | ||
48 | extern void imx25_soc_init(void); | ||
49 | extern void imx27_soc_init(void); | ||
50 | extern void imx31_soc_init(void); | ||
51 | extern void imx35_soc_init(void); | ||
52 | extern void imx50_soc_init(void); | ||
53 | extern void imx51_soc_init(void); | ||
54 | extern void imx53_soc_init(void); | ||
46 | extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq); | 55 | extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq); |
47 | extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int); | 56 | extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int); |
48 | extern int mx1_clocks_init(unsigned long fref); | 57 | extern int mx1_clocks_init(unsigned long fref); |
@@ -55,7 +64,8 @@ extern int mx51_clocks_init(unsigned long ckil, unsigned long osc, | |||
55 | unsigned long ckih1, unsigned long ckih2); | 64 | unsigned long ckih1, unsigned long ckih2); |
56 | extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, | 65 | extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, |
57 | unsigned long ckih1, unsigned long ckih2); | 66 | unsigned long ckih1, unsigned long ckih2); |
58 | extern int mxc_register_gpios(void); | 67 | extern struct platform_device *mxc_register_gpio(int id, |
68 | resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); | ||
59 | extern int mxc_register_device(struct platform_device *pdev, void *data); | 69 | extern int mxc_register_device(struct platform_device *pdev, void *data); |
60 | extern void mxc_set_cpu_type(unsigned int type); | 70 | extern void mxc_set_cpu_type(unsigned int type); |
61 | extern void mxc_arch_reset_init(void __iomem *); | 71 | extern void mxc_arch_reset_init(void __iomem *); |
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index fa8477337f91..03f626645374 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | 12 | ||
13 | extern struct device mxc_aips_bus; | ||
14 | |||
13 | struct platform_device *imx_add_platform_device_dmamask( | 15 | struct platform_device *imx_add_platform_device_dmamask( |
14 | const char *name, int id, | 16 | const char *name, int id, |
15 | const struct resource *res, unsigned int num_resources, | 17 | const struct resource *res, unsigned int num_resources, |
diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h index a2747f12813e..31c820c1b796 100644 --- a/arch/arm/plat-mxc/include/mach/gpio.h +++ b/arch/arm/plat-mxc/include/mach/gpio.h | |||
@@ -36,31 +36,4 @@ | |||
36 | #define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio)) | 36 | #define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio)) |
37 | #define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) | 37 | #define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) |
38 | 38 | ||
39 | struct mxc_gpio_port { | ||
40 | void __iomem *base; | ||
41 | int irq; | ||
42 | int irq_high; | ||
43 | int virtual_irq_start; | ||
44 | struct gpio_chip chip; | ||
45 | u32 both_edges; | ||
46 | spinlock_t lock; | ||
47 | }; | ||
48 | |||
49 | #define DEFINE_IMX_GPIO_PORT_IRQ_HIGH(soc, _id, _hwid, _irq, _irq_high) \ | ||
50 | { \ | ||
51 | .chip.label = "gpio-" #_id, \ | ||
52 | .irq = _irq, \ | ||
53 | .irq_high = _irq_high, \ | ||
54 | .base = soc ## _IO_ADDRESS( \ | ||
55 | soc ## _GPIO ## _hwid ## _BASE_ADDR), \ | ||
56 | .virtual_irq_start = MXC_GPIO_IRQ_START + (_id) * 32, \ | ||
57 | } | ||
58 | |||
59 | #define DEFINE_IMX_GPIO_PORT_IRQ(soc, _id, _hwid, _irq) \ | ||
60 | DEFINE_IMX_GPIO_PORT_IRQ_HIGH(soc, _id, _hwid, _irq, 0) | ||
61 | #define DEFINE_IMX_GPIO_PORT(soc, _id, _hwid) \ | ||
62 | DEFINE_IMX_GPIO_PORT_IRQ(soc, _id, _hwid, 0) | ||
63 | |||
64 | int mxc_gpio_init(struct mxc_gpio_port*, int); | ||
65 | |||
66 | #endif | 39 | #endif |
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 6cd6d7f686f6..844079a83f25 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c | |||
@@ -24,11 +24,28 @@ | |||
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/slab.h> | ||
27 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
28 | #include <asm-generic/bug.h> | 30 | #include <asm-generic/bug.h> |
29 | 31 | ||
30 | static struct mxc_gpio_port *mxc_gpio_ports; | 32 | struct mxc_gpio_port { |
31 | static int gpio_table_size; | 33 | struct list_head node; |
34 | void __iomem *base; | ||
35 | int irq; | ||
36 | int irq_high; | ||
37 | int virtual_irq_start; | ||
38 | struct gpio_chip chip; | ||
39 | u32 both_edges; | ||
40 | spinlock_t lock; | ||
41 | }; | ||
42 | |||
43 | /* | ||
44 | * MX2 has one interrupt *for all* gpio ports. The list is used | ||
45 | * to save the references to all ports, so that mx2_gpio_irq_handler | ||
46 | * can walk through all interrupt status registers. | ||
47 | */ | ||
48 | static LIST_HEAD(mxc_gpio_ports); | ||
32 | 49 | ||
33 | #define cpu_is_mx1_mx2() (cpu_is_mx1() || cpu_is_mx2()) | 50 | #define cpu_is_mx1_mx2() (cpu_is_mx1() || cpu_is_mx2()) |
34 | 51 | ||
@@ -50,7 +67,7 @@ static int gpio_table_size; | |||
50 | 67 | ||
51 | static void _clear_gpio_irqstatus(struct mxc_gpio_port *port, u32 index) | 68 | static void _clear_gpio_irqstatus(struct mxc_gpio_port *port, u32 index) |
52 | { | 69 | { |
53 | __raw_writel(1 << index, port->base + GPIO_ISR); | 70 | writel(1 << index, port->base + GPIO_ISR); |
54 | } | 71 | } |
55 | 72 | ||
56 | static void _set_gpio_irqenable(struct mxc_gpio_port *port, u32 index, | 73 | static void _set_gpio_irqenable(struct mxc_gpio_port *port, u32 index, |
@@ -58,27 +75,30 @@ static void _set_gpio_irqenable(struct mxc_gpio_port *port, u32 index, | |||
58 | { | 75 | { |
59 | u32 l; | 76 | u32 l; |
60 | 77 | ||
61 | l = __raw_readl(port->base + GPIO_IMR); | 78 | l = readl(port->base + GPIO_IMR); |
62 | l = (l & (~(1 << index))) | (!!enable << index); | 79 | l = (l & (~(1 << index))) | (!!enable << index); |
63 | __raw_writel(l, port->base + GPIO_IMR); | 80 | writel(l, port->base + GPIO_IMR); |
64 | } | 81 | } |
65 | 82 | ||
66 | static void gpio_ack_irq(struct irq_data *d) | 83 | static void gpio_ack_irq(struct irq_data *d) |
67 | { | 84 | { |
85 | struct mxc_gpio_port *port = irq_data_get_irq_chip_data(d); | ||
68 | u32 gpio = irq_to_gpio(d->irq); | 86 | u32 gpio = irq_to_gpio(d->irq); |
69 | _clear_gpio_irqstatus(&mxc_gpio_ports[gpio / 32], gpio & 0x1f); | 87 | _clear_gpio_irqstatus(port, gpio & 0x1f); |
70 | } | 88 | } |
71 | 89 | ||
72 | static void gpio_mask_irq(struct irq_data *d) | 90 | static void gpio_mask_irq(struct irq_data *d) |
73 | { | 91 | { |
92 | struct mxc_gpio_port *port = irq_data_get_irq_chip_data(d); | ||
74 | u32 gpio = irq_to_gpio(d->irq); | 93 | u32 gpio = irq_to_gpio(d->irq); |
75 | _set_gpio_irqenable(&mxc_gpio_ports[gpio / 32], gpio & 0x1f, 0); | 94 | _set_gpio_irqenable(port, gpio & 0x1f, 0); |
76 | } | 95 | } |
77 | 96 | ||
78 | static void gpio_unmask_irq(struct irq_data *d) | 97 | static void gpio_unmask_irq(struct irq_data *d) |
79 | { | 98 | { |
99 | struct mxc_gpio_port *port = irq_data_get_irq_chip_data(d); | ||
80 | u32 gpio = irq_to_gpio(d->irq); | 100 | u32 gpio = irq_to_gpio(d->irq); |
81 | _set_gpio_irqenable(&mxc_gpio_ports[gpio / 32], gpio & 0x1f, 1); | 101 | _set_gpio_irqenable(port, gpio & 0x1f, 1); |
82 | } | 102 | } |
83 | 103 | ||
84 | static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset); | 104 | static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset); |
@@ -86,7 +106,7 @@ static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset); | |||
86 | static int gpio_set_irq_type(struct irq_data *d, u32 type) | 106 | static int gpio_set_irq_type(struct irq_data *d, u32 type) |
87 | { | 107 | { |
88 | u32 gpio = irq_to_gpio(d->irq); | 108 | u32 gpio = irq_to_gpio(d->irq); |
89 | struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32]; | 109 | struct mxc_gpio_port *port = irq_data_get_irq_chip_data(d); |
90 | u32 bit, val; | 110 | u32 bit, val; |
91 | int edge; | 111 | int edge; |
92 | void __iomem *reg = port->base; | 112 | void __iomem *reg = port->base; |
@@ -122,8 +142,8 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) | |||
122 | 142 | ||
123 | reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */ | 143 | reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */ |
124 | bit = gpio & 0xf; | 144 | bit = gpio & 0xf; |
125 | val = __raw_readl(reg) & ~(0x3 << (bit << 1)); | 145 | val = readl(reg) & ~(0x3 << (bit << 1)); |
126 | __raw_writel(val | (edge << (bit << 1)), reg); | 146 | writel(val | (edge << (bit << 1)), reg); |
127 | _clear_gpio_irqstatus(port, gpio & 0x1f); | 147 | _clear_gpio_irqstatus(port, gpio & 0x1f); |
128 | 148 | ||
129 | return 0; | 149 | return 0; |
@@ -137,7 +157,7 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio) | |||
137 | 157 | ||
138 | reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */ | 158 | reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */ |
139 | bit = gpio & 0xf; | 159 | bit = gpio & 0xf; |
140 | val = __raw_readl(reg); | 160 | val = readl(reg); |
141 | edge = (val >> (bit << 1)) & 3; | 161 | edge = (val >> (bit << 1)) & 3; |
142 | val &= ~(0x3 << (bit << 1)); | 162 | val &= ~(0x3 << (bit << 1)); |
143 | if (edge == GPIO_INT_HIGH_LEV) { | 163 | if (edge == GPIO_INT_HIGH_LEV) { |
@@ -151,7 +171,7 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio) | |||
151 | gpio, edge); | 171 | gpio, edge); |
152 | return; | 172 | return; |
153 | } | 173 | } |
154 | __raw_writel(val | (edge << (bit << 1)), reg); | 174 | writel(val | (edge << (bit << 1)), reg); |
155 | } | 175 | } |
156 | 176 | ||
157 | /* handle 32 interrupts in one status register */ | 177 | /* handle 32 interrupts in one status register */ |
@@ -177,8 +197,7 @@ static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc) | |||
177 | u32 irq_stat; | 197 | u32 irq_stat; |
178 | struct mxc_gpio_port *port = irq_get_handler_data(irq); | 198 | struct mxc_gpio_port *port = irq_get_handler_data(irq); |
179 | 199 | ||
180 | irq_stat = __raw_readl(port->base + GPIO_ISR) & | 200 | irq_stat = readl(port->base + GPIO_ISR) & readl(port->base + GPIO_IMR); |
181 | __raw_readl(port->base + GPIO_IMR); | ||
182 | 201 | ||
183 | mxc_gpio_irq_handler(port, irq_stat); | 202 | mxc_gpio_irq_handler(port, irq_stat); |
184 | } | 203 | } |
@@ -186,19 +205,18 @@ static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc) | |||
186 | /* MX2 has one interrupt *for all* gpio ports */ | 205 | /* MX2 has one interrupt *for all* gpio ports */ |
187 | static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc) | 206 | static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc) |
188 | { | 207 | { |
189 | int i; | ||
190 | u32 irq_msk, irq_stat; | 208 | u32 irq_msk, irq_stat; |
191 | struct mxc_gpio_port *port = irq_get_handler_data(irq); | 209 | struct mxc_gpio_port *port; |
192 | 210 | ||
193 | /* walk through all interrupt status registers */ | 211 | /* walk through all interrupt status registers */ |
194 | for (i = 0; i < gpio_table_size; i++) { | 212 | list_for_each_entry(port, &mxc_gpio_ports, node) { |
195 | irq_msk = __raw_readl(port[i].base + GPIO_IMR); | 213 | irq_msk = readl(port->base + GPIO_IMR); |
196 | if (!irq_msk) | 214 | if (!irq_msk) |
197 | continue; | 215 | continue; |
198 | 216 | ||
199 | irq_stat = __raw_readl(port[i].base + GPIO_ISR) & irq_msk; | 217 | irq_stat = readl(port->base + GPIO_ISR) & irq_msk; |
200 | if (irq_stat) | 218 | if (irq_stat) |
201 | mxc_gpio_irq_handler(&port[i], irq_stat); | 219 | mxc_gpio_irq_handler(port, irq_stat); |
202 | } | 220 | } |
203 | } | 221 | } |
204 | 222 | ||
@@ -215,7 +233,7 @@ static int gpio_set_wake_irq(struct irq_data *d, u32 enable) | |||
215 | { | 233 | { |
216 | u32 gpio = irq_to_gpio(d->irq); | 234 | u32 gpio = irq_to_gpio(d->irq); |
217 | u32 gpio_idx = gpio & 0x1F; | 235 | u32 gpio_idx = gpio & 0x1F; |
218 | struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32]; | 236 | struct mxc_gpio_port *port = irq_data_get_irq_chip_data(d); |
219 | 237 | ||
220 | if (enable) { | 238 | if (enable) { |
221 | if (port->irq_high && (gpio_idx >= 16)) | 239 | if (port->irq_high && (gpio_idx >= 16)) |
@@ -250,12 +268,12 @@ static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset, | |||
250 | unsigned long flags; | 268 | unsigned long flags; |
251 | 269 | ||
252 | spin_lock_irqsave(&port->lock, flags); | 270 | spin_lock_irqsave(&port->lock, flags); |
253 | l = __raw_readl(port->base + GPIO_GDIR); | 271 | l = readl(port->base + GPIO_GDIR); |
254 | if (dir) | 272 | if (dir) |
255 | l |= 1 << offset; | 273 | l |= 1 << offset; |
256 | else | 274 | else |
257 | l &= ~(1 << offset); | 275 | l &= ~(1 << offset); |
258 | __raw_writel(l, port->base + GPIO_GDIR); | 276 | writel(l, port->base + GPIO_GDIR); |
259 | spin_unlock_irqrestore(&port->lock, flags); | 277 | spin_unlock_irqrestore(&port->lock, flags); |
260 | } | 278 | } |
261 | 279 | ||
@@ -268,8 +286,8 @@ static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
268 | unsigned long flags; | 286 | unsigned long flags; |
269 | 287 | ||
270 | spin_lock_irqsave(&port->lock, flags); | 288 | spin_lock_irqsave(&port->lock, flags); |
271 | l = (__raw_readl(reg) & (~(1 << offset))) | (!!value << offset); | 289 | l = (readl(reg) & (~(1 << offset))) | (!!value << offset); |
272 | __raw_writel(l, reg); | 290 | writel(l, reg); |
273 | spin_unlock_irqrestore(&port->lock, flags); | 291 | spin_unlock_irqrestore(&port->lock, flags); |
274 | } | 292 | } |
275 | 293 | ||
@@ -278,7 +296,7 @@ static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
278 | struct mxc_gpio_port *port = | 296 | struct mxc_gpio_port *port = |
279 | container_of(chip, struct mxc_gpio_port, chip); | 297 | container_of(chip, struct mxc_gpio_port, chip); |
280 | 298 | ||
281 | return (__raw_readl(port->base + GPIO_PSR) >> offset) & 1; | 299 | return (readl(port->base + GPIO_PSR) >> offset) & 1; |
282 | } | 300 | } |
283 | 301 | ||
284 | static int mxc_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 302 | static int mxc_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
@@ -301,61 +319,116 @@ static int mxc_gpio_direction_output(struct gpio_chip *chip, | |||
301 | */ | 319 | */ |
302 | static struct lock_class_key gpio_lock_class; | 320 | static struct lock_class_key gpio_lock_class; |
303 | 321 | ||
304 | int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt) | 322 | static int __devinit mxc_gpio_probe(struct platform_device *pdev) |
305 | { | 323 | { |
306 | int i, j; | 324 | struct mxc_gpio_port *port; |
307 | 325 | struct resource *iores; | |
308 | /* save for local usage */ | 326 | int err, i; |
309 | mxc_gpio_ports = port; | 327 | |
310 | gpio_table_size = cnt; | 328 | port = kzalloc(sizeof(struct mxc_gpio_port), GFP_KERNEL); |
311 | 329 | if (!port) | |
312 | printk(KERN_INFO "MXC GPIO hardware\n"); | 330 | return -ENOMEM; |
313 | |||
314 | for (i = 0; i < cnt; i++) { | ||
315 | /* disable the interrupt and clear the status */ | ||
316 | __raw_writel(0, port[i].base + GPIO_IMR); | ||
317 | __raw_writel(~0, port[i].base + GPIO_ISR); | ||
318 | for (j = port[i].virtual_irq_start; | ||
319 | j < port[i].virtual_irq_start + 32; j++) { | ||
320 | irq_set_lockdep_class(j, &gpio_lock_class); | ||
321 | irq_set_chip_and_handler(j, &gpio_irq_chip, | ||
322 | handle_level_irq); | ||
323 | set_irq_flags(j, IRQF_VALID); | ||
324 | } | ||
325 | 331 | ||
326 | /* register gpio chip */ | 332 | port->virtual_irq_start = MXC_GPIO_IRQ_START + pdev->id * 32; |
327 | port[i].chip.direction_input = mxc_gpio_direction_input; | ||
328 | port[i].chip.direction_output = mxc_gpio_direction_output; | ||
329 | port[i].chip.get = mxc_gpio_get; | ||
330 | port[i].chip.set = mxc_gpio_set; | ||
331 | port[i].chip.base = i * 32; | ||
332 | port[i].chip.ngpio = 32; | ||
333 | 333 | ||
334 | spin_lock_init(&port[i].lock); | 334 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
335 | if (!iores) { | ||
336 | err = -ENODEV; | ||
337 | goto out_kfree; | ||
338 | } | ||
335 | 339 | ||
336 | /* its a serious configuration bug when it fails */ | 340 | if (!request_mem_region(iores->start, resource_size(iores), |
337 | BUG_ON( gpiochip_add(&port[i].chip) < 0 ); | 341 | pdev->name)) { |
342 | err = -EBUSY; | ||
343 | goto out_kfree; | ||
344 | } | ||
338 | 345 | ||
339 | if (cpu_is_mx1() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) { | 346 | port->base = ioremap(iores->start, resource_size(iores)); |
340 | /* setup one handler for each entry */ | 347 | if (!port->base) { |
341 | irq_set_chained_handler(port[i].irq, | 348 | err = -ENOMEM; |
342 | mx3_gpio_irq_handler); | 349 | goto out_release_mem; |
343 | irq_set_handler_data(port[i].irq, &port[i]); | 350 | } |
344 | if (port[i].irq_high) { | 351 | |
345 | /* setup handler for GPIO 16 to 31 */ | 352 | port->irq_high = platform_get_irq(pdev, 1); |
346 | irq_set_chained_handler(port[i].irq_high, | 353 | port->irq = platform_get_irq(pdev, 0); |
347 | mx3_gpio_irq_handler); | 354 | if (port->irq < 0) { |
348 | irq_set_handler_data(port[i].irq_high, | 355 | err = -EINVAL; |
349 | &port[i]); | 356 | goto out_iounmap; |
350 | } | 357 | } |
351 | } | 358 | |
359 | /* disable the interrupt and clear the status */ | ||
360 | writel(0, port->base + GPIO_IMR); | ||
361 | writel(~0, port->base + GPIO_ISR); | ||
362 | |||
363 | for (i = port->virtual_irq_start; | ||
364 | i < port->virtual_irq_start + 32; i++) { | ||
365 | irq_set_lockdep_class(i, &gpio_lock_class); | ||
366 | irq_set_chip_and_handler(i, &gpio_irq_chip, handle_level_irq); | ||
367 | set_irq_flags(i, IRQF_VALID); | ||
368 | irq_set_chip_data(i, port); | ||
352 | } | 369 | } |
353 | 370 | ||
354 | if (cpu_is_mx2()) { | 371 | if (cpu_is_mx2()) { |
355 | /* setup one handler for all GPIO interrupts */ | 372 | /* setup one handler for all GPIO interrupts */ |
356 | irq_set_chained_handler(port[0].irq, mx2_gpio_irq_handler); | 373 | if (pdev->id == 0) |
357 | irq_set_handler_data(port[0].irq, port); | 374 | irq_set_chained_handler(port->irq, |
375 | mx2_gpio_irq_handler); | ||
376 | } else { | ||
377 | /* setup one handler for each entry */ | ||
378 | irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); | ||
379 | irq_set_handler_data(port->irq, port); | ||
380 | if (port->irq_high > 0) { | ||
381 | /* setup handler for GPIO 16 to 31 */ | ||
382 | irq_set_chained_handler(port->irq_high, | ||
383 | mx3_gpio_irq_handler); | ||
384 | irq_set_handler_data(port->irq_high, port); | ||
385 | } | ||
358 | } | 386 | } |
359 | 387 | ||
388 | /* register gpio chip */ | ||
389 | port->chip.direction_input = mxc_gpio_direction_input; | ||
390 | port->chip.direction_output = mxc_gpio_direction_output; | ||
391 | port->chip.get = mxc_gpio_get; | ||
392 | port->chip.set = mxc_gpio_set; | ||
393 | port->chip.base = pdev->id * 32; | ||
394 | port->chip.ngpio = 32; | ||
395 | |||
396 | spin_lock_init(&port->lock); | ||
397 | |||
398 | err = gpiochip_add(&port->chip); | ||
399 | if (err) | ||
400 | goto out_iounmap; | ||
401 | |||
402 | list_add_tail(&port->node, &mxc_gpio_ports); | ||
403 | |||
360 | return 0; | 404 | return 0; |
405 | |||
406 | out_iounmap: | ||
407 | iounmap(port->base); | ||
408 | out_release_mem: | ||
409 | release_mem_region(iores->start, resource_size(iores)); | ||
410 | out_kfree: | ||
411 | kfree(port); | ||
412 | dev_info(&pdev->dev, "%s failed with errno %d\n", __func__, err); | ||
413 | return err; | ||
361 | } | 414 | } |
415 | |||
416 | static struct platform_driver mxc_gpio_driver = { | ||
417 | .driver = { | ||
418 | .name = "gpio-mxc", | ||
419 | .owner = THIS_MODULE, | ||
420 | }, | ||
421 | .probe = mxc_gpio_probe, | ||
422 | }; | ||
423 | |||
424 | static int __init gpio_mxc_init(void) | ||
425 | { | ||
426 | return platform_driver_register(&mxc_gpio_driver); | ||
427 | } | ||
428 | postcore_initcall(gpio_mxc_init); | ||
429 | |||
430 | MODULE_AUTHOR("Freescale Semiconductor, " | ||
431 | "Daniel Mack <danielncaiaq.de>, " | ||
432 | "Juergen Beisert <kernel@pengutronix.de>"); | ||
433 | MODULE_DESCRIPTION("Freescale MXC GPIO"); | ||
434 | MODULE_LICENSE("GPL"); | ||