diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-03-26 06:03:03 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-03-26 06:03:03 -0400 |
commit | 938c0ace3ffb8cc2073a6d2e68fa7a6ab7cb471e (patch) | |
tree | 9257bdba52ce88ca0a0c2f6fce1f59a1eb278452 | |
parent | 16c29dafcc86024048f1dbb8349d31cb22c7c55a (diff) | |
parent | 5898eb79fb45d4fd4ce22139c168de937bfaab38 (diff) |
Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into devel-stable
Conflicts:
arch/arm/mach-pxa/tosa.c
51 files changed, 514 insertions, 582 deletions
diff --git a/arch/arm/include/asm/mach/udc_pxa2xx.h b/arch/arm/include/asm/mach/udc_pxa2xx.h index 833306ee9e7f..ea297ac70bc6 100644 --- a/arch/arm/include/asm/mach/udc_pxa2xx.h +++ b/arch/arm/include/asm/mach/udc_pxa2xx.h | |||
@@ -20,8 +20,6 @@ struct pxa2xx_udc_mach_info { | |||
20 | * VBUS IRQ and omit the methods above. Store the GPIO number | 20 | * VBUS IRQ and omit the methods above. Store the GPIO number |
21 | * here. Note that sometimes the signals go through inverters... | 21 | * here. Note that sometimes the signals go through inverters... |
22 | */ | 22 | */ |
23 | bool gpio_vbus_inverted; | ||
24 | int gpio_vbus; /* high == vbus present */ | ||
25 | bool gpio_pullup_inverted; | 23 | bool gpio_pullup_inverted; |
26 | int gpio_pullup; /* high == pullup activated */ | 24 | int gpio_pullup; /* high == pullup activated */ |
27 | }; | 25 | }; |
diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c index 3499fada73ae..4cb069fd9af2 100644 --- a/arch/arm/mach-pxa/am200epd.c +++ b/arch/arm/mach-pxa/am200epd.c | |||
@@ -128,8 +128,8 @@ static int am200_init_gpio_regs(struct metronomefb_par *par) | |||
128 | return 0; | 128 | return 0; |
129 | 129 | ||
130 | err_req_gpio: | 130 | err_req_gpio: |
131 | while (i > 0) | 131 | while (--i >= 0) |
132 | gpio_free(gpios[i--]); | 132 | gpio_free(gpios[i]); |
133 | 133 | ||
134 | return err; | 134 | return err; |
135 | } | 135 | } |
@@ -194,7 +194,7 @@ static struct notifier_block am200_fb_notif = { | |||
194 | }; | 194 | }; |
195 | 195 | ||
196 | /* this gets called as part of our init. these steps must be done now so | 196 | /* this gets called as part of our init. these steps must be done now so |
197 | * that we can use set_pxa_fb_info */ | 197 | * that we can use pxa_set_fb_info */ |
198 | static void __init am200_presetup_fb(void) | 198 | static void __init am200_presetup_fb(void) |
199 | { | 199 | { |
200 | int fw; | 200 | int fw; |
@@ -249,7 +249,7 @@ static void __init am200_presetup_fb(void) | |||
249 | /* we divide since we told the LCD controller we're 16bpp */ | 249 | /* we divide since we told the LCD controller we're 16bpp */ |
250 | am200_fb_info.modes->xres /= 2; | 250 | am200_fb_info.modes->xres /= 2; |
251 | 251 | ||
252 | set_pxa_fb_info(&am200_fb_info); | 252 | pxa_set_fb_info(NULL, &am200_fb_info); |
253 | 253 | ||
254 | } | 254 | } |
255 | 255 | ||
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c index 993d75e66390..fa8bad235d9f 100644 --- a/arch/arm/mach-pxa/am300epd.c +++ b/arch/arm/mach-pxa/am300epd.c | |||
@@ -125,10 +125,7 @@ static int am300_init_gpio_regs(struct broadsheetfb_par *par) | |||
125 | if (err) { | 125 | if (err) { |
126 | dev_err(&am300_device->dev, "failed requesting " | 126 | dev_err(&am300_device->dev, "failed requesting " |
127 | "gpio %d, err=%d\n", i, err); | 127 | "gpio %d, err=%d\n", i, err); |
128 | while (i >= DB0_GPIO_PIN) | 128 | goto err_req_gpio2; |
129 | gpio_free(i--); | ||
130 | i = ARRAY_SIZE(gpios) - 1; | ||
131 | goto err_req_gpio; | ||
132 | } | 129 | } |
133 | } | 130 | } |
134 | 131 | ||
@@ -159,9 +156,13 @@ static int am300_init_gpio_regs(struct broadsheetfb_par *par) | |||
159 | 156 | ||
160 | return 0; | 157 | return 0; |
161 | 158 | ||
159 | err_req_gpio2: | ||
160 | while (--i >= DB0_GPIO_PIN) | ||
161 | gpio_free(i); | ||
162 | i = ARRAY_SIZE(gpios); | ||
162 | err_req_gpio: | 163 | err_req_gpio: |
163 | while (i > 0) | 164 | while (--i >= 0) |
164 | gpio_free(gpios[i--]); | 165 | gpio_free(gpios[i]); |
165 | 166 | ||
166 | return err; | 167 | return err; |
167 | } | 168 | } |
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c index d2af73321dae..c6661b1d30b2 100644 --- a/arch/arm/mach-pxa/balloon3.c +++ b/arch/arm/mach-pxa/balloon3.c | |||
@@ -263,7 +263,7 @@ static void __init balloon3_lcd_init(void) | |||
263 | } | 263 | } |
264 | 264 | ||
265 | balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power; | 265 | balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power; |
266 | set_pxa_fb_info(&balloon3_lcd_screen); | 266 | pxa_set_fb_info(NULL, &balloon3_lcd_screen); |
267 | return; | 267 | return; |
268 | 268 | ||
269 | err2: | 269 | err2: |
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c index b734d8468168..8225e2e58c6e 100644 --- a/arch/arm/mach-pxa/cm-x2xx.c +++ b/arch/arm/mach-pxa/cm-x2xx.c | |||
@@ -379,7 +379,7 @@ __setup("monitor=", cmx2xx_set_display); | |||
379 | 379 | ||
380 | static void __init cmx2xx_init_display(void) | 380 | static void __init cmx2xx_init_display(void) |
381 | { | 381 | { |
382 | set_pxa_fb_info(cmx2xx_display); | 382 | pxa_set_fb_info(NULL, cmx2xx_display); |
383 | } | 383 | } |
384 | #else | 384 | #else |
385 | static inline void cmx2xx_init_display(void) {} | 385 | static inline void cmx2xx_init_display(void) {} |
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index bfca7ed2fea3..7a8edba0dcdf 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -296,7 +296,7 @@ static struct pxafb_mach_info cm_x300_lcd = { | |||
296 | 296 | ||
297 | static void __init cm_x300_init_lcd(void) | 297 | static void __init cm_x300_init_lcd(void) |
298 | { | 298 | { |
299 | set_pxa_fb_info(&cm_x300_lcd); | 299 | pxa_set_fb_info(NULL, &cm_x300_lcd); |
300 | } | 300 | } |
301 | #else | 301 | #else |
302 | static inline void cm_x300_init_lcd(void) {} | 302 | static inline void cm_x300_init_lcd(void) {} |
diff --git a/arch/arm/mach-pxa/colibri-pxa270-income.c b/arch/arm/mach-pxa/colibri-pxa270-income.c index ee797397dc5b..44c1b77ece67 100644 --- a/arch/arm/mach-pxa/colibri-pxa270-income.c +++ b/arch/arm/mach-pxa/colibri-pxa270-income.c | |||
@@ -175,7 +175,7 @@ static struct pxafb_mach_info income_lcd_screen = { | |||
175 | 175 | ||
176 | static void __init income_lcd_init(void) | 176 | static void __init income_lcd_init(void) |
177 | { | 177 | { |
178 | set_pxa_fb_info(&income_lcd_screen); | 178 | pxa_set_fb_info(NULL, &income_lcd_screen); |
179 | } | 179 | } |
180 | #else | 180 | #else |
181 | static inline void income_lcd_init(void) {} | 181 | static inline void income_lcd_init(void) {} |
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c index 96b2d9fbfef0..3f9be419959d 100644 --- a/arch/arm/mach-pxa/colibri-pxa3xx.c +++ b/arch/arm/mach-pxa/colibri-pxa3xx.c | |||
@@ -105,7 +105,7 @@ void __init colibri_pxa3xx_init_lcd(int bl_pin) | |||
105 | lcd_bl_pin = bl_pin; | 105 | lcd_bl_pin = bl_pin; |
106 | gpio_request(bl_pin, "lcd backlight"); | 106 | gpio_request(bl_pin, "lcd backlight"); |
107 | gpio_direction_output(bl_pin, 0); | 107 | gpio_direction_output(bl_pin, 0); |
108 | set_pxa_fb_info(&sharp_lq43_info); | 108 | pxa_set_fb_info(NULL, &sharp_lq43_info); |
109 | } | 109 | } |
110 | #endif | 110 | #endif |
111 | 111 | ||
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index d4e705caefea..3a5507e31919 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -462,7 +462,6 @@ static struct pxaficp_platform_data corgi_ficp_platform_data = { | |||
462 | * USB Device Controller | 462 | * USB Device Controller |
463 | */ | 463 | */ |
464 | static struct pxa2xx_udc_mach_info udc_info __initdata = { | 464 | static struct pxa2xx_udc_mach_info udc_info __initdata = { |
465 | .gpio_vbus = -1, | ||
466 | /* no connect GPIO; corgi can't tell connection status */ | 465 | /* no connect GPIO; corgi can't tell connection status */ |
467 | .gpio_pullup = CORGI_GPIO_USB_PULLUP, | 466 | .gpio_pullup = CORGI_GPIO_USB_PULLUP, |
468 | }; | 467 | }; |
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index c4bf08b3eb61..2e0425404de5 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -90,7 +90,6 @@ void __init pxa_set_mci_info(struct pxamci_platform_data *info) | |||
90 | 90 | ||
91 | static struct pxa2xx_udc_mach_info pxa_udc_info = { | 91 | static struct pxa2xx_udc_mach_info pxa_udc_info = { |
92 | .gpio_pullup = -1, | 92 | .gpio_pullup = -1, |
93 | .gpio_vbus = -1, | ||
94 | }; | 93 | }; |
95 | 94 | ||
96 | void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info) | 95 | void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info) |
@@ -188,16 +187,12 @@ struct platform_device pxa_device_fb = { | |||
188 | .resource = pxafb_resources, | 187 | .resource = pxafb_resources, |
189 | }; | 188 | }; |
190 | 189 | ||
191 | void __init set_pxa_fb_info(struct pxafb_mach_info *info) | 190 | void __init pxa_set_fb_info(struct device *parent, struct pxafb_mach_info *info) |
192 | { | 191 | { |
192 | pxa_device_fb.dev.parent = parent; | ||
193 | pxa_register_device(&pxa_device_fb, info); | 193 | pxa_register_device(&pxa_device_fb, info); |
194 | } | 194 | } |
195 | 195 | ||
196 | void __init set_pxa_fb_parent(struct device *parent_dev) | ||
197 | { | ||
198 | pxa_device_fb.dev.parent = parent_dev; | ||
199 | } | ||
200 | |||
201 | static struct resource pxa_resource_ffuart[] = { | 196 | static struct resource pxa_resource_ffuart[] = { |
202 | { | 197 | { |
203 | .start = 0x40100000, | 198 | .start = 0x40100000, |
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index b411d7cbf5a1..f8a6e9d79a3a 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -689,7 +689,7 @@ static struct pxafb_mach_info em_x270_lcd = { | |||
689 | 689 | ||
690 | static void __init em_x270_init_lcd(void) | 690 | static void __init em_x270_init_lcd(void) |
691 | { | 691 | { |
692 | set_pxa_fb_info(&em_x270_lcd); | 692 | pxa_set_fb_info(NULL, &em_x270_lcd); |
693 | } | 693 | } |
694 | #else | 694 | #else |
695 | static inline void em_x270_init_lcd(void) {} | 695 | static inline void em_x270_init_lcd(void) {} |
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index edca0a043293..2e3970fdde0b 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/mfd/t7l66xb.h> | 20 | #include <linux/mfd/t7l66xb.h> |
21 | #include <linux/mtd/nand.h> | 21 | #include <linux/mtd/nand.h> |
22 | #include <linux/mtd/partitions.h> | 22 | #include <linux/mtd/partitions.h> |
23 | #include <linux/usb/gpio_vbus.h> | ||
23 | 24 | ||
24 | #include <video/w100fb.h> | 25 | #include <video/w100fb.h> |
25 | 26 | ||
@@ -51,12 +52,20 @@ void __init eseries_fixup(struct machine_desc *desc, | |||
51 | mi->bank[0].size = (64*1024*1024); | 52 | mi->bank[0].size = (64*1024*1024); |
52 | } | 53 | } |
53 | 54 | ||
54 | struct pxa2xx_udc_mach_info e7xx_udc_mach_info = { | 55 | struct gpio_vbus_mach_info e7xx_udc_info = { |
55 | .gpio_vbus = GPIO_E7XX_USB_DISC, | 56 | .gpio_vbus = GPIO_E7XX_USB_DISC, |
56 | .gpio_pullup = GPIO_E7XX_USB_PULLUP, | 57 | .gpio_pullup = GPIO_E7XX_USB_PULLUP, |
57 | .gpio_pullup_inverted = 1 | 58 | .gpio_pullup_inverted = 1 |
58 | }; | 59 | }; |
59 | 60 | ||
61 | static struct platform_device e7xx_gpio_vbus = { | ||
62 | .name = "gpio-vbus", | ||
63 | .id = -1, | ||
64 | .dev = { | ||
65 | .platform_data = &e7xx_udc_info, | ||
66 | }, | ||
67 | }; | ||
68 | |||
60 | struct pxaficp_platform_data e7xx_ficp_platform_data = { | 69 | struct pxaficp_platform_data e7xx_ficp_platform_data = { |
61 | .gpio_pwdown = GPIO_E7XX_IR_OFF, | 70 | .gpio_pwdown = GPIO_E7XX_IR_OFF, |
62 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 71 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
@@ -165,6 +174,7 @@ static struct platform_device e330_tc6387xb_device = { | |||
165 | 174 | ||
166 | static struct platform_device *e330_devices[] __initdata = { | 175 | static struct platform_device *e330_devices[] __initdata = { |
167 | &e330_tc6387xb_device, | 176 | &e330_tc6387xb_device, |
177 | &e7xx_gpio_vbus, | ||
168 | }; | 178 | }; |
169 | 179 | ||
170 | static void __init e330_init(void) | 180 | static void __init e330_init(void) |
@@ -175,7 +185,6 @@ static void __init e330_init(void) | |||
175 | eseries_register_clks(); | 185 | eseries_register_clks(); |
176 | eseries_get_tmio_gpios(); | 186 | eseries_get_tmio_gpios(); |
177 | platform_add_devices(ARRAY_AND_SIZE(e330_devices)); | 187 | platform_add_devices(ARRAY_AND_SIZE(e330_devices)); |
178 | pxa_set_udc_info(&e7xx_udc_mach_info); | ||
179 | } | 188 | } |
180 | 189 | ||
181 | MACHINE_START(E330, "Toshiba e330") | 190 | MACHINE_START(E330, "Toshiba e330") |
@@ -214,6 +223,7 @@ static struct platform_device e350_t7l66xb_device = { | |||
214 | 223 | ||
215 | static struct platform_device *e350_devices[] __initdata = { | 224 | static struct platform_device *e350_devices[] __initdata = { |
216 | &e350_t7l66xb_device, | 225 | &e350_t7l66xb_device, |
226 | &e7xx_gpio_vbus, | ||
217 | }; | 227 | }; |
218 | 228 | ||
219 | static void __init e350_init(void) | 229 | static void __init e350_init(void) |
@@ -224,7 +234,6 @@ static void __init e350_init(void) | |||
224 | eseries_register_clks(); | 234 | eseries_register_clks(); |
225 | eseries_get_tmio_gpios(); | 235 | eseries_get_tmio_gpios(); |
226 | platform_add_devices(ARRAY_AND_SIZE(e350_devices)); | 236 | platform_add_devices(ARRAY_AND_SIZE(e350_devices)); |
227 | pxa_set_udc_info(&e7xx_udc_mach_info); | ||
228 | } | 237 | } |
229 | 238 | ||
230 | MACHINE_START(E350, "Toshiba e350") | 239 | MACHINE_START(E350, "Toshiba e350") |
@@ -333,6 +342,7 @@ static struct platform_device e400_t7l66xb_device = { | |||
333 | 342 | ||
334 | static struct platform_device *e400_devices[] __initdata = { | 343 | static struct platform_device *e400_devices[] __initdata = { |
335 | &e400_t7l66xb_device, | 344 | &e400_t7l66xb_device, |
345 | &e7xx_gpio_vbus, | ||
336 | }; | 346 | }; |
337 | 347 | ||
338 | static void __init e400_init(void) | 348 | static void __init e400_init(void) |
@@ -344,9 +354,8 @@ static void __init e400_init(void) | |||
344 | /* Fixme - e400 may have a switched clock */ | 354 | /* Fixme - e400 may have a switched clock */ |
345 | eseries_register_clks(); | 355 | eseries_register_clks(); |
346 | eseries_get_tmio_gpios(); | 356 | eseries_get_tmio_gpios(); |
347 | set_pxa_fb_info(&e400_pxafb_mach_info); | 357 | pxa_set_fb_info(NULL, &e400_pxafb_mach_info); |
348 | platform_add_devices(ARRAY_AND_SIZE(e400_devices)); | 358 | platform_add_devices(ARRAY_AND_SIZE(e400_devices)); |
349 | pxa_set_udc_info(&e7xx_udc_mach_info); | ||
350 | } | 359 | } |
351 | 360 | ||
352 | MACHINE_START(E400, "Toshiba e400") | 361 | MACHINE_START(E400, "Toshiba e400") |
@@ -519,6 +528,7 @@ static struct platform_device e740_t7l66xb_device = { | |||
519 | static struct platform_device *e740_devices[] __initdata = { | 528 | static struct platform_device *e740_devices[] __initdata = { |
520 | &e740_fb_device, | 529 | &e740_fb_device, |
521 | &e740_t7l66xb_device, | 530 | &e740_t7l66xb_device, |
531 | &e7xx_gpio_vbus, | ||
522 | }; | 532 | }; |
523 | 533 | ||
524 | static void __init e740_init(void) | 534 | static void __init e740_init(void) |
@@ -532,7 +542,6 @@ static void __init e740_init(void) | |||
532 | "UDCCLK", &pxa25x_device_udc.dev), | 542 | "UDCCLK", &pxa25x_device_udc.dev), |
533 | eseries_get_tmio_gpios(); | 543 | eseries_get_tmio_gpios(); |
534 | platform_add_devices(ARRAY_AND_SIZE(e740_devices)); | 544 | platform_add_devices(ARRAY_AND_SIZE(e740_devices)); |
535 | pxa_set_udc_info(&e7xx_udc_mach_info); | ||
536 | pxa_set_ac97_info(NULL); | 545 | pxa_set_ac97_info(NULL); |
537 | pxa_set_ficp_info(&e7xx_ficp_platform_data); | 546 | pxa_set_ficp_info(&e7xx_ficp_platform_data); |
538 | } | 547 | } |
@@ -711,6 +720,7 @@ static struct platform_device e750_tc6393xb_device = { | |||
711 | static struct platform_device *e750_devices[] __initdata = { | 720 | static struct platform_device *e750_devices[] __initdata = { |
712 | &e750_fb_device, | 721 | &e750_fb_device, |
713 | &e750_tc6393xb_device, | 722 | &e750_tc6393xb_device, |
723 | &e7xx_gpio_vbus, | ||
714 | }; | 724 | }; |
715 | 725 | ||
716 | static void __init e750_init(void) | 726 | static void __init e750_init(void) |
@@ -723,7 +733,6 @@ static void __init e750_init(void) | |||
723 | "GPIO11_CLK", NULL), | 733 | "GPIO11_CLK", NULL), |
724 | eseries_get_tmio_gpios(); | 734 | eseries_get_tmio_gpios(); |
725 | platform_add_devices(ARRAY_AND_SIZE(e750_devices)); | 735 | platform_add_devices(ARRAY_AND_SIZE(e750_devices)); |
726 | pxa_set_udc_info(&e7xx_udc_mach_info); | ||
727 | pxa_set_ac97_info(NULL); | 736 | pxa_set_ac97_info(NULL); |
728 | pxa_set_ficp_info(&e7xx_ficp_platform_data); | 737 | pxa_set_ficp_info(&e7xx_ficp_platform_data); |
729 | } | 738 | } |
@@ -873,12 +882,21 @@ static struct platform_device e800_fb_device = { | |||
873 | 882 | ||
874 | /* --------------------------- UDC definitions --------------------------- */ | 883 | /* --------------------------- UDC definitions --------------------------- */ |
875 | 884 | ||
876 | static struct pxa2xx_udc_mach_info e800_udc_mach_info = { | 885 | static struct gpio_vbus_mach_info e800_udc_info = { |
877 | .gpio_vbus = GPIO_E800_USB_DISC, | 886 | .gpio_vbus = GPIO_E800_USB_DISC, |
878 | .gpio_pullup = GPIO_E800_USB_PULLUP, | 887 | .gpio_pullup = GPIO_E800_USB_PULLUP, |
879 | .gpio_pullup_inverted = 1 | 888 | .gpio_pullup_inverted = 1 |
880 | }; | 889 | }; |
881 | 890 | ||
891 | static struct platform_device e800_gpio_vbus = { | ||
892 | .name = "gpio-vbus", | ||
893 | .id = -1, | ||
894 | .dev = { | ||
895 | .platform_data = &e800_udc_info, | ||
896 | }, | ||
897 | }; | ||
898 | |||
899 | |||
882 | /* ----------------- e800 tc6393xb parameters ------------------ */ | 900 | /* ----------------- e800 tc6393xb parameters ------------------ */ |
883 | 901 | ||
884 | static struct tc6393xb_platform_data e800_tc6393xb_info = { | 902 | static struct tc6393xb_platform_data e800_tc6393xb_info = { |
@@ -907,6 +925,7 @@ static struct platform_device e800_tc6393xb_device = { | |||
907 | static struct platform_device *e800_devices[] __initdata = { | 925 | static struct platform_device *e800_devices[] __initdata = { |
908 | &e800_fb_device, | 926 | &e800_fb_device, |
909 | &e800_tc6393xb_device, | 927 | &e800_tc6393xb_device, |
928 | &e800_gpio_vbus, | ||
910 | }; | 929 | }; |
911 | 930 | ||
912 | static void __init e800_init(void) | 931 | static void __init e800_init(void) |
@@ -919,7 +938,6 @@ static void __init e800_init(void) | |||
919 | "GPIO11_CLK", NULL), | 938 | "GPIO11_CLK", NULL), |
920 | eseries_get_tmio_gpios(); | 939 | eseries_get_tmio_gpios(); |
921 | platform_add_devices(ARRAY_AND_SIZE(e800_devices)); | 940 | platform_add_devices(ARRAY_AND_SIZE(e800_devices)); |
922 | pxa_set_udc_info(&e800_udc_mach_info); | ||
923 | pxa_set_ac97_info(NULL); | 941 | pxa_set_ac97_info(NULL); |
924 | } | 942 | } |
925 | 943 | ||
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index 93f05e024313..d88aed8fbe15 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c | |||
@@ -783,7 +783,7 @@ static void __init a780_init(void) | |||
783 | 783 | ||
784 | pxa_set_i2c_info(NULL); | 784 | pxa_set_i2c_info(NULL); |
785 | 785 | ||
786 | set_pxa_fb_info(&ezx_fb_info_1); | 786 | pxa_set_fb_info(NULL, &ezx_fb_info_1); |
787 | 787 | ||
788 | pxa_set_keypad_info(&a780_keypad_platform_data); | 788 | pxa_set_keypad_info(&a780_keypad_platform_data); |
789 | 789 | ||
@@ -853,7 +853,7 @@ static void __init e680_init(void) | |||
853 | pxa_set_i2c_info(NULL); | 853 | pxa_set_i2c_info(NULL); |
854 | i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info)); | 854 | i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info)); |
855 | 855 | ||
856 | set_pxa_fb_info(&ezx_fb_info_1); | 856 | pxa_set_fb_info(NULL, &ezx_fb_info_1); |
857 | 857 | ||
858 | pxa_set_keypad_info(&e680_keypad_platform_data); | 858 | pxa_set_keypad_info(&e680_keypad_platform_data); |
859 | 859 | ||
@@ -918,7 +918,7 @@ static void __init a1200_init(void) | |||
918 | pxa_set_i2c_info(NULL); | 918 | pxa_set_i2c_info(NULL); |
919 | i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info)); | 919 | i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info)); |
920 | 920 | ||
921 | set_pxa_fb_info(&ezx_fb_info_2); | 921 | pxa_set_fb_info(NULL, &ezx_fb_info_2); |
922 | 922 | ||
923 | pxa_set_keypad_info(&a1200_keypad_platform_data); | 923 | pxa_set_keypad_info(&a1200_keypad_platform_data); |
924 | 924 | ||
@@ -1103,7 +1103,7 @@ static void __init a910_init(void) | |||
1103 | pxa_set_i2c_info(NULL); | 1103 | pxa_set_i2c_info(NULL); |
1104 | i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info)); | 1104 | i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info)); |
1105 | 1105 | ||
1106 | set_pxa_fb_info(&ezx_fb_info_2); | 1106 | pxa_set_fb_info(NULL, &ezx_fb_info_2); |
1107 | 1107 | ||
1108 | pxa_set_keypad_info(&a910_keypad_platform_data); | 1108 | pxa_set_keypad_info(&a910_keypad_platform_data); |
1109 | 1109 | ||
@@ -1173,7 +1173,7 @@ static void __init e6_init(void) | |||
1173 | pxa_set_i2c_info(NULL); | 1173 | pxa_set_i2c_info(NULL); |
1174 | i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info)); | 1174 | i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info)); |
1175 | 1175 | ||
1176 | set_pxa_fb_info(&ezx_fb_info_2); | 1176 | pxa_set_fb_info(NULL, &ezx_fb_info_2); |
1177 | 1177 | ||
1178 | pxa_set_keypad_info(&e6_keypad_platform_data); | 1178 | pxa_set_keypad_info(&e6_keypad_platform_data); |
1179 | 1179 | ||
@@ -1212,7 +1212,7 @@ static void __init e2_init(void) | |||
1212 | pxa_set_i2c_info(NULL); | 1212 | pxa_set_i2c_info(NULL); |
1213 | i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info)); | 1213 | i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info)); |
1214 | 1214 | ||
1215 | set_pxa_fb_info(&ezx_fb_info_2); | 1215 | pxa_set_fb_info(NULL, &ezx_fb_info_2); |
1216 | 1216 | ||
1217 | pxa_set_keypad_info(&e2_keypad_platform_data); | 1217 | pxa_set_keypad_info(&e2_keypad_platform_data); |
1218 | 1218 | ||
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index 6fd319ea5284..d65e4bde9b91 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
29 | #include <linux/usb/gpio_vbus.h> | ||
29 | 30 | ||
30 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
31 | #include <asm/memory.h> | 32 | #include <asm/memory.h> |
@@ -106,14 +107,22 @@ static void __init gumstix_mmc_init(void) | |||
106 | #endif | 107 | #endif |
107 | 108 | ||
108 | #ifdef CONFIG_USB_GADGET_PXA25X | 109 | #ifdef CONFIG_USB_GADGET_PXA25X |
109 | static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = { | 110 | static struct gpio_vbus_mach_info gumstix_udc_info = { |
110 | .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn, | 111 | .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn, |
111 | .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx, | 112 | .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx, |
112 | }; | 113 | }; |
113 | 114 | ||
115 | static struct platform_device gumstix_gpio_vbus = { | ||
116 | .name = "gpio-vbus", | ||
117 | .id = -1, | ||
118 | .dev = { | ||
119 | .platform_data = &gumstix_udc_info, | ||
120 | }, | ||
121 | }; | ||
122 | |||
114 | static void __init gumstix_udc_init(void) | 123 | static void __init gumstix_udc_init(void) |
115 | { | 124 | { |
116 | pxa_set_udc_info(&gumstix_udc_info); | 125 | platform_device_register(&gumstix_gpio_vbus); |
117 | } | 126 | } |
118 | #else | 127 | #else |
119 | static void gumstix_udc_init(void) | 128 | static void gumstix_udc_init(void) |
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index dd40e4a9291c..f7fb64f11a7d 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -167,7 +167,7 @@ static void __init idp_init(void) | |||
167 | 167 | ||
168 | platform_device_register(&smc91x_device); | 168 | platform_device_register(&smc91x_device); |
169 | //platform_device_register(&mst_audio_device); | 169 | //platform_device_register(&mst_audio_device); |
170 | set_pxa_fb_info(&sharp_lm8v31); | 170 | pxa_set_fb_info(NULL, &sharp_lm8v31); |
171 | pxa_set_mci_info(&idp_mci_platform_data); | 171 | pxa_set_mci_info(&idp_mci_platform_data); |
172 | } | 172 | } |
173 | 173 | ||
diff --git a/arch/arm/mach-pxa/include/mach/palmz72.h b/arch/arm/mach-pxa/include/mach/palmz72.h index 2bbcf70dd935..0d4700a79612 100644 --- a/arch/arm/mach-pxa/include/mach/palmz72.h +++ b/arch/arm/mach-pxa/include/mach/palmz72.h | |||
@@ -44,6 +44,11 @@ | |||
44 | #define GPIO_NR_PALMZ72_BT_POWER 17 | 44 | #define GPIO_NR_PALMZ72_BT_POWER 17 |
45 | #define GPIO_NR_PALMZ72_BT_RESET 83 | 45 | #define GPIO_NR_PALMZ72_BT_RESET 83 |
46 | 46 | ||
47 | /* Camera */ | ||
48 | #define GPIO_NR_PALMZ72_CAM_PWDN 56 | ||
49 | #define GPIO_NR_PALMZ72_CAM_RESET 57 | ||
50 | #define GPIO_NR_PALMZ72_CAM_POWER 91 | ||
51 | |||
47 | /** Initial values **/ | 52 | /** Initial values **/ |
48 | 53 | ||
49 | /* Battery */ | 54 | /* Battery */ |
diff --git a/arch/arm/mach-pxa/include/mach/pxafb.h b/arch/arm/mach-pxa/include/mach/pxafb.h index 160ec83f51a6..01a45ac48114 100644 --- a/arch/arm/mach-pxa/include/mach/pxafb.h +++ b/arch/arm/mach-pxa/include/mach/pxafb.h | |||
@@ -154,8 +154,8 @@ struct pxafb_mach_info { | |||
154 | void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *); | 154 | void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *); |
155 | void (*smart_update)(struct fb_info *); | 155 | void (*smart_update)(struct fb_info *); |
156 | }; | 156 | }; |
157 | void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); | 157 | |
158 | void set_pxa_fb_parent(struct device *parent_dev); | 158 | void pxa_set_fb_info(struct device *, struct pxafb_mach_info *); |
159 | unsigned long pxafb_get_hsync_time(struct device *dev); | 159 | unsigned long pxafb_get_hsync_time(struct device *dev); |
160 | 160 | ||
161 | extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int); | 161 | extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int); |
diff --git a/arch/arm/mach-pxa/include/mach/z2.h b/arch/arm/mach-pxa/include/mach/z2.h index 8835c16bc82f..7b0f71ef3167 100644 --- a/arch/arm/mach-pxa/include/mach/z2.h +++ b/arch/arm/mach-pxa/include/mach/z2.h | |||
@@ -25,8 +25,7 @@ | |||
25 | #define GPIO98_ZIPITZ2_LID_BUTTON 98 | 25 | #define GPIO98_ZIPITZ2_LID_BUTTON 98 |
26 | 26 | ||
27 | /* Libertas GSPI8686 WiFi */ | 27 | /* Libertas GSPI8686 WiFi */ |
28 | #define GPIO14_ZIPITZ2_WIFI_RESET 14 | 28 | #define GPIO14_ZIPITZ2_WIFI_POWER 14 |
29 | #define GPIO15_ZIPITZ2_WIFI_POWER 15 | ||
30 | #define GPIO24_ZIPITZ2_WIFI_CS 24 | 29 | #define GPIO24_ZIPITZ2_WIFI_CS 24 |
31 | #define GPIO36_ZIPITZ2_WIFI_IRQ 36 | 30 | #define GPIO36_ZIPITZ2_WIFI_IRQ 36 |
32 | 31 | ||
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index 87c1ed9ccd2f..e5e326d2cdc9 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c | |||
@@ -185,7 +185,7 @@ static struct pxafb_mach_info littleton_lcd_info = { | |||
185 | 185 | ||
186 | static void littleton_init_lcd(void) | 186 | static void littleton_init_lcd(void) |
187 | { | 187 | { |
188 | set_pxa_fb_info(&littleton_lcd_info); | 188 | pxa_set_fb_info(NULL, &littleton_lcd_info); |
189 | } | 189 | } |
190 | #else | 190 | #else |
191 | static inline void littleton_init_lcd(void) {}; | 191 | static inline void littleton_init_lcd(void) {}; |
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c index c9a3e775c2de..8aebc58c9f1d 100644 --- a/arch/arm/mach-pxa/lpd270.c +++ b/arch/arm/mach-pxa/lpd270.c | |||
@@ -480,7 +480,7 @@ static void __init lpd270_init(void) | |||
480 | pxa_set_ac97_info(NULL); | 480 | pxa_set_ac97_info(NULL); |
481 | 481 | ||
482 | if (lpd270_lcd_to_use != NULL) | 482 | if (lpd270_lcd_to_use != NULL) |
483 | set_pxa_fb_info(lpd270_lcd_to_use); | 483 | pxa_set_fb_info(NULL, lpd270_lcd_to_use); |
484 | 484 | ||
485 | pxa_set_ohci_info(&lpd270_ohci_platform_data); | 485 | pxa_set_ohci_info(&lpd270_ohci_platform_data); |
486 | } | 486 | } |
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index dca20de306bb..12a2a56b2157 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -521,7 +521,7 @@ static void __init lubbock_init(void) | |||
521 | 521 | ||
522 | clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); | 522 | clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); |
523 | pxa_set_udc_info(&udc_info); | 523 | pxa_set_udc_info(&udc_info); |
524 | set_pxa_fb_info(&sharp_lm8v31); | 524 | pxa_set_fb_info(NULL, &sharp_lm8v31); |
525 | pxa_set_mci_info(&lubbock_mci_platform_data); | 525 | pxa_set_mci_info(&lubbock_mci_platform_data); |
526 | pxa_set_ficp_info(&lubbock_ficp_platform_data); | 526 | pxa_set_ficp_info(&lubbock_ficp_platform_data); |
527 | pxa_set_ac97_info(NULL); | 527 | pxa_set_ac97_info(NULL); |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 5535991c4a3c..a72993dde2b3 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -757,7 +757,7 @@ static void __init magician_init(void) | |||
757 | gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0); | 757 | gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
758 | gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0); | 758 | gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
759 | gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0); | 759 | gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
760 | set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); | 760 | pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info); |
761 | } else | 761 | } else |
762 | pr_err("LCD detection: CPLD mapping failed\n"); | 762 | pr_err("LCD detection: CPLD mapping failed\n"); |
763 | } | 763 | } |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index f9542220595a..8306b227e61c 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -592,7 +592,7 @@ static void __init mainstone_init(void) | |||
592 | else | 592 | else |
593 | mainstone_pxafb_info.modes = &toshiba_ltm035a776c_mode; | 593 | mainstone_pxafb_info.modes = &toshiba_ltm035a776c_mode; |
594 | 594 | ||
595 | set_pxa_fb_info(&mainstone_pxafb_info); | 595 | pxa_set_fb_info(NULL, &mainstone_pxafb_info); |
596 | mainstone_backlight_register(); | 596 | mainstone_backlight_register(); |
597 | 597 | ||
598 | pxa_set_mci_info(&mainstone_mci_platform_data); | 598 | pxa_set_mci_info(&mainstone_mci_platform_data); |
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 78d98a8607ec..dd13bb63259b 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -795,7 +795,7 @@ static void __init mioa701_machine_init(void) | |||
795 | pxa_set_stuart_info(NULL); | 795 | pxa_set_stuart_info(NULL); |
796 | mio_gpio_request(ARRAY_AND_SIZE(global_gpios)); | 796 | mio_gpio_request(ARRAY_AND_SIZE(global_gpios)); |
797 | bootstrap_init(); | 797 | bootstrap_init(); |
798 | set_pxa_fb_info(&mioa701_pxafb_info); | 798 | pxa_set_fb_info(NULL, &mioa701_pxafb_info); |
799 | pxa_set_mci_info(&mioa701_mci_info); | 799 | pxa_set_mci_info(&mioa701_mci_info); |
800 | pxa_set_keypad_info(&mioa701_keypad_info); | 800 | pxa_set_keypad_info(&mioa701_keypad_info); |
801 | pxa_set_udc_info(&mioa701_udc_info); | 801 | pxa_set_udc_info(&mioa701_udc_info); |
diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c index 72adb3ae2b43..325c245c0a0d 100644 --- a/arch/arm/mach-pxa/palm27x.c +++ b/arch/arm/mach-pxa/palm27x.c | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Common code for Palm LD, T5, TX, Z72 | 2 | * Common code for Palm LD, T5, TX, Z72 |
3 | * | 3 | * |
4 | * Copyright (C) 2010 | 4 | * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com> |
5 | * Marek Vasut <marek.vasut@gmail.com> | ||
6 | * | 5 | * |
7 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
@@ -158,7 +157,7 @@ void __init palm27x_lcd_init(int power, struct pxafb_mode_info *mode) | |||
158 | palm27x_lcd_screen.pxafb_lcd_power = palm27x_lcd_ctl; | 157 | palm27x_lcd_screen.pxafb_lcd_power = palm27x_lcd_ctl; |
159 | } | 158 | } |
160 | 159 | ||
161 | set_pxa_fb_info(&palm27x_lcd_screen); | 160 | pxa_set_fb_info(NULL, &palm27x_lcd_screen); |
162 | } | 161 | } |
163 | #endif | 162 | #endif |
164 | 163 | ||
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c index a09a2374697b..fb06bd047272 100644 --- a/arch/arm/mach-pxa/palmtc.c +++ b/arch/arm/mach-pxa/palmtc.c | |||
@@ -507,7 +507,7 @@ static struct pxafb_mach_info palmtc_lcd_screen = { | |||
507 | 507 | ||
508 | static void __init palmtc_lcd_init(void) | 508 | static void __init palmtc_lcd_init(void) |
509 | { | 509 | { |
510 | set_pxa_fb_info(&palmtc_lcd_screen); | 510 | pxa_set_fb_info(NULL, &palmtc_lcd_screen); |
511 | } | 511 | } |
512 | #else | 512 | #else |
513 | static inline void palmtc_lcd_init(void) {} | 513 | static inline void palmtc_lcd_init(void) {} |
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c index 3f25014a136c..726f5b98dcd3 100644 --- a/arch/arm/mach-pxa/palmte2.c +++ b/arch/arm/mach-pxa/palmte2.c | |||
@@ -136,30 +136,14 @@ static struct platform_device palmte2_pxa_keys = { | |||
136 | /****************************************************************************** | 136 | /****************************************************************************** |
137 | * Backlight | 137 | * Backlight |
138 | ******************************************************************************/ | 138 | ******************************************************************************/ |
139 | static struct gpio palmte_bl_gpios[] = { | ||
140 | { GPIO_NR_PALMTE2_BL_POWER, GPIOF_INIT_LOW, "Backlight power" }, | ||
141 | { GPIO_NR_PALMTE2_LCD_POWER, GPIOF_INIT_LOW, "LCD power" }, | ||
142 | }; | ||
143 | |||
139 | static int palmte2_backlight_init(struct device *dev) | 144 | static int palmte2_backlight_init(struct device *dev) |
140 | { | 145 | { |
141 | int ret; | 146 | return gpio_request_array(ARRAY_AND_SIZE(palmte_bl_gpios)); |
142 | |||
143 | ret = gpio_request(GPIO_NR_PALMTE2_BL_POWER, "BL POWER"); | ||
144 | if (ret) | ||
145 | goto err; | ||
146 | ret = gpio_direction_output(GPIO_NR_PALMTE2_BL_POWER, 0); | ||
147 | if (ret) | ||
148 | goto err2; | ||
149 | ret = gpio_request(GPIO_NR_PALMTE2_LCD_POWER, "LCD POWER"); | ||
150 | if (ret) | ||
151 | goto err2; | ||
152 | ret = gpio_direction_output(GPIO_NR_PALMTE2_LCD_POWER, 0); | ||
153 | if (ret) | ||
154 | goto err3; | ||
155 | |||
156 | return 0; | ||
157 | err3: | ||
158 | gpio_free(GPIO_NR_PALMTE2_LCD_POWER); | ||
159 | err2: | ||
160 | gpio_free(GPIO_NR_PALMTE2_BL_POWER); | ||
161 | err: | ||
162 | return ret; | ||
163 | } | 147 | } |
164 | 148 | ||
165 | static int palmte2_backlight_notify(struct device *dev, int brightness) | 149 | static int palmte2_backlight_notify(struct device *dev, int brightness) |
@@ -171,8 +155,7 @@ static int palmte2_backlight_notify(struct device *dev, int brightness) | |||
171 | 155 | ||
172 | static void palmte2_backlight_exit(struct device *dev) | 156 | static void palmte2_backlight_exit(struct device *dev) |
173 | { | 157 | { |
174 | gpio_free(GPIO_NR_PALMTE2_BL_POWER); | 158 | gpio_free_array(ARRAY_AND_SIZE(palmte_bl_gpios)); |
175 | gpio_free(GPIO_NR_PALMTE2_LCD_POWER); | ||
176 | } | 159 | } |
177 | 160 | ||
178 | static struct platform_pwm_backlight_data palmte2_backlight_data = { | 161 | static struct platform_pwm_backlight_data palmte2_backlight_data = { |
@@ -363,7 +346,7 @@ static void __init palmte2_init(void) | |||
363 | pxa_set_btuart_info(NULL); | 346 | pxa_set_btuart_info(NULL); |
364 | pxa_set_stuart_info(NULL); | 347 | pxa_set_stuart_info(NULL); |
365 | 348 | ||
366 | set_pxa_fb_info(&palmte2_lcd_screen); | 349 | pxa_set_fb_info(NULL, &palmte2_lcd_screen); |
367 | pxa_set_mci_info(&palmte2_mci_platform_data); | 350 | pxa_set_mci_info(&palmte2_mci_platform_data); |
368 | palmte2_udc_init(); | 351 | palmte2_udc_init(); |
369 | pxa_set_ac97_info(&palmte2_ac97_pdata); | 352 | pxa_set_ac97_info(&palmte2_ac97_pdata); |
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c index 3010193b081e..3b8a4f37dbbe 100644 --- a/arch/arm/mach-pxa/palmz72.c +++ b/arch/arm/mach-pxa/palmz72.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/wm97xx.h> | 30 | #include <linux/wm97xx.h> |
31 | #include <linux/power_supply.h> | 31 | #include <linux/power_supply.h> |
32 | #include <linux/usb/gpio_vbus.h> | 32 | #include <linux/usb/gpio_vbus.h> |
33 | #include <linux/i2c-gpio.h> | ||
33 | 34 | ||
34 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
35 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
@@ -47,6 +48,9 @@ | |||
47 | #include <mach/palm27x.h> | 48 | #include <mach/palm27x.h> |
48 | 49 | ||
49 | #include <mach/pm.h> | 50 | #include <mach/pm.h> |
51 | #include <mach/camera.h> | ||
52 | |||
53 | #include <media/soc_camera.h> | ||
50 | 54 | ||
51 | #include "generic.h" | 55 | #include "generic.h" |
52 | #include "devices.h" | 56 | #include "devices.h" |
@@ -103,6 +107,28 @@ static unsigned long palmz72_pin_config[] __initdata = { | |||
103 | GPIO22_GPIO, /* LCD border color */ | 107 | GPIO22_GPIO, /* LCD border color */ |
104 | GPIO96_GPIO, /* lcd power */ | 108 | GPIO96_GPIO, /* lcd power */ |
105 | 109 | ||
110 | /* PXA Camera */ | ||
111 | GPIO81_CIF_DD_0, | ||
112 | GPIO48_CIF_DD_5, | ||
113 | GPIO50_CIF_DD_3, | ||
114 | GPIO51_CIF_DD_2, | ||
115 | GPIO52_CIF_DD_4, | ||
116 | GPIO53_CIF_MCLK, | ||
117 | GPIO54_CIF_PCLK, | ||
118 | GPIO55_CIF_DD_1, | ||
119 | GPIO84_CIF_FV, | ||
120 | GPIO85_CIF_LV, | ||
121 | GPIO93_CIF_DD_6, | ||
122 | GPIO108_CIF_DD_7, | ||
123 | |||
124 | GPIO56_GPIO, /* OV9640 Powerdown */ | ||
125 | GPIO57_GPIO, /* OV9640 Reset */ | ||
126 | GPIO91_GPIO, /* OV9640 Power */ | ||
127 | |||
128 | /* I2C */ | ||
129 | GPIO117_GPIO, /* I2C_SCL */ | ||
130 | GPIO118_GPIO, /* I2C_SDA */ | ||
131 | |||
106 | /* Misc. */ | 132 | /* Misc. */ |
107 | GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH, /* power detect */ | 133 | GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH, /* power detect */ |
108 | GPIO88_GPIO, /* green led */ | 134 | GPIO88_GPIO, /* green led */ |
@@ -254,6 +280,106 @@ device_initcall(palmz72_pm_init); | |||
254 | #endif | 280 | #endif |
255 | 281 | ||
256 | /****************************************************************************** | 282 | /****************************************************************************** |
283 | * SoC Camera | ||
284 | ******************************************************************************/ | ||
285 | #if defined(CONFIG_SOC_CAMERA_OV9640) || \ | ||
286 | defined(CONFIG_SOC_CAMERA_OV9640_MODULE) | ||
287 | static struct pxacamera_platform_data palmz72_pxacamera_platform_data = { | ||
288 | .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | | ||
289 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, | ||
290 | .mclk_10khz = 2600, | ||
291 | }; | ||
292 | |||
293 | /* Board I2C devices. */ | ||
294 | static struct i2c_board_info palmz72_i2c_device[] = { | ||
295 | { | ||
296 | I2C_BOARD_INFO("ov9640", 0x30), | ||
297 | } | ||
298 | }; | ||
299 | |||
300 | static int palmz72_camera_power(struct device *dev, int power) | ||
301 | { | ||
302 | gpio_set_value(GPIO_NR_PALMZ72_CAM_PWDN, !power); | ||
303 | mdelay(50); | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static int palmz72_camera_reset(struct device *dev) | ||
308 | { | ||
309 | gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 1); | ||
310 | mdelay(50); | ||
311 | gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 0); | ||
312 | mdelay(50); | ||
313 | return 0; | ||
314 | } | ||
315 | |||
316 | static struct soc_camera_link palmz72_iclink = { | ||
317 | .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */ | ||
318 | .board_info = &palmz72_i2c_device[0], | ||
319 | .i2c_adapter_id = 0, | ||
320 | .module_name = "ov96xx", | ||
321 | .power = &palmz72_camera_power, | ||
322 | .reset = &palmz72_camera_reset, | ||
323 | .flags = SOCAM_DATAWIDTH_8, | ||
324 | }; | ||
325 | |||
326 | static struct i2c_gpio_platform_data palmz72_i2c_bus_data = { | ||
327 | .sda_pin = 118, | ||
328 | .scl_pin = 117, | ||
329 | .udelay = 10, | ||
330 | .timeout = 100, | ||
331 | }; | ||
332 | |||
333 | static struct platform_device palmz72_i2c_bus_device = { | ||
334 | .name = "i2c-gpio", | ||
335 | .id = 0, /* we use this as a replacement for i2c-pxa */ | ||
336 | .dev = { | ||
337 | .platform_data = &palmz72_i2c_bus_data, | ||
338 | } | ||
339 | }; | ||
340 | |||
341 | static struct platform_device palmz72_camera = { | ||
342 | .name = "soc-camera-pdrv", | ||
343 | .id = -1, | ||
344 | .dev = { | ||
345 | .platform_data = &palmz72_iclink, | ||
346 | }, | ||
347 | }; | ||
348 | |||
349 | /* Here we request the camera GPIOs and configure them. We power up the camera | ||
350 | * module, deassert the reset pin, but put it into powerdown (low to no power | ||
351 | * consumption) mode. This allows us to later bring the module up fast. */ | ||
352 | static struct gpio palmz72_camera_gpios[] = { | ||
353 | { GPIO_NR_PALMZ72_CAM_POWER, GPIOF_INIT_HIGH,"Camera DVDD" }, | ||
354 | { GPIO_NR_PALMZ72_CAM_RESET, GPIOF_INIT_LOW, "Camera RESET" }, | ||
355 | { GPIO_NR_PALMZ72_CAM_PWDN, GPIOF_INIT_LOW, "Camera PWDN" }, | ||
356 | }; | ||
357 | |||
358 | static inline void __init palmz72_cam_gpio_init(void) | ||
359 | { | ||
360 | int ret; | ||
361 | |||
362 | ret = gpio_request_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); | ||
363 | if (!ret) | ||
364 | gpio_free_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); | ||
365 | else | ||
366 | printk(KERN_ERR "Camera GPIO init failed!\n"); | ||
367 | |||
368 | return; | ||
369 | } | ||
370 | |||
371 | static void __init palmz72_camera_init(void) | ||
372 | { | ||
373 | palmz72_cam_gpio_init(); | ||
374 | pxa_set_camera_info(&palmz72_pxacamera_platform_data); | ||
375 | platform_device_register(&palmz72_i2c_bus_device); | ||
376 | platform_device_register(&palmz72_camera); | ||
377 | } | ||
378 | #else | ||
379 | static inline void palmz72_camera_init(void) {} | ||
380 | #endif | ||
381 | |||
382 | /****************************************************************************** | ||
257 | * Machine init | 383 | * Machine init |
258 | ******************************************************************************/ | 384 | ******************************************************************************/ |
259 | static void __init palmz72_init(void) | 385 | static void __init palmz72_init(void) |
@@ -276,6 +402,7 @@ static void __init palmz72_init(void) | |||
276 | palm27x_pmic_init(); | 402 | palm27x_pmic_init(); |
277 | palmz72_kpc_init(); | 403 | palmz72_kpc_init(); |
278 | palmz72_leds_init(); | 404 | palmz72_leds_init(); |
405 | palmz72_camera_init(); | ||
279 | } | 406 | } |
280 | 407 | ||
281 | MACHINE_START(PALMZ72, "Palm Zire72") | 408 | MACHINE_START(PALMZ72, "Palm Zire72") |
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index 9dbf3ccd4150..a70fb848dcde 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -515,7 +515,7 @@ void __init pcm990_baseboard_init(void) | |||
515 | pcm990_init_irq(); | 515 | pcm990_init_irq(); |
516 | 516 | ||
517 | #ifndef CONFIG_PCM990_DISPLAY_NONE | 517 | #ifndef CONFIG_PCM990_DISPLAY_NONE |
518 | set_pxa_fb_info(&pcm990_fbinfo); | 518 | pxa_set_fb_info(NULL, &pcm990_fbinfo); |
519 | #endif | 519 | #endif |
520 | platform_device_register(&pcm990_backlight_device); | 520 | platform_device_register(&pcm990_backlight_device); |
521 | 521 | ||
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 35353af345d5..16d14fd79b4b 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -445,8 +445,7 @@ static void __init poodle_init(void) | |||
445 | if (ret) | 445 | if (ret) |
446 | pr_warning("poodle: Unable to register LoCoMo device\n"); | 446 | pr_warning("poodle: Unable to register LoCoMo device\n"); |
447 | 447 | ||
448 | set_pxa_fb_parent(&poodle_locomo_device.dev); | 448 | pxa_set_fb_info(&poodle_locomo_device.dev, &poodle_fb_info); |
449 | set_pxa_fb_info(&poodle_fb_info); | ||
450 | pxa_set_udc_info(&udc_info); | 449 | pxa_set_udc_info(&udc_info); |
451 | pxa_set_mci_info(&poodle_mci_platform_data); | 450 | pxa_set_mci_info(&poodle_mci_platform_data); |
452 | pxa_set_ficp_info(&poodle_ficp_platform_data); | 451 | pxa_set_ficp_info(&poodle_ficp_platform_data); |
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c index 47094188e029..cd1861351f75 100644 --- a/arch/arm/mach-pxa/raumfeld.c +++ b/arch/arm/mach-pxa/raumfeld.c | |||
@@ -597,7 +597,7 @@ static void __init raumfeld_lcd_init(void) | |||
597 | { | 597 | { |
598 | int ret; | 598 | int ret; |
599 | 599 | ||
600 | set_pxa_fb_info(&raumfeld_sharp_lcd_info); | 600 | pxa_set_fb_info(NULL, &raumfeld_sharp_lcd_info); |
601 | 601 | ||
602 | /* Earlier devices had the backlight regulator controlled | 602 | /* Earlier devices had the backlight regulator controlled |
603 | * via PWM, later versions use another controller for that */ | 603 | * via PWM, later versions use another controller for that */ |
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c index eb83c89428ef..fee97a935122 100644 --- a/arch/arm/mach-pxa/saar.c +++ b/arch/arm/mach-pxa/saar.c | |||
@@ -473,7 +473,7 @@ static struct pxafb_mach_info saar_lcd_info = { | |||
473 | 473 | ||
474 | static void __init saar_init_lcd(void) | 474 | static void __init saar_init_lcd(void) |
475 | { | 475 | { |
476 | set_pxa_fb_info(&saar_lcd_info); | 476 | pxa_set_fb_info(NULL, &saar_lcd_info); |
477 | } | 477 | } |
478 | #else | 478 | #else |
479 | static inline void saar_init_lcd(void) {} | 479 | static inline void saar_init_lcd(void) {} |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 38e2c0912b9a..01c576963e94 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -724,7 +724,7 @@ static struct pxafb_mach_info spitz_pxafb_info = { | |||
724 | 724 | ||
725 | static void __init spitz_lcd_init(void) | 725 | static void __init spitz_lcd_init(void) |
726 | { | 726 | { |
727 | set_pxa_fb_info(&spitz_pxafb_info); | 727 | pxa_set_fb_info(NULL, &spitz_pxafb_info); |
728 | } | 728 | } |
729 | #else | 729 | #else |
730 | static inline void spitz_lcd_init(void) {} | 730 | static inline void spitz_lcd_init(void) {} |
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c index 9cecf8366db8..53d4a472b699 100644 --- a/arch/arm/mach-pxa/tavorevb.c +++ b/arch/arm/mach-pxa/tavorevb.c | |||
@@ -466,7 +466,7 @@ static void __init tavorevb_init_lcd(void) | |||
466 | { | 466 | { |
467 | platform_device_register(&tavorevb_backlight_devices[0]); | 467 | platform_device_register(&tavorevb_backlight_devices[0]); |
468 | platform_device_register(&tavorevb_backlight_devices[1]); | 468 | platform_device_register(&tavorevb_backlight_devices[1]); |
469 | set_pxa_fb_info(&tavorevb_lcd_info); | 469 | pxa_set_fb_info(NULL, &tavorevb_lcd_info); |
470 | } | 470 | } |
471 | #else | 471 | #else |
472 | static inline void tavorevb_init_lcd(void) {} | 472 | static inline void tavorevb_init_lcd(void) {} |
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c index e7f64d9b4f2d..428da3ff33a5 100644 --- a/arch/arm/mach-pxa/time.c +++ b/arch/arm/mach-pxa/time.c | |||
@@ -100,7 +100,6 @@ pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev) | |||
100 | static struct clock_event_device ckevt_pxa_osmr0 = { | 100 | static struct clock_event_device ckevt_pxa_osmr0 = { |
101 | .name = "osmr0", | 101 | .name = "osmr0", |
102 | .features = CLOCK_EVT_FEAT_ONESHOT, | 102 | .features = CLOCK_EVT_FEAT_ONESHOT, |
103 | .shift = 32, | ||
104 | .rating = 200, | 103 | .rating = 200, |
105 | .set_next_event = pxa_osmr0_set_next_event, | 104 | .set_next_event = pxa_osmr0_set_next_event, |
106 | .set_mode = pxa_osmr0_set_mode, | 105 | .set_mode = pxa_osmr0_set_mode, |
@@ -135,8 +134,8 @@ static void __init pxa_timer_init(void) | |||
135 | 134 | ||
136 | init_sched_clock(&cd, pxa_update_sched_clock, 32, clock_tick_rate); | 135 | init_sched_clock(&cd, pxa_update_sched_clock, 32, clock_tick_rate); |
137 | 136 | ||
138 | ckevt_pxa_osmr0.mult = | 137 | clocksource_calc_mult_shift(&cksrc_pxa_oscr0, clock_tick_rate, 4); |
139 | div_sc(clock_tick_rate, NSEC_PER_SEC, ckevt_pxa_osmr0.shift); | 138 | clockevents_calc_mult_shift(&ckevt_pxa_osmr0, clock_tick_rate, 4); |
140 | ckevt_pxa_osmr0.max_delta_ns = | 139 | ckevt_pxa_osmr0.max_delta_ns = |
141 | clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0); | 140 | clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0); |
142 | ckevt_pxa_osmr0.min_delta_ns = | 141 | ckevt_pxa_osmr0.min_delta_ns = |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 5ad3807af334..5fa145778e7d 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/spi/pxa2xx_spi.h> | 35 | #include <linux/spi/pxa2xx_spi.h> |
36 | #include <linux/input/matrix_keypad.h> | 36 | #include <linux/input/matrix_keypad.h> |
37 | #include <linux/i2c/pxa-i2c.h> | 37 | #include <linux/i2c/pxa-i2c.h> |
38 | #include <linux/usb/gpio_vbus.h> | ||
38 | 39 | ||
39 | #include <asm/setup.h> | 40 | #include <asm/setup.h> |
40 | #include <asm/mach-types.h> | 41 | #include <asm/mach-types.h> |
@@ -240,12 +241,20 @@ static struct scoop_pcmcia_config tosa_pcmcia_config = { | |||
240 | /* | 241 | /* |
241 | * USB Device Controller | 242 | * USB Device Controller |
242 | */ | 243 | */ |
243 | static struct pxa2xx_udc_mach_info udc_info __initdata = { | 244 | static struct gpio_vbus_mach_info tosa_udc_info = { |
244 | .gpio_pullup = TOSA_GPIO_USB_PULLUP, | 245 | .gpio_pullup = TOSA_GPIO_USB_PULLUP, |
245 | .gpio_vbus = TOSA_GPIO_USB_IN, | 246 | .gpio_vbus = TOSA_GPIO_USB_IN, |
246 | .gpio_vbus_inverted = 1, | 247 | .gpio_vbus_inverted = 1, |
247 | }; | 248 | }; |
248 | 249 | ||
250 | static struct platform_device tosa_gpio_vbus = { | ||
251 | .name = "gpio-vbus", | ||
252 | .id = -1, | ||
253 | .dev = { | ||
254 | .platform_data = &tosa_udc_info, | ||
255 | }, | ||
256 | }; | ||
257 | |||
249 | /* | 258 | /* |
250 | * MMC/SD Device | 259 | * MMC/SD Device |
251 | */ | 260 | */ |
@@ -891,6 +900,7 @@ static struct platform_device *devices[] __initdata = { | |||
891 | &tosa_bt_device, | 900 | &tosa_bt_device, |
892 | &sharpsl_rom_device, | 901 | &sharpsl_rom_device, |
893 | &wm9712_device, | 902 | &wm9712_device, |
903 | &tosa_gpio_vbus, | ||
894 | }; | 904 | }; |
895 | 905 | ||
896 | static void tosa_poweroff(void) | 906 | static void tosa_poweroff(void) |
@@ -937,7 +947,6 @@ static void __init tosa_init(void) | |||
937 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); | 947 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); |
938 | 948 | ||
939 | pxa_set_mci_info(&tosa_mci_platform_data); | 949 | pxa_set_mci_info(&tosa_mci_platform_data); |
940 | pxa_set_udc_info(&udc_info); | ||
941 | pxa_set_ficp_info(&tosa_ficp_platform_data); | 950 | pxa_set_ficp_info(&tosa_ficp_platform_data); |
942 | pxa_set_i2c_info(NULL); | 951 | pxa_set_i2c_info(NULL); |
943 | pxa_set_ac97_info(NULL); | 952 | pxa_set_ac97_info(NULL); |
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index 857bb2e63486..b9cfbebdfe9c 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c | |||
@@ -516,9 +516,9 @@ static void __init trizeps4_init(void) | |||
516 | pxa_set_stuart_info(NULL); | 516 | pxa_set_stuart_info(NULL); |
517 | 517 | ||
518 | if (0) /* dont know how to determine LCD */ | 518 | if (0) /* dont know how to determine LCD */ |
519 | set_pxa_fb_info(&sharp_lcd); | 519 | pxa_set_fb_info(NULL, &sharp_lcd); |
520 | else | 520 | else |
521 | set_pxa_fb_info(&toshiba_lcd); | 521 | pxa_set_fb_info(NULL, &toshiba_lcd); |
522 | 522 | ||
523 | pxa_set_mci_info(&trizeps4_mci_platform_data); | 523 | pxa_set_mci_info(&trizeps4_mci_platform_data); |
524 | #ifndef STATUS_LEDS_ON_STUART_PINS | 524 | #ifndef STATUS_LEDS_ON_STUART_PINS |
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index 12279214c875..0fbe78df8461 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c | |||
@@ -932,7 +932,7 @@ static void __init viper_init(void) | |||
932 | /* Wake-up serial console */ | 932 | /* Wake-up serial console */ |
933 | viper_init_serial_gpio(); | 933 | viper_init_serial_gpio(); |
934 | 934 | ||
935 | set_pxa_fb_info(&fb_info); | 935 | pxa_set_fb_info(NULL, &fb_info); |
936 | 936 | ||
937 | /* v1 hardware cannot use the datacs line */ | 937 | /* v1 hardware cannot use the datacs line */ |
938 | version = viper_hw_version(); | 938 | version = viper_hw_version(); |
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c index e709fd459268..f71d377c8640 100644 --- a/arch/arm/mach-pxa/vpac270.c +++ b/arch/arm/mach-pxa/vpac270.c | |||
@@ -572,7 +572,7 @@ static void __init vpac270_lcd_init(void) | |||
572 | } | 572 | } |
573 | 573 | ||
574 | vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power; | 574 | vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power; |
575 | set_pxa_fb_info(&vpac270_lcd_screen); | 575 | pxa_set_fb_info(NULL, &vpac270_lcd_screen); |
576 | return; | 576 | return; |
577 | 577 | ||
578 | err2: | 578 | err2: |
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c index aaf883754ef4..fbe9e02e2f9f 100644 --- a/arch/arm/mach-pxa/z2.c +++ b/arch/arm/mach-pxa/z2.c | |||
@@ -91,13 +91,13 @@ static unsigned long z2_pin_config[] = { | |||
91 | GPIO47_STUART_TXD, | 91 | GPIO47_STUART_TXD, |
92 | 92 | ||
93 | /* Keypad */ | 93 | /* Keypad */ |
94 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | 94 | GPIO100_KP_MKIN_0, |
95 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | 95 | GPIO101_KP_MKIN_1, |
96 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | 96 | GPIO102_KP_MKIN_2, |
97 | GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | 97 | GPIO34_KP_MKIN_3, |
98 | GPIO38_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | 98 | GPIO38_KP_MKIN_4, |
99 | GPIO16_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, | 99 | GPIO16_KP_MKIN_5, |
100 | GPIO17_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH, | 100 | GPIO17_KP_MKIN_6, |
101 | GPIO103_KP_MKOUT_0, | 101 | GPIO103_KP_MKOUT_0, |
102 | GPIO104_KP_MKOUT_1, | 102 | GPIO104_KP_MKOUT_1, |
103 | GPIO105_KP_MKOUT_2, | 103 | GPIO105_KP_MKOUT_2, |
@@ -138,8 +138,7 @@ static unsigned long z2_pin_config[] = { | |||
138 | GPIO1_GPIO, /* Power button */ | 138 | GPIO1_GPIO, /* Power button */ |
139 | GPIO37_GPIO, /* Headphone detect */ | 139 | GPIO37_GPIO, /* Headphone detect */ |
140 | GPIO98_GPIO, /* Lid switch */ | 140 | GPIO98_GPIO, /* Lid switch */ |
141 | GPIO14_GPIO, /* WiFi Reset */ | 141 | GPIO14_GPIO, /* WiFi Power */ |
142 | GPIO15_GPIO, /* WiFi Power */ | ||
143 | GPIO24_GPIO, /* WiFi CS */ | 142 | GPIO24_GPIO, /* WiFi CS */ |
144 | GPIO36_GPIO, /* WiFi IRQ */ | 143 | GPIO36_GPIO, /* WiFi IRQ */ |
145 | GPIO88_GPIO, /* LCD CS */ | 144 | GPIO88_GPIO, /* LCD CS */ |
@@ -204,7 +203,7 @@ static struct platform_pwm_backlight_data z2_backlight_data[] = { | |||
204 | /* Keypad Backlight */ | 203 | /* Keypad Backlight */ |
205 | .pwm_id = 1, | 204 | .pwm_id = 1, |
206 | .max_brightness = 1023, | 205 | .max_brightness = 1023, |
207 | .dft_brightness = 512, | 206 | .dft_brightness = 0, |
208 | .pwm_period_ns = 1260320, | 207 | .pwm_period_ns = 1260320, |
209 | }, | 208 | }, |
210 | [1] = { | 209 | [1] = { |
@@ -271,7 +270,7 @@ static struct pxafb_mach_info z2_lcd_screen = { | |||
271 | 270 | ||
272 | static void __init z2_lcd_init(void) | 271 | static void __init z2_lcd_init(void) |
273 | { | 272 | { |
274 | set_pxa_fb_info(&z2_lcd_screen); | 273 | pxa_set_fb_info(NULL, &z2_lcd_screen); |
275 | } | 274 | } |
276 | #else | 275 | #else |
277 | static inline void z2_lcd_init(void) {} | 276 | static inline void z2_lcd_init(void) {} |
@@ -309,12 +308,12 @@ struct gpio_led z2_gpio_leds[] = { | |||
309 | .active_low = 1, | 308 | .active_low = 1, |
310 | }, { | 309 | }, { |
311 | .name = "z2:green:charged", | 310 | .name = "z2:green:charged", |
312 | .default_trigger = "none", | 311 | .default_trigger = "mmc0", |
313 | .gpio = GPIO85_ZIPITZ2_LED_CHARGED, | 312 | .gpio = GPIO85_ZIPITZ2_LED_CHARGED, |
314 | .active_low = 1, | 313 | .active_low = 1, |
315 | }, { | 314 | }, { |
316 | .name = "z2:amber:charging", | 315 | .name = "z2:amber:charging", |
317 | .default_trigger = "none", | 316 | .default_trigger = "Z2-charging-or-full", |
318 | .gpio = GPIO83_ZIPITZ2_LED_CHARGING, | 317 | .gpio = GPIO83_ZIPITZ2_LED_CHARGING, |
319 | .active_low = 1, | 318 | .active_low = 1, |
320 | }, | 319 | }, |
@@ -427,8 +426,22 @@ static inline void z2_mkp_init(void) {} | |||
427 | ******************************************************************************/ | 426 | ******************************************************************************/ |
428 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | 427 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
429 | static struct gpio_keys_button z2_pxa_buttons[] = { | 428 | static struct gpio_keys_button z2_pxa_buttons[] = { |
430 | {KEY_POWER, GPIO1_ZIPITZ2_POWER_BUTTON, 0, "Power Button" }, | 429 | { |
431 | {KEY_CLOSE, GPIO98_ZIPITZ2_LID_BUTTON, 0, "Lid Button" }, | 430 | .code = KEY_POWER, |
431 | .gpio = GPIO1_ZIPITZ2_POWER_BUTTON, | ||
432 | .active_low = 0, | ||
433 | .desc = "Power Button", | ||
434 | .wakeup = 1, | ||
435 | .type = EV_KEY, | ||
436 | }, | ||
437 | { | ||
438 | .code = SW_LID, | ||
439 | .gpio = GPIO98_ZIPITZ2_LID_BUTTON, | ||
440 | .active_low = 1, | ||
441 | .desc = "Lid Switch", | ||
442 | .wakeup = 0, | ||
443 | .type = EV_SW, | ||
444 | }, | ||
432 | }; | 445 | }; |
433 | 446 | ||
434 | static struct gpio_keys_platform_data z2_pxa_keys_data = { | 447 | static struct gpio_keys_platform_data z2_pxa_keys_data = { |
@@ -461,9 +474,9 @@ static struct z2_battery_info batt_chip_info = { | |||
461 | .batt_I2C_addr = 0x55, | 474 | .batt_I2C_addr = 0x55, |
462 | .batt_I2C_reg = 2, | 475 | .batt_I2C_reg = 2, |
463 | .charge_gpio = GPIO0_ZIPITZ2_AC_DETECT, | 476 | .charge_gpio = GPIO0_ZIPITZ2_AC_DETECT, |
464 | .min_voltage = 2400000, | 477 | .min_voltage = 3475000, |
465 | .max_voltage = 3700000, | 478 | .max_voltage = 4190000, |
466 | .batt_div = 69, | 479 | .batt_div = 59, |
467 | .batt_mult = 1000000, | 480 | .batt_mult = 1000000, |
468 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LION, | 481 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LION, |
469 | .batt_name = "Z2", | 482 | .batt_name = "Z2", |
@@ -497,26 +510,16 @@ static int z2_lbs_spi_setup(struct spi_device *spi) | |||
497 | { | 510 | { |
498 | int ret = 0; | 511 | int ret = 0; |
499 | 512 | ||
500 | ret = gpio_request(GPIO15_ZIPITZ2_WIFI_POWER, "WiFi Power"); | 513 | ret = gpio_request(GPIO14_ZIPITZ2_WIFI_POWER, "WiFi Power"); |
501 | if (ret) | 514 | if (ret) |
502 | goto err; | 515 | goto err; |
503 | 516 | ||
504 | ret = gpio_direction_output(GPIO15_ZIPITZ2_WIFI_POWER, 1); | 517 | ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_POWER, 1); |
505 | if (ret) | 518 | if (ret) |
506 | goto err2; | 519 | goto err2; |
507 | 520 | ||
508 | ret = gpio_request(GPIO14_ZIPITZ2_WIFI_RESET, "WiFi Reset"); | 521 | /* Wait until card is powered on */ |
509 | if (ret) | ||
510 | goto err2; | ||
511 | |||
512 | ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_RESET, 0); | ||
513 | if (ret) | ||
514 | goto err3; | ||
515 | |||
516 | /* Reset the card */ | ||
517 | mdelay(180); | 522 | mdelay(180); |
518 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 1); | ||
519 | mdelay(20); | ||
520 | 523 | ||
521 | spi->bits_per_word = 16; | 524 | spi->bits_per_word = 16; |
522 | spi->mode = SPI_MODE_2, | 525 | spi->mode = SPI_MODE_2, |
@@ -525,22 +528,18 @@ static int z2_lbs_spi_setup(struct spi_device *spi) | |||
525 | 528 | ||
526 | return 0; | 529 | return 0; |
527 | 530 | ||
528 | err3: | ||
529 | gpio_free(GPIO14_ZIPITZ2_WIFI_RESET); | ||
530 | err2: | 531 | err2: |
531 | gpio_free(GPIO15_ZIPITZ2_WIFI_POWER); | 532 | gpio_free(GPIO14_ZIPITZ2_WIFI_POWER); |
532 | err: | 533 | err: |
533 | return ret; | 534 | return ret; |
534 | }; | 535 | }; |
535 | 536 | ||
536 | static int z2_lbs_spi_teardown(struct spi_device *spi) | 537 | static int z2_lbs_spi_teardown(struct spi_device *spi) |
537 | { | 538 | { |
538 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 0); | 539 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_POWER, 0); |
539 | gpio_set_value(GPIO15_ZIPITZ2_WIFI_POWER, 0); | 540 | gpio_free(GPIO14_ZIPITZ2_WIFI_POWER); |
540 | gpio_free(GPIO14_ZIPITZ2_WIFI_RESET); | ||
541 | gpio_free(GPIO15_ZIPITZ2_WIFI_POWER); | ||
542 | return 0; | ||
543 | 541 | ||
542 | return 0; | ||
544 | }; | 543 | }; |
545 | 544 | ||
546 | static struct pxa2xx_spi_chip z2_lbs_chip_info = { | 545 | static struct pxa2xx_spi_chip z2_lbs_chip_info = { |
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c index 730f51e57c17..5891590126f7 100644 --- a/arch/arm/mach-pxa/zeus.c +++ b/arch/arm/mach-pxa/zeus.c | |||
@@ -846,7 +846,7 @@ static void __init zeus_init(void) | |||
846 | if (zeus_setup_fb_gpios()) | 846 | if (zeus_setup_fb_gpios()) |
847 | pr_err("Failed to setup fb gpios\n"); | 847 | pr_err("Failed to setup fb gpios\n"); |
848 | else | 848 | else |
849 | set_pxa_fb_info(&zeus_fb_info); | 849 | pxa_set_fb_info(NULL, &zeus_fb_info); |
850 | 850 | ||
851 | pxa_set_mci_info(&zeus_mci_platform_data); | 851 | pxa_set_mci_info(&zeus_mci_platform_data); |
852 | pxa_set_udc_info(&zeus_udc_info); | 852 | pxa_set_udc_info(&zeus_udc_info); |
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index a4c784aab764..5821185f77ab 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c | |||
@@ -208,7 +208,7 @@ static void __init zylonite_init_lcd(void) | |||
208 | platform_device_register(&zylonite_backlight_device); | 208 | platform_device_register(&zylonite_backlight_device); |
209 | 209 | ||
210 | if (lcd_id & 0x20) { | 210 | if (lcd_id & 0x20) { |
211 | set_pxa_fb_info(&zylonite_sharp_lcd_info); | 211 | pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info); |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | 214 | ||
@@ -220,7 +220,7 @@ static void __init zylonite_init_lcd(void) | |||
220 | else | 220 | else |
221 | zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode; | 221 | zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode; |
222 | 222 | ||
223 | set_pxa_fb_info(&zylonite_toshiba_lcd_info); | 223 | pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info); |
224 | } | 224 | } |
225 | #else | 225 | #else |
226 | static inline void zylonite_init_lcd(void) {} | 226 | static inline void zylonite_init_lcd(void) {} |
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c index a2a73d953840..b86d7e22595e 100644 --- a/drivers/ata/pata_palmld.c +++ b/drivers/ata/pata_palmld.c | |||
@@ -33,6 +33,11 @@ | |||
33 | 33 | ||
34 | #define DRV_NAME "pata_palmld" | 34 | #define DRV_NAME "pata_palmld" |
35 | 35 | ||
36 | static struct gpio palmld_hdd_gpios[] = { | ||
37 | { GPIO_NR_PALMLD_IDE_PWEN, GPIOF_INIT_HIGH, "HDD Power" }, | ||
38 | { GPIO_NR_PALMLD_IDE_RESET, GPIOF_INIT_LOW, "HDD Reset" }, | ||
39 | }; | ||
40 | |||
36 | static struct scsi_host_template palmld_sht = { | 41 | static struct scsi_host_template palmld_sht = { |
37 | ATA_PIO_SHT(DRV_NAME), | 42 | ATA_PIO_SHT(DRV_NAME), |
38 | }; | 43 | }; |
@@ -52,28 +57,23 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev) | |||
52 | 57 | ||
53 | /* allocate host */ | 58 | /* allocate host */ |
54 | host = ata_host_alloc(&pdev->dev, 1); | 59 | host = ata_host_alloc(&pdev->dev, 1); |
55 | if (!host) | 60 | if (!host) { |
56 | return -ENOMEM; | 61 | ret = -ENOMEM; |
62 | goto err1; | ||
63 | } | ||
57 | 64 | ||
58 | /* remap drive's physical memory address */ | 65 | /* remap drive's physical memory address */ |
59 | mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000); | 66 | mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000); |
60 | if (!mem) | 67 | if (!mem) { |
61 | return -ENOMEM; | 68 | ret = -ENOMEM; |
69 | goto err1; | ||
70 | } | ||
62 | 71 | ||
63 | /* request and activate power GPIO, IRQ GPIO */ | 72 | /* request and activate power GPIO, IRQ GPIO */ |
64 | ret = gpio_request(GPIO_NR_PALMLD_IDE_PWEN, "HDD PWR"); | 73 | ret = gpio_request_array(palmld_hdd_gpios, |
74 | ARRAY_SIZE(palmld_hdd_gpios)); | ||
65 | if (ret) | 75 | if (ret) |
66 | goto err1; | 76 | goto err1; |
67 | ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_PWEN, 1); | ||
68 | if (ret) | ||
69 | goto err2; | ||
70 | |||
71 | ret = gpio_request(GPIO_NR_PALMLD_IDE_RESET, "HDD RST"); | ||
72 | if (ret) | ||
73 | goto err2; | ||
74 | ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_RESET, 0); | ||
75 | if (ret) | ||
76 | goto err3; | ||
77 | 77 | ||
78 | /* reset the drive */ | 78 | /* reset the drive */ |
79 | gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0); | 79 | gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0); |
@@ -96,13 +96,15 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev) | |||
96 | ata_sff_std_ports(&ap->ioaddr); | 96 | ata_sff_std_ports(&ap->ioaddr); |
97 | 97 | ||
98 | /* activate host */ | 98 | /* activate host */ |
99 | return ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING, | 99 | ret = ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING, |
100 | &palmld_sht); | 100 | &palmld_sht); |
101 | if (ret) | ||
102 | goto err2; | ||
103 | |||
104 | return ret; | ||
101 | 105 | ||
102 | err3: | ||
103 | gpio_free(GPIO_NR_PALMLD_IDE_RESET); | ||
104 | err2: | 106 | err2: |
105 | gpio_free(GPIO_NR_PALMLD_IDE_PWEN); | 107 | gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios)); |
106 | err1: | 108 | err1: |
107 | return ret; | 109 | return ret; |
108 | } | 110 | } |
@@ -116,8 +118,7 @@ static __devexit int palmld_pata_remove(struct platform_device *dev) | |||
116 | /* power down the HDD */ | 118 | /* power down the HDD */ |
117 | gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0); | 119 | gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0); |
118 | 120 | ||
119 | gpio_free(GPIO_NR_PALMLD_IDE_RESET); | 121 | gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios)); |
120 | gpio_free(GPIO_NR_PALMLD_IDE_PWEN); | ||
121 | 122 | ||
122 | return 0; | 123 | return 0; |
123 | } | 124 | } |
diff --git a/drivers/pcmcia/pxa2xx_colibri.c b/drivers/pcmcia/pxa2xx_colibri.c index a52039564e74..443cb7fc872d 100644 --- a/drivers/pcmcia/pxa2xx_colibri.c +++ b/drivers/pcmcia/pxa2xx_colibri.c | |||
@@ -34,14 +34,24 @@ | |||
34 | #define COLIBRI320_DETECT_GPIO 81 | 34 | #define COLIBRI320_DETECT_GPIO 81 |
35 | #define COLIBRI320_READY_GPIO 29 | 35 | #define COLIBRI320_READY_GPIO 29 |
36 | 36 | ||
37 | static struct { | 37 | enum { |
38 | int reset_gpio; | 38 | DETECT = 0, |
39 | int ppen_gpio; | 39 | READY = 1, |
40 | int bvd1_gpio; | 40 | BVD1 = 2, |
41 | int bvd2_gpio; | 41 | BVD2 = 3, |
42 | int detect_gpio; | 42 | PPEN = 4, |
43 | int ready_gpio; | 43 | RESET = 5, |
44 | } colibri_pcmcia_gpio; | 44 | }; |
45 | |||
46 | /* Contents of this array are configured on-the-fly in init function */ | ||
47 | static struct gpio colibri_pcmcia_gpios[] = { | ||
48 | { 0, GPIOF_IN, "PCMCIA Detect" }, | ||
49 | { 0, GPIOF_IN, "PCMCIA Ready" }, | ||
50 | { 0, GPIOF_IN, "PCMCIA BVD1" }, | ||
51 | { 0, GPIOF_IN, "PCMCIA BVD2" }, | ||
52 | { 0, GPIOF_INIT_LOW, "PCMCIA PPEN" }, | ||
53 | { 0, GPIOF_INIT_HIGH,"PCMCIA Reset" }, | ||
54 | }; | ||
45 | 55 | ||
46 | static struct pcmcia_irqs colibri_irqs[] = { | 56 | static struct pcmcia_irqs colibri_irqs[] = { |
47 | { | 57 | { |
@@ -54,88 +64,42 @@ static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
54 | { | 64 | { |
55 | int ret; | 65 | int ret; |
56 | 66 | ||
57 | ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT"); | 67 | ret = gpio_request_array(colibri_pcmcia_gpios, |
68 | ARRAY_SIZE(colibri_pcmcia_gpios)); | ||
58 | if (ret) | 69 | if (ret) |
59 | goto err1; | 70 | goto err1; |
60 | ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio); | ||
61 | if (ret) | ||
62 | goto err2; | ||
63 | |||
64 | ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY"); | ||
65 | if (ret) | ||
66 | goto err2; | ||
67 | ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio); | ||
68 | if (ret) | ||
69 | goto err3; | ||
70 | 71 | ||
71 | ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1"); | 72 | colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpios[DETECT].gpio); |
72 | if (ret) | 73 | skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpios[READY].gpio); |
73 | goto err3; | ||
74 | ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio); | ||
75 | if (ret) | ||
76 | goto err4; | ||
77 | 74 | ||
78 | ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2"); | 75 | ret = soc_pcmcia_request_irqs(skt, colibri_irqs, |
79 | if (ret) | 76 | ARRAY_SIZE(colibri_irqs)); |
80 | goto err4; | ||
81 | ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio); | ||
82 | if (ret) | ||
83 | goto err5; | ||
84 | |||
85 | ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN"); | ||
86 | if (ret) | ||
87 | goto err5; | ||
88 | ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0); | ||
89 | if (ret) | ||
90 | goto err6; | ||
91 | |||
92 | ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET"); | ||
93 | if (ret) | ||
94 | goto err6; | ||
95 | ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1); | ||
96 | if (ret) | 77 | if (ret) |
97 | goto err7; | 78 | goto err2; |
98 | |||
99 | colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpio.detect_gpio); | ||
100 | skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio); | ||
101 | 79 | ||
102 | return soc_pcmcia_request_irqs(skt, colibri_irqs, | 80 | return ret; |
103 | ARRAY_SIZE(colibri_irqs)); | ||
104 | 81 | ||
105 | err7: | ||
106 | gpio_free(colibri_pcmcia_gpio.detect_gpio); | ||
107 | err6: | ||
108 | gpio_free(colibri_pcmcia_gpio.ready_gpio); | ||
109 | err5: | ||
110 | gpio_free(colibri_pcmcia_gpio.bvd1_gpio); | ||
111 | err4: | ||
112 | gpio_free(colibri_pcmcia_gpio.bvd2_gpio); | ||
113 | err3: | ||
114 | gpio_free(colibri_pcmcia_gpio.reset_gpio); | ||
115 | err2: | 82 | err2: |
116 | gpio_free(colibri_pcmcia_gpio.ppen_gpio); | 83 | gpio_free_array(colibri_pcmcia_gpios, |
84 | ARRAY_SIZE(colibri_pcmcia_gpios)); | ||
117 | err1: | 85 | err1: |
118 | return ret; | 86 | return ret; |
119 | } | 87 | } |
120 | 88 | ||
121 | static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 89 | static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
122 | { | 90 | { |
123 | gpio_free(colibri_pcmcia_gpio.detect_gpio); | 91 | gpio_free_array(colibri_pcmcia_gpios, |
124 | gpio_free(colibri_pcmcia_gpio.ready_gpio); | 92 | ARRAY_SIZE(colibri_pcmcia_gpios)); |
125 | gpio_free(colibri_pcmcia_gpio.bvd1_gpio); | ||
126 | gpio_free(colibri_pcmcia_gpio.bvd2_gpio); | ||
127 | gpio_free(colibri_pcmcia_gpio.reset_gpio); | ||
128 | gpio_free(colibri_pcmcia_gpio.ppen_gpio); | ||
129 | } | 93 | } |
130 | 94 | ||
131 | static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 95 | static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
132 | struct pcmcia_state *state) | 96 | struct pcmcia_state *state) |
133 | { | 97 | { |
134 | 98 | ||
135 | state->detect = !!gpio_get_value(colibri_pcmcia_gpio.detect_gpio); | 99 | state->detect = !!gpio_get_value(colibri_pcmcia_gpios[DETECT].gpio); |
136 | state->ready = !!gpio_get_value(colibri_pcmcia_gpio.ready_gpio); | 100 | state->ready = !!gpio_get_value(colibri_pcmcia_gpios[READY].gpio); |
137 | state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpio.bvd1_gpio); | 101 | state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpios[BVD1].gpio); |
138 | state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpio.bvd2_gpio); | 102 | state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpios[BVD2].gpio); |
139 | state->wrprot = 0; | 103 | state->wrprot = 0; |
140 | state->vs_3v = 1; | 104 | state->vs_3v = 1; |
141 | state->vs_Xv = 0; | 105 | state->vs_Xv = 0; |
@@ -145,9 +109,10 @@ static int | |||
145 | colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | 109 | colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, |
146 | const socket_state_t *state) | 110 | const socket_state_t *state) |
147 | { | 111 | { |
148 | gpio_set_value(colibri_pcmcia_gpio.ppen_gpio, | 112 | gpio_set_value(colibri_pcmcia_gpios[PPEN].gpio, |
149 | !(state->Vcc == 33 && state->Vpp < 50)); | 113 | !(state->Vcc == 33 && state->Vpp < 50)); |
150 | gpio_set_value(colibri_pcmcia_gpio.reset_gpio, state->flags & SS_RESET); | 114 | gpio_set_value(colibri_pcmcia_gpios[RESET].gpio, |
115 | state->flags & SS_RESET); | ||
151 | return 0; | 116 | return 0; |
152 | } | 117 | } |
153 | 118 | ||
@@ -190,20 +155,20 @@ static int __init colibri_pcmcia_init(void) | |||
190 | 155 | ||
191 | /* Colibri PXA270 */ | 156 | /* Colibri PXA270 */ |
192 | if (machine_is_colibri()) { | 157 | if (machine_is_colibri()) { |
193 | colibri_pcmcia_gpio.reset_gpio = COLIBRI270_RESET_GPIO; | 158 | colibri_pcmcia_gpios[RESET].gpio = COLIBRI270_RESET_GPIO; |
194 | colibri_pcmcia_gpio.ppen_gpio = COLIBRI270_PPEN_GPIO; | 159 | colibri_pcmcia_gpios[PPEN].gpio = COLIBRI270_PPEN_GPIO; |
195 | colibri_pcmcia_gpio.bvd1_gpio = COLIBRI270_BVD1_GPIO; | 160 | colibri_pcmcia_gpios[BVD1].gpio = COLIBRI270_BVD1_GPIO; |
196 | colibri_pcmcia_gpio.bvd2_gpio = COLIBRI270_BVD2_GPIO; | 161 | colibri_pcmcia_gpios[BVD2].gpio = COLIBRI270_BVD2_GPIO; |
197 | colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO; | 162 | colibri_pcmcia_gpios[DETECT].gpio = COLIBRI270_DETECT_GPIO; |
198 | colibri_pcmcia_gpio.ready_gpio = COLIBRI270_READY_GPIO; | 163 | colibri_pcmcia_gpios[READY].gpio = COLIBRI270_READY_GPIO; |
199 | /* Colibri PXA320 */ | 164 | /* Colibri PXA320 */ |
200 | } else if (machine_is_colibri320()) { | 165 | } else if (machine_is_colibri320()) { |
201 | colibri_pcmcia_gpio.reset_gpio = COLIBRI320_RESET_GPIO; | 166 | colibri_pcmcia_gpios[RESET].gpio = COLIBRI320_RESET_GPIO; |
202 | colibri_pcmcia_gpio.ppen_gpio = COLIBRI320_PPEN_GPIO; | 167 | colibri_pcmcia_gpios[PPEN].gpio = COLIBRI320_PPEN_GPIO; |
203 | colibri_pcmcia_gpio.bvd1_gpio = COLIBRI320_BVD1_GPIO; | 168 | colibri_pcmcia_gpios[BVD1].gpio = COLIBRI320_BVD1_GPIO; |
204 | colibri_pcmcia_gpio.bvd2_gpio = COLIBRI320_BVD2_GPIO; | 169 | colibri_pcmcia_gpios[BVD2].gpio = COLIBRI320_BVD2_GPIO; |
205 | colibri_pcmcia_gpio.detect_gpio = COLIBRI320_DETECT_GPIO; | 170 | colibri_pcmcia_gpios[DETECT].gpio = COLIBRI320_DETECT_GPIO; |
206 | colibri_pcmcia_gpio.ready_gpio = COLIBRI320_READY_GPIO; | 171 | colibri_pcmcia_gpios[READY].gpio = COLIBRI320_READY_GPIO; |
207 | } | 172 | } |
208 | 173 | ||
209 | ret = platform_device_add_data(colibri_pcmcia_device, | 174 | ret = platform_device_add_data(colibri_pcmcia_device, |
diff --git a/drivers/pcmcia/pxa2xx_palmld.c b/drivers/pcmcia/pxa2xx_palmld.c index 6fb6f7f0672e..69f73670949a 100644 --- a/drivers/pcmcia/pxa2xx_palmld.c +++ b/drivers/pcmcia/pxa2xx_palmld.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Driver for Palm LifeDrive PCMCIA | 4 | * Driver for Palm LifeDrive PCMCIA |
5 | * | 5 | * |
6 | * Copyright (C) 2006 Alex Osborne <ato@meshy.org> | 6 | * Copyright (C) 2006 Alex Osborne <ato@meshy.org> |
7 | * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> | 7 | * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -20,49 +20,27 @@ | |||
20 | #include <mach/palmld.h> | 20 | #include <mach/palmld.h> |
21 | #include "soc_common.h" | 21 | #include "soc_common.h" |
22 | 22 | ||
23 | static struct gpio palmld_pcmcia_gpios[] = { | ||
24 | { GPIO_NR_PALMLD_PCMCIA_POWER, GPIOF_INIT_LOW, "PCMCIA Power" }, | ||
25 | { GPIO_NR_PALMLD_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, | ||
26 | { GPIO_NR_PALMLD_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" }, | ||
27 | }; | ||
28 | |||
23 | static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 29 | static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
24 | { | 30 | { |
25 | int ret; | 31 | int ret; |
26 | 32 | ||
27 | ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_POWER, "PCMCIA PWR"); | 33 | ret = gpio_request_array(palmld_pcmcia_gpios, |
28 | if (ret) | 34 | ARRAY_SIZE(palmld_pcmcia_gpios)); |
29 | goto err1; | ||
30 | ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_POWER, 0); | ||
31 | if (ret) | ||
32 | goto err2; | ||
33 | |||
34 | ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_RESET, "PCMCIA RST"); | ||
35 | if (ret) | ||
36 | goto err2; | ||
37 | ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_RESET, 1); | ||
38 | if (ret) | ||
39 | goto err3; | ||
40 | |||
41 | ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_READY, "PCMCIA RDY"); | ||
42 | if (ret) | ||
43 | goto err3; | ||
44 | ret = gpio_direction_input(GPIO_NR_PALMLD_PCMCIA_READY); | ||
45 | if (ret) | ||
46 | goto err4; | ||
47 | 35 | ||
48 | skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); | 36 | skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); |
49 | return 0; | ||
50 | 37 | ||
51 | err4: | ||
52 | gpio_free(GPIO_NR_PALMLD_PCMCIA_READY); | ||
53 | err3: | ||
54 | gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET); | ||
55 | err2: | ||
56 | gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER); | ||
57 | err1: | ||
58 | return ret; | 38 | return ret; |
59 | } | 39 | } |
60 | 40 | ||
61 | static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 41 | static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
62 | { | 42 | { |
63 | gpio_free(GPIO_NR_PALMLD_PCMCIA_READY); | 43 | gpio_free_array(palmld_pcmcia_gpios, ARRAY_SIZE(palmld_pcmcia_gpios)); |
64 | gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET); | ||
65 | gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER); | ||
66 | } | 44 | } |
67 | 45 | ||
68 | static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 46 | static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
diff --git a/drivers/pcmcia/pxa2xx_palmtc.c b/drivers/pcmcia/pxa2xx_palmtc.c index 459a232d66be..d0ad6a76bbde 100644 --- a/drivers/pcmcia/pxa2xx_palmtc.c +++ b/drivers/pcmcia/pxa2xx_palmtc.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Driver for Palm Tungsten|C PCMCIA | 4 | * Driver for Palm Tungsten|C PCMCIA |
5 | * | 5 | * |
6 | * Copyright (C) 2008 Alex Osborne <ato@meshy.org> | 6 | * Copyright (C) 2008 Alex Osborne <ato@meshy.org> |
7 | * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com> | 7 | * Copyright (C) 2009-2011 Marek Vasut <marek.vasut@gmail.com> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -21,79 +21,30 @@ | |||
21 | #include <mach/palmtc.h> | 21 | #include <mach/palmtc.h> |
22 | #include "soc_common.h" | 22 | #include "soc_common.h" |
23 | 23 | ||
24 | static struct gpio palmtc_pcmcia_gpios[] = { | ||
25 | { GPIO_NR_PALMTC_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" }, | ||
26 | { GPIO_NR_PALMTC_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" }, | ||
27 | { GPIO_NR_PALMTC_PCMCIA_POWER3, GPIOF_INIT_LOW, "PCMCIA Power 3" }, | ||
28 | { GPIO_NR_PALMTC_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, | ||
29 | { GPIO_NR_PALMTC_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" }, | ||
30 | { GPIO_NR_PALMTC_PCMCIA_PWRREADY, GPIOF_IN, "PCMCIA Power Ready" }, | ||
31 | }; | ||
32 | |||
24 | static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 33 | static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
25 | { | 34 | { |
26 | int ret; | 35 | int ret; |
27 | 36 | ||
28 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER1, "PCMCIA PWR1"); | 37 | ret = gpio_request_array(palmtc_pcmcia_gpios, |
29 | if (ret) | 38 | ARRAY_SIZE(palmtc_pcmcia_gpios)); |
30 | goto err1; | ||
31 | ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER1, 0); | ||
32 | if (ret) | ||
33 | goto err2; | ||
34 | |||
35 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER2, "PCMCIA PWR2"); | ||
36 | if (ret) | ||
37 | goto err2; | ||
38 | ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER2, 0); | ||
39 | if (ret) | ||
40 | goto err3; | ||
41 | |||
42 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER3, "PCMCIA PWR3"); | ||
43 | if (ret) | ||
44 | goto err3; | ||
45 | ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER3, 0); | ||
46 | if (ret) | ||
47 | goto err4; | ||
48 | |||
49 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_RESET, "PCMCIA RST"); | ||
50 | if (ret) | ||
51 | goto err4; | ||
52 | ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_RESET, 1); | ||
53 | if (ret) | ||
54 | goto err5; | ||
55 | |||
56 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_READY, "PCMCIA RDY"); | ||
57 | if (ret) | ||
58 | goto err5; | ||
59 | ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_READY); | ||
60 | if (ret) | ||
61 | goto err6; | ||
62 | |||
63 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_PWRREADY, "PCMCIA PWRRDY"); | ||
64 | if (ret) | ||
65 | goto err6; | ||
66 | ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_PWRREADY); | ||
67 | if (ret) | ||
68 | goto err7; | ||
69 | 39 | ||
70 | skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY); | 40 | skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY); |
71 | return 0; | ||
72 | 41 | ||
73 | err7: | ||
74 | gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY); | ||
75 | err6: | ||
76 | gpio_free(GPIO_NR_PALMTC_PCMCIA_READY); | ||
77 | err5: | ||
78 | gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET); | ||
79 | err4: | ||
80 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3); | ||
81 | err3: | ||
82 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2); | ||
83 | err2: | ||
84 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1); | ||
85 | err1: | ||
86 | return ret; | 42 | return ret; |
87 | } | 43 | } |
88 | 44 | ||
89 | static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 45 | static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
90 | { | 46 | { |
91 | gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY); | 47 | gpio_free_array(palmtc_pcmcia_gpios, ARRAY_SIZE(palmtc_pcmcia_gpios)); |
92 | gpio_free(GPIO_NR_PALMTC_PCMCIA_READY); | ||
93 | gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET); | ||
94 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3); | ||
95 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2); | ||
96 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1); | ||
97 | } | 48 | } |
98 | 49 | ||
99 | static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 50 | static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
diff --git a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c index b07b247a399f..1a2580450402 100644 --- a/drivers/pcmcia/pxa2xx_palmtx.c +++ b/drivers/pcmcia/pxa2xx_palmtx.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Driver for Palm T|X PCMCIA | 4 | * Driver for Palm T|X PCMCIA |
5 | * | 5 | * |
6 | * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> | 6 | * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -13,67 +13,34 @@ | |||
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/gpio.h> | ||
16 | 17 | ||
17 | #include <asm/mach-types.h> | 18 | #include <asm/mach-types.h> |
18 | |||
19 | #include <mach/gpio.h> | ||
20 | #include <mach/palmtx.h> | 19 | #include <mach/palmtx.h> |
21 | |||
22 | #include "soc_common.h" | 20 | #include "soc_common.h" |
23 | 21 | ||
22 | static struct gpio palmtx_pcmcia_gpios[] = { | ||
23 | { GPIO_NR_PALMTX_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" }, | ||
24 | { GPIO_NR_PALMTX_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" }, | ||
25 | { GPIO_NR_PALMTX_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, | ||
26 | { GPIO_NR_PALMTX_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" }, | ||
27 | }; | ||
28 | |||
24 | static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 29 | static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
25 | { | 30 | { |
26 | int ret; | 31 | int ret; |
27 | 32 | ||
28 | ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER1, "PCMCIA PWR1"); | 33 | ret = gpio_request_array(palmtx_pcmcia_gpios, |
29 | if (ret) | 34 | ARRAY_SIZE(palmtx_pcmcia_gpios)); |
30 | goto err1; | ||
31 | ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER1, 0); | ||
32 | if (ret) | ||
33 | goto err2; | ||
34 | |||
35 | ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER2, "PCMCIA PWR2"); | ||
36 | if (ret) | ||
37 | goto err2; | ||
38 | ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER2, 0); | ||
39 | if (ret) | ||
40 | goto err3; | ||
41 | |||
42 | ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_RESET, "PCMCIA RST"); | ||
43 | if (ret) | ||
44 | goto err3; | ||
45 | ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_RESET, 1); | ||
46 | if (ret) | ||
47 | goto err4; | ||
48 | |||
49 | ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_READY, "PCMCIA RDY"); | ||
50 | if (ret) | ||
51 | goto err4; | ||
52 | ret = gpio_direction_input(GPIO_NR_PALMTX_PCMCIA_READY); | ||
53 | if (ret) | ||
54 | goto err5; | ||
55 | 35 | ||
56 | skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); | 36 | skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); |
57 | return 0; | ||
58 | 37 | ||
59 | err5: | ||
60 | gpio_free(GPIO_NR_PALMTX_PCMCIA_READY); | ||
61 | err4: | ||
62 | gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET); | ||
63 | err3: | ||
64 | gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2); | ||
65 | err2: | ||
66 | gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1); | ||
67 | err1: | ||
68 | return ret; | 38 | return ret; |
69 | } | 39 | } |
70 | 40 | ||
71 | static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 41 | static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
72 | { | 42 | { |
73 | gpio_free(GPIO_NR_PALMTX_PCMCIA_READY); | 43 | gpio_free_array(palmtx_pcmcia_gpios, ARRAY_SIZE(palmtx_pcmcia_gpios)); |
74 | gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET); | ||
75 | gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2); | ||
76 | gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1); | ||
77 | } | 44 | } |
78 | 45 | ||
79 | static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 46 | static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c index 55627eccee8e..435002dfc3ca 100644 --- a/drivers/pcmcia/pxa2xx_vpac270.c +++ b/drivers/pcmcia/pxa2xx_vpac270.c | |||
@@ -3,8 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Driver for Voipac PXA270 PCMCIA and CF sockets | 4 | * Driver for Voipac PXA270 PCMCIA and CF sockets |
5 | * | 5 | * |
6 | * Copyright (C) 2010 | 6 | * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com> |
7 | * Marek Vasut <marek.vasut@gmail.com> | ||
8 | * | 7 | * |
9 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -22,6 +21,19 @@ | |||
22 | 21 | ||
23 | #include "soc_common.h" | 22 | #include "soc_common.h" |
24 | 23 | ||
24 | static struct gpio vpac270_pcmcia_gpios[] = { | ||
25 | { GPIO84_VPAC270_PCMCIA_CD, GPIOF_IN, "PCMCIA Card Detect" }, | ||
26 | { GPIO35_VPAC270_PCMCIA_RDY, GPIOF_IN, "PCMCIA Ready" }, | ||
27 | { GPIO107_VPAC270_PCMCIA_PPEN, GPIOF_INIT_LOW, "PCMCIA PPEN" }, | ||
28 | { GPIO11_VPAC270_PCMCIA_RESET, GPIOF_INIT_LOW, "PCMCIA Reset" }, | ||
29 | }; | ||
30 | |||
31 | static struct gpio vpac270_cf_gpios[] = { | ||
32 | { GPIO17_VPAC270_CF_CD, GPIOF_IN, "CF Card Detect" }, | ||
33 | { GPIO12_VPAC270_CF_RDY, GPIOF_IN, "CF Ready" }, | ||
34 | { GPIO16_VPAC270_CF_RESET, GPIOF_INIT_LOW, "CF Reset" }, | ||
35 | }; | ||
36 | |||
25 | static struct pcmcia_irqs cd_irqs[] = { | 37 | static struct pcmcia_irqs cd_irqs[] = { |
26 | { | 38 | { |
27 | .sock = 0, | 39 | .sock = 0, |
@@ -40,96 +52,34 @@ static int vpac270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
40 | int ret; | 52 | int ret; |
41 | 53 | ||
42 | if (skt->nr == 0) { | 54 | if (skt->nr == 0) { |
43 | ret = gpio_request(GPIO84_VPAC270_PCMCIA_CD, "PCMCIA CD"); | 55 | ret = gpio_request_array(vpac270_pcmcia_gpios, |
44 | if (ret) | 56 | ARRAY_SIZE(vpac270_pcmcia_gpios)); |
45 | goto err1; | ||
46 | ret = gpio_direction_input(GPIO84_VPAC270_PCMCIA_CD); | ||
47 | if (ret) | ||
48 | goto err2; | ||
49 | |||
50 | ret = gpio_request(GPIO35_VPAC270_PCMCIA_RDY, "PCMCIA RDY"); | ||
51 | if (ret) | ||
52 | goto err2; | ||
53 | ret = gpio_direction_input(GPIO35_VPAC270_PCMCIA_RDY); | ||
54 | if (ret) | ||
55 | goto err3; | ||
56 | |||
57 | ret = gpio_request(GPIO107_VPAC270_PCMCIA_PPEN, "PCMCIA PPEN"); | ||
58 | if (ret) | ||
59 | goto err3; | ||
60 | ret = gpio_direction_output(GPIO107_VPAC270_PCMCIA_PPEN, 0); | ||
61 | if (ret) | ||
62 | goto err4; | ||
63 | |||
64 | ret = gpio_request(GPIO11_VPAC270_PCMCIA_RESET, "PCMCIA RESET"); | ||
65 | if (ret) | ||
66 | goto err4; | ||
67 | ret = gpio_direction_output(GPIO11_VPAC270_PCMCIA_RESET, 0); | ||
68 | if (ret) | ||
69 | goto err5; | ||
70 | 57 | ||
71 | skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY); | 58 | skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY); |
72 | 59 | ||
73 | return soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1); | 60 | if (!ret) |
74 | 61 | ret = soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1); | |
75 | err5: | ||
76 | gpio_free(GPIO11_VPAC270_PCMCIA_RESET); | ||
77 | err4: | ||
78 | gpio_free(GPIO107_VPAC270_PCMCIA_PPEN); | ||
79 | err3: | ||
80 | gpio_free(GPIO35_VPAC270_PCMCIA_RDY); | ||
81 | err2: | ||
82 | gpio_free(GPIO84_VPAC270_PCMCIA_CD); | ||
83 | err1: | ||
84 | return ret; | ||
85 | |||
86 | } else { | 62 | } else { |
87 | ret = gpio_request(GPIO17_VPAC270_CF_CD, "CF CD"); | 63 | ret = gpio_request_array(vpac270_cf_gpios, |
88 | if (ret) | 64 | ARRAY_SIZE(vpac270_cf_gpios)); |
89 | goto err6; | ||
90 | ret = gpio_direction_input(GPIO17_VPAC270_CF_CD); | ||
91 | if (ret) | ||
92 | goto err7; | ||
93 | |||
94 | ret = gpio_request(GPIO12_VPAC270_CF_RDY, "CF RDY"); | ||
95 | if (ret) | ||
96 | goto err7; | ||
97 | ret = gpio_direction_input(GPIO12_VPAC270_CF_RDY); | ||
98 | if (ret) | ||
99 | goto err8; | ||
100 | |||
101 | ret = gpio_request(GPIO16_VPAC270_CF_RESET, "CF RESET"); | ||
102 | if (ret) | ||
103 | goto err8; | ||
104 | ret = gpio_direction_output(GPIO16_VPAC270_CF_RESET, 0); | ||
105 | if (ret) | ||
106 | goto err9; | ||
107 | 65 | ||
108 | skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY); | 66 | skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY); |
109 | 67 | ||
110 | return soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1); | 68 | if (!ret) |
111 | 69 | ret = soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1); | |
112 | err9: | ||
113 | gpio_free(GPIO16_VPAC270_CF_RESET); | ||
114 | err8: | ||
115 | gpio_free(GPIO12_VPAC270_CF_RDY); | ||
116 | err7: | ||
117 | gpio_free(GPIO17_VPAC270_CF_CD); | ||
118 | err6: | ||
119 | return ret; | ||
120 | |||
121 | } | 70 | } |
71 | |||
72 | return ret; | ||
122 | } | 73 | } |
123 | 74 | ||
124 | static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 75 | static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
125 | { | 76 | { |
126 | gpio_free(GPIO11_VPAC270_PCMCIA_RESET); | 77 | if (skt->nr == 0) |
127 | gpio_free(GPIO107_VPAC270_PCMCIA_PPEN); | 78 | gpio_request_array(vpac270_pcmcia_gpios, |
128 | gpio_free(GPIO35_VPAC270_PCMCIA_RDY); | 79 | ARRAY_SIZE(vpac270_pcmcia_gpios)); |
129 | gpio_free(GPIO84_VPAC270_PCMCIA_CD); | 80 | else |
130 | gpio_free(GPIO16_VPAC270_CF_RESET); | 81 | gpio_request_array(vpac270_cf_gpios, |
131 | gpio_free(GPIO12_VPAC270_CF_RDY); | 82 | ARRAY_SIZE(vpac270_cf_gpios)); |
132 | gpio_free(GPIO17_VPAC270_CF_CD); | ||
133 | } | 83 | } |
134 | 84 | ||
135 | static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 85 | static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index b37f92cb71bc..444b60aa15e9 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -139,24 +139,6 @@ static const char ep0name [] = "ep0"; | |||
139 | static void pxa25x_ep_fifo_flush (struct usb_ep *ep); | 139 | static void pxa25x_ep_fifo_flush (struct usb_ep *ep); |
140 | static void nuke (struct pxa25x_ep *, int status); | 140 | static void nuke (struct pxa25x_ep *, int status); |
141 | 141 | ||
142 | /* one GPIO should be used to detect VBUS from the host */ | ||
143 | static int is_vbus_present(void) | ||
144 | { | ||
145 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | ||
146 | |||
147 | if (gpio_is_valid(mach->gpio_vbus)) { | ||
148 | int value = gpio_get_value(mach->gpio_vbus); | ||
149 | |||
150 | if (mach->gpio_vbus_inverted) | ||
151 | return !value; | ||
152 | else | ||
153 | return !!value; | ||
154 | } | ||
155 | if (mach->udc_is_connected) | ||
156 | return mach->udc_is_connected(); | ||
157 | return 1; | ||
158 | } | ||
159 | |||
160 | /* one GPIO should control a D+ pullup, so host sees this device (or not) */ | 142 | /* one GPIO should control a D+ pullup, so host sees this device (or not) */ |
161 | static void pullup_off(void) | 143 | static void pullup_off(void) |
162 | { | 144 | { |
@@ -1055,7 +1037,7 @@ udc_seq_show(struct seq_file *m, void *_d) | |||
1055 | "%s version: %s\nGadget driver: %s\nHost %s\n\n", | 1037 | "%s version: %s\nGadget driver: %s\nHost %s\n\n", |
1056 | driver_name, DRIVER_VERSION SIZE_STR "(pio)", | 1038 | driver_name, DRIVER_VERSION SIZE_STR "(pio)", |
1057 | dev->driver ? dev->driver->driver.name : "(none)", | 1039 | dev->driver ? dev->driver->driver.name : "(none)", |
1058 | is_vbus_present() ? "full speed" : "disconnected"); | 1040 | dev->gadget.speed == USB_SPEED_FULL ? "full speed" : "disconnected"); |
1059 | 1041 | ||
1060 | /* registers for device and ep0 */ | 1042 | /* registers for device and ep0 */ |
1061 | seq_printf(m, | 1043 | seq_printf(m, |
@@ -1094,7 +1076,7 @@ udc_seq_show(struct seq_file *m, void *_d) | |||
1094 | (tmp & UDCCFR_ACM) ? " acm" : ""); | 1076 | (tmp & UDCCFR_ACM) ? " acm" : ""); |
1095 | } | 1077 | } |
1096 | 1078 | ||
1097 | if (!is_vbus_present() || !dev->driver) | 1079 | if (dev->gadget.speed != USB_SPEED_FULL || !dev->driver) |
1098 | goto done; | 1080 | goto done; |
1099 | 1081 | ||
1100 | seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n", | 1082 | seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n", |
@@ -1435,14 +1417,6 @@ lubbock_vbus_irq(int irq, void *_dev) | |||
1435 | 1417 | ||
1436 | #endif | 1418 | #endif |
1437 | 1419 | ||
1438 | static irqreturn_t udc_vbus_irq(int irq, void *_dev) | ||
1439 | { | ||
1440 | struct pxa25x_udc *dev = _dev; | ||
1441 | |||
1442 | pxa25x_udc_vbus_session(&dev->gadget, is_vbus_present()); | ||
1443 | return IRQ_HANDLED; | ||
1444 | } | ||
1445 | |||
1446 | 1420 | ||
1447 | /*-------------------------------------------------------------------------*/ | 1421 | /*-------------------------------------------------------------------------*/ |
1448 | 1422 | ||
@@ -1766,12 +1740,9 @@ pxa25x_udc_irq(int irq, void *_dev) | |||
1766 | if (unlikely(udccr & UDCCR_SUSIR)) { | 1740 | if (unlikely(udccr & UDCCR_SUSIR)) { |
1767 | udc_ack_int_UDCCR(UDCCR_SUSIR); | 1741 | udc_ack_int_UDCCR(UDCCR_SUSIR); |
1768 | handled = 1; | 1742 | handled = 1; |
1769 | DBG(DBG_VERBOSE, "USB suspend%s\n", is_vbus_present() | 1743 | DBG(DBG_VERBOSE, "USB suspend\n"); |
1770 | ? "" : "+disconnect"); | ||
1771 | 1744 | ||
1772 | if (!is_vbus_present()) | 1745 | if (dev->gadget.speed != USB_SPEED_UNKNOWN |
1773 | stop_activity(dev, dev->driver); | ||
1774 | else if (dev->gadget.speed != USB_SPEED_UNKNOWN | ||
1775 | && dev->driver | 1746 | && dev->driver |
1776 | && dev->driver->suspend) | 1747 | && dev->driver->suspend) |
1777 | dev->driver->suspend(&dev->gadget); | 1748 | dev->driver->suspend(&dev->gadget); |
@@ -1786,8 +1757,7 @@ pxa25x_udc_irq(int irq, void *_dev) | |||
1786 | 1757 | ||
1787 | if (dev->gadget.speed != USB_SPEED_UNKNOWN | 1758 | if (dev->gadget.speed != USB_SPEED_UNKNOWN |
1788 | && dev->driver | 1759 | && dev->driver |
1789 | && dev->driver->resume | 1760 | && dev->driver->resume) |
1790 | && is_vbus_present()) | ||
1791 | dev->driver->resume(&dev->gadget); | 1761 | dev->driver->resume(&dev->gadget); |
1792 | } | 1762 | } |
1793 | 1763 | ||
@@ -2137,7 +2107,7 @@ static struct pxa25x_udc memory = { | |||
2137 | static int __init pxa25x_udc_probe(struct platform_device *pdev) | 2107 | static int __init pxa25x_udc_probe(struct platform_device *pdev) |
2138 | { | 2108 | { |
2139 | struct pxa25x_udc *dev = &memory; | 2109 | struct pxa25x_udc *dev = &memory; |
2140 | int retval, vbus_irq, irq; | 2110 | int retval, irq; |
2141 | u32 chiprev; | 2111 | u32 chiprev; |
2142 | 2112 | ||
2143 | /* insist on Intel/ARM/XScale */ | 2113 | /* insist on Intel/ARM/XScale */ |
@@ -2199,19 +2169,6 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2199 | 2169 | ||
2200 | dev->transceiver = otg_get_transceiver(); | 2170 | dev->transceiver = otg_get_transceiver(); |
2201 | 2171 | ||
2202 | if (gpio_is_valid(dev->mach->gpio_vbus)) { | ||
2203 | if ((retval = gpio_request(dev->mach->gpio_vbus, | ||
2204 | "pxa25x_udc GPIO VBUS"))) { | ||
2205 | dev_dbg(&pdev->dev, | ||
2206 | "can't get vbus gpio %d, err: %d\n", | ||
2207 | dev->mach->gpio_vbus, retval); | ||
2208 | goto err_gpio_vbus; | ||
2209 | } | ||
2210 | gpio_direction_input(dev->mach->gpio_vbus); | ||
2211 | vbus_irq = gpio_to_irq(dev->mach->gpio_vbus); | ||
2212 | } else | ||
2213 | vbus_irq = 0; | ||
2214 | |||
2215 | if (gpio_is_valid(dev->mach->gpio_pullup)) { | 2172 | if (gpio_is_valid(dev->mach->gpio_pullup)) { |
2216 | if ((retval = gpio_request(dev->mach->gpio_pullup, | 2173 | if ((retval = gpio_request(dev->mach->gpio_pullup, |
2217 | "pca25x_udc GPIO PULLUP"))) { | 2174 | "pca25x_udc GPIO PULLUP"))) { |
@@ -2237,7 +2194,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2237 | udc_disable(dev); | 2194 | udc_disable(dev); |
2238 | udc_reinit(dev); | 2195 | udc_reinit(dev); |
2239 | 2196 | ||
2240 | dev->vbus = !!is_vbus_present(); | 2197 | dev->vbus = 0; |
2241 | 2198 | ||
2242 | /* irq setup after old hardware state is cleaned up */ | 2199 | /* irq setup after old hardware state is cleaned up */ |
2243 | retval = request_irq(irq, pxa25x_udc_irq, | 2200 | retval = request_irq(irq, pxa25x_udc_irq, |
@@ -2273,22 +2230,10 @@ lubbock_fail0: | |||
2273 | } | 2230 | } |
2274 | } else | 2231 | } else |
2275 | #endif | 2232 | #endif |
2276 | if (vbus_irq) { | ||
2277 | retval = request_irq(vbus_irq, udc_vbus_irq, | ||
2278 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
2279 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
2280 | driver_name, dev); | ||
2281 | if (retval != 0) { | ||
2282 | pr_err("%s: can't get irq %i, err %d\n", | ||
2283 | driver_name, vbus_irq, retval); | ||
2284 | goto err_vbus_irq; | ||
2285 | } | ||
2286 | } | ||
2287 | create_debug_files(dev); | 2233 | create_debug_files(dev); |
2288 | 2234 | ||
2289 | return 0; | 2235 | return 0; |
2290 | 2236 | ||
2291 | err_vbus_irq: | ||
2292 | #ifdef CONFIG_ARCH_LUBBOCK | 2237 | #ifdef CONFIG_ARCH_LUBBOCK |
2293 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); | 2238 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); |
2294 | err_irq_lub: | 2239 | err_irq_lub: |
@@ -2298,9 +2243,6 @@ lubbock_fail0: | |||
2298 | if (gpio_is_valid(dev->mach->gpio_pullup)) | 2243 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2299 | gpio_free(dev->mach->gpio_pullup); | 2244 | gpio_free(dev->mach->gpio_pullup); |
2300 | err_gpio_pullup: | 2245 | err_gpio_pullup: |
2301 | if (gpio_is_valid(dev->mach->gpio_vbus)) | ||
2302 | gpio_free(dev->mach->gpio_vbus); | ||
2303 | err_gpio_vbus: | ||
2304 | if (dev->transceiver) { | 2246 | if (dev->transceiver) { |
2305 | otg_put_transceiver(dev->transceiver); | 2247 | otg_put_transceiver(dev->transceiver); |
2306 | dev->transceiver = NULL; | 2248 | dev->transceiver = NULL; |
@@ -2337,10 +2279,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) | |||
2337 | free_irq(LUBBOCK_USB_IRQ, dev); | 2279 | free_irq(LUBBOCK_USB_IRQ, dev); |
2338 | } | 2280 | } |
2339 | #endif | 2281 | #endif |
2340 | if (gpio_is_valid(dev->mach->gpio_vbus)) { | ||
2341 | free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev); | ||
2342 | gpio_free(dev->mach->gpio_vbus); | ||
2343 | } | ||
2344 | if (gpio_is_valid(dev->mach->gpio_pullup)) | 2282 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2345 | gpio_free(dev->mach->gpio_pullup); | 2283 | gpio_free(dev->mach->gpio_pullup); |
2346 | 2284 | ||
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 825b665245bb..a2e5b5100ab4 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -627,7 +627,12 @@ static void overlay1fb_enable(struct pxafb_layer *ofb) | |||
627 | 627 | ||
628 | static void overlay1fb_disable(struct pxafb_layer *ofb) | 628 | static void overlay1fb_disable(struct pxafb_layer *ofb) |
629 | { | 629 | { |
630 | uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5); | 630 | uint32_t lccr5; |
631 | |||
632 | if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN)) | ||
633 | return; | ||
634 | |||
635 | lccr5 = lcd_readl(ofb->fbi, LCCR5); | ||
631 | 636 | ||
632 | lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN); | 637 | lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN); |
633 | 638 | ||
@@ -685,7 +690,12 @@ static void overlay2fb_enable(struct pxafb_layer *ofb) | |||
685 | 690 | ||
686 | static void overlay2fb_disable(struct pxafb_layer *ofb) | 691 | static void overlay2fb_disable(struct pxafb_layer *ofb) |
687 | { | 692 | { |
688 | uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5); | 693 | uint32_t lccr5; |
694 | |||
695 | if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN)) | ||
696 | return; | ||
697 | |||
698 | lccr5 = lcd_readl(ofb->fbi, LCCR5); | ||
689 | 699 | ||
690 | lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN); | 700 | lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN); |
691 | 701 | ||
@@ -720,12 +730,10 @@ static int overlayfb_open(struct fb_info *info, int user) | |||
720 | if (user == 0) | 730 | if (user == 0) |
721 | return -ENODEV; | 731 | return -ENODEV; |
722 | 732 | ||
723 | /* allow only one user at a time */ | 733 | if (ofb->usage++ == 0) |
724 | if (atomic_inc_and_test(&ofb->usage)) | 734 | /* unblank the base framebuffer */ |
725 | return -EBUSY; | 735 | fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK); |
726 | 736 | ||
727 | /* unblank the base framebuffer */ | ||
728 | fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK); | ||
729 | return 0; | 737 | return 0; |
730 | } | 738 | } |
731 | 739 | ||
@@ -733,12 +741,15 @@ static int overlayfb_release(struct fb_info *info, int user) | |||
733 | { | 741 | { |
734 | struct pxafb_layer *ofb = (struct pxafb_layer*) info; | 742 | struct pxafb_layer *ofb = (struct pxafb_layer*) info; |
735 | 743 | ||
736 | atomic_dec(&ofb->usage); | 744 | if (ofb->usage == 1) { |
737 | ofb->ops->disable(ofb); | 745 | ofb->ops->disable(ofb); |
746 | ofb->fb.var.height = -1; | ||
747 | ofb->fb.var.width = -1; | ||
748 | ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0; | ||
749 | ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0; | ||
738 | 750 | ||
739 | free_pages_exact(ofb->video_mem, ofb->video_mem_size); | 751 | ofb->usage--; |
740 | ofb->video_mem = NULL; | 752 | } |
741 | ofb->video_mem_size = 0; | ||
742 | return 0; | 753 | return 0; |
743 | } | 754 | } |
744 | 755 | ||
@@ -750,7 +761,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo *var, | |||
750 | int xpos, ypos, pfor, bpp; | 761 | int xpos, ypos, pfor, bpp; |
751 | 762 | ||
752 | xpos = NONSTD_TO_XPOS(var->nonstd); | 763 | xpos = NONSTD_TO_XPOS(var->nonstd); |
753 | ypos = NONSTD_TO_XPOS(var->nonstd); | 764 | ypos = NONSTD_TO_YPOS(var->nonstd); |
754 | pfor = NONSTD_TO_PFOR(var->nonstd); | 765 | pfor = NONSTD_TO_PFOR(var->nonstd); |
755 | 766 | ||
756 | bpp = pxafb_var_to_bpp(var); | 767 | bpp = pxafb_var_to_bpp(var); |
@@ -794,7 +805,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo *var, | |||
794 | return 0; | 805 | return 0; |
795 | } | 806 | } |
796 | 807 | ||
797 | static int overlayfb_map_video_memory(struct pxafb_layer *ofb) | 808 | static int overlayfb_check_video_memory(struct pxafb_layer *ofb) |
798 | { | 809 | { |
799 | struct fb_var_screeninfo *var = &ofb->fb.var; | 810 | struct fb_var_screeninfo *var = &ofb->fb.var; |
800 | int pfor = NONSTD_TO_PFOR(var->nonstd); | 811 | int pfor = NONSTD_TO_PFOR(var->nonstd); |
@@ -812,27 +823,11 @@ static int overlayfb_map_video_memory(struct pxafb_layer *ofb) | |||
812 | 823 | ||
813 | size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual); | 824 | size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual); |
814 | 825 | ||
815 | /* don't re-allocate if the original video memory is enough */ | ||
816 | if (ofb->video_mem) { | 826 | if (ofb->video_mem) { |
817 | if (ofb->video_mem_size >= size) | 827 | if (ofb->video_mem_size >= size) |
818 | return 0; | 828 | return 0; |
819 | |||
820 | free_pages_exact(ofb->video_mem, ofb->video_mem_size); | ||
821 | } | 829 | } |
822 | 830 | return -EINVAL; | |
823 | ofb->video_mem = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO); | ||
824 | if (ofb->video_mem == NULL) | ||
825 | return -ENOMEM; | ||
826 | |||
827 | ofb->video_mem_phys = virt_to_phys(ofb->video_mem); | ||
828 | ofb->video_mem_size = size; | ||
829 | |||
830 | mutex_lock(&ofb->fb.mm_lock); | ||
831 | ofb->fb.fix.smem_start = ofb->video_mem_phys; | ||
832 | ofb->fb.fix.smem_len = ofb->fb.fix.line_length * var->yres_virtual; | ||
833 | mutex_unlock(&ofb->fb.mm_lock); | ||
834 | ofb->fb.screen_base = ofb->video_mem; | ||
835 | return 0; | ||
836 | } | 831 | } |
837 | 832 | ||
838 | static int overlayfb_set_par(struct fb_info *info) | 833 | static int overlayfb_set_par(struct fb_info *info) |
@@ -841,13 +836,13 @@ static int overlayfb_set_par(struct fb_info *info) | |||
841 | struct fb_var_screeninfo *var = &info->var; | 836 | struct fb_var_screeninfo *var = &info->var; |
842 | int xpos, ypos, pfor, bpp, ret; | 837 | int xpos, ypos, pfor, bpp, ret; |
843 | 838 | ||
844 | ret = overlayfb_map_video_memory(ofb); | 839 | ret = overlayfb_check_video_memory(ofb); |
845 | if (ret) | 840 | if (ret) |
846 | return ret; | 841 | return ret; |
847 | 842 | ||
848 | bpp = pxafb_var_to_bpp(var); | 843 | bpp = pxafb_var_to_bpp(var); |
849 | xpos = NONSTD_TO_XPOS(var->nonstd); | 844 | xpos = NONSTD_TO_XPOS(var->nonstd); |
850 | ypos = NONSTD_TO_XPOS(var->nonstd); | 845 | ypos = NONSTD_TO_YPOS(var->nonstd); |
851 | pfor = NONSTD_TO_PFOR(var->nonstd); | 846 | pfor = NONSTD_TO_PFOR(var->nonstd); |
852 | 847 | ||
853 | ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) | | 848 | ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) | |
@@ -891,7 +886,7 @@ static void __devinit init_pxafb_overlay(struct pxafb_info *fbi, | |||
891 | 886 | ||
892 | ofb->id = id; | 887 | ofb->id = id; |
893 | ofb->ops = &ofb_ops[id]; | 888 | ofb->ops = &ofb_ops[id]; |
894 | atomic_set(&ofb->usage, 0); | 889 | ofb->usage = 0; |
895 | ofb->fbi = fbi; | 890 | ofb->fbi = fbi; |
896 | init_completion(&ofb->branch_done); | 891 | init_completion(&ofb->branch_done); |
897 | } | 892 | } |
@@ -904,29 +899,60 @@ static inline int pxafb_overlay_supported(void) | |||
904 | return 0; | 899 | return 0; |
905 | } | 900 | } |
906 | 901 | ||
907 | static int __devinit pxafb_overlay_init(struct pxafb_info *fbi) | 902 | static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info *pxafb, |
903 | struct pxafb_layer *ofb) | ||
904 | { | ||
905 | /* We assume that user will use at most video_mem_size for overlay fb, | ||
906 | * anyway, it's useless to use 16bpp main plane and 24bpp overlay | ||
907 | */ | ||
908 | ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size), | ||
909 | GFP_KERNEL | __GFP_ZERO); | ||
910 | if (ofb->video_mem == NULL) | ||
911 | return -ENOMEM; | ||
912 | |||
913 | ofb->video_mem_phys = virt_to_phys(ofb->video_mem); | ||
914 | ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size); | ||
915 | |||
916 | mutex_lock(&ofb->fb.mm_lock); | ||
917 | ofb->fb.fix.smem_start = ofb->video_mem_phys; | ||
918 | ofb->fb.fix.smem_len = pxafb->video_mem_size; | ||
919 | mutex_unlock(&ofb->fb.mm_lock); | ||
920 | |||
921 | ofb->fb.screen_base = ofb->video_mem; | ||
922 | |||
923 | return 0; | ||
924 | } | ||
925 | |||
926 | static void __devinit pxafb_overlay_init(struct pxafb_info *fbi) | ||
908 | { | 927 | { |
909 | int i, ret; | 928 | int i, ret; |
910 | 929 | ||
911 | if (!pxafb_overlay_supported()) | 930 | if (!pxafb_overlay_supported()) |
912 | return 0; | 931 | return; |
913 | 932 | ||
914 | for (i = 0; i < 2; i++) { | 933 | for (i = 0; i < 2; i++) { |
915 | init_pxafb_overlay(fbi, &fbi->overlay[i], i); | 934 | struct pxafb_layer *ofb = &fbi->overlay[i]; |
916 | ret = register_framebuffer(&fbi->overlay[i].fb); | 935 | init_pxafb_overlay(fbi, ofb, i); |
936 | ret = register_framebuffer(&ofb->fb); | ||
917 | if (ret) { | 937 | if (ret) { |
918 | dev_err(fbi->dev, "failed to register overlay %d\n", i); | 938 | dev_err(fbi->dev, "failed to register overlay %d\n", i); |
919 | return ret; | 939 | continue; |
920 | } | 940 | } |
941 | ret = pxafb_overlay_map_video_memory(fbi, ofb); | ||
942 | if (ret) { | ||
943 | dev_err(fbi->dev, | ||
944 | "failed to map video memory for overlay %d\n", | ||
945 | i); | ||
946 | unregister_framebuffer(&ofb->fb); | ||
947 | continue; | ||
948 | } | ||
949 | ofb->registered = 1; | ||
921 | } | 950 | } |
922 | 951 | ||
923 | /* mask all IU/BS/EOF/SOF interrupts */ | 952 | /* mask all IU/BS/EOF/SOF interrupts */ |
924 | lcd_writel(fbi, LCCR5, ~0); | 953 | lcd_writel(fbi, LCCR5, ~0); |
925 | 954 | ||
926 | /* place overlay(s) on top of base */ | ||
927 | fbi->lccr0 |= LCCR0_OUC; | ||
928 | pr_info("PXA Overlay driver loaded successfully!\n"); | 955 | pr_info("PXA Overlay driver loaded successfully!\n"); |
929 | return 0; | ||
930 | } | 956 | } |
931 | 957 | ||
932 | static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi) | 958 | static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi) |
@@ -936,8 +962,15 @@ static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi) | |||
936 | if (!pxafb_overlay_supported()) | 962 | if (!pxafb_overlay_supported()) |
937 | return; | 963 | return; |
938 | 964 | ||
939 | for (i = 0; i < 2; i++) | 965 | for (i = 0; i < 2; i++) { |
940 | unregister_framebuffer(&fbi->overlay[i].fb); | 966 | struct pxafb_layer *ofb = &fbi->overlay[i]; |
967 | if (ofb->registered) { | ||
968 | if (ofb->video_mem) | ||
969 | free_pages_exact(ofb->video_mem, | ||
970 | ofb->video_mem_size); | ||
971 | unregister_framebuffer(&ofb->fb); | ||
972 | } | ||
973 | } | ||
941 | } | 974 | } |
942 | #else | 975 | #else |
943 | static inline void pxafb_overlay_init(struct pxafb_info *fbi) {} | 976 | static inline void pxafb_overlay_init(struct pxafb_info *fbi) {} |
@@ -1368,7 +1401,8 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, | |||
1368 | (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) || | 1401 | (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) || |
1369 | (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) || | 1402 | (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) || |
1370 | (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) || | 1403 | (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) || |
1371 | (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])) | 1404 | ((fbi->lccr0 & LCCR0_SDS) && |
1405 | (lcd_readl(fbi, FDADR1) != fbi->fdadr[1]))) | ||
1372 | pxafb_schedule_work(fbi, C_REENABLE); | 1406 | pxafb_schedule_work(fbi, C_REENABLE); |
1373 | 1407 | ||
1374 | return 0; | 1408 | return 0; |
@@ -1420,7 +1454,8 @@ static void pxafb_enable_controller(struct pxafb_info *fbi) | |||
1420 | lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB); | 1454 | lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB); |
1421 | 1455 | ||
1422 | lcd_writel(fbi, FDADR0, fbi->fdadr[0]); | 1456 | lcd_writel(fbi, FDADR0, fbi->fdadr[0]); |
1423 | lcd_writel(fbi, FDADR1, fbi->fdadr[1]); | 1457 | if (fbi->lccr0 & LCCR0_SDS) |
1458 | lcd_writel(fbi, FDADR1, fbi->fdadr[1]); | ||
1424 | lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB); | 1459 | lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB); |
1425 | } | 1460 | } |
1426 | 1461 | ||
@@ -1613,7 +1648,8 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data) | |||
1613 | 1648 | ||
1614 | switch (val) { | 1649 | switch (val) { |
1615 | case CPUFREQ_PRECHANGE: | 1650 | case CPUFREQ_PRECHANGE: |
1616 | set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); | 1651 | if (!fbi->overlay[0].usage && !fbi->overlay[1].usage) |
1652 | set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); | ||
1617 | break; | 1653 | break; |
1618 | 1654 | ||
1619 | case CPUFREQ_POSTCHANGE: | 1655 | case CPUFREQ_POSTCHANGE: |
@@ -1806,6 +1842,12 @@ static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev) | |||
1806 | 1842 | ||
1807 | pxafb_decode_mach_info(fbi, inf); | 1843 | pxafb_decode_mach_info(fbi, inf); |
1808 | 1844 | ||
1845 | #ifdef CONFIG_FB_PXA_OVERLAY | ||
1846 | /* place overlay(s) on top of base */ | ||
1847 | if (pxafb_overlay_supported()) | ||
1848 | fbi->lccr0 |= LCCR0_OUC; | ||
1849 | #endif | ||
1850 | |||
1809 | init_waitqueue_head(&fbi->ctrlr_wait); | 1851 | init_waitqueue_head(&fbi->ctrlr_wait); |
1810 | INIT_WORK(&fbi->task, pxafb_task); | 1852 | INIT_WORK(&fbi->task, pxafb_task); |
1811 | mutex_init(&fbi->ctrlr_lock); | 1853 | mutex_init(&fbi->ctrlr_lock); |
diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h index 2353521c5c8c..26ba9fa3f737 100644 --- a/drivers/video/pxafb.h +++ b/drivers/video/pxafb.h | |||
@@ -92,7 +92,8 @@ struct pxafb_layer_ops { | |||
92 | struct pxafb_layer { | 92 | struct pxafb_layer { |
93 | struct fb_info fb; | 93 | struct fb_info fb; |
94 | int id; | 94 | int id; |
95 | atomic_t usage; | 95 | int registered; |
96 | uint32_t usage; | ||
96 | uint32_t control[2]; | 97 | uint32_t control[2]; |
97 | 98 | ||
98 | struct pxafb_layer_ops *ops; | 99 | struct pxafb_layer_ops *ops; |