diff options
Diffstat (limited to 'arch/arm/mach-pxa')
47 files changed, 3515 insertions, 765 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 17d3fbd368a3..f4533f8ff4e8 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -51,6 +51,12 @@ config MACH_INTELMOTE2 | |||
51 | select IWMMXT | 51 | select IWMMXT |
52 | select PXA_HAVE_BOARD_IRQS | 52 | select PXA_HAVE_BOARD_IRQS |
53 | 53 | ||
54 | config MACH_STARGATE2 | ||
55 | bool "Intel Stargate 2 Platform" | ||
56 | select PXA27x | ||
57 | select IWMMXT | ||
58 | select PXA_HAVE_BOARD_IRQS | ||
59 | |||
54 | config ARCH_LUBBOCK | 60 | config ARCH_LUBBOCK |
55 | bool "Intel DBPXA250 Development Platform" | 61 | bool "Intel DBPXA250 Development Platform" |
56 | select PXA25x | 62 | select PXA25x |
@@ -88,6 +94,10 @@ config PXA_SHARPSL | |||
88 | SL-C3000 (Spitz), SL-C3100 (Borzoi) or SL-C6000x (Tosa) | 94 | SL-C3000 (Spitz), SL-C3100 (Borzoi) or SL-C6000x (Tosa) |
89 | handheld computer. | 95 | handheld computer. |
90 | 96 | ||
97 | config SHARPSL_PM | ||
98 | bool | ||
99 | select APM_EMULATION | ||
100 | |||
91 | config CORGI_SSP_DEPRECATED | 101 | config CORGI_SSP_DEPRECATED |
92 | bool | 102 | bool |
93 | select PXA_SSP | 103 | select PXA_SSP |
@@ -280,6 +290,7 @@ config MACH_ZYLONITE | |||
280 | select PXA3xx | 290 | select PXA3xx |
281 | select PXA_SSP | 291 | select PXA_SSP |
282 | select HAVE_PWM | 292 | select HAVE_PWM |
293 | select PXA_HAVE_BOARD_IRQS | ||
283 | 294 | ||
284 | config MACH_LITTLETON | 295 | config MACH_LITTLETON |
285 | bool "PXA3xx Form Factor Platform (aka Littleton)" | 296 | bool "PXA3xx Form Factor Platform (aka Littleton)" |
@@ -308,6 +319,14 @@ config MACH_CM_X300 | |||
308 | select PXA3xx | 319 | select PXA3xx |
309 | select CPU_PXA300 | 320 | select CPU_PXA300 |
310 | 321 | ||
322 | config MACH_H4700 | ||
323 | bool "HP iPAQ hx4700" | ||
324 | select PXA27x | ||
325 | select IWMMXT | ||
326 | select PXA_SSP | ||
327 | select HAVE_PWM | ||
328 | select PXA_HAVE_BOARD_IRQS | ||
329 | |||
311 | config MACH_MAGICIAN | 330 | config MACH_MAGICIAN |
312 | bool "Enable HTC Magician Support" | 331 | bool "Enable HTC Magician Support" |
313 | select PXA27x | 332 | select PXA27x |
@@ -505,12 +524,6 @@ config PXA_SSP | |||
505 | help | 524 | help |
506 | Enable support for PXA2xx SSP ports | 525 | Enable support for PXA2xx SSP ports |
507 | 526 | ||
508 | config PXA_PWM | ||
509 | tristate | ||
510 | default BACKLIGHT_PWM | ||
511 | help | ||
512 | Enable support for PXA2xx/PXA3xx PWM controllers | ||
513 | |||
514 | config TOSA_BT | 527 | config TOSA_BT |
515 | tristate "Control the state of built-in bluetooth chip on Sharp SL-6000" | 528 | tristate "Control the state of built-in bluetooth chip on Sharp SL-6000" |
516 | depends on MACH_TOSA | 529 | depends on MACH_TOSA |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 682dbf4e14b0..d18ffef44b8c 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -15,7 +15,6 @@ endif | |||
15 | 15 | ||
16 | # Generic drivers that other drivers may depend upon | 16 | # Generic drivers that other drivers may depend upon |
17 | obj-$(CONFIG_PXA_SSP) += ssp.o | 17 | obj-$(CONFIG_PXA_SSP) += ssp.o |
18 | obj-$(CONFIG_PXA_PWM) += pwm.o | ||
19 | 18 | ||
20 | # SoC-specific code | 19 | # SoC-specific code |
21 | obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa2xx.o pxa25x.o | 20 | obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa2xx.o pxa25x.o |
@@ -47,6 +46,7 @@ obj-$(CONFIG_MACH_PCM027) += pcm027.o | |||
47 | obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o | 46 | obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o |
48 | obj-$(CONFIG_MACH_TOSA) += tosa.o | 47 | obj-$(CONFIG_MACH_TOSA) += tosa.o |
49 | obj-$(CONFIG_MACH_EM_X270) += em-x270.o | 48 | obj-$(CONFIG_MACH_EM_X270) += em-x270.o |
49 | obj-$(CONFIG_MACH_H4700) += hx4700.o | ||
50 | obj-$(CONFIG_MACH_MAGICIAN) += magician.o | 50 | obj-$(CONFIG_MACH_MAGICIAN) += magician.o |
51 | obj-$(CONFIG_MACH_HIMALAYA) += himalaya.o | 51 | obj-$(CONFIG_MACH_HIMALAYA) += himalaya.o |
52 | obj-$(CONFIG_MACH_MIOA701) += mioa701.o mioa701_bootresume.o | 52 | obj-$(CONFIG_MACH_MIOA701) += mioa701.o mioa701_bootresume.o |
@@ -78,6 +78,7 @@ obj-$(CONFIG_MACH_CM_X300) += cm-x300.o | |||
78 | obj-$(CONFIG_PXA_EZX) += ezx.o | 78 | obj-$(CONFIG_PXA_EZX) += ezx.o |
79 | 79 | ||
80 | obj-$(CONFIG_MACH_INTELMOTE2) += imote2.o | 80 | obj-$(CONFIG_MACH_INTELMOTE2) += imote2.o |
81 | obj-$(CONFIG_MACH_STARGATE2) += stargate2.o | ||
81 | obj-$(CONFIG_MACH_CSB726) += csb726.o | 82 | obj-$(CONFIG_MACH_CSB726) += csb726.o |
82 | obj-$(CONFIG_CSB726_CSB701) += csb701.o | 83 | obj-$(CONFIG_CSB726_CSB701) += csb701.o |
83 | 84 | ||
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c index db52d2c4791d..49ae38292310 100644 --- a/arch/arm/mach-pxa/clock.c +++ b/arch/arm/mach-pxa/clock.c | |||
@@ -86,20 +86,3 @@ void clks_register(struct clk_lookup *clks, size_t num) | |||
86 | for (i = 0; i < num; i++) | 86 | for (i = 0; i < num; i++) |
87 | clkdev_add(&clks[i]); | 87 | clkdev_add(&clks[i]); |
88 | } | 88 | } |
89 | |||
90 | int clk_add_alias(const char *alias, const char *alias_dev_name, char *id, | ||
91 | struct device *dev) | ||
92 | { | ||
93 | struct clk *r = clk_get(dev, id); | ||
94 | struct clk_lookup *l; | ||
95 | |||
96 | if (!r) | ||
97 | return -ENODEV; | ||
98 | |||
99 | l = clkdev_alloc(r, alias, alias_dev_name); | ||
100 | clk_put(r); | ||
101 | if (!l) | ||
102 | return -ENODEV; | ||
103 | clkdev_add(l); | ||
104 | return 0; | ||
105 | } | ||
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c index 34576ba5f5fd..1d2cec25391d 100644 --- a/arch/arm/mach-pxa/cm-x270.c +++ b/arch/arm/mach-pxa/cm-x270.c | |||
@@ -335,6 +335,10 @@ void __init cmx270_init(void) | |||
335 | { | 335 | { |
336 | pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config)); | 336 | pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config)); |
337 | 337 | ||
338 | #ifdef CONFIG_PM | ||
339 | pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP); | ||
340 | #endif | ||
341 | |||
338 | cmx270_init_rtc(); | 342 | cmx270_init_rtc(); |
339 | cmx270_init_mmc(); | 343 | cmx270_init_mmc(); |
340 | cmx270_init_ohci(); | 344 | cmx270_init_ohci(); |
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index a9f48b1cb54a..465da26591bd 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -21,18 +21,20 @@ | |||
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/dm9000.h> | 22 | #include <linux/dm9000.h> |
23 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
24 | #include <linux/rtc-v3020.h> | ||
24 | 25 | ||
25 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
26 | #include <linux/i2c/pca953x.h> | 27 | #include <linux/i2c/pca953x.h> |
27 | 28 | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
31 | #include <asm/setup.h> | ||
30 | 32 | ||
31 | #include <mach/pxa300.h> | 33 | #include <mach/pxa300.h> |
32 | #include <mach/pxafb.h> | 34 | #include <mach/pxafb.h> |
33 | #include <mach/mmc.h> | 35 | #include <mach/mmc.h> |
34 | #include <mach/ohci.h> | 36 | #include <mach/ohci.h> |
35 | #include <mach/i2c.h> | 37 | #include <plat/i2c.h> |
36 | #include <mach/pxa3xx_nand.h> | 38 | #include <mach/pxa3xx_nand.h> |
37 | 39 | ||
38 | #include <asm/mach/map.h> | 40 | #include <asm/mach/map.h> |
@@ -46,6 +48,11 @@ | |||
46 | 48 | ||
47 | #define CM_X300_MMC2_IRQ IRQ_GPIO(GPIO82_MMC2_IRQ) | 49 | #define CM_X300_MMC2_IRQ IRQ_GPIO(GPIO82_MMC2_IRQ) |
48 | 50 | ||
51 | #define GPIO95_RTC_CS (95) | ||
52 | #define GPIO96_RTC_WR (96) | ||
53 | #define GPIO97_RTC_RD (97) | ||
54 | #define GPIO98_RTC_IO (98) | ||
55 | |||
49 | static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = { | 56 | static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = { |
50 | /* LCD */ | 57 | /* LCD */ |
51 | GPIO54_LCD_LDD_0, | 58 | GPIO54_LCD_LDD_0, |
@@ -135,6 +142,12 @@ static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = { | |||
135 | GPIO85_GPIO, /* MMC WP */ | 142 | GPIO85_GPIO, /* MMC WP */ |
136 | GPIO99_GPIO, /* Ethernet IRQ */ | 143 | GPIO99_GPIO, /* Ethernet IRQ */ |
137 | 144 | ||
145 | /* RTC GPIOs */ | ||
146 | GPIO95_GPIO, /* RTC CS */ | ||
147 | GPIO96_GPIO, /* RTC WR */ | ||
148 | GPIO97_GPIO, /* RTC RD */ | ||
149 | GPIO98_GPIO, /* RTC IO */ | ||
150 | |||
138 | /* Standard I2C */ | 151 | /* Standard I2C */ |
139 | GPIO21_I2C_SCL, | 152 | GPIO21_I2C_SCL, |
140 | GPIO22_I2C_SDA, | 153 | GPIO22_I2C_SDA, |
@@ -265,6 +278,7 @@ static struct mtd_partition cm_x300_nand_partitions[] = { | |||
265 | 278 | ||
266 | static struct pxa3xx_nand_platform_data cm_x300_nand_info = { | 279 | static struct pxa3xx_nand_platform_data cm_x300_nand_info = { |
267 | .enable_arbiter = 1, | 280 | .enable_arbiter = 1, |
281 | .keep_config = 1, | ||
268 | .parts = cm_x300_nand_partitions, | 282 | .parts = cm_x300_nand_partitions, |
269 | .nr_parts = ARRAY_SIZE(cm_x300_nand_partitions), | 283 | .nr_parts = ARRAY_SIZE(cm_x300_nand_partitions), |
270 | }; | 284 | }; |
@@ -441,6 +455,31 @@ static void __init cm_x300_init_i2c(void) | |||
441 | static inline void cm_x300_init_i2c(void) {} | 455 | static inline void cm_x300_init_i2c(void) {} |
442 | #endif | 456 | #endif |
443 | 457 | ||
458 | #if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE) | ||
459 | struct v3020_platform_data cm_x300_v3020_pdata = { | ||
460 | .use_gpio = 1, | ||
461 | .gpio_cs = GPIO95_RTC_CS, | ||
462 | .gpio_wr = GPIO96_RTC_WR, | ||
463 | .gpio_rd = GPIO97_RTC_RD, | ||
464 | .gpio_io = GPIO98_RTC_IO, | ||
465 | }; | ||
466 | |||
467 | static struct platform_device cm_x300_rtc_device = { | ||
468 | .name = "v3020", | ||
469 | .id = -1, | ||
470 | .dev = { | ||
471 | .platform_data = &cm_x300_v3020_pdata, | ||
472 | } | ||
473 | }; | ||
474 | |||
475 | static void __init cm_x300_init_rtc(void) | ||
476 | { | ||
477 | platform_device_register(&cm_x300_rtc_device); | ||
478 | } | ||
479 | #else | ||
480 | static inline void cm_x300_init_rtc(void) {} | ||
481 | #endif | ||
482 | |||
444 | static void __init cm_x300_init(void) | 483 | static void __init cm_x300_init(void) |
445 | { | 484 | { |
446 | /* board-processor specific GPIO initialization */ | 485 | /* board-processor specific GPIO initialization */ |
@@ -453,6 +492,19 @@ static void __init cm_x300_init(void) | |||
453 | cm_x300_init_nand(); | 492 | cm_x300_init_nand(); |
454 | cm_x300_init_leds(); | 493 | cm_x300_init_leds(); |
455 | cm_x300_init_i2c(); | 494 | cm_x300_init_i2c(); |
495 | cm_x300_init_rtc(); | ||
496 | } | ||
497 | |||
498 | static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags, | ||
499 | char **cmdline, struct meminfo *mi) | ||
500 | { | ||
501 | mi->nr_banks = 2; | ||
502 | mi->bank[0].start = 0xa0000000; | ||
503 | mi->bank[0].node = 0; | ||
504 | mi->bank[0].size = (64*1024*1024); | ||
505 | mi->bank[1].start = 0xc0000000; | ||
506 | mi->bank[1].node = 0; | ||
507 | mi->bank[1].size = (64*1024*1024); | ||
456 | } | 508 | } |
457 | 509 | ||
458 | MACHINE_START(CM_X300, "CM-X300 module") | 510 | MACHINE_START(CM_X300, "CM-X300 module") |
@@ -463,4 +515,5 @@ MACHINE_START(CM_X300, "CM-X300 module") | |||
463 | .init_irq = pxa3xx_init_irq, | 515 | .init_irq = pxa3xx_init_irq, |
464 | .timer = &pxa_timer, | 516 | .timer = &pxa_timer, |
465 | .init_machine = cm_x300_init, | 517 | .init_machine = cm_x300_init, |
518 | .fixup = cm_x300_fixup, | ||
466 | MACHINE_END | 519 | MACHINE_END |
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 930e364ccde9..962dda2e154a 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <asm/mach/irq.h> | 42 | #include <asm/mach/irq.h> |
43 | 43 | ||
44 | #include <mach/pxa25x.h> | 44 | #include <mach/pxa25x.h> |
45 | #include <mach/i2c.h> | 45 | #include <plat/i2c.h> |
46 | #include <mach/irda.h> | 46 | #include <mach/irda.h> |
47 | #include <mach/mmc.h> | 47 | #include <mach/mmc.h> |
48 | #include <mach/udc.h> | 48 | #include <mach/udc.h> |
@@ -445,13 +445,8 @@ static struct ads7846_platform_data corgi_ads7846_info = { | |||
445 | .wait_for_sync = corgi_wait_for_hsync, | 445 | .wait_for_sync = corgi_wait_for_hsync, |
446 | }; | 446 | }; |
447 | 447 | ||
448 | static void corgi_ads7846_cs(u32 command) | ||
449 | { | ||
450 | gpio_set_value(CORGI_GPIO_ADS7846_CS, !(command == PXA2XX_CS_ASSERT)); | ||
451 | } | ||
452 | |||
453 | static struct pxa2xx_spi_chip corgi_ads7846_chip = { | 448 | static struct pxa2xx_spi_chip corgi_ads7846_chip = { |
454 | .cs_control = corgi_ads7846_cs, | 449 | .gpio_cs = CORGI_GPIO_ADS7846_CS, |
455 | }; | 450 | }; |
456 | 451 | ||
457 | static void corgi_bl_kick_battery(void) | 452 | static void corgi_bl_kick_battery(void) |
@@ -475,22 +470,12 @@ static struct corgi_lcd_platform_data corgi_lcdcon_info = { | |||
475 | .kick_battery = corgi_bl_kick_battery, | 470 | .kick_battery = corgi_bl_kick_battery, |
476 | }; | 471 | }; |
477 | 472 | ||
478 | static void corgi_lcdcon_cs(u32 command) | ||
479 | { | ||
480 | gpio_set_value(CORGI_GPIO_LCDCON_CS, !(command == PXA2XX_CS_ASSERT)); | ||
481 | } | ||
482 | |||
483 | static struct pxa2xx_spi_chip corgi_lcdcon_chip = { | 473 | static struct pxa2xx_spi_chip corgi_lcdcon_chip = { |
484 | .cs_control = corgi_lcdcon_cs, | 474 | .gpio_cs = CORGI_GPIO_LCDCON_CS, |
485 | }; | 475 | }; |
486 | 476 | ||
487 | static void corgi_max1111_cs(u32 command) | ||
488 | { | ||
489 | gpio_set_value(CORGI_GPIO_MAX1111_CS, !(command == PXA2XX_CS_ASSERT)); | ||
490 | } | ||
491 | |||
492 | static struct pxa2xx_spi_chip corgi_max1111_chip = { | 477 | static struct pxa2xx_spi_chip corgi_max1111_chip = { |
493 | .cs_control = corgi_max1111_cs, | 478 | .gpio_cs = CORGI_GPIO_MAX1111_CS, |
494 | }; | 479 | }; |
495 | 480 | ||
496 | static struct spi_board_info corgi_spi_devices[] = { | 481 | static struct spi_board_info corgi_spi_devices[] = { |
@@ -520,32 +505,8 @@ static struct spi_board_info corgi_spi_devices[] = { | |||
520 | 505 | ||
521 | static void __init corgi_init_spi(void) | 506 | static void __init corgi_init_spi(void) |
522 | { | 507 | { |
523 | int err; | ||
524 | |||
525 | err = gpio_request(CORGI_GPIO_ADS7846_CS, "ADS7846_CS"); | ||
526 | if (err) | ||
527 | return; | ||
528 | |||
529 | err = gpio_request(CORGI_GPIO_LCDCON_CS, "LCDCON_CS"); | ||
530 | if (err) | ||
531 | goto err_free_1; | ||
532 | |||
533 | err = gpio_request(CORGI_GPIO_MAX1111_CS, "MAX1111_CS"); | ||
534 | if (err) | ||
535 | goto err_free_2; | ||
536 | |||
537 | gpio_direction_output(CORGI_GPIO_ADS7846_CS, 1); | ||
538 | gpio_direction_output(CORGI_GPIO_LCDCON_CS, 1); | ||
539 | gpio_direction_output(CORGI_GPIO_MAX1111_CS, 1); | ||
540 | |||
541 | pxa2xx_set_spi_info(1, &corgi_spi_info); | 508 | pxa2xx_set_spi_info(1, &corgi_spi_info); |
542 | spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices)); | 509 | spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices)); |
543 | return; | ||
544 | |||
545 | err_free_2: | ||
546 | gpio_free(CORGI_GPIO_LCDCON_CS); | ||
547 | err_free_1: | ||
548 | gpio_free(CORGI_GPIO_ADS7846_CS); | ||
549 | } | 510 | } |
550 | #else | 511 | #else |
551 | static inline void corgi_init_spi(void) {} | 512 | static inline void corgi_init_spi(void) {} |
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c index 7f04b3a761d1..a093282fe4db 100644 --- a/arch/arm/mach-pxa/corgi_pm.c +++ b/arch/arm/mach-pxa/corgi_pm.c | |||
@@ -41,7 +41,6 @@ static void corgi_charger_init(void) | |||
41 | pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT); | 41 | pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT); |
42 | pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT); | 42 | pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT); |
43 | pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN); | 43 | pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN); |
44 | sharpsl_pm_pxa_init(); | ||
45 | } | 44 | } |
46 | 45 | ||
47 | static void corgi_measure_temp(int on) | 46 | static void corgi_measure_temp(int on) |
@@ -191,7 +190,7 @@ unsigned long corgipm_read_devdata(int type) | |||
191 | 190 | ||
192 | static struct sharpsl_charger_machinfo corgi_pm_machinfo = { | 191 | static struct sharpsl_charger_machinfo corgi_pm_machinfo = { |
193 | .init = corgi_charger_init, | 192 | .init = corgi_charger_init, |
194 | .exit = sharpsl_pm_pxa_remove, | 193 | .exit = NULL, |
195 | .gpio_batlock = CORGI_GPIO_BAT_COVER, | 194 | .gpio_batlock = CORGI_GPIO_BAT_COVER, |
196 | .gpio_acin = CORGI_GPIO_AC_IN, | 195 | .gpio_acin = CORGI_GPIO_AC_IN, |
197 | .gpio_batfull = CORGI_GPIO_CHRG_FULL, | 196 | .gpio_batfull = CORGI_GPIO_CHRG_FULL, |
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c index 083a1d851d49..3a8ee2272add 100644 --- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c +++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/cpufreq.h> | 38 | #include <linux/cpufreq.h> |
39 | #include <linux/err.h> | ||
40 | #include <linux/regulator/consumer.h> | ||
39 | 41 | ||
40 | #include <mach/pxa2xx-regs.h> | 42 | #include <mach/pxa2xx-regs.h> |
41 | 43 | ||
@@ -47,6 +49,8 @@ MODULE_PARM_DESC(freq_debug, "Set the debug messages to on=1/off=0"); | |||
47 | #define freq_debug 0 | 49 | #define freq_debug 0 |
48 | #endif | 50 | #endif |
49 | 51 | ||
52 | static struct regulator *vcc_core; | ||
53 | |||
50 | static unsigned int pxa27x_maxfreq; | 54 | static unsigned int pxa27x_maxfreq; |
51 | module_param(pxa27x_maxfreq, uint, 0); | 55 | module_param(pxa27x_maxfreq, uint, 0); |
52 | MODULE_PARM_DESC(pxa27x_maxfreq, "Set the pxa27x maxfreq in MHz" | 56 | MODULE_PARM_DESC(pxa27x_maxfreq, "Set the pxa27x maxfreq in MHz" |
@@ -58,6 +62,8 @@ typedef struct { | |||
58 | unsigned int cccr; | 62 | unsigned int cccr; |
59 | unsigned int div2; | 63 | unsigned int div2; |
60 | unsigned int cclkcfg; | 64 | unsigned int cclkcfg; |
65 | int vmin; | ||
66 | int vmax; | ||
61 | } pxa_freqs_t; | 67 | } pxa_freqs_t; |
62 | 68 | ||
63 | /* Define the refresh period in mSec for the SDRAM and the number of rows */ | 69 | /* Define the refresh period in mSec for the SDRAM and the number of rows */ |
@@ -82,24 +88,24 @@ static unsigned int sdram_rows; | |||
82 | 88 | ||
83 | static pxa_freqs_t pxa255_run_freqs[] = | 89 | static pxa_freqs_t pxa255_run_freqs[] = |
84 | { | 90 | { |
85 | /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */ | 91 | /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */ |
86 | { 99500, 99500, 0x121, 1, CCLKCFG}, /* 99, 99, 50, 50 */ | 92 | { 99500, 99500, 0x121, 1, CCLKCFG, -1, -1}, /* 99, 99, 50, 50 */ |
87 | {132700, 132700, 0x123, 1, CCLKCFG}, /* 133, 133, 66, 66 */ | 93 | {132700, 132700, 0x123, 1, CCLKCFG, -1, -1}, /* 133, 133, 66, 66 */ |
88 | {199100, 99500, 0x141, 0, CCLKCFG}, /* 199, 199, 99, 99 */ | 94 | {199100, 99500, 0x141, 0, CCLKCFG, -1, -1}, /* 199, 199, 99, 99 */ |
89 | {265400, 132700, 0x143, 1, CCLKCFG}, /* 265, 265, 133, 66 */ | 95 | {265400, 132700, 0x143, 1, CCLKCFG, -1, -1}, /* 265, 265, 133, 66 */ |
90 | {331800, 165900, 0x145, 1, CCLKCFG}, /* 331, 331, 166, 83 */ | 96 | {331800, 165900, 0x145, 1, CCLKCFG, -1, -1}, /* 331, 331, 166, 83 */ |
91 | {398100, 99500, 0x161, 0, CCLKCFG}, /* 398, 398, 196, 99 */ | 97 | {398100, 99500, 0x161, 0, CCLKCFG, -1, -1}, /* 398, 398, 196, 99 */ |
92 | }; | 98 | }; |
93 | 99 | ||
94 | /* Use the turbo mode frequencies for the CPUFREQ_POLICY_POWERSAVE policy */ | 100 | /* Use the turbo mode frequencies for the CPUFREQ_POLICY_POWERSAVE policy */ |
95 | static pxa_freqs_t pxa255_turbo_freqs[] = | 101 | static pxa_freqs_t pxa255_turbo_freqs[] = |
96 | { | 102 | { |
97 | /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */ | 103 | /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */ |
98 | { 99500, 99500, 0x121, 1, CCLKCFG}, /* 99, 99, 50, 50 */ | 104 | { 99500, 99500, 0x121, 1, CCLKCFG, -1, -1}, /* 99, 99, 50, 50 */ |
99 | {199100, 99500, 0x221, 0, CCLKCFG}, /* 99, 199, 50, 99 */ | 105 | {199100, 99500, 0x221, 0, CCLKCFG, -1, -1}, /* 99, 199, 50, 99 */ |
100 | {298500, 99500, 0x321, 0, CCLKCFG}, /* 99, 287, 50, 99 */ | 106 | {298500, 99500, 0x321, 0, CCLKCFG, -1, -1}, /* 99, 287, 50, 99 */ |
101 | {298600, 99500, 0x1c1, 0, CCLKCFG}, /* 199, 287, 99, 99 */ | 107 | {298600, 99500, 0x1c1, 0, CCLKCFG, -1, -1}, /* 199, 287, 99, 99 */ |
102 | {398100, 99500, 0x241, 0, CCLKCFG}, /* 199, 398, 99, 99 */ | 108 | {398100, 99500, 0x241, 0, CCLKCFG, -1, -1}, /* 199, 398, 99, 99 */ |
103 | }; | 109 | }; |
104 | 110 | ||
105 | #define NUM_PXA25x_RUN_FREQS ARRAY_SIZE(pxa255_run_freqs) | 111 | #define NUM_PXA25x_RUN_FREQS ARRAY_SIZE(pxa255_run_freqs) |
@@ -148,13 +154,13 @@ MODULE_PARM_DESC(pxa255_turbo_table, "Selects the frequency table (0 = run table | |||
148 | ((T) ? CCLKCFG_TURBO : 0)) | 154 | ((T) ? CCLKCFG_TURBO : 0)) |
149 | 155 | ||
150 | static pxa_freqs_t pxa27x_freqs[] = { | 156 | static pxa_freqs_t pxa27x_freqs[] = { |
151 | {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1)}, | 157 | {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1), 900000, 1705000 }, |
152 | {156000, 104000, PXA27x_CCCR(1, 8, 6), 0, CCLKCFG2(1, 1, 1)}, | 158 | {156000, 104000, PXA27x_CCCR(1, 8, 6), 0, CCLKCFG2(1, 1, 1), 1000000, 1705000 }, |
153 | {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1)}, | 159 | {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 }, |
154 | {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1)}, | 160 | {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 }, |
155 | {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1)}, | 161 | {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 }, |
156 | {520000, 208000, PXA27x_CCCR(1, 16, 5), 1, CCLKCFG2(1, 0, 1)}, | 162 | {520000, 208000, PXA27x_CCCR(1, 16, 5), 1, CCLKCFG2(1, 0, 1), 1450000, 1705000 }, |
157 | {624000, 208000, PXA27x_CCCR(1, 16, 6), 1, CCLKCFG2(1, 0, 1)} | 163 | {624000, 208000, PXA27x_CCCR(1, 16, 6), 1, CCLKCFG2(1, 0, 1), 1550000, 1705000 } |
158 | }; | 164 | }; |
159 | 165 | ||
160 | #define NUM_PXA27x_FREQS ARRAY_SIZE(pxa27x_freqs) | 166 | #define NUM_PXA27x_FREQS ARRAY_SIZE(pxa27x_freqs) |
@@ -163,6 +169,47 @@ static struct cpufreq_frequency_table | |||
163 | 169 | ||
164 | extern unsigned get_clk_frequency_khz(int info); | 170 | extern unsigned get_clk_frequency_khz(int info); |
165 | 171 | ||
172 | #ifdef CONFIG_REGULATOR | ||
173 | |||
174 | static int pxa_cpufreq_change_voltage(pxa_freqs_t *pxa_freq) | ||
175 | { | ||
176 | int ret = 0; | ||
177 | int vmin, vmax; | ||
178 | |||
179 | if (!cpu_is_pxa27x()) | ||
180 | return 0; | ||
181 | |||
182 | vmin = pxa_freq->vmin; | ||
183 | vmax = pxa_freq->vmax; | ||
184 | if ((vmin == -1) || (vmax == -1)) | ||
185 | return 0; | ||
186 | |||
187 | ret = regulator_set_voltage(vcc_core, vmin, vmax); | ||
188 | if (ret) | ||
189 | pr_err("cpufreq: Failed to set vcc_core in [%dmV..%dmV]\n", | ||
190 | vmin, vmax); | ||
191 | return ret; | ||
192 | } | ||
193 | |||
194 | static __init void pxa_cpufreq_init_voltages(void) | ||
195 | { | ||
196 | vcc_core = regulator_get(NULL, "vcc_core"); | ||
197 | if (IS_ERR(vcc_core)) { | ||
198 | pr_info("cpufreq: Didn't find vcc_core regulator\n"); | ||
199 | vcc_core = NULL; | ||
200 | } else { | ||
201 | pr_info("cpufreq: Found vcc_core regulator\n"); | ||
202 | } | ||
203 | } | ||
204 | #else | ||
205 | static int pxa_cpufreq_change_voltage(pxa_freqs_t *pxa_freq) | ||
206 | { | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static __init void pxa_cpufreq_init_voltages(void) { } | ||
211 | #endif | ||
212 | |||
166 | static void find_freq_tables(struct cpufreq_frequency_table **freq_table, | 213 | static void find_freq_tables(struct cpufreq_frequency_table **freq_table, |
167 | pxa_freqs_t **pxa_freqs) | 214 | pxa_freqs_t **pxa_freqs) |
168 | { | 215 | { |
@@ -251,6 +298,7 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
251 | unsigned long flags; | 298 | unsigned long flags; |
252 | unsigned int new_freq_cpu, new_freq_mem; | 299 | unsigned int new_freq_cpu, new_freq_mem; |
253 | unsigned int unused, preset_mdrefr, postset_mdrefr, cclkcfg; | 300 | unsigned int unused, preset_mdrefr, postset_mdrefr, cclkcfg; |
301 | int ret = 0; | ||
254 | 302 | ||
255 | /* Get the current policy */ | 303 | /* Get the current policy */ |
256 | find_freq_tables(&pxa_freqs_table, &pxa_freq_settings); | 304 | find_freq_tables(&pxa_freqs_table, &pxa_freq_settings); |
@@ -273,6 +321,10 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
273 | freqs.new / 1000, (pxa_freq_settings[idx].div2) ? | 321 | freqs.new / 1000, (pxa_freq_settings[idx].div2) ? |
274 | (new_freq_mem / 2000) : (new_freq_mem / 1000)); | 322 | (new_freq_mem / 2000) : (new_freq_mem / 1000)); |
275 | 323 | ||
324 | if (vcc_core && freqs.new > freqs.old) | ||
325 | ret = pxa_cpufreq_change_voltage(&pxa_freq_settings[idx]); | ||
326 | if (ret) | ||
327 | return ret; | ||
276 | /* | 328 | /* |
277 | * Tell everyone what we're about to do... | 329 | * Tell everyone what we're about to do... |
278 | * you should add a notify client with any platform specific | 330 | * you should add a notify client with any platform specific |
@@ -335,6 +387,18 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
335 | */ | 387 | */ |
336 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 388 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
337 | 389 | ||
390 | /* | ||
391 | * Even if voltage setting fails, we don't report it, as the frequency | ||
392 | * change succeeded. The voltage reduction is not a critical failure, | ||
393 | * only power savings will suffer from this. | ||
394 | * | ||
395 | * Note: if the voltage change fails, and a return value is returned, a | ||
396 | * bug is triggered (seems a deadlock). Should anybody find out where, | ||
397 | * the "return 0" should become a "return ret". | ||
398 | */ | ||
399 | if (vcc_core && freqs.new < freqs.old) | ||
400 | ret = pxa_cpufreq_change_voltage(&pxa_freq_settings[idx]); | ||
401 | |||
338 | return 0; | 402 | return 0; |
339 | } | 403 | } |
340 | 404 | ||
@@ -349,6 +413,8 @@ static __init int pxa_cpufreq_init(struct cpufreq_policy *policy) | |||
349 | if (cpu_is_pxa27x()) | 413 | if (cpu_is_pxa27x()) |
350 | pxa27x_guess_max_freq(); | 414 | pxa27x_guess_max_freq(); |
351 | 415 | ||
416 | pxa_cpufreq_init_voltages(); | ||
417 | |||
352 | init_sdram_rows(); | 418 | init_sdram_rows(); |
353 | 419 | ||
354 | /* set default policy and cpuinfo */ | 420 | /* set default policy and cpuinfo */ |
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c index 2b289f83a61a..7d3e1b46e550 100644 --- a/arch/arm/mach-pxa/csb726.c +++ b/arch/arm/mach-pxa/csb726.c | |||
@@ -16,15 +16,17 @@ | |||
16 | #include <linux/mtd/physmap.h> | 16 | #include <linux/mtd/physmap.h> |
17 | #include <linux/mtd/partitions.h> | 17 | #include <linux/mtd/partitions.h> |
18 | #include <linux/sm501.h> | 18 | #include <linux/sm501.h> |
19 | #include <linux/smsc911x.h> | ||
19 | 20 | ||
20 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
21 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
22 | #include <mach/csb726.h> | 23 | #include <mach/csb726.h> |
23 | #include <mach/mfp-pxa27x.h> | 24 | #include <mach/mfp-pxa27x.h> |
24 | #include <mach/i2c.h> | 25 | #include <plat/i2c.h> |
25 | #include <mach/mmc.h> | 26 | #include <mach/mmc.h> |
26 | #include <mach/ohci.h> | 27 | #include <mach/ohci.h> |
27 | #include <mach/pxa2xx-regs.h> | 28 | #include <mach/pxa2xx-regs.h> |
29 | #include <mach/audio.h> | ||
28 | 30 | ||
29 | #include "generic.h" | 31 | #include "generic.h" |
30 | #include "devices.h" | 32 | #include "devices.h" |
@@ -275,15 +277,26 @@ static struct resource csb726_lan_resources[] = { | |||
275 | { | 277 | { |
276 | .start = CSB726_IRQ_LAN, | 278 | .start = CSB726_IRQ_LAN, |
277 | .end = CSB726_IRQ_LAN, | 279 | .end = CSB726_IRQ_LAN, |
278 | .flags = IORESOURCE_IRQ, | 280 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, |
279 | }, | 281 | }, |
280 | }; | 282 | }; |
281 | 283 | ||
284 | struct smsc911x_platform_config csb726_lan_config = { | ||
285 | .irq_type = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
286 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | ||
287 | .flags = SMSC911X_USE_32BIT, | ||
288 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
289 | }; | ||
290 | |||
291 | |||
282 | static struct platform_device csb726_lan = { | 292 | static struct platform_device csb726_lan = { |
283 | .name = "smc911x", | 293 | .name = "smsc911x", |
284 | .id = -1, | 294 | .id = -1, |
285 | .num_resources = ARRAY_SIZE(csb726_lan_resources), | 295 | .num_resources = ARRAY_SIZE(csb726_lan_resources), |
286 | .resource = csb726_lan_resources, | 296 | .resource = csb726_lan_resources, |
297 | .dev = { | ||
298 | .platform_data = &csb726_lan_config, | ||
299 | }, | ||
287 | }; | 300 | }; |
288 | 301 | ||
289 | static struct platform_device *devices[] __initdata = { | 302 | static struct platform_device *devices[] __initdata = { |
@@ -303,6 +316,7 @@ static void __init csb726_init(void) | |||
303 | pxa27x_set_i2c_power_info(NULL); | 316 | pxa27x_set_i2c_power_info(NULL); |
304 | pxa_set_mci_info(&csb726_mci); | 317 | pxa_set_mci_info(&csb726_mci); |
305 | pxa_set_ohci_info(&csb726_ohci_platform_data); | 318 | pxa_set_ohci_info(&csb726_ohci_platform_data); |
319 | pxa_set_ac97_info(NULL); | ||
306 | 320 | ||
307 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 321 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
308 | } | 322 | } |
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 29970f703f3c..ecc08f360b68 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <mach/pxafb.h> | 8 | #include <mach/pxafb.h> |
9 | #include <mach/mmc.h> | 9 | #include <mach/mmc.h> |
10 | #include <mach/irda.h> | 10 | #include <mach/irda.h> |
11 | #include <mach/i2c.h> | 11 | #include <plat/i2c.h> |
12 | #include <mach/ohci.h> | 12 | #include <mach/ohci.h> |
13 | #include <mach/pxa27x_keypad.h> | 13 | #include <mach/pxa27x_keypad.h> |
14 | #include <mach/pxa2xx_spi.h> | 14 | #include <mach/pxa2xx_spi.h> |
@@ -290,7 +290,7 @@ static struct resource pxa3xx_resources_i2c_power[] = { | |||
290 | }; | 290 | }; |
291 | 291 | ||
292 | struct platform_device pxa3xx_device_i2c_power = { | 292 | struct platform_device pxa3xx_device_i2c_power = { |
293 | .name = "pxa2xx-i2c", | 293 | .name = "pxa3xx-pwri2c", |
294 | .id = 1, | 294 | .id = 1, |
295 | .resource = pxa3xx_resources_i2c_power, | 295 | .resource = pxa3xx_resources_i2c_power, |
296 | .num_resources = ARRAY_SIZE(pxa3xx_resources_i2c_power), | 296 | .num_resources = ARRAY_SIZE(pxa3xx_resources_i2c_power), |
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index bc0f73fbd4ca..243e0802b5f4 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/spi/libertas_spi.h> | 28 | #include <linux/spi/libertas_spi.h> |
29 | #include <linux/power_supply.h> | 29 | #include <linux/power_supply.h> |
30 | #include <linux/apm-emulation.h> | 30 | #include <linux/apm-emulation.h> |
31 | #include <linux/i2c.h> | ||
32 | #include <linux/i2c/pca953x.h> | ||
31 | 33 | ||
32 | #include <media/soc_camera.h> | 34 | #include <media/soc_camera.h> |
33 | 35 | ||
@@ -41,7 +43,7 @@ | |||
41 | #include <mach/ohci.h> | 43 | #include <mach/ohci.h> |
42 | #include <mach/mmc.h> | 44 | #include <mach/mmc.h> |
43 | #include <mach/pxa27x_keypad.h> | 45 | #include <mach/pxa27x_keypad.h> |
44 | #include <mach/i2c.h> | 46 | #include <plat/i2c.h> |
45 | #include <mach/camera.h> | 47 | #include <mach/camera.h> |
46 | #include <mach/pxa2xx_spi.h> | 48 | #include <mach/pxa2xx_spi.h> |
47 | 49 | ||
@@ -52,23 +54,31 @@ | |||
52 | #define GPIO13_MMC_CD (13) | 54 | #define GPIO13_MMC_CD (13) |
53 | #define GPIO95_MMC_WP (95) | 55 | #define GPIO95_MMC_WP (95) |
54 | #define GPIO56_NAND_RB (56) | 56 | #define GPIO56_NAND_RB (56) |
57 | #define GPIO93_CAM_RESET (93) | ||
58 | #define GPIO16_USB_HUB_RESET (16) | ||
55 | 59 | ||
56 | /* eXeda specific GPIOs */ | 60 | /* eXeda specific GPIOs */ |
57 | #define GPIO114_MMC_CD (114) | 61 | #define GPIO114_MMC_CD (114) |
58 | #define GPIO20_NAND_RB (20) | 62 | #define GPIO20_NAND_RB (20) |
59 | #define GPIO38_SD_PWEN (38) | 63 | #define GPIO38_SD_PWEN (38) |
64 | #define GPIO37_WLAN_RST (37) | ||
65 | #define GPIO95_TOUCHPAD_INT (95) | ||
66 | #define GPIO130_CAM_RESET (130) | ||
67 | #define GPIO10_USB_HUB_RESET (10) | ||
60 | 68 | ||
61 | /* common GPIOs */ | 69 | /* common GPIOs */ |
62 | #define GPIO11_NAND_CS (11) | 70 | #define GPIO11_NAND_CS (11) |
63 | #define GPIO93_CAM_RESET (93) | ||
64 | #define GPIO41_ETHIRQ (41) | 71 | #define GPIO41_ETHIRQ (41) |
65 | #define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) | 72 | #define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) |
66 | #define GPIO115_WLAN_PWEN (115) | 73 | #define GPIO115_WLAN_PWEN (115) |
67 | #define GPIO19_WLAN_STRAP (19) | 74 | #define GPIO19_WLAN_STRAP (19) |
75 | #define GPIO9_USB_VBUS_EN (9) | ||
68 | 76 | ||
69 | static int mmc_cd; | 77 | static int mmc_cd; |
70 | static int nand_rb; | 78 | static int nand_rb; |
71 | static int dm9000_flags; | 79 | static int dm9000_flags; |
80 | static int cam_reset; | ||
81 | static int usb_hub_reset; | ||
72 | 82 | ||
73 | static unsigned long common_pin_config[] = { | 83 | static unsigned long common_pin_config[] = { |
74 | /* AC'97 */ | 84 | /* AC'97 */ |
@@ -180,7 +190,6 @@ static unsigned long common_pin_config[] = { | |||
180 | 190 | ||
181 | /* power controls */ | 191 | /* power controls */ |
182 | GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */ | 192 | GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */ |
183 | GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */ | ||
184 | GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */ | 193 | GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */ |
185 | 194 | ||
186 | /* NAND controls */ | 195 | /* NAND controls */ |
@@ -191,14 +200,18 @@ static unsigned long common_pin_config[] = { | |||
191 | }; | 200 | }; |
192 | 201 | ||
193 | static unsigned long em_x270_pin_config[] = { | 202 | static unsigned long em_x270_pin_config[] = { |
194 | GPIO13_GPIO, /* MMC card detect */ | 203 | GPIO13_GPIO, /* MMC card detect */ |
195 | GPIO56_GPIO, /* NAND Ready/Busy */ | 204 | GPIO16_GPIO, /* USB hub reset */ |
196 | GPIO95_GPIO, /* MMC Write protect */ | 205 | GPIO56_GPIO, /* NAND Ready/Busy */ |
206 | GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */ | ||
207 | GPIO95_GPIO, /* MMC Write protect */ | ||
197 | }; | 208 | }; |
198 | 209 | ||
199 | static unsigned long exeda_pin_config[] = { | 210 | static unsigned long exeda_pin_config[] = { |
211 | GPIO10_GPIO, /* USB hub reset */ | ||
200 | GPIO20_GPIO, /* NAND Ready/Busy */ | 212 | GPIO20_GPIO, /* NAND Ready/Busy */ |
201 | GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */ | 213 | GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */ |
214 | GPIO95_GPIO, /* touchpad IRQ */ | ||
202 | GPIO114_GPIO, /* MMC card detect */ | 215 | GPIO114_GPIO, /* MMC card detect */ |
203 | }; | 216 | }; |
204 | 217 | ||
@@ -464,18 +477,79 @@ static inline void em_x270_init_nor(void) {} | |||
464 | 477 | ||
465 | /* PXA27x OHCI controller setup */ | 478 | /* PXA27x OHCI controller setup */ |
466 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 479 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
480 | static struct regulator *em_x270_usb_ldo; | ||
481 | |||
482 | static int em_x270_usb_hub_init(void) | ||
483 | { | ||
484 | int err; | ||
485 | |||
486 | em_x270_usb_ldo = regulator_get(NULL, "vcc usb"); | ||
487 | if (IS_ERR(em_x270_usb_ldo)) | ||
488 | return PTR_ERR(em_x270_usb_ldo); | ||
489 | |||
490 | err = gpio_request(GPIO9_USB_VBUS_EN, "vbus en"); | ||
491 | if (err) | ||
492 | goto err_free_usb_ldo; | ||
493 | |||
494 | err = gpio_request(usb_hub_reset, "hub rst"); | ||
495 | if (err) | ||
496 | goto err_free_vbus_gpio; | ||
497 | |||
498 | /* USB Hub power-on and reset */ | ||
499 | gpio_direction_output(usb_hub_reset, 0); | ||
500 | regulator_enable(em_x270_usb_ldo); | ||
501 | gpio_set_value(usb_hub_reset, 1); | ||
502 | gpio_set_value(usb_hub_reset, 0); | ||
503 | regulator_disable(em_x270_usb_ldo); | ||
504 | regulator_enable(em_x270_usb_ldo); | ||
505 | gpio_set_value(usb_hub_reset, 1); | ||
506 | |||
507 | /* enable VBUS */ | ||
508 | gpio_direction_output(GPIO9_USB_VBUS_EN, 1); | ||
509 | |||
510 | return 0; | ||
511 | |||
512 | err_free_vbus_gpio: | ||
513 | gpio_free(GPIO9_USB_VBUS_EN); | ||
514 | err_free_usb_ldo: | ||
515 | regulator_put(em_x270_usb_ldo); | ||
516 | |||
517 | return err; | ||
518 | } | ||
519 | |||
467 | static int em_x270_ohci_init(struct device *dev) | 520 | static int em_x270_ohci_init(struct device *dev) |
468 | { | 521 | { |
522 | int err; | ||
523 | |||
524 | /* we don't want to entirely disable USB if the HUB init failed */ | ||
525 | err = em_x270_usb_hub_init(); | ||
526 | if (err) | ||
527 | pr_err("USB Hub initialization failed: %d\n", err); | ||
528 | |||
469 | /* enable port 2 transiever */ | 529 | /* enable port 2 transiever */ |
470 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE; | 530 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE; |
471 | 531 | ||
472 | return 0; | 532 | return 0; |
473 | } | 533 | } |
474 | 534 | ||
535 | static void em_x270_ohci_exit(struct device *dev) | ||
536 | { | ||
537 | gpio_free(usb_hub_reset); | ||
538 | gpio_free(GPIO9_USB_VBUS_EN); | ||
539 | |||
540 | if (!IS_ERR(em_x270_usb_ldo)) { | ||
541 | if (regulator_is_enabled(em_x270_usb_ldo)) | ||
542 | regulator_disable(em_x270_usb_ldo); | ||
543 | |||
544 | regulator_put(em_x270_usb_ldo); | ||
545 | } | ||
546 | } | ||
547 | |||
475 | static struct pxaohci_platform_data em_x270_ohci_platform_data = { | 548 | static struct pxaohci_platform_data em_x270_ohci_platform_data = { |
476 | .port_mode = PMM_PERPORT_MODE, | 549 | .port_mode = PMM_PERPORT_MODE, |
477 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW, | 550 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW, |
478 | .init = em_x270_ohci_init, | 551 | .init = em_x270_ohci_init, |
552 | .exit = em_x270_ohci_exit, | ||
479 | }; | 553 | }; |
480 | 554 | ||
481 | static void __init em_x270_init_ohci(void) | 555 | static void __init em_x270_init_ohci(void) |
@@ -677,26 +751,52 @@ static int em_x270_libertas_setup(struct spi_device *spi) | |||
677 | if (err) | 751 | if (err) |
678 | return err; | 752 | return err; |
679 | 753 | ||
754 | err = gpio_request(GPIO19_WLAN_STRAP, "WLAN STRAP"); | ||
755 | if (err) | ||
756 | goto err_free_pwen; | ||
757 | |||
758 | if (machine_is_exeda()) { | ||
759 | err = gpio_request(GPIO37_WLAN_RST, "WLAN RST"); | ||
760 | if (err) | ||
761 | goto err_free_strap; | ||
762 | |||
763 | gpio_direction_output(GPIO37_WLAN_RST, 1); | ||
764 | msleep(100); | ||
765 | } | ||
766 | |||
680 | gpio_direction_output(GPIO19_WLAN_STRAP, 1); | 767 | gpio_direction_output(GPIO19_WLAN_STRAP, 1); |
681 | mdelay(100); | 768 | msleep(100); |
682 | 769 | ||
683 | pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config)); | 770 | pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config)); |
684 | 771 | ||
685 | gpio_direction_output(GPIO115_WLAN_PWEN, 0); | 772 | gpio_direction_output(GPIO115_WLAN_PWEN, 0); |
686 | mdelay(100); | 773 | msleep(100); |
687 | gpio_set_value(GPIO115_WLAN_PWEN, 1); | 774 | gpio_set_value(GPIO115_WLAN_PWEN, 1); |
688 | mdelay(100); | 775 | msleep(100); |
689 | 776 | ||
690 | spi->bits_per_word = 16; | 777 | spi->bits_per_word = 16; |
691 | spi_setup(spi); | 778 | spi_setup(spi); |
692 | 779 | ||
693 | return 0; | 780 | return 0; |
781 | |||
782 | err_free_strap: | ||
783 | gpio_free(GPIO19_WLAN_STRAP); | ||
784 | err_free_pwen: | ||
785 | gpio_free(GPIO115_WLAN_PWEN); | ||
786 | |||
787 | return err; | ||
694 | } | 788 | } |
695 | 789 | ||
696 | static int em_x270_libertas_teardown(struct spi_device *spi) | 790 | static int em_x270_libertas_teardown(struct spi_device *spi) |
697 | { | 791 | { |
698 | gpio_set_value(GPIO115_WLAN_PWEN, 0); | 792 | gpio_set_value(GPIO115_WLAN_PWEN, 0); |
699 | gpio_free(GPIO115_WLAN_PWEN); | 793 | gpio_free(GPIO115_WLAN_PWEN); |
794 | gpio_free(GPIO19_WLAN_STRAP); | ||
795 | |||
796 | if (machine_is_exeda()) { | ||
797 | gpio_set_value(GPIO37_WLAN_RST, 0); | ||
798 | gpio_free(GPIO37_WLAN_RST); | ||
799 | } | ||
700 | 800 | ||
701 | return 0; | 801 | return 0; |
702 | } | 802 | } |
@@ -863,26 +963,26 @@ static int em_x270_sensor_init(struct device *dev) | |||
863 | { | 963 | { |
864 | int ret; | 964 | int ret; |
865 | 965 | ||
866 | ret = gpio_request(GPIO93_CAM_RESET, "camera reset"); | 966 | ret = gpio_request(cam_reset, "camera reset"); |
867 | if (ret) | 967 | if (ret) |
868 | return ret; | 968 | return ret; |
869 | 969 | ||
870 | gpio_direction_output(GPIO93_CAM_RESET, 0); | 970 | gpio_direction_output(cam_reset, 0); |
871 | 971 | ||
872 | em_x270_camera_ldo = regulator_get(NULL, "vcc cam"); | 972 | em_x270_camera_ldo = regulator_get(NULL, "vcc cam"); |
873 | if (em_x270_camera_ldo == NULL) { | 973 | if (em_x270_camera_ldo == NULL) { |
874 | gpio_free(GPIO93_CAM_RESET); | 974 | gpio_free(cam_reset); |
875 | return -ENODEV; | 975 | return -ENODEV; |
876 | } | 976 | } |
877 | 977 | ||
878 | ret = regulator_enable(em_x270_camera_ldo); | 978 | ret = regulator_enable(em_x270_camera_ldo); |
879 | if (ret) { | 979 | if (ret) { |
880 | regulator_put(em_x270_camera_ldo); | 980 | regulator_put(em_x270_camera_ldo); |
881 | gpio_free(GPIO93_CAM_RESET); | 981 | gpio_free(cam_reset); |
882 | return ret; | 982 | return ret; |
883 | } | 983 | } |
884 | 984 | ||
885 | gpio_set_value(GPIO93_CAM_RESET, 1); | 985 | gpio_set_value(cam_reset, 1); |
886 | 986 | ||
887 | return 0; | 987 | return 0; |
888 | } | 988 | } |
@@ -902,7 +1002,7 @@ static int em_x270_sensor_power(struct device *dev, int on) | |||
902 | if (on == is_on) | 1002 | if (on == is_on) |
903 | return 0; | 1003 | return 0; |
904 | 1004 | ||
905 | gpio_set_value(GPIO93_CAM_RESET, !on); | 1005 | gpio_set_value(cam_reset, !on); |
906 | 1006 | ||
907 | if (on) | 1007 | if (on) |
908 | ret = regulator_enable(em_x270_camera_ldo); | 1008 | ret = regulator_enable(em_x270_camera_ldo); |
@@ -912,7 +1012,7 @@ static int em_x270_sensor_power(struct device *dev, int on) | |||
912 | if (ret) | 1012 | if (ret) |
913 | return ret; | 1013 | return ret; |
914 | 1014 | ||
915 | gpio_set_value(GPIO93_CAM_RESET, on); | 1015 | gpio_set_value(cam_reset, on); |
916 | 1016 | ||
917 | return 0; | 1017 | return 0; |
918 | } | 1018 | } |
@@ -929,13 +1029,8 @@ static struct i2c_board_info em_x270_i2c_cam_info[] = { | |||
929 | }, | 1029 | }, |
930 | }; | 1030 | }; |
931 | 1031 | ||
932 | static struct i2c_pxa_platform_data em_x270_i2c_info = { | ||
933 | .fast_mode = 1, | ||
934 | }; | ||
935 | |||
936 | static void __init em_x270_init_camera(void) | 1032 | static void __init em_x270_init_camera(void) |
937 | { | 1033 | { |
938 | pxa_set_i2c_info(&em_x270_i2c_info); | ||
939 | i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info)); | 1034 | i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info)); |
940 | pxa_set_camera_info(&em_x270_camera_platform_data); | 1035 | pxa_set_camera_info(&em_x270_camera_platform_data); |
941 | } | 1036 | } |
@@ -985,7 +1080,7 @@ struct led_info em_x270_led_info = { | |||
985 | }; | 1080 | }; |
986 | 1081 | ||
987 | struct power_supply_info em_x270_psy_info = { | 1082 | struct power_supply_info em_x270_psy_info = { |
988 | .name = "LP555597P6H-FPS", | 1083 | .name = "battery", |
989 | .technology = POWER_SUPPLY_TECHNOLOGY_LIPO, | 1084 | .technology = POWER_SUPPLY_TECHNOLOGY_LIPO, |
990 | .voltage_max_design = 4200000, | 1085 | .voltage_max_design = 4200000, |
991 | .voltage_min_design = 3000000, | 1086 | .voltage_min_design = 3000000, |
@@ -1069,6 +1164,29 @@ static void __init em_x270_init_da9030(void) | |||
1069 | i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1); | 1164 | i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1); |
1070 | } | 1165 | } |
1071 | 1166 | ||
1167 | static struct pca953x_platform_data exeda_gpio_ext_pdata = { | ||
1168 | .gpio_base = 128, | ||
1169 | }; | ||
1170 | |||
1171 | static struct i2c_board_info exeda_i2c_info[] = { | ||
1172 | { | ||
1173 | I2C_BOARD_INFO("pca9555", 0x21), | ||
1174 | .platform_data = &exeda_gpio_ext_pdata, | ||
1175 | }, | ||
1176 | }; | ||
1177 | |||
1178 | static struct i2c_pxa_platform_data em_x270_i2c_info = { | ||
1179 | .fast_mode = 1, | ||
1180 | }; | ||
1181 | |||
1182 | static void __init em_x270_init_i2c(void) | ||
1183 | { | ||
1184 | pxa_set_i2c_info(&em_x270_i2c_info); | ||
1185 | |||
1186 | if (machine_is_exeda()) | ||
1187 | i2c_register_board_info(0, ARRAY_AND_SIZE(exeda_i2c_info)); | ||
1188 | } | ||
1189 | |||
1072 | static void __init em_x270_module_init(void) | 1190 | static void __init em_x270_module_init(void) |
1073 | { | 1191 | { |
1074 | pr_info("%s\n", __func__); | 1192 | pr_info("%s\n", __func__); |
@@ -1077,6 +1195,8 @@ static void __init em_x270_module_init(void) | |||
1077 | mmc_cd = GPIO13_MMC_CD; | 1195 | mmc_cd = GPIO13_MMC_CD; |
1078 | nand_rb = GPIO56_NAND_RB; | 1196 | nand_rb = GPIO56_NAND_RB; |
1079 | dm9000_flags = DM9000_PLATF_32BITONLY; | 1197 | dm9000_flags = DM9000_PLATF_32BITONLY; |
1198 | cam_reset = GPIO93_CAM_RESET; | ||
1199 | usb_hub_reset = GPIO16_USB_HUB_RESET; | ||
1080 | } | 1200 | } |
1081 | 1201 | ||
1082 | static void __init em_x270_exeda_init(void) | 1202 | static void __init em_x270_exeda_init(void) |
@@ -1087,12 +1207,18 @@ static void __init em_x270_exeda_init(void) | |||
1087 | mmc_cd = GPIO114_MMC_CD; | 1207 | mmc_cd = GPIO114_MMC_CD; |
1088 | nand_rb = GPIO20_NAND_RB; | 1208 | nand_rb = GPIO20_NAND_RB; |
1089 | dm9000_flags = DM9000_PLATF_16BITONLY; | 1209 | dm9000_flags = DM9000_PLATF_16BITONLY; |
1210 | cam_reset = GPIO130_CAM_RESET; | ||
1211 | usb_hub_reset = GPIO10_USB_HUB_RESET; | ||
1090 | } | 1212 | } |
1091 | 1213 | ||
1092 | static void __init em_x270_init(void) | 1214 | static void __init em_x270_init(void) |
1093 | { | 1215 | { |
1094 | pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config)); | 1216 | pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config)); |
1095 | 1217 | ||
1218 | #ifdef CONFIG_PM | ||
1219 | pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP); | ||
1220 | #endif | ||
1221 | |||
1096 | if (machine_is_em_x270()) | 1222 | if (machine_is_em_x270()) |
1097 | em_x270_module_init(); | 1223 | em_x270_module_init(); |
1098 | else if (machine_is_exeda()) | 1224 | else if (machine_is_exeda()) |
@@ -1111,8 +1237,9 @@ static void __init em_x270_init(void) | |||
1111 | em_x270_init_keypad(); | 1237 | em_x270_init_keypad(); |
1112 | em_x270_init_gpio_keys(); | 1238 | em_x270_init_gpio_keys(); |
1113 | em_x270_init_ac97(); | 1239 | em_x270_init_ac97(); |
1114 | em_x270_init_camera(); | ||
1115 | em_x270_init_spi(); | 1240 | em_x270_init_spi(); |
1241 | em_x270_init_i2c(); | ||
1242 | em_x270_init_camera(); | ||
1116 | } | 1243 | } |
1117 | 1244 | ||
1118 | MACHINE_START(EM_X270, "Compulab EM-X270") | 1245 | MACHINE_START(EM_X270, "Compulab EM-X270") |
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index 7db966dc29ce..588b265e5755 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/pwm_backlight.h> | 18 | #include <linux/pwm_backlight.h> |
19 | #include <linux/input.h> | 19 | #include <linux/input.h> |
20 | #include <linux/gpio_keys.h> | ||
20 | 21 | ||
21 | #include <asm/setup.h> | 22 | #include <asm/setup.h> |
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
@@ -25,13 +26,19 @@ | |||
25 | #include <mach/pxa27x.h> | 26 | #include <mach/pxa27x.h> |
26 | #include <mach/pxafb.h> | 27 | #include <mach/pxafb.h> |
27 | #include <mach/ohci.h> | 28 | #include <mach/ohci.h> |
28 | #include <mach/i2c.h> | 29 | #include <plat/i2c.h> |
29 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
30 | #include <mach/pxa27x_keypad.h> | 31 | #include <mach/pxa27x_keypad.h> |
31 | 32 | ||
32 | #include "devices.h" | 33 | #include "devices.h" |
33 | #include "generic.h" | 34 | #include "generic.h" |
34 | 35 | ||
36 | #define GPIO12_A780_FLIP_LID 12 | ||
37 | #define GPIO15_A1200_FLIP_LID 15 | ||
38 | #define GPIO15_A910_FLIP_LID 15 | ||
39 | #define GPIO12_E680_LOCK_SWITCH 12 | ||
40 | #define GPIO15_E6_LOCK_SWITCH 15 | ||
41 | |||
35 | static struct platform_pwm_backlight_data ezx_backlight_data = { | 42 | static struct platform_pwm_backlight_data ezx_backlight_data = { |
36 | .pwm_id = 0, | 43 | .pwm_id = 0, |
37 | .max_brightness = 1023, | 44 | .max_brightness = 1023, |
@@ -88,7 +95,7 @@ static struct pxafb_mach_info ezx_fb_info_2 = { | |||
88 | .lcd_conn = LCD_COLOR_TFT_18BPP, | 95 | .lcd_conn = LCD_COLOR_TFT_18BPP, |
89 | }; | 96 | }; |
90 | 97 | ||
91 | static struct platform_device *devices[] __initdata = { | 98 | static struct platform_device *ezx_devices[] __initdata = { |
92 | &ezx_backlight_device, | 99 | &ezx_backlight_device, |
93 | }; | 100 | }; |
94 | 101 | ||
@@ -651,6 +658,35 @@ static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { | |||
651 | #endif /* CONFIG_MACH_EZX_E2 */ | 658 | #endif /* CONFIG_MACH_EZX_E2 */ |
652 | 659 | ||
653 | #ifdef CONFIG_MACH_EZX_A780 | 660 | #ifdef CONFIG_MACH_EZX_A780 |
661 | /* gpio_keys */ | ||
662 | static struct gpio_keys_button a780_buttons[] = { | ||
663 | [0] = { | ||
664 | .code = SW_LID, | ||
665 | .gpio = GPIO12_A780_FLIP_LID, | ||
666 | .active_low = 0, | ||
667 | .desc = "A780 flip lid", | ||
668 | .type = EV_SW, | ||
669 | .wakeup = 1, | ||
670 | }, | ||
671 | }; | ||
672 | |||
673 | static struct gpio_keys_platform_data a780_gpio_keys_platform_data = { | ||
674 | .buttons = a780_buttons, | ||
675 | .nbuttons = ARRAY_SIZE(a780_buttons), | ||
676 | }; | ||
677 | |||
678 | static struct platform_device a780_gpio_keys = { | ||
679 | .name = "gpio-keys", | ||
680 | .id = -1, | ||
681 | .dev = { | ||
682 | .platform_data = &a780_gpio_keys_platform_data, | ||
683 | }, | ||
684 | }; | ||
685 | |||
686 | static struct platform_device *a780_devices[] __initdata = { | ||
687 | &a780_gpio_keys, | ||
688 | }; | ||
689 | |||
654 | static void __init a780_init(void) | 690 | static void __init a780_init(void) |
655 | { | 691 | { |
656 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 692 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -663,7 +699,8 @@ static void __init a780_init(void) | |||
663 | 699 | ||
664 | pxa_set_keypad_info(&a780_keypad_platform_data); | 700 | pxa_set_keypad_info(&a780_keypad_platform_data); |
665 | 701 | ||
666 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 702 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
703 | platform_add_devices(ARRAY_AND_SIZE(a780_devices)); | ||
667 | } | 704 | } |
668 | 705 | ||
669 | MACHINE_START(EZX_A780, "Motorola EZX A780") | 706 | MACHINE_START(EZX_A780, "Motorola EZX A780") |
@@ -678,10 +715,39 @@ MACHINE_END | |||
678 | #endif | 715 | #endif |
679 | 716 | ||
680 | #ifdef CONFIG_MACH_EZX_E680 | 717 | #ifdef CONFIG_MACH_EZX_E680 |
718 | /* gpio_keys */ | ||
719 | static struct gpio_keys_button e680_buttons[] = { | ||
720 | [0] = { | ||
721 | .code = KEY_SCREENLOCK, | ||
722 | .gpio = GPIO12_E680_LOCK_SWITCH, | ||
723 | .active_low = 0, | ||
724 | .desc = "E680 lock switch", | ||
725 | .type = EV_KEY, | ||
726 | .wakeup = 1, | ||
727 | }, | ||
728 | }; | ||
729 | |||
730 | static struct gpio_keys_platform_data e680_gpio_keys_platform_data = { | ||
731 | .buttons = e680_buttons, | ||
732 | .nbuttons = ARRAY_SIZE(e680_buttons), | ||
733 | }; | ||
734 | |||
735 | static struct platform_device e680_gpio_keys = { | ||
736 | .name = "gpio-keys", | ||
737 | .id = -1, | ||
738 | .dev = { | ||
739 | .platform_data = &e680_gpio_keys_platform_data, | ||
740 | }, | ||
741 | }; | ||
742 | |||
681 | static struct i2c_board_info __initdata e680_i2c_board_info[] = { | 743 | static struct i2c_board_info __initdata e680_i2c_board_info[] = { |
682 | { I2C_BOARD_INFO("tea5767", 0x81) }, | 744 | { I2C_BOARD_INFO("tea5767", 0x81) }, |
683 | }; | 745 | }; |
684 | 746 | ||
747 | static struct platform_device *e680_devices[] __initdata = { | ||
748 | &e680_gpio_keys, | ||
749 | }; | ||
750 | |||
685 | static void __init e680_init(void) | 751 | static void __init e680_init(void) |
686 | { | 752 | { |
687 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 753 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -695,7 +761,8 @@ static void __init e680_init(void) | |||
695 | 761 | ||
696 | pxa_set_keypad_info(&e680_keypad_platform_data); | 762 | pxa_set_keypad_info(&e680_keypad_platform_data); |
697 | 763 | ||
698 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 764 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
765 | platform_add_devices(ARRAY_AND_SIZE(e680_devices)); | ||
699 | } | 766 | } |
700 | 767 | ||
701 | MACHINE_START(EZX_E680, "Motorola EZX E680") | 768 | MACHINE_START(EZX_E680, "Motorola EZX E680") |
@@ -710,10 +777,39 @@ MACHINE_END | |||
710 | #endif | 777 | #endif |
711 | 778 | ||
712 | #ifdef CONFIG_MACH_EZX_A1200 | 779 | #ifdef CONFIG_MACH_EZX_A1200 |
780 | /* gpio_keys */ | ||
781 | static struct gpio_keys_button a1200_buttons[] = { | ||
782 | [0] = { | ||
783 | .code = SW_LID, | ||
784 | .gpio = GPIO15_A1200_FLIP_LID, | ||
785 | .active_low = 0, | ||
786 | .desc = "A1200 flip lid", | ||
787 | .type = EV_SW, | ||
788 | .wakeup = 1, | ||
789 | }, | ||
790 | }; | ||
791 | |||
792 | static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = { | ||
793 | .buttons = a1200_buttons, | ||
794 | .nbuttons = ARRAY_SIZE(a1200_buttons), | ||
795 | }; | ||
796 | |||
797 | static struct platform_device a1200_gpio_keys = { | ||
798 | .name = "gpio-keys", | ||
799 | .id = -1, | ||
800 | .dev = { | ||
801 | .platform_data = &a1200_gpio_keys_platform_data, | ||
802 | }, | ||
803 | }; | ||
804 | |||
713 | static struct i2c_board_info __initdata a1200_i2c_board_info[] = { | 805 | static struct i2c_board_info __initdata a1200_i2c_board_info[] = { |
714 | { I2C_BOARD_INFO("tea5767", 0x81) }, | 806 | { I2C_BOARD_INFO("tea5767", 0x81) }, |
715 | }; | 807 | }; |
716 | 808 | ||
809 | static struct platform_device *a1200_devices[] __initdata = { | ||
810 | &a1200_gpio_keys, | ||
811 | }; | ||
812 | |||
717 | static void __init a1200_init(void) | 813 | static void __init a1200_init(void) |
718 | { | 814 | { |
719 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 815 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -727,7 +823,8 @@ static void __init a1200_init(void) | |||
727 | 823 | ||
728 | pxa_set_keypad_info(&a1200_keypad_platform_data); | 824 | pxa_set_keypad_info(&a1200_keypad_platform_data); |
729 | 825 | ||
730 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 826 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
827 | platform_add_devices(ARRAY_AND_SIZE(a1200_devices)); | ||
731 | } | 828 | } |
732 | 829 | ||
733 | MACHINE_START(EZX_A1200, "Motorola EZX A1200") | 830 | MACHINE_START(EZX_A1200, "Motorola EZX A1200") |
@@ -742,6 +839,35 @@ MACHINE_END | |||
742 | #endif | 839 | #endif |
743 | 840 | ||
744 | #ifdef CONFIG_MACH_EZX_A910 | 841 | #ifdef CONFIG_MACH_EZX_A910 |
842 | /* gpio_keys */ | ||
843 | static struct gpio_keys_button a910_buttons[] = { | ||
844 | [0] = { | ||
845 | .code = SW_LID, | ||
846 | .gpio = GPIO15_A910_FLIP_LID, | ||
847 | .active_low = 0, | ||
848 | .desc = "A910 flip lid", | ||
849 | .type = EV_SW, | ||
850 | .wakeup = 1, | ||
851 | }, | ||
852 | }; | ||
853 | |||
854 | static struct gpio_keys_platform_data a910_gpio_keys_platform_data = { | ||
855 | .buttons = a910_buttons, | ||
856 | .nbuttons = ARRAY_SIZE(a910_buttons), | ||
857 | }; | ||
858 | |||
859 | static struct platform_device a910_gpio_keys = { | ||
860 | .name = "gpio-keys", | ||
861 | .id = -1, | ||
862 | .dev = { | ||
863 | .platform_data = &a910_gpio_keys_platform_data, | ||
864 | }, | ||
865 | }; | ||
866 | |||
867 | static struct platform_device *a910_devices[] __initdata = { | ||
868 | &a910_gpio_keys, | ||
869 | }; | ||
870 | |||
745 | static void __init a910_init(void) | 871 | static void __init a910_init(void) |
746 | { | 872 | { |
747 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 873 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -754,7 +880,8 @@ static void __init a910_init(void) | |||
754 | 880 | ||
755 | pxa_set_keypad_info(&a910_keypad_platform_data); | 881 | pxa_set_keypad_info(&a910_keypad_platform_data); |
756 | 882 | ||
757 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 883 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
884 | platform_add_devices(ARRAY_AND_SIZE(a910_devices)); | ||
758 | } | 885 | } |
759 | 886 | ||
760 | MACHINE_START(EZX_A910, "Motorola EZX A910") | 887 | MACHINE_START(EZX_A910, "Motorola EZX A910") |
@@ -769,10 +896,39 @@ MACHINE_END | |||
769 | #endif | 896 | #endif |
770 | 897 | ||
771 | #ifdef CONFIG_MACH_EZX_E6 | 898 | #ifdef CONFIG_MACH_EZX_E6 |
899 | /* gpio_keys */ | ||
900 | static struct gpio_keys_button e6_buttons[] = { | ||
901 | [0] = { | ||
902 | .code = KEY_SCREENLOCK, | ||
903 | .gpio = GPIO15_E6_LOCK_SWITCH, | ||
904 | .active_low = 0, | ||
905 | .desc = "E6 lock switch", | ||
906 | .type = EV_KEY, | ||
907 | .wakeup = 1, | ||
908 | }, | ||
909 | }; | ||
910 | |||
911 | static struct gpio_keys_platform_data e6_gpio_keys_platform_data = { | ||
912 | .buttons = e6_buttons, | ||
913 | .nbuttons = ARRAY_SIZE(e6_buttons), | ||
914 | }; | ||
915 | |||
916 | static struct platform_device e6_gpio_keys = { | ||
917 | .name = "gpio-keys", | ||
918 | .id = -1, | ||
919 | .dev = { | ||
920 | .platform_data = &e6_gpio_keys_platform_data, | ||
921 | }, | ||
922 | }; | ||
923 | |||
772 | static struct i2c_board_info __initdata e6_i2c_board_info[] = { | 924 | static struct i2c_board_info __initdata e6_i2c_board_info[] = { |
773 | { I2C_BOARD_INFO("tea5767", 0x81) }, | 925 | { I2C_BOARD_INFO("tea5767", 0x81) }, |
774 | }; | 926 | }; |
775 | 927 | ||
928 | static struct platform_device *e6_devices[] __initdata = { | ||
929 | &e6_gpio_keys, | ||
930 | }; | ||
931 | |||
776 | static void __init e6_init(void) | 932 | static void __init e6_init(void) |
777 | { | 933 | { |
778 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 934 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -786,7 +942,8 @@ static void __init e6_init(void) | |||
786 | 942 | ||
787 | pxa_set_keypad_info(&e6_keypad_platform_data); | 943 | pxa_set_keypad_info(&e6_keypad_platform_data); |
788 | 944 | ||
789 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 945 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
946 | platform_add_devices(ARRAY_AND_SIZE(e6_devices)); | ||
790 | } | 947 | } |
791 | 948 | ||
792 | MACHINE_START(EZX_E6, "Motorola EZX E6") | 949 | MACHINE_START(EZX_E6, "Motorola EZX E6") |
@@ -805,6 +962,9 @@ static struct i2c_board_info __initdata e2_i2c_board_info[] = { | |||
805 | { I2C_BOARD_INFO("tea5767", 0x81) }, | 962 | { I2C_BOARD_INFO("tea5767", 0x81) }, |
806 | }; | 963 | }; |
807 | 964 | ||
965 | static struct platform_device *e2_devices[] __initdata = { | ||
966 | }; | ||
967 | |||
808 | static void __init e2_init(void) | 968 | static void __init e2_init(void) |
809 | { | 969 | { |
810 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 970 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -818,7 +978,8 @@ static void __init e2_init(void) | |||
818 | 978 | ||
819 | pxa_set_keypad_info(&e2_keypad_platform_data); | 979 | pxa_set_keypad_info(&e2_keypad_platform_data); |
820 | 980 | ||
821 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 981 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
982 | platform_add_devices(ARRAY_AND_SIZE(e2_devices)); | ||
822 | } | 983 | } |
823 | 984 | ||
824 | MACHINE_START(EZX_E2, "Motorola EZX E2") | 985 | MACHINE_START(EZX_E2, "Motorola EZX E2") |
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c new file mode 100644 index 000000000000..7fff467e84fc --- /dev/null +++ b/arch/arm/mach-pxa/hx4700.c | |||
@@ -0,0 +1,851 @@ | |||
1 | /* | ||
2 | * Support for HP iPAQ hx4700 PDAs. | ||
3 | * | ||
4 | * Copyright (c) 2008-2009 Philipp Zabel | ||
5 | * | ||
6 | * Based on code: | ||
7 | * Copyright (c) 2004 Hewlett-Packard Company. | ||
8 | * Copyright (c) 2005 SDG Systems, LLC | ||
9 | * Copyright (c) 2006 Anton Vorontsov <cbou@mail.ru> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/fb.h> | ||
22 | #include <linux/gpio.h> | ||
23 | #include <linux/gpio_keys.h> | ||
24 | #include <linux/input.h> | ||
25 | #include <linux/lcd.h> | ||
26 | #include <linux/mfd/htc-egpio.h> | ||
27 | #include <linux/mfd/asic3.h> | ||
28 | #include <linux/mtd/physmap.h> | ||
29 | #include <linux/pda_power.h> | ||
30 | #include <linux/pwm_backlight.h> | ||
31 | #include <linux/regulator/bq24022.h> | ||
32 | #include <linux/regulator/machine.h> | ||
33 | #include <linux/spi/ads7846.h> | ||
34 | #include <linux/spi/spi.h> | ||
35 | #include <linux/usb/gpio_vbus.h> | ||
36 | |||
37 | #include <mach/hardware.h> | ||
38 | #include <asm/mach-types.h> | ||
39 | #include <asm/mach/arch.h> | ||
40 | |||
41 | #include <mach/pxa27x.h> | ||
42 | #include <mach/hx4700.h> | ||
43 | #include <plat/i2c.h> | ||
44 | #include <mach/irda.h> | ||
45 | #include <mach/pxa2xx_spi.h> | ||
46 | |||
47 | #include <video/w100fb.h> | ||
48 | |||
49 | #include "devices.h" | ||
50 | #include "generic.h" | ||
51 | |||
52 | /* Physical address space information */ | ||
53 | |||
54 | #define ATI_W3220_PHYS PXA_CS2_PHYS /* ATI Imageon 3220 Graphics */ | ||
55 | #define ASIC3_PHYS PXA_CS3_PHYS | ||
56 | #define ASIC3_SD_PHYS (PXA_CS3_PHYS + 0x02000000) | ||
57 | |||
58 | static unsigned long hx4700_pin_config[] __initdata = { | ||
59 | |||
60 | /* SDRAM and Static Memory I/O Signals */ | ||
61 | GPIO20_nSDCS_2, | ||
62 | GPIO21_nSDCS_3, | ||
63 | GPIO15_nCS_1, | ||
64 | GPIO78_nCS_2, /* W3220 */ | ||
65 | GPIO79_nCS_3, /* ASIC3 */ | ||
66 | GPIO80_nCS_4, | ||
67 | GPIO33_nCS_5, /* EGPIO, WLAN */ | ||
68 | |||
69 | /* PC CARD */ | ||
70 | GPIO48_nPOE, | ||
71 | GPIO49_nPWE, | ||
72 | GPIO50_nPIOR, | ||
73 | GPIO51_nPIOW, | ||
74 | GPIO54_nPCE_2, | ||
75 | GPIO55_nPREG, | ||
76 | GPIO56_nPWAIT, | ||
77 | GPIO57_nIOIS16, | ||
78 | GPIO85_nPCE_1, | ||
79 | GPIO104_PSKTSEL, | ||
80 | |||
81 | /* I2C */ | ||
82 | GPIO117_I2C_SCL, | ||
83 | GPIO118_I2C_SDA, | ||
84 | |||
85 | /* FFUART (RS-232) */ | ||
86 | GPIO34_FFUART_RXD, | ||
87 | GPIO35_FFUART_CTS, | ||
88 | GPIO36_FFUART_DCD, | ||
89 | GPIO37_FFUART_DSR, | ||
90 | GPIO38_FFUART_RI, | ||
91 | GPIO39_FFUART_TXD, | ||
92 | GPIO40_FFUART_DTR, | ||
93 | GPIO41_FFUART_RTS, | ||
94 | |||
95 | /* BTUART */ | ||
96 | GPIO42_BTUART_RXD, | ||
97 | GPIO43_BTUART_TXD, | ||
98 | GPIO44_BTUART_CTS, | ||
99 | GPIO45_BTUART_RTS, | ||
100 | |||
101 | /* PWM 1 (Backlight) */ | ||
102 | GPIO17_PWM1_OUT, | ||
103 | |||
104 | /* I2S */ | ||
105 | GPIO28_I2S_BITCLK_OUT, | ||
106 | GPIO29_I2S_SDATA_IN, | ||
107 | GPIO30_I2S_SDATA_OUT, | ||
108 | GPIO31_I2S_SYNC, | ||
109 | GPIO113_I2S_SYSCLK, | ||
110 | |||
111 | /* SSP 1 (NavPoint) */ | ||
112 | GPIO23_SSP1_SCLK, | ||
113 | GPIO24_SSP1_SFRM, | ||
114 | GPIO25_SSP1_TXD, | ||
115 | GPIO26_SSP1_RXD, | ||
116 | |||
117 | /* SSP 2 (TSC2046) */ | ||
118 | GPIO19_SSP2_SCLK, | ||
119 | GPIO86_SSP2_RXD, | ||
120 | GPIO87_SSP2_TXD, | ||
121 | GPIO88_GPIO, | ||
122 | |||
123 | /* HX4700 specific input GPIOs */ | ||
124 | GPIO12_GPIO, /* ASIC3_IRQ */ | ||
125 | GPIO13_GPIO, /* W3220_IRQ */ | ||
126 | GPIO14_GPIO, /* nWLAN_IRQ */ | ||
127 | |||
128 | GPIO10_GPIO, /* GSM_IRQ */ | ||
129 | GPIO13_GPIO, /* CPLD_IRQ */ | ||
130 | GPIO107_GPIO, /* DS1WM_IRQ */ | ||
131 | GPIO108_GPIO, /* GSM_READY */ | ||
132 | GPIO58_GPIO, /* TSC2046_nPENIRQ */ | ||
133 | GPIO66_GPIO, /* nSDIO_IRQ */ | ||
134 | }; | ||
135 | |||
136 | #define HX4700_GPIO_IN(num, _desc) \ | ||
137 | { .gpio = (num), .dir = 0, .desc = (_desc) } | ||
138 | #define HX4700_GPIO_OUT(num, _init, _desc) \ | ||
139 | { .gpio = (num), .dir = 1, .init = (_init), .desc = (_desc) } | ||
140 | struct gpio_ress { | ||
141 | unsigned gpio : 8; | ||
142 | unsigned dir : 1; | ||
143 | unsigned init : 1; | ||
144 | char *desc; | ||
145 | }; | ||
146 | |||
147 | static int hx4700_gpio_request(struct gpio_ress *gpios, int size) | ||
148 | { | ||
149 | int i, rc = 0; | ||
150 | int gpio; | ||
151 | int dir; | ||
152 | |||
153 | for (i = 0; (!rc) && (i < size); i++) { | ||
154 | gpio = gpios[i].gpio; | ||
155 | dir = gpios[i].dir; | ||
156 | rc = gpio_request(gpio, gpios[i].desc); | ||
157 | if (rc) { | ||
158 | pr_err("Error requesting GPIO %d(%s) : %d\n", | ||
159 | gpio, gpios[i].desc, rc); | ||
160 | continue; | ||
161 | } | ||
162 | if (dir) | ||
163 | gpio_direction_output(gpio, gpios[i].init); | ||
164 | else | ||
165 | gpio_direction_input(gpio); | ||
166 | } | ||
167 | while ((rc) && (--i >= 0)) | ||
168 | gpio_free(gpios[i].gpio); | ||
169 | return rc; | ||
170 | } | ||
171 | |||
172 | /* | ||
173 | * IRDA | ||
174 | */ | ||
175 | |||
176 | static void irda_transceiver_mode(struct device *dev, int mode) | ||
177 | { | ||
178 | gpio_set_value(GPIO105_HX4700_nIR_ON, mode & IR_OFF); | ||
179 | } | ||
180 | |||
181 | static struct pxaficp_platform_data ficp_info = { | ||
182 | .transceiver_cap = IR_SIRMODE | IR_OFF, | ||
183 | .transceiver_mode = irda_transceiver_mode, | ||
184 | }; | ||
185 | |||
186 | /* | ||
187 | * GPIO Keys | ||
188 | */ | ||
189 | |||
190 | #define INIT_KEY(_code, _gpio, _active_low, _desc) \ | ||
191 | { \ | ||
192 | .code = KEY_##_code, \ | ||
193 | .gpio = _gpio, \ | ||
194 | .active_low = _active_low, \ | ||
195 | .desc = _desc, \ | ||
196 | .type = EV_KEY, \ | ||
197 | .wakeup = 1, \ | ||
198 | } | ||
199 | |||
200 | static struct gpio_keys_button gpio_keys_buttons[] = { | ||
201 | INIT_KEY(POWER, GPIO0_HX4700_nKEY_POWER, 1, "Power button"), | ||
202 | INIT_KEY(MAIL, GPIO94_HX4700_KEY_MAIL, 0, "Mail button"), | ||
203 | INIT_KEY(ADDRESSBOOK, GPIO99_HX4700_KEY_CONTACTS,0, "Contacts button"), | ||
204 | INIT_KEY(RECORD, GPIOD6_nKEY_RECORD, 1, "Record button"), | ||
205 | INIT_KEY(CALENDAR, GPIOD1_nKEY_CALENDAR, 1, "Calendar button"), | ||
206 | INIT_KEY(HOMEPAGE, GPIOD3_nKEY_HOME, 1, "Home button"), | ||
207 | }; | ||
208 | |||
209 | static struct gpio_keys_platform_data gpio_keys_data = { | ||
210 | .buttons = gpio_keys_buttons, | ||
211 | .nbuttons = ARRAY_SIZE(gpio_keys_buttons), | ||
212 | }; | ||
213 | |||
214 | static struct platform_device gpio_keys = { | ||
215 | .name = "gpio-keys", | ||
216 | .dev = { | ||
217 | .platform_data = &gpio_keys_data, | ||
218 | }, | ||
219 | .id = -1, | ||
220 | }; | ||
221 | |||
222 | /* | ||
223 | * ASIC3 | ||
224 | */ | ||
225 | |||
226 | static u16 asic3_gpio_config[] = { | ||
227 | /* ASIC3 GPIO banks A and B along with some of C and D | ||
228 | implement the buffering for the CF slot. */ | ||
229 | ASIC3_CONFIG_GPIO(0, 1, 1, 0), | ||
230 | ASIC3_CONFIG_GPIO(1, 1, 1, 0), | ||
231 | ASIC3_CONFIG_GPIO(2, 1, 1, 0), | ||
232 | ASIC3_CONFIG_GPIO(3, 1, 1, 0), | ||
233 | ASIC3_CONFIG_GPIO(4, 1, 1, 0), | ||
234 | ASIC3_CONFIG_GPIO(5, 1, 1, 0), | ||
235 | ASIC3_CONFIG_GPIO(6, 1, 1, 0), | ||
236 | ASIC3_CONFIG_GPIO(7, 1, 1, 0), | ||
237 | ASIC3_CONFIG_GPIO(8, 1, 1, 0), | ||
238 | ASIC3_CONFIG_GPIO(9, 1, 1, 0), | ||
239 | ASIC3_CONFIG_GPIO(10, 1, 1, 0), | ||
240 | ASIC3_CONFIG_GPIO(11, 1, 1, 0), | ||
241 | ASIC3_CONFIG_GPIO(12, 1, 1, 0), | ||
242 | ASIC3_CONFIG_GPIO(13, 1, 1, 0), | ||
243 | ASIC3_CONFIG_GPIO(14, 1, 1, 0), | ||
244 | ASIC3_CONFIG_GPIO(15, 1, 1, 0), | ||
245 | |||
246 | ASIC3_CONFIG_GPIO(16, 1, 1, 0), | ||
247 | ASIC3_CONFIG_GPIO(17, 1, 1, 0), | ||
248 | ASIC3_CONFIG_GPIO(18, 1, 1, 0), | ||
249 | ASIC3_CONFIG_GPIO(19, 1, 1, 0), | ||
250 | ASIC3_CONFIG_GPIO(20, 1, 1, 0), | ||
251 | ASIC3_CONFIG_GPIO(21, 1, 1, 0), | ||
252 | ASIC3_CONFIG_GPIO(22, 1, 1, 0), | ||
253 | ASIC3_CONFIG_GPIO(23, 1, 1, 0), | ||
254 | ASIC3_CONFIG_GPIO(24, 1, 1, 0), | ||
255 | ASIC3_CONFIG_GPIO(25, 1, 1, 0), | ||
256 | ASIC3_CONFIG_GPIO(26, 1, 1, 0), | ||
257 | ASIC3_CONFIG_GPIO(27, 1, 1, 0), | ||
258 | ASIC3_CONFIG_GPIO(28, 1, 1, 0), | ||
259 | ASIC3_CONFIG_GPIO(29, 1, 1, 0), | ||
260 | ASIC3_CONFIG_GPIO(30, 1, 1, 0), | ||
261 | ASIC3_CONFIG_GPIO(31, 1, 1, 0), | ||
262 | |||
263 | /* GPIOC - CF, LEDs, SD */ | ||
264 | ASIC3_GPIOC0_LED0, /* red */ | ||
265 | ASIC3_GPIOC1_LED1, /* green */ | ||
266 | ASIC3_GPIOC2_LED2, /* blue */ | ||
267 | ASIC3_GPIOC4_CF_nCD, | ||
268 | ASIC3_GPIOC5_nCIOW, | ||
269 | ASIC3_GPIOC6_nCIOR, | ||
270 | ASIC3_GPIOC7_nPCE_1, | ||
271 | ASIC3_GPIOC8_nPCE_2, | ||
272 | ASIC3_GPIOC9_nPOE, | ||
273 | ASIC3_GPIOC10_nPWE, | ||
274 | ASIC3_GPIOC11_PSKTSEL, | ||
275 | ASIC3_GPIOC12_nPREG, | ||
276 | ASIC3_GPIOC13_nPWAIT, | ||
277 | ASIC3_GPIOC14_nPIOIS16, | ||
278 | ASIC3_GPIOC15_nPIOR, | ||
279 | |||
280 | /* GPIOD: input GPIOs, CF */ | ||
281 | ASIC3_GPIOD11_nCIOIS16, | ||
282 | ASIC3_GPIOD12_nCWAIT, | ||
283 | ASIC3_GPIOD15_nPIOW, | ||
284 | }; | ||
285 | |||
286 | static struct resource asic3_resources[] = { | ||
287 | /* GPIO part */ | ||
288 | [0] = { | ||
289 | .start = ASIC3_PHYS, | ||
290 | .end = ASIC3_PHYS + ASIC3_MAP_SIZE_16BIT - 1, | ||
291 | .flags = IORESOURCE_MEM, | ||
292 | }, | ||
293 | [1] = { | ||
294 | .start = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ), | ||
295 | .end = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ), | ||
296 | .flags = IORESOURCE_IRQ, | ||
297 | }, | ||
298 | /* SD part */ | ||
299 | [2] = { | ||
300 | .start = ASIC3_SD_PHYS, | ||
301 | .end = ASIC3_SD_PHYS + ASIC3_MAP_SIZE_16BIT - 1, | ||
302 | .flags = IORESOURCE_MEM, | ||
303 | }, | ||
304 | [3] = { | ||
305 | .start = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ), | ||
306 | .end = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ), | ||
307 | .flags = IORESOURCE_IRQ, | ||
308 | }, | ||
309 | }; | ||
310 | |||
311 | static struct asic3_platform_data asic3_platform_data = { | ||
312 | .gpio_config = asic3_gpio_config, | ||
313 | .gpio_config_num = ARRAY_SIZE(asic3_gpio_config), | ||
314 | .irq_base = IRQ_BOARD_START, | ||
315 | .gpio_base = HX4700_ASIC3_GPIO_BASE, | ||
316 | }; | ||
317 | |||
318 | static struct platform_device asic3 = { | ||
319 | .name = "asic3", | ||
320 | .id = -1, | ||
321 | .resource = asic3_resources, | ||
322 | .num_resources = ARRAY_SIZE(asic3_resources), | ||
323 | .dev = { | ||
324 | .platform_data = &asic3_platform_data, | ||
325 | }, | ||
326 | }; | ||
327 | |||
328 | /* | ||
329 | * EGPIO | ||
330 | */ | ||
331 | |||
332 | static struct resource egpio_resources[] = { | ||
333 | [0] = { | ||
334 | .start = PXA_CS5_PHYS, | ||
335 | .end = PXA_CS5_PHYS + 0x4 - 1, | ||
336 | .flags = IORESOURCE_MEM, | ||
337 | }, | ||
338 | }; | ||
339 | |||
340 | static struct htc_egpio_chip egpio_chips[] = { | ||
341 | [0] = { | ||
342 | .reg_start = 0, | ||
343 | .gpio_base = HX4700_EGPIO_BASE, | ||
344 | .num_gpios = 8, | ||
345 | .direction = HTC_EGPIO_OUTPUT, | ||
346 | }, | ||
347 | }; | ||
348 | |||
349 | static struct htc_egpio_platform_data egpio_info = { | ||
350 | .reg_width = 16, | ||
351 | .bus_width = 16, | ||
352 | .chip = egpio_chips, | ||
353 | .num_chips = ARRAY_SIZE(egpio_chips), | ||
354 | }; | ||
355 | |||
356 | static struct platform_device egpio = { | ||
357 | .name = "htc-egpio", | ||
358 | .id = -1, | ||
359 | .resource = egpio_resources, | ||
360 | .num_resources = ARRAY_SIZE(egpio_resources), | ||
361 | .dev = { | ||
362 | .platform_data = &egpio_info, | ||
363 | }, | ||
364 | }; | ||
365 | |||
366 | /* | ||
367 | * LCD - Sony display connected to ATI Imageon w3220 | ||
368 | */ | ||
369 | |||
370 | static int lcd_power; | ||
371 | |||
372 | static void sony_lcd_init(void) | ||
373 | { | ||
374 | gpio_set_value(GPIO84_HX4700_LCD_SQN, 1); | ||
375 | gpio_set_value(GPIO110_HX4700_LCD_LVDD_3V3_ON, 0); | ||
376 | gpio_set_value(GPIO111_HX4700_LCD_AVDD_3V3_ON, 0); | ||
377 | gpio_set_value(GPIO70_HX4700_LCD_SLIN1, 0); | ||
378 | gpio_set_value(GPIO62_HX4700_LCD_nRESET, 0); | ||
379 | mdelay(10); | ||
380 | gpio_set_value(GPIO59_HX4700_LCD_PC1, 0); | ||
381 | gpio_set_value(GPIO110_HX4700_LCD_LVDD_3V3_ON, 0); | ||
382 | mdelay(20); | ||
383 | |||
384 | gpio_set_value(GPIO110_HX4700_LCD_LVDD_3V3_ON, 1); | ||
385 | mdelay(5); | ||
386 | gpio_set_value(GPIO111_HX4700_LCD_AVDD_3V3_ON, 1); | ||
387 | |||
388 | /* FIXME: init w3220 registers here */ | ||
389 | |||
390 | mdelay(5); | ||
391 | gpio_set_value(GPIO70_HX4700_LCD_SLIN1, 1); | ||
392 | mdelay(10); | ||
393 | gpio_set_value(GPIO62_HX4700_LCD_nRESET, 1); | ||
394 | mdelay(10); | ||
395 | gpio_set_value(GPIO59_HX4700_LCD_PC1, 1); | ||
396 | mdelay(10); | ||
397 | gpio_set_value(GPIO112_HX4700_LCD_N2V7_7V3_ON, 1); | ||
398 | } | ||
399 | |||
400 | static void sony_lcd_off(void) | ||
401 | { | ||
402 | gpio_set_value(GPIO59_HX4700_LCD_PC1, 0); | ||
403 | gpio_set_value(GPIO62_HX4700_LCD_nRESET, 0); | ||
404 | mdelay(10); | ||
405 | gpio_set_value(GPIO112_HX4700_LCD_N2V7_7V3_ON, 0); | ||
406 | mdelay(10); | ||
407 | gpio_set_value(GPIO111_HX4700_LCD_AVDD_3V3_ON, 0); | ||
408 | mdelay(10); | ||
409 | gpio_set_value(GPIO110_HX4700_LCD_LVDD_3V3_ON, 0); | ||
410 | } | ||
411 | |||
412 | static int hx4700_lcd_set_power(struct lcd_device *ldev, int level) | ||
413 | { | ||
414 | switch (level) { | ||
415 | case FB_BLANK_UNBLANK: | ||
416 | sony_lcd_init(); | ||
417 | break; | ||
418 | case FB_BLANK_NORMAL: | ||
419 | case FB_BLANK_VSYNC_SUSPEND: | ||
420 | case FB_BLANK_HSYNC_SUSPEND: | ||
421 | case FB_BLANK_POWERDOWN: | ||
422 | sony_lcd_off(); | ||
423 | break; | ||
424 | } | ||
425 | lcd_power = level; | ||
426 | return 0; | ||
427 | } | ||
428 | |||
429 | static int hx4700_lcd_get_power(struct lcd_device *lm) | ||
430 | { | ||
431 | return lcd_power; | ||
432 | } | ||
433 | |||
434 | static struct lcd_ops hx4700_lcd_ops = { | ||
435 | .get_power = hx4700_lcd_get_power, | ||
436 | .set_power = hx4700_lcd_set_power, | ||
437 | }; | ||
438 | |||
439 | static struct lcd_device *hx4700_lcd_device; | ||
440 | |||
441 | #ifdef CONFIG_PM | ||
442 | static void w3220_lcd_suspend(struct w100fb_par *wfb) | ||
443 | { | ||
444 | sony_lcd_off(); | ||
445 | } | ||
446 | |||
447 | static void w3220_lcd_resume(struct w100fb_par *wfb) | ||
448 | { | ||
449 | sony_lcd_init(); | ||
450 | } | ||
451 | #else | ||
452 | #define w3220_lcd_resume NULL | ||
453 | #define w3220_lcd_suspend NULL | ||
454 | #endif | ||
455 | |||
456 | static struct w100_tg_info w3220_tg_info = { | ||
457 | .suspend = w3220_lcd_suspend, | ||
458 | .resume = w3220_lcd_resume, | ||
459 | }; | ||
460 | |||
461 | /* W3220_VGA QVGA */ | ||
462 | static struct w100_gen_regs w3220_regs = { | ||
463 | .lcd_format = 0x00000003, | ||
464 | .lcdd_cntl1 = 0x00000000, | ||
465 | .lcdd_cntl2 = 0x0003ffff, | ||
466 | .genlcd_cntl1 = 0x00abf003, /* 0x00fff003 */ | ||
467 | .genlcd_cntl2 = 0x00000003, | ||
468 | .genlcd_cntl3 = 0x000102aa, | ||
469 | }; | ||
470 | |||
471 | static struct w100_mode w3220_modes[] = { | ||
472 | { | ||
473 | .xres = 480, | ||
474 | .yres = 640, | ||
475 | .left_margin = 15, | ||
476 | .right_margin = 16, | ||
477 | .upper_margin = 8, | ||
478 | .lower_margin = 7, | ||
479 | .crtc_ss = 0x00000000, | ||
480 | .crtc_ls = 0xa1ff01f9, /* 0x21ff01f9 */ | ||
481 | .crtc_gs = 0xc0000000, /* 0x40000000 */ | ||
482 | .crtc_vpos_gs = 0x0000028f, | ||
483 | .crtc_ps1_active = 0x00000000, /* 0x41060010 */ | ||
484 | .crtc_rev = 0, | ||
485 | .crtc_dclk = 0x80000000, | ||
486 | .crtc_gclk = 0x040a0104, | ||
487 | .crtc_goe = 0, | ||
488 | .pll_freq = 95, | ||
489 | .pixclk_divider = 4, | ||
490 | .pixclk_divider_rotated = 4, | ||
491 | .pixclk_src = CLK_SRC_PLL, | ||
492 | .sysclk_divider = 0, | ||
493 | .sysclk_src = CLK_SRC_PLL, | ||
494 | }, | ||
495 | { | ||
496 | .xres = 240, | ||
497 | .yres = 320, | ||
498 | .left_margin = 9, | ||
499 | .right_margin = 8, | ||
500 | .upper_margin = 5, | ||
501 | .lower_margin = 4, | ||
502 | .crtc_ss = 0x80150014, | ||
503 | .crtc_ls = 0xa0fb00f7, | ||
504 | .crtc_gs = 0xc0080007, | ||
505 | .crtc_vpos_gs = 0x00080007, | ||
506 | .crtc_rev = 0x0000000a, | ||
507 | .crtc_dclk = 0x81700030, | ||
508 | .crtc_gclk = 0x8015010f, | ||
509 | .crtc_goe = 0x00000000, | ||
510 | .pll_freq = 95, | ||
511 | .pixclk_divider = 4, | ||
512 | .pixclk_divider_rotated = 4, | ||
513 | .pixclk_src = CLK_SRC_PLL, | ||
514 | .sysclk_divider = 0, | ||
515 | .sysclk_src = CLK_SRC_PLL, | ||
516 | }, | ||
517 | }; | ||
518 | |||
519 | struct w100_mem_info w3220_mem_info = { | ||
520 | .ext_cntl = 0x09640011, | ||
521 | .sdram_mode_reg = 0x00600021, | ||
522 | .ext_timing_cntl = 0x1a001545, /* 0x15001545 */ | ||
523 | .io_cntl = 0x7ddd7333, | ||
524 | .size = 0x1fffff, | ||
525 | }; | ||
526 | |||
527 | struct w100_bm_mem_info w3220_bm_mem_info = { | ||
528 | .ext_mem_bw = 0x50413e01, | ||
529 | .offset = 0, | ||
530 | .ext_timing_ctl = 0x00043f7f, | ||
531 | .ext_cntl = 0x00000010, | ||
532 | .mode_reg = 0x00250000, | ||
533 | .io_cntl = 0x0fff0000, | ||
534 | .config = 0x08301480, | ||
535 | }; | ||
536 | |||
537 | static struct w100_gpio_regs w3220_gpio_info = { | ||
538 | .init_data1 = 0xdfe00100, /* GPIO_DATA */ | ||
539 | .gpio_dir1 = 0xffff0000, /* GPIO_CNTL1 */ | ||
540 | .gpio_oe1 = 0x00000000, /* GPIO_CNTL2 */ | ||
541 | .init_data2 = 0x00000000, /* GPIO_DATA2 */ | ||
542 | .gpio_dir2 = 0x00000000, /* GPIO_CNTL3 */ | ||
543 | .gpio_oe2 = 0x00000000, /* GPIO_CNTL4 */ | ||
544 | }; | ||
545 | |||
546 | static struct w100fb_mach_info w3220_info = { | ||
547 | .tg = &w3220_tg_info, | ||
548 | .mem = &w3220_mem_info, | ||
549 | .bm_mem = &w3220_bm_mem_info, | ||
550 | .gpio = &w3220_gpio_info, | ||
551 | .regs = &w3220_regs, | ||
552 | .modelist = w3220_modes, | ||
553 | .num_modes = 2, | ||
554 | .xtal_freq = 16000000, | ||
555 | }; | ||
556 | |||
557 | static struct resource w3220_resources[] = { | ||
558 | [0] = { | ||
559 | .start = ATI_W3220_PHYS, | ||
560 | .end = ATI_W3220_PHYS + 0x00ffffff, | ||
561 | .flags = IORESOURCE_MEM, | ||
562 | }, | ||
563 | }; | ||
564 | |||
565 | static struct platform_device w3220 = { | ||
566 | .name = "w100fb", | ||
567 | .id = -1, | ||
568 | .dev = { | ||
569 | .platform_data = &w3220_info, | ||
570 | }, | ||
571 | .num_resources = ARRAY_SIZE(w3220_resources), | ||
572 | .resource = w3220_resources, | ||
573 | }; | ||
574 | |||
575 | /* | ||
576 | * Backlight | ||
577 | */ | ||
578 | |||
579 | static struct platform_pwm_backlight_data backlight_data = { | ||
580 | .pwm_id = 1, | ||
581 | .max_brightness = 200, | ||
582 | .dft_brightness = 100, | ||
583 | .pwm_period_ns = 30923, | ||
584 | }; | ||
585 | |||
586 | static struct platform_device backlight = { | ||
587 | .name = "pwm-backlight", | ||
588 | .id = -1, | ||
589 | .dev = { | ||
590 | .parent = &pxa27x_device_pwm1.dev, | ||
591 | .platform_data = &backlight_data, | ||
592 | }, | ||
593 | }; | ||
594 | |||
595 | /* | ||
596 | * USB "Transceiver" | ||
597 | */ | ||
598 | |||
599 | static struct gpio_vbus_mach_info gpio_vbus_info = { | ||
600 | .gpio_pullup = GPIO76_HX4700_USBC_PUEN, | ||
601 | .gpio_vbus = GPIOD14_nUSBC_DETECT, | ||
602 | .gpio_vbus_inverted = 1, | ||
603 | }; | ||
604 | |||
605 | static struct platform_device gpio_vbus = { | ||
606 | .name = "gpio-vbus", | ||
607 | .id = -1, | ||
608 | .dev = { | ||
609 | .platform_data = &gpio_vbus_info, | ||
610 | }, | ||
611 | }; | ||
612 | |||
613 | /* | ||
614 | * Touchscreen - TSC2046 connected to SSP2 | ||
615 | */ | ||
616 | |||
617 | static const struct ads7846_platform_data tsc2046_info = { | ||
618 | .model = 7846, | ||
619 | .vref_delay_usecs = 100, | ||
620 | .pressure_max = 512, | ||
621 | .debounce_max = 10, | ||
622 | .debounce_tol = 3, | ||
623 | .debounce_rep = 1, | ||
624 | .gpio_pendown = GPIO58_HX4700_TSC2046_nPENIRQ, | ||
625 | }; | ||
626 | |||
627 | static struct pxa2xx_spi_chip tsc2046_chip = { | ||
628 | .tx_threshold = 1, | ||
629 | .rx_threshold = 2, | ||
630 | .timeout = 64, | ||
631 | .gpio_cs = GPIO88_HX4700_TSC2046_CS, | ||
632 | }; | ||
633 | |||
634 | static struct spi_board_info tsc2046_board_info[] __initdata = { | ||
635 | { | ||
636 | .modalias = "ads7846", | ||
637 | .bus_num = 2, | ||
638 | .max_speed_hz = 2600000, /* 100 kHz sample rate */ | ||
639 | .irq = gpio_to_irq(GPIO58_HX4700_TSC2046_nPENIRQ), | ||
640 | .platform_data = &tsc2046_info, | ||
641 | .controller_data = &tsc2046_chip, | ||
642 | }, | ||
643 | }; | ||
644 | |||
645 | static struct pxa2xx_spi_master pxa_ssp2_master_info = { | ||
646 | .num_chipselect = 1, | ||
647 | .clock_enable = CKEN_SSP2, | ||
648 | .enable_dma = 1, | ||
649 | }; | ||
650 | |||
651 | /* | ||
652 | * External power | ||
653 | */ | ||
654 | |||
655 | static int power_supply_init(struct device *dev) | ||
656 | { | ||
657 | return gpio_request(GPIOD9_nAC_IN, "AC charger detect"); | ||
658 | } | ||
659 | |||
660 | static int hx4700_is_ac_online(void) | ||
661 | { | ||
662 | return !gpio_get_value(GPIOD9_nAC_IN); | ||
663 | } | ||
664 | |||
665 | static void power_supply_exit(struct device *dev) | ||
666 | { | ||
667 | gpio_free(GPIOD9_nAC_IN); | ||
668 | } | ||
669 | |||
670 | static char *hx4700_supplicants[] = { | ||
671 | "ds2760-battery.0", "backup-battery" | ||
672 | }; | ||
673 | |||
674 | static struct pda_power_pdata power_supply_info = { | ||
675 | .init = power_supply_init, | ||
676 | .is_ac_online = hx4700_is_ac_online, | ||
677 | .exit = power_supply_exit, | ||
678 | .supplied_to = hx4700_supplicants, | ||
679 | .num_supplicants = ARRAY_SIZE(hx4700_supplicants), | ||
680 | }; | ||
681 | |||
682 | static struct resource power_supply_resources[] = { | ||
683 | [0] = { | ||
684 | .name = "ac", | ||
685 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | | ||
686 | IORESOURCE_IRQ_LOWEDGE, | ||
687 | .start = gpio_to_irq(GPIOD9_nAC_IN), | ||
688 | .end = gpio_to_irq(GPIOD9_nAC_IN), | ||
689 | }, | ||
690 | [1] = { | ||
691 | .name = "usb", | ||
692 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | | ||
693 | IORESOURCE_IRQ_LOWEDGE, | ||
694 | .start = gpio_to_irq(GPIOD14_nUSBC_DETECT), | ||
695 | .end = gpio_to_irq(GPIOD14_nUSBC_DETECT), | ||
696 | }, | ||
697 | }; | ||
698 | |||
699 | static struct platform_device power_supply = { | ||
700 | .name = "pda-power", | ||
701 | .id = -1, | ||
702 | .dev = { | ||
703 | .platform_data = &power_supply_info, | ||
704 | }, | ||
705 | .resource = power_supply_resources, | ||
706 | .num_resources = ARRAY_SIZE(power_supply_resources), | ||
707 | }; | ||
708 | |||
709 | /* | ||
710 | * Battery charger | ||
711 | */ | ||
712 | |||
713 | static struct regulator_consumer_supply bq24022_consumers[] = { | ||
714 | { | ||
715 | .dev = &gpio_vbus.dev, | ||
716 | .supply = "vbus_draw", | ||
717 | }, | ||
718 | { | ||
719 | .dev = &power_supply.dev, | ||
720 | .supply = "ac_draw", | ||
721 | }, | ||
722 | }; | ||
723 | |||
724 | static struct regulator_init_data bq24022_init_data = { | ||
725 | .constraints = { | ||
726 | .max_uA = 500000, | ||
727 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT, | ||
728 | }, | ||
729 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), | ||
730 | .consumer_supplies = bq24022_consumers, | ||
731 | }; | ||
732 | |||
733 | static struct bq24022_mach_info bq24022_info = { | ||
734 | .gpio_nce = GPIO72_HX4700_BQ24022_nCHARGE_EN, | ||
735 | .gpio_iset2 = GPIO96_HX4700_BQ24022_ISET2, | ||
736 | .init_data = &bq24022_init_data, | ||
737 | }; | ||
738 | |||
739 | static struct platform_device bq24022 = { | ||
740 | .name = "bq24022", | ||
741 | .id = -1, | ||
742 | .dev = { | ||
743 | .platform_data = &bq24022_info, | ||
744 | }, | ||
745 | }; | ||
746 | |||
747 | /* | ||
748 | * StrataFlash | ||
749 | */ | ||
750 | |||
751 | static void hx4700_set_vpp(struct map_info *map, int vpp) | ||
752 | { | ||
753 | gpio_set_value(GPIO91_HX4700_FLASH_VPEN, vpp); | ||
754 | } | ||
755 | |||
756 | static struct resource strataflash_resource = { | ||
757 | .start = PXA_CS0_PHYS, | ||
758 | .end = PXA_CS0_PHYS + SZ_128M - 1, | ||
759 | .flags = IORESOURCE_MEM, | ||
760 | }; | ||
761 | |||
762 | static struct physmap_flash_data strataflash_data = { | ||
763 | .width = 4, | ||
764 | .set_vpp = hx4700_set_vpp, | ||
765 | }; | ||
766 | |||
767 | static struct platform_device strataflash = { | ||
768 | .name = "physmap-flash", | ||
769 | .id = -1, | ||
770 | .resource = &strataflash_resource, | ||
771 | .num_resources = 1, | ||
772 | .dev = { | ||
773 | .platform_data = &strataflash_data, | ||
774 | }, | ||
775 | }; | ||
776 | |||
777 | /* | ||
778 | * PCMCIA | ||
779 | */ | ||
780 | |||
781 | static struct platform_device pcmcia = { | ||
782 | .name = "hx4700-pcmcia", | ||
783 | .dev = { | ||
784 | .parent = &asic3.dev, | ||
785 | }, | ||
786 | }; | ||
787 | |||
788 | /* | ||
789 | * Platform devices | ||
790 | */ | ||
791 | |||
792 | static struct platform_device *devices[] __initdata = { | ||
793 | &asic3, | ||
794 | &gpio_keys, | ||
795 | &backlight, | ||
796 | &w3220, | ||
797 | &egpio, | ||
798 | &bq24022, | ||
799 | &gpio_vbus, | ||
800 | &power_supply, | ||
801 | &strataflash, | ||
802 | &pcmcia, | ||
803 | }; | ||
804 | |||
805 | static struct gpio_ress global_gpios[] = { | ||
806 | HX4700_GPIO_IN(GPIO12_HX4700_ASIC3_IRQ, "ASIC3_IRQ"), | ||
807 | HX4700_GPIO_IN(GPIO13_HX4700_W3220_IRQ, "W3220_IRQ"), | ||
808 | HX4700_GPIO_IN(GPIO14_HX4700_nWLAN_IRQ, "WLAN_IRQ"), | ||
809 | HX4700_GPIO_OUT(GPIO59_HX4700_LCD_PC1, 1, "LCD_PC1"), | ||
810 | HX4700_GPIO_OUT(GPIO62_HX4700_LCD_nRESET, 1, "LCD_RESET"), | ||
811 | HX4700_GPIO_OUT(GPIO70_HX4700_LCD_SLIN1, 1, "LCD_SLIN1"), | ||
812 | HX4700_GPIO_OUT(GPIO84_HX4700_LCD_SQN, 1, "LCD_SQN"), | ||
813 | HX4700_GPIO_OUT(GPIO110_HX4700_LCD_LVDD_3V3_ON, 1, "LCD_LVDD"), | ||
814 | HX4700_GPIO_OUT(GPIO111_HX4700_LCD_AVDD_3V3_ON, 1, "LCD_AVDD"), | ||
815 | HX4700_GPIO_OUT(GPIO32_HX4700_RS232_ON, 1, "RS232_ON"), | ||
816 | HX4700_GPIO_OUT(GPIO71_HX4700_ASIC3_nRESET, 1, "ASIC3_nRESET"), | ||
817 | HX4700_GPIO_OUT(GPIO82_HX4700_EUART_RESET, 1, "EUART_RESET"), | ||
818 | HX4700_GPIO_OUT(GPIO105_HX4700_nIR_ON, 1, "nIR_EN"), | ||
819 | }; | ||
820 | |||
821 | static void __init hx4700_init(void) | ||
822 | { | ||
823 | pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config)); | ||
824 | hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios)); | ||
825 | |||
826 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
827 | |||
828 | pxa_set_ficp_info(&ficp_info); | ||
829 | pxa27x_set_i2c_power_info(NULL); | ||
830 | pxa_set_i2c_info(NULL); | ||
831 | pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); | ||
832 | spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info)); | ||
833 | |||
834 | hx4700_lcd_device = lcd_device_register("w100fb", NULL, | ||
835 | (void *)&w3220_info, &hx4700_lcd_ops); | ||
836 | |||
837 | gpio_set_value(GPIO71_HX4700_ASIC3_nRESET, 0); | ||
838 | mdelay(10); | ||
839 | gpio_set_value(GPIO71_HX4700_ASIC3_nRESET, 1); | ||
840 | mdelay(10); | ||
841 | } | ||
842 | |||
843 | MACHINE_START(H4700, "HP iPAQ HX4700") | ||
844 | .phys_io = 0x40000000, | ||
845 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
846 | .boot_params = 0xa0000100, | ||
847 | .map_io = pxa_map_io, | ||
848 | .init_irq = pxa27x_init_irq, | ||
849 | .init_machine = hx4700_init, | ||
850 | .timer = &pxa_timer, | ||
851 | MACHINE_END | ||
diff --git a/arch/arm/mach-pxa/imote2.c b/arch/arm/mach-pxa/imote2.c index 2b27336c29f1..961807dc6467 100644 --- a/arch/arm/mach-pxa/imote2.c +++ b/arch/arm/mach-pxa/imote2.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/i2c.h> | 23 | #include <linux/i2c.h> |
24 | #include <linux/mfd/da903x.h> | 24 | #include <linux/mfd/da903x.h> |
25 | #include <linux/sht15.h> | ||
25 | 26 | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
@@ -29,7 +30,7 @@ | |||
29 | #include <asm/mach/flash.h> | 30 | #include <asm/mach/flash.h> |
30 | 31 | ||
31 | #include <mach/pxa27x.h> | 32 | #include <mach/pxa27x.h> |
32 | #include <mach/i2c.h> | 33 | #include <plat/i2c.h> |
33 | #include <mach/udc.h> | 34 | #include <mach/udc.h> |
34 | #include <mach/mmc.h> | 35 | #include <mach/mmc.h> |
35 | #include <mach/pxa2xx_spi.h> | 36 | #include <mach/pxa2xx_spi.h> |
@@ -102,6 +103,10 @@ static unsigned long imote2_pin_config[] __initdata = { | |||
102 | GPIO96_GPIO, /* accelerometer interrupt */ | 103 | GPIO96_GPIO, /* accelerometer interrupt */ |
103 | GPIO99_GPIO, /* ADC interrupt */ | 104 | GPIO99_GPIO, /* ADC interrupt */ |
104 | 105 | ||
106 | /* SHT15 */ | ||
107 | GPIO100_GPIO, | ||
108 | GPIO98_GPIO, | ||
109 | |||
105 | /* Connector pins specified as gpios */ | 110 | /* Connector pins specified as gpios */ |
106 | GPIO94_GPIO, /* large basic connector pin 14 */ | 111 | GPIO94_GPIO, /* large basic connector pin 14 */ |
107 | GPIO10_GPIO, /* large basic connector pin 23 */ | 112 | GPIO10_GPIO, /* large basic connector pin 23 */ |
@@ -112,6 +117,26 @@ static unsigned long imote2_pin_config[] __initdata = { | |||
112 | GPIO105_GPIO, /* blue led */ | 117 | GPIO105_GPIO, /* blue led */ |
113 | }; | 118 | }; |
114 | 119 | ||
120 | static struct sht15_platform_data platform_data_sht15 = { | ||
121 | .gpio_data = 100, | ||
122 | .gpio_sck = 98, | ||
123 | }; | ||
124 | |||
125 | static struct platform_device sht15 = { | ||
126 | .name = "sht15", | ||
127 | .id = -1, | ||
128 | .dev = { | ||
129 | .platform_data = &platform_data_sht15, | ||
130 | }, | ||
131 | }; | ||
132 | |||
133 | static struct regulator_consumer_supply imote2_sensor_3_con[] = { | ||
134 | { | ||
135 | .dev = &sht15.dev, | ||
136 | .supply = "vcc", | ||
137 | }, | ||
138 | }; | ||
139 | |||
115 | static struct gpio_led imote2_led_pins[] = { | 140 | static struct gpio_led imote2_led_pins[] = { |
116 | { | 141 | { |
117 | .name = "imote2:red", | 142 | .name = "imote2:red", |
@@ -257,6 +282,8 @@ static struct regulator_init_data imote2_ldo_init_data[] = { | |||
257 | .min_uV = 2800000, | 282 | .min_uV = 2800000, |
258 | .max_uV = 3000000, | 283 | .max_uV = 3000000, |
259 | }, | 284 | }, |
285 | .num_consumer_supplies = ARRAY_SIZE(imote2_sensor_3_con), | ||
286 | .consumer_supplies = imote2_sensor_3_con, | ||
260 | }, | 287 | }, |
261 | [vcc_pxa_pll] = { /* 1.17V - 1.43V, default 1.3V*/ | 288 | [vcc_pxa_pll] = { /* 1.17V - 1.43V, default 1.3V*/ |
262 | .constraints = { | 289 | .constraints = { |
@@ -432,6 +459,9 @@ static struct i2c_board_info __initdata imote2_i2c_board_info[] = { | |||
432 | .type = "tmp175", | 459 | .type = "tmp175", |
433 | .addr = 0x4A, | 460 | .addr = 0x4A, |
434 | .irq = IRQ_GPIO(96), | 461 | .irq = IRQ_GPIO(96), |
462 | }, { /* IMB400 Multimedia board */ | ||
463 | .type = "wm8940", | ||
464 | .addr = 0x1A, | ||
435 | }, | 465 | }, |
436 | }; | 466 | }; |
437 | 467 | ||
@@ -456,25 +486,12 @@ static struct pxa2xx_spi_master pxa_ssp_master_2_info = { | |||
456 | .num_chipselect = 1, | 486 | .num_chipselect = 1, |
457 | }; | 487 | }; |
458 | 488 | ||
459 | /* Patch posted by Eric Miao <eric.miao@marvell.com> will remove | ||
460 | * the need for these functions. | ||
461 | */ | ||
462 | static void spi1control(u32 command) | ||
463 | { | ||
464 | gpio_set_value(24, command & PXA2XX_CS_ASSERT ? 0 : 1); | ||
465 | }; | ||
466 | |||
467 | static void spi3control(u32 command) | ||
468 | { | ||
469 | gpio_set_value(39, command & PXA2XX_CS_ASSERT ? 0 : 1); | ||
470 | }; | ||
471 | |||
472 | static struct pxa2xx_spi_chip staccel_chip_info = { | 489 | static struct pxa2xx_spi_chip staccel_chip_info = { |
473 | .tx_threshold = 8, | 490 | .tx_threshold = 8, |
474 | .rx_threshold = 8, | 491 | .rx_threshold = 8, |
475 | .dma_burst_size = 8, | 492 | .dma_burst_size = 8, |
476 | .timeout = 235, | 493 | .timeout = 235, |
477 | .cs_control = spi1control, | 494 | .gpio_cs = 24, |
478 | }; | 495 | }; |
479 | 496 | ||
480 | static struct pxa2xx_spi_chip cc2420_info = { | 497 | static struct pxa2xx_spi_chip cc2420_info = { |
@@ -482,7 +499,7 @@ static struct pxa2xx_spi_chip cc2420_info = { | |||
482 | .rx_threshold = 8, | 499 | .rx_threshold = 8, |
483 | .dma_burst_size = 8, | 500 | .dma_burst_size = 8, |
484 | .timeout = 235, | 501 | .timeout = 235, |
485 | .cs_control = spi3control, | 502 | .gpio_cs = 39, |
486 | }; | 503 | }; |
487 | 504 | ||
488 | static struct spi_board_info spi_board_info[] __initdata = { | 505 | static struct spi_board_info spi_board_info[] __initdata = { |
@@ -521,6 +538,7 @@ static struct pxa2xx_udc_mach_info imote2_udc_info __initdata = { | |||
521 | static struct platform_device *imote2_devices[] = { | 538 | static struct platform_device *imote2_devices[] = { |
522 | &imote2_flash_device, | 539 | &imote2_flash_device, |
523 | &imote2_leds, | 540 | &imote2_leds, |
541 | &sht15, | ||
524 | }; | 542 | }; |
525 | 543 | ||
526 | static struct i2c_pxa_platform_data i2c_pwr_pdata = { | 544 | static struct i2c_pxa_platform_data i2c_pwr_pdata = { |
@@ -538,8 +556,6 @@ static void __init imote2_init(void) | |||
538 | /* SPI chip select directions - all other directions should | 556 | /* SPI chip select directions - all other directions should |
539 | * be handled by drivers.*/ | 557 | * be handled by drivers.*/ |
540 | gpio_direction_output(37, 0); | 558 | gpio_direction_output(37, 0); |
541 | gpio_direction_output(24, 0); | ||
542 | gpio_direction_output(39, 0); | ||
543 | 559 | ||
544 | platform_add_devices(imote2_devices, ARRAY_SIZE(imote2_devices)); | 560 | platform_add_devices(imote2_devices, ARRAY_SIZE(imote2_devices)); |
545 | 561 | ||
diff --git a/arch/arm/mach-pxa/include/mach/hx4700.h b/arch/arm/mach-pxa/include/mach/hx4700.h new file mode 100644 index 000000000000..9eaeed1f87f1 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/hx4700.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * GPIO and IRQ definitions for HP iPAQ hx4700 | ||
3 | * | ||
4 | * Copyright (c) 2008 Philipp Zabel | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _HX4700_H_ | ||
13 | #define _HX4700_H_ | ||
14 | |||
15 | #include <linux/gpio.h> | ||
16 | #include <linux/mfd/asic3.h> | ||
17 | |||
18 | #define HX4700_ASIC3_GPIO_BASE NR_BUILTIN_GPIO | ||
19 | #define HX4700_EGPIO_BASE (HX4700_ASIC3_GPIO_BASE + ASIC3_NUM_GPIOS) | ||
20 | |||
21 | /* | ||
22 | * PXA GPIOs | ||
23 | */ | ||
24 | |||
25 | #define GPIO0_HX4700_nKEY_POWER 0 | ||
26 | #define GPIO12_HX4700_ASIC3_IRQ 12 | ||
27 | #define GPIO13_HX4700_W3220_IRQ 13 | ||
28 | #define GPIO14_HX4700_nWLAN_IRQ 14 | ||
29 | #define GPIO18_HX4700_RDY 18 | ||
30 | #define GPIO22_HX4700_LCD_RL 22 | ||
31 | #define GPIO27_HX4700_CODEC_ON 27 | ||
32 | #define GPIO32_HX4700_RS232_ON 32 | ||
33 | #define GPIO52_HX4700_CPU_nBATT_FAULT 52 | ||
34 | #define GPIO58_HX4700_TSC2046_nPENIRQ 58 | ||
35 | #define GPIO59_HX4700_LCD_PC1 59 | ||
36 | #define GPIO60_HX4700_CF_RNB 60 | ||
37 | #define GPIO61_HX4700_W3220_nRESET 61 | ||
38 | #define GPIO62_HX4700_LCD_nRESET 62 | ||
39 | #define GPIO63_HX4700_CPU_SS_nRESET 63 | ||
40 | #define GPIO65_HX4700_TSC2046_PEN_PU 65 | ||
41 | #define GPIO66_HX4700_ASIC3_nSDIO_IRQ 66 | ||
42 | #define GPIO67_HX4700_EUART_PS 67 | ||
43 | #define GPIO70_HX4700_LCD_SLIN1 70 | ||
44 | #define GPIO71_HX4700_ASIC3_nRESET 71 | ||
45 | #define GPIO72_HX4700_BQ24022_nCHARGE_EN 72 | ||
46 | #define GPIO73_HX4700_LCD_UD_1 73 | ||
47 | #define GPIO75_HX4700_EARPHONE_nDET 75 | ||
48 | #define GPIO76_HX4700_USBC_PUEN 76 | ||
49 | #define GPIO81_HX4700_CPU_GP_nRESET 81 | ||
50 | #define GPIO82_HX4700_EUART_RESET 82 | ||
51 | #define GPIO83_HX4700_WLAN_nRESET 83 | ||
52 | #define GPIO84_HX4700_LCD_SQN 84 | ||
53 | #define GPIO85_HX4700_nPCE1 85 | ||
54 | #define GPIO88_HX4700_TSC2046_CS 88 | ||
55 | #define GPIO91_HX4700_FLASH_VPEN 91 | ||
56 | #define GPIO92_HX4700_HP_DRIVER 92 | ||
57 | #define GPIO93_HX4700_EUART_INT 93 | ||
58 | #define GPIO94_HX4700_KEY_MAIL 94 | ||
59 | #define GPIO95_HX4700_BATT_OFF 95 | ||
60 | #define GPIO96_HX4700_BQ24022_ISET2 96 | ||
61 | #define GPIO97_HX4700_nBL_DETECT 97 | ||
62 | #define GPIO99_HX4700_KEY_CONTACTS 99 | ||
63 | #define GPIO100_HX4700_AUTO_SENSE 100 /* BL auto brightness */ | ||
64 | #define GPIO102_HX4700_SYNAPTICS_POWER_ON 102 | ||
65 | #define GPIO103_HX4700_SYNAPTICS_INT 103 | ||
66 | #define GPIO105_HX4700_nIR_ON 105 | ||
67 | #define GPIO106_HX4700_CPU_BT_nRESET 106 | ||
68 | #define GPIO107_HX4700_SPK_nSD 107 | ||
69 | #define GPIO109_HX4700_CODEC_nPDN 109 | ||
70 | #define GPIO110_HX4700_LCD_LVDD_3V3_ON 110 | ||
71 | #define GPIO111_HX4700_LCD_AVDD_3V3_ON 111 | ||
72 | #define GPIO112_HX4700_LCD_N2V7_7V3_ON 112 | ||
73 | #define GPIO114_HX4700_CF_RESET 114 | ||
74 | #define GPIO116_HX4700_CPU_HW_nRESET 116 | ||
75 | |||
76 | /* | ||
77 | * ASIC3 GPIOs | ||
78 | */ | ||
79 | |||
80 | #define GPIOC_BASE (HX4700_ASIC3_GPIO_BASE + 32) | ||
81 | #define GPIOD_BASE (HX4700_ASIC3_GPIO_BASE + 48) | ||
82 | |||
83 | #define GPIOC0_LED_RED (GPIOC_BASE + 0) | ||
84 | #define GPIOC1_LED_GREEN (GPIOC_BASE + 1) | ||
85 | #define GPIOC2_LED_BLUE (GPIOC_BASE + 2) | ||
86 | #define GPIOC3_nSD_CS (GPIOC_BASE + 3) | ||
87 | #define GPIOC4_CF_nCD (GPIOC_BASE + 4) /* Input */ | ||
88 | #define GPIOC5_nCIOW (GPIOC_BASE + 5) /* Output, to CF */ | ||
89 | #define GPIOC6_nCIOR (GPIOC_BASE + 6) /* Output, to CF */ | ||
90 | #define GPIOC7_nPCE1 (GPIOC_BASE + 7) /* Input, from CPU */ | ||
91 | #define GPIOC8_nPCE2 (GPIOC_BASE + 8) /* Input, from CPU */ | ||
92 | #define GPIOC9_nPOE (GPIOC_BASE + 9) /* Input, from CPU */ | ||
93 | #define GPIOC10_CF_nPWE (GPIOC_BASE + 10) /* Input */ | ||
94 | #define GPIOC11_PSKTSEL (GPIOC_BASE + 11) /* Input, from CPU */ | ||
95 | #define GPIOC12_nPREG (GPIOC_BASE + 12) /* Input, from CPU */ | ||
96 | #define GPIOC13_nPWAIT (GPIOC_BASE + 13) /* Output, to CPU */ | ||
97 | #define GPIOC14_nPIOIS16 (GPIOC_BASE + 14) /* Output, to CPU */ | ||
98 | #define GPIOC15_nPIOR (GPIOC_BASE + 15) /* Input, from CPU */ | ||
99 | |||
100 | #define GPIOD0_CPU_SS_INT (GPIOD_BASE + 0) /* Input */ | ||
101 | #define GPIOD1_nKEY_CALENDAR (GPIOD_BASE + 1) | ||
102 | #define GPIOD2_BLUETOOTH_WAKEUP (GPIOD_BASE + 2) | ||
103 | #define GPIOD3_nKEY_HOME (GPIOD_BASE + 3) | ||
104 | #define GPIOD4_CF_nCD (GPIOD_BASE + 4) /* Input, from CF */ | ||
105 | #define GPIOD5_nPIO (GPIOD_BASE + 5) /* Input */ | ||
106 | #define GPIOD6_nKEY_RECORD (GPIOD_BASE + 6) | ||
107 | #define GPIOD7_nSDIO_DETECT (GPIOD_BASE + 7) | ||
108 | #define GPIOD8_COM_DCD (GPIOD_BASE + 8) /* Input */ | ||
109 | #define GPIOD9_nAC_IN (GPIOD_BASE + 9) | ||
110 | #define GPIOD10_nSDIO_IRQ (GPIOD_BASE + 10) /* Input */ | ||
111 | #define GPIOD11_nCIOIS16 (GPIOD_BASE + 11) /* Input, from CF */ | ||
112 | #define GPIOD12_nCWAIT (GPIOD_BASE + 12) /* Input, from CF */ | ||
113 | #define GPIOD13_CF_RNB (GPIOD_BASE + 13) /* Input */ | ||
114 | #define GPIOD14_nUSBC_DETECT (GPIOD_BASE + 14) | ||
115 | #define GPIOD15_nPIOW (GPIOD_BASE + 15) /* Input, from CPU */ | ||
116 | |||
117 | /* | ||
118 | * EGPIOs | ||
119 | */ | ||
120 | |||
121 | #define EGPIO0_VCC_3V3_EN (HX4700_EGPIO_BASE + 0) /* WLAN support chip */ | ||
122 | #define EGPIO1_WL_VREG_EN (HX4700_EGPIO_BASE + 1) /* WLAN power */ | ||
123 | #define EGPIO2_VCC_2V1_WL_EN (HX4700_EGPIO_BASE + 2) /* unused */ | ||
124 | #define EGPIO3_SS_PWR_ON (HX4700_EGPIO_BASE + 3) /* smart slot power */ | ||
125 | #define EGPIO4_CF_3V3_ON (HX4700_EGPIO_BASE + 4) /* CF 3.3V enable */ | ||
126 | #define EGPIO5_BT_3V3_ON (HX4700_EGPIO_BASE + 5) /* BT 3.3V enable */ | ||
127 | #define EGPIO6_WL1V8_EN (HX4700_EGPIO_BASE + 6) /* WLAN 1.8V enable */ | ||
128 | #define EGPIO7_VCC_3V3_WL_EN (HX4700_EGPIO_BASE + 7) /* WLAN 3.3V enable */ | ||
129 | #define EGPIO8_USB_3V3_ON (HX4700_EGPIO_BASE + 8) /* unused */ | ||
130 | |||
131 | #endif /* _HX4700_H_ */ | ||
diff --git a/arch/arm/mach-pxa/include/mach/i2c.h b/arch/arm/mach-pxa/include/mach/i2c.h deleted file mode 100644 index 1a9f65e6ec0f..000000000000 --- a/arch/arm/mach-pxa/include/mach/i2c.h +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* | ||
2 | * i2c_pxa.h | ||
3 | * | ||
4 | * Copyright (C) 2002 Intrinsyc Software Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | #ifndef _I2C_PXA_H_ | ||
12 | #define _I2C_PXA_H_ | ||
13 | |||
14 | #if 0 | ||
15 | #define DEF_TIMEOUT 3 | ||
16 | #else | ||
17 | /* need a longer timeout if we're dealing with the fact we may well be | ||
18 | * looking at a multi-master environment | ||
19 | */ | ||
20 | #define DEF_TIMEOUT 32 | ||
21 | #endif | ||
22 | |||
23 | #define BUS_ERROR (-EREMOTEIO) | ||
24 | #define XFER_NAKED (-ECONNREFUSED) | ||
25 | #define I2C_RETRY (-2000) /* an error has occurred retry transmit */ | ||
26 | |||
27 | /* ICR initialize bit values | ||
28 | * | ||
29 | * 15. FM 0 (100 Khz operation) | ||
30 | * 14. UR 0 (No unit reset) | ||
31 | * 13. SADIE 0 (Disables the unit from interrupting on slave addresses | ||
32 | * matching its slave address) | ||
33 | * 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration | ||
34 | * in master mode) | ||
35 | * 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode) | ||
36 | * 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent) | ||
37 | * 9. IRFIE 1 (Enable interrupts from full buffer received) | ||
38 | * 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty) | ||
39 | * 7. GCD 1 (Disables i2c unit response to general call messages as a slave) | ||
40 | * 6. IUE 0 (Disable unit until we change settings) | ||
41 | * 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL) | ||
42 | * 4. MA 0 (Only send stop with the ICR stop bit) | ||
43 | * 3. TB 0 (We are not transmitting a byte initially) | ||
44 | * 2. ACKNAK 0 (Send an ACK after the unit receives a byte) | ||
45 | * 1. STOP 0 (Do not send a STOP) | ||
46 | * 0. START 0 (Do not send a START) | ||
47 | * | ||
48 | */ | ||
49 | #define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) | ||
50 | |||
51 | /* I2C status register init values | ||
52 | * | ||
53 | * 10. BED 1 (Clear bus error detected) | ||
54 | * 9. SAD 1 (Clear slave address detected) | ||
55 | * 7. IRF 1 (Clear IDBR Receive Full) | ||
56 | * 6. ITE 1 (Clear IDBR Transmit Empty) | ||
57 | * 5. ALD 1 (Clear Arbitration Loss Detected) | ||
58 | * 4. SSD 1 (Clear Slave Stop Detected) | ||
59 | */ | ||
60 | #define I2C_ISR_INIT 0x7FF /* status register init */ | ||
61 | |||
62 | struct i2c_slave_client; | ||
63 | |||
64 | struct i2c_pxa_platform_data { | ||
65 | unsigned int slave_addr; | ||
66 | struct i2c_slave_client *slave; | ||
67 | unsigned int class; | ||
68 | unsigned int use_pio :1; | ||
69 | unsigned int fast_mode :1; | ||
70 | }; | ||
71 | |||
72 | extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info); | ||
73 | |||
74 | #ifdef CONFIG_PXA27x | ||
75 | extern void pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info); | ||
76 | #endif | ||
77 | |||
78 | #ifdef CONFIG_PXA3xx | ||
79 | extern void pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info); | ||
80 | #endif | ||
81 | |||
82 | #endif | ||
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h index 32bb4a2eb7f1..6a1d95993342 100644 --- a/arch/arm/mach-pxa/include/mach/irqs.h +++ b/arch/arm/mach-pxa/include/mach/irqs.h | |||
@@ -91,13 +91,23 @@ | |||
91 | #define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i)) | 91 | #define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i)) |
92 | 92 | ||
93 | /* | 93 | /* |
94 | * The next 16 interrupts are for board specific purposes. Since | 94 | * The following interrupts are for board specific purposes. Since |
95 | * the kernel can only run on one machine at a time, we can re-use | 95 | * the kernel can only run on one machine at a time, we can re-use |
96 | * these. If you need more, increase IRQ_BOARD_END, but keep it | 96 | * these. There will be 16 IRQs by default. If it is not enough, |
97 | * within sensible limits. | 97 | * IRQ_BOARD_END is allowed be customized for each board, but keep |
98 | * the numbers within sensible limits and in descending order, so | ||
99 | * when multiple config options are selected, the maximum will be | ||
100 | * used. | ||
98 | */ | 101 | */ |
99 | #define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM) | 102 | #define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM) |
103 | |||
104 | #if defined(CONFIG_MACH_H4700) | ||
105 | #define IRQ_BOARD_END (IRQ_BOARD_START + 70) | ||
106 | #elif defined(CONFIG_MACH_ZYLONITE) | ||
107 | #define IRQ_BOARD_END (IRQ_BOARD_START + 32) | ||
108 | #else | ||
100 | #define IRQ_BOARD_END (IRQ_BOARD_START + 16) | 109 | #define IRQ_BOARD_END (IRQ_BOARD_START + 16) |
110 | #endif | ||
101 | 111 | ||
102 | #define IRQ_SA1111_START (IRQ_BOARD_END) | 112 | #define IRQ_SA1111_START (IRQ_BOARD_END) |
103 | #define IRQ_GPAIN0 (IRQ_BOARD_END + 0) | 113 | #define IRQ_GPAIN0 (IRQ_BOARD_END + 0) |
@@ -188,8 +198,6 @@ | |||
188 | #define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1) | 198 | #define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1) |
189 | #elif defined(CONFIG_PXA_HAVE_BOARD_IRQS) | 199 | #elif defined(CONFIG_PXA_HAVE_BOARD_IRQS) |
190 | #define NR_IRQS (IRQ_BOARD_END) | 200 | #define NR_IRQS (IRQ_BOARD_END) |
191 | #elif defined(CONFIG_MACH_ZYLONITE) | ||
192 | #define NR_IRQS (IRQ_BOARD_START + 32) | ||
193 | #else | 201 | #else |
194 | #define NR_IRQS (IRQ_BOARD_START) | 202 | #define NR_IRQS (IRQ_BOARD_START) |
195 | #endif | 203 | #endif |
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa320.h b/arch/arm/mach-pxa/include/mach/mfp-pxa320.h index 07897e61d05a..3ce4682eabb6 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa320.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa320.h | |||
@@ -283,6 +283,9 @@ | |||
283 | #define GPIO41_UART1_TXD MFP_CFG_LPM(GPIO41, AF4, FLOAT) | 283 | #define GPIO41_UART1_TXD MFP_CFG_LPM(GPIO41, AF4, FLOAT) |
284 | #define GPIO42_UART1_RXD MFP_CFG_LPM(GPIO42, AF4, FLOAT) | 284 | #define GPIO42_UART1_RXD MFP_CFG_LPM(GPIO42, AF4, FLOAT) |
285 | #define GPIO42_UART1_TXD MFP_CFG_LPM(GPIO42, AF2, FLOAT) | 285 | #define GPIO42_UART1_TXD MFP_CFG_LPM(GPIO42, AF2, FLOAT) |
286 | #define GPIO75_UART1_RXD MFP_CFG_LPM(GPIO75, AF1, FLOAT) | ||
287 | #define GPIO76_UART1_RXD MFP_CFG_LPM(GPIO76, AF3, FLOAT) | ||
288 | #define GPIO76_UART1_TXD MFP_CFG_LPM(GPIO76, AF1, FLOAT) | ||
286 | #define GPIO97_UART1_RXD MFP_CFG_LPM(GPIO97, AF1, FLOAT) | 289 | #define GPIO97_UART1_RXD MFP_CFG_LPM(GPIO97, AF1, FLOAT) |
287 | #define GPIO97_UART1_TXD MFP_CFG_LPM(GPIO97, AF6, FLOAT) | 290 | #define GPIO97_UART1_TXD MFP_CFG_LPM(GPIO97, AF6, FLOAT) |
288 | #define GPIO98_UART1_RXD MFP_CFG_LPM(GPIO98, AF6, FLOAT) | 291 | #define GPIO98_UART1_RXD MFP_CFG_LPM(GPIO98, AF6, FLOAT) |
@@ -291,6 +294,9 @@ | |||
291 | #define GPIO43_UART1_RTS MFP_CFG_LPM(GPIO43, AF4, FLOAT) | 294 | #define GPIO43_UART1_RTS MFP_CFG_LPM(GPIO43, AF4, FLOAT) |
292 | #define GPIO48_UART1_CTS MFP_CFG_LPM(GPIO48, AF4, FLOAT) | 295 | #define GPIO48_UART1_CTS MFP_CFG_LPM(GPIO48, AF4, FLOAT) |
293 | #define GPIO48_UART1_RTS MFP_CFG_LPM(GPIO48, AF2, FLOAT) | 296 | #define GPIO48_UART1_RTS MFP_CFG_LPM(GPIO48, AF2, FLOAT) |
297 | #define GPIO77_UART1_CTS MFP_CFG_LPM(GPIO77, AF1, FLOAT) | ||
298 | #define GPIO82_UART1_RTS MFP_CFG_LPM(GPIO82, AF1, FLOAT) | ||
299 | #define GPIO82_UART1_CTS MFP_CFG_LPM(GPIO82, AF3, FLOAT) | ||
294 | #define GPIO99_UART1_CTS MFP_CFG_LPM(GPIO99, AF1, FLOAT) | 300 | #define GPIO99_UART1_CTS MFP_CFG_LPM(GPIO99, AF1, FLOAT) |
295 | #define GPIO99_UART1_RTS MFP_CFG_LPM(GPIO99, AF6, FLOAT) | 301 | #define GPIO99_UART1_RTS MFP_CFG_LPM(GPIO99, AF6, FLOAT) |
296 | #define GPIO104_UART1_CTS MFP_CFG_LPM(GPIO104, AF6, FLOAT) | 302 | #define GPIO104_UART1_CTS MFP_CFG_LPM(GPIO104, AF6, FLOAT) |
@@ -299,13 +305,18 @@ | |||
299 | #define GPIO45_UART1_DSR MFP_CFG_LPM(GPIO45, AF2, FLOAT) | 305 | #define GPIO45_UART1_DSR MFP_CFG_LPM(GPIO45, AF2, FLOAT) |
300 | #define GPIO47_UART1_DTR MFP_CFG_LPM(GPIO47, AF2, FLOAT) | 306 | #define GPIO47_UART1_DTR MFP_CFG_LPM(GPIO47, AF2, FLOAT) |
301 | #define GPIO47_UART1_DSR MFP_CFG_LPM(GPIO47, AF4, FLOAT) | 307 | #define GPIO47_UART1_DSR MFP_CFG_LPM(GPIO47, AF4, FLOAT) |
308 | #define GPIO79_UART1_DSR MFP_CFG_LPM(GPIO79, AF1, FLOAT) | ||
309 | #define GPIO81_UART1_DTR MFP_CFG_LPM(GPIO81, AF1, FLOAT) | ||
310 | #define GPIO81_UART1_DSR MFP_CFG_LPM(GPIO81, AF3, FLOAT) | ||
302 | #define GPIO101_UART1_DTR MFP_CFG_LPM(GPIO101, AF6, FLOAT) | 311 | #define GPIO101_UART1_DTR MFP_CFG_LPM(GPIO101, AF6, FLOAT) |
303 | #define GPIO101_UART1_DSR MFP_CFG_LPM(GPIO101, AF1, FLOAT) | 312 | #define GPIO101_UART1_DSR MFP_CFG_LPM(GPIO101, AF1, FLOAT) |
304 | #define GPIO103_UART1_DTR MFP_CFG_LPM(GPIO103, AF1, FLOAT) | 313 | #define GPIO103_UART1_DTR MFP_CFG_LPM(GPIO103, AF1, FLOAT) |
305 | #define GPIO103_UART1_DSR MFP_CFG_LPM(GPIO103, AF6, FLOAT) | 314 | #define GPIO103_UART1_DSR MFP_CFG_LPM(GPIO103, AF6, FLOAT) |
306 | #define GPIO44_UART1_DCD MFP_CFG_LPM(GPIO44, AF2, FLOAT) | 315 | #define GPIO44_UART1_DCD MFP_CFG_LPM(GPIO44, AF2, FLOAT) |
316 | #define GPIO78_UART1_DCD MFP_CFG_LPM(GPIO78, AF1, FLOAT) | ||
307 | #define GPIO100_UART1_DCD MFP_CFG_LPM(GPIO100, AF1, FLOAT) | 317 | #define GPIO100_UART1_DCD MFP_CFG_LPM(GPIO100, AF1, FLOAT) |
308 | #define GPIO46_UART1_RI MFP_CFG_LPM(GPIO46, AF2, FLOAT) | 318 | #define GPIO46_UART1_RI MFP_CFG_LPM(GPIO46, AF2, FLOAT) |
319 | #define GPIO80_UART1_RI MFP_CFG_LPM(GPIO80, AF1, FLOAT) | ||
309 | #define GPIO102_UART1_RI MFP_CFG_LPM(GPIO102, AF1, FLOAT) | 320 | #define GPIO102_UART1_RI MFP_CFG_LPM(GPIO102, AF1, FLOAT) |
310 | 321 | ||
311 | /* UART2 */ | 322 | /* UART2 */ |
@@ -438,6 +449,9 @@ | |||
438 | 449 | ||
439 | #define GPIO2_RDY MFP_CFG(GPIO2, AF1) | 450 | #define GPIO2_RDY MFP_CFG(GPIO2, AF1) |
440 | #define GPIO5_NPIOR MFP_CFG(GPIO5, AF3) | 451 | #define GPIO5_NPIOR MFP_CFG(GPIO5, AF3) |
452 | #define GPIO6_NPIOW MFP_CFG(GPIO6, AF3) | ||
453 | #define GPIO7_NPIOS16 MFP_CFG(GPIO7, AF3) | ||
454 | #define GPIO8_NPWAIT MFP_CFG(GPIO8, AF3) | ||
441 | 455 | ||
442 | #define GPIO11_PWM0_OUT MFP_CFG(GPIO11, AF1) | 456 | #define GPIO11_PWM0_OUT MFP_CFG(GPIO11, AF1) |
443 | #define GPIO12_PWM1_OUT MFP_CFG(GPIO12, AF1) | 457 | #define GPIO12_PWM1_OUT MFP_CFG(GPIO12, AF1) |
diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h index fb13c82ad6dc..8721b8010221 100644 --- a/arch/arm/mach-pxa/include/mach/palmld.h +++ b/arch/arm/mach-pxa/include/mach/palmld.h | |||
@@ -56,7 +56,6 @@ | |||
56 | #define GPIO_NR_PALMLD_LED_AMBER 94 | 56 | #define GPIO_NR_PALMLD_LED_AMBER 94 |
57 | 57 | ||
58 | /* IDE */ | 58 | /* IDE */ |
59 | #define GPIO_NR_PALMLD_IDE_IRQ 95 | ||
60 | #define GPIO_NR_PALMLD_IDE_RESET 98 | 59 | #define GPIO_NR_PALMLD_IDE_RESET 98 |
61 | #define GPIO_NR_PALMLD_IDE_PWEN 115 | 60 | #define GPIO_NR_PALMLD_IDE_PWEN 115 |
62 | 61 | ||
diff --git a/arch/arm/mach-pxa/include/mach/pm.h b/arch/arm/mach-pxa/include/mach/pm.h index a6eeef8a075f..fd8360c6839d 100644 --- a/arch/arm/mach-pxa/include/mach/pm.h +++ b/arch/arm/mach-pxa/include/mach/pm.h | |||
@@ -27,6 +27,8 @@ extern void pxa27x_cpu_suspend(unsigned int); | |||
27 | extern void pxa_cpu_resume(void); | 27 | extern void pxa_cpu_resume(void); |
28 | 28 | ||
29 | extern int pxa_pm_enter(suspend_state_t state); | 29 | extern int pxa_pm_enter(suspend_state_t state); |
30 | extern int pxa_pm_prepare(void); | ||
31 | extern void pxa_pm_finish(void); | ||
30 | 32 | ||
31 | /* NOTE: this is for PM debugging on Lubbock, it's really a big | 33 | /* NOTE: this is for PM debugging on Lubbock, it's really a big |
32 | * ugly, but let's keep the crap minimum here, instead of direct | 34 | * ugly, but let's keep the crap minimum here, instead of direct |
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h index 6876e16c2970..0b702693f458 100644 --- a/arch/arm/mach-pxa/include/mach/pxa27x.h +++ b/arch/arm/mach-pxa/include/mach/pxa27x.h | |||
@@ -16,4 +16,7 @@ | |||
16 | #define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */ | 16 | #define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */ |
17 | #define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ | 17 | #define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ |
18 | #define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ | 18 | #define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ |
19 | |||
20 | extern int __init pxa27x_set_pwrmode(unsigned int mode); | ||
21 | |||
19 | #endif /* __MACH_PXA27x_H */ | 22 | #endif /* __MACH_PXA27x_H */ |
diff --git a/arch/arm/mach-pxa/include/mach/sharpsl_pm.h b/arch/arm/mach-pxa/include/mach/sharpsl_pm.h new file mode 100644 index 000000000000..1920dc6b05dc --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/sharpsl_pm.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * SharpSL Battery/PM Driver | ||
3 | * | ||
4 | * Copyright (c) 2004-2005 Richard Purdie | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | #ifndef _MACH_SHARPSL_PM | ||
12 | #define _MACH_SHARPSL_PM | ||
13 | |||
14 | struct sharpsl_charger_machinfo { | ||
15 | void (*init)(void); | ||
16 | void (*exit)(void); | ||
17 | int gpio_acin; | ||
18 | int gpio_batfull; | ||
19 | int batfull_irq; | ||
20 | int gpio_batlock; | ||
21 | int gpio_fatal; | ||
22 | void (*discharge)(int); | ||
23 | void (*discharge1)(int); | ||
24 | void (*charge)(int); | ||
25 | void (*measure_temp)(int); | ||
26 | void (*presuspend)(void); | ||
27 | void (*postsuspend)(void); | ||
28 | void (*earlyresume)(void); | ||
29 | unsigned long (*read_devdata)(int); | ||
30 | #define SHARPSL_BATT_VOLT 1 | ||
31 | #define SHARPSL_BATT_TEMP 2 | ||
32 | #define SHARPSL_ACIN_VOLT 3 | ||
33 | #define SHARPSL_STATUS_ACIN 4 | ||
34 | #define SHARPSL_STATUS_LOCK 5 | ||
35 | #define SHARPSL_STATUS_CHRGFULL 6 | ||
36 | #define SHARPSL_STATUS_FATAL 7 | ||
37 | unsigned long (*charger_wakeup)(void); | ||
38 | int (*should_wakeup)(unsigned int resume_on_alarm); | ||
39 | void (*backlight_limit)(int); | ||
40 | int (*backlight_get_status) (void); | ||
41 | int charge_on_volt; | ||
42 | int charge_on_temp; | ||
43 | int charge_acin_high; | ||
44 | int charge_acin_low; | ||
45 | int fatal_acin_volt; | ||
46 | int fatal_noacin_volt; | ||
47 | int bat_levels; | ||
48 | struct battery_thresh *bat_levels_noac; | ||
49 | struct battery_thresh *bat_levels_acin; | ||
50 | struct battery_thresh *bat_levels_noac_bl; | ||
51 | struct battery_thresh *bat_levels_acin_bl; | ||
52 | int status_high_acin; | ||
53 | int status_low_acin; | ||
54 | int status_high_noac; | ||
55 | int status_low_noac; | ||
56 | }; | ||
57 | |||
58 | struct battery_thresh { | ||
59 | int voltage; | ||
60 | int percentage; | ||
61 | }; | ||
62 | |||
63 | struct battery_stat { | ||
64 | int ac_status; /* APM AC Present/Not Present */ | ||
65 | int mainbat_status; /* APM Main Battery Status */ | ||
66 | int mainbat_percent; /* Main Battery Percentage Charge */ | ||
67 | int mainbat_voltage; /* Main Battery Voltage */ | ||
68 | }; | ||
69 | |||
70 | struct sharpsl_pm_status { | ||
71 | struct device *dev; | ||
72 | struct timer_list ac_timer; | ||
73 | struct timer_list chrg_full_timer; | ||
74 | |||
75 | int charge_mode; | ||
76 | #define CHRG_ERROR (-1) | ||
77 | #define CHRG_OFF (0) | ||
78 | #define CHRG_ON (1) | ||
79 | #define CHRG_DONE (2) | ||
80 | |||
81 | unsigned int flags; | ||
82 | #define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */ | ||
83 | #define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */ | ||
84 | #define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */ | ||
85 | #define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */ | ||
86 | #define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */ | ||
87 | |||
88 | int full_count; | ||
89 | unsigned long charge_start_time; | ||
90 | struct sharpsl_charger_machinfo *machinfo; | ||
91 | struct battery_stat battstat; | ||
92 | }; | ||
93 | |||
94 | extern struct sharpsl_pm_status sharpsl_pm; | ||
95 | |||
96 | |||
97 | #define SHARPSL_LED_ERROR 2 | ||
98 | #define SHARPSL_LED_ON 1 | ||
99 | #define SHARPSL_LED_OFF 0 | ||
100 | |||
101 | void sharpsl_battery_kick(void); | ||
102 | void sharpsl_pm_led(int val); | ||
103 | |||
104 | #endif | ||
diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h index 5706cea95d11..b54749413e96 100644 --- a/arch/arm/mach-pxa/include/mach/uncompress.h +++ b/arch/arm/mach-pxa/include/mach/uncompress.h | |||
@@ -36,7 +36,8 @@ static inline void flush(void) | |||
36 | static inline void arch_decomp_setup(void) | 36 | static inline void arch_decomp_setup(void) |
37 | { | 37 | { |
38 | if (machine_is_littleton() || machine_is_intelmote2() | 38 | if (machine_is_littleton() || machine_is_intelmote2() |
39 | || machine_is_csb726()) | 39 | || machine_is_csb726() || machine_is_stargate2() |
40 | || machine_is_cm_x300()) | ||
40 | UART = STUART; | 41 | UART = STUART; |
41 | } | 42 | } |
42 | 43 | ||
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index c872b9feb4d4..55b3788fd1ae 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c | |||
@@ -42,14 +42,17 @@ | |||
42 | #include <mach/pxa300.h> | 42 | #include <mach/pxa300.h> |
43 | #include <mach/pxafb.h> | 43 | #include <mach/pxafb.h> |
44 | #include <mach/ssp.h> | 44 | #include <mach/ssp.h> |
45 | #include <mach/mmc.h> | ||
45 | #include <mach/pxa2xx_spi.h> | 46 | #include <mach/pxa2xx_spi.h> |
46 | #include <mach/i2c.h> | 47 | #include <plat/i2c.h> |
47 | #include <mach/pxa27x_keypad.h> | 48 | #include <mach/pxa27x_keypad.h> |
48 | #include <mach/pxa3xx_nand.h> | 49 | #include <mach/pxa3xx_nand.h> |
49 | #include <mach/littleton.h> | 50 | #include <mach/littleton.h> |
50 | 51 | ||
51 | #include "generic.h" | 52 | #include "generic.h" |
52 | 53 | ||
54 | #define GPIO_MMC1_CARD_DETECT mfp_to_gpio(MFP_PIN_GPIO15) | ||
55 | |||
53 | /* Littleton MFP configurations */ | 56 | /* Littleton MFP configurations */ |
54 | static mfp_cfg_t littleton_mfp_cfg[] __initdata = { | 57 | static mfp_cfg_t littleton_mfp_cfg[] __initdata = { |
55 | /* LCD */ | 58 | /* LCD */ |
@@ -98,6 +101,15 @@ static mfp_cfg_t littleton_mfp_cfg[] __initdata = { | |||
98 | GPIO123_KP_MKOUT_2, | 101 | GPIO123_KP_MKOUT_2, |
99 | GPIO124_KP_MKOUT_3, | 102 | GPIO124_KP_MKOUT_3, |
100 | GPIO125_KP_MKOUT_4, | 103 | GPIO125_KP_MKOUT_4, |
104 | |||
105 | /* MMC1 */ | ||
106 | GPIO3_MMC1_DAT0, | ||
107 | GPIO4_MMC1_DAT1, | ||
108 | GPIO5_MMC1_DAT2, | ||
109 | GPIO6_MMC1_DAT3, | ||
110 | GPIO7_MMC1_CLK, | ||
111 | GPIO8_MMC1_CMD, | ||
112 | GPIO15_GPIO, /* card detect */ | ||
101 | }; | 113 | }; |
102 | 114 | ||
103 | static struct resource smc91x_resources[] = { | 115 | static struct resource smc91x_resources[] = { |
@@ -179,15 +191,10 @@ static struct pxa2xx_spi_master littleton_spi_info = { | |||
179 | .num_chipselect = 1, | 191 | .num_chipselect = 1, |
180 | }; | 192 | }; |
181 | 193 | ||
182 | static void littleton_tdo24m_cs(u32 cmd) | ||
183 | { | ||
184 | gpio_set_value(LITTLETON_GPIO_LCD_CS, !(cmd == PXA2XX_CS_ASSERT)); | ||
185 | } | ||
186 | |||
187 | static struct pxa2xx_spi_chip littleton_tdo24m_chip = { | 194 | static struct pxa2xx_spi_chip littleton_tdo24m_chip = { |
188 | .rx_threshold = 1, | 195 | .rx_threshold = 1, |
189 | .tx_threshold = 1, | 196 | .tx_threshold = 1, |
190 | .cs_control = littleton_tdo24m_cs, | 197 | .gpio_cs = LITTLETON_GPIO_LCD_CS, |
191 | }; | 198 | }; |
192 | 199 | ||
193 | static struct spi_board_info littleton_spi_devices[] __initdata = { | 200 | static struct spi_board_info littleton_spi_devices[] __initdata = { |
@@ -202,16 +209,6 @@ static struct spi_board_info littleton_spi_devices[] __initdata = { | |||
202 | 209 | ||
203 | static void __init littleton_init_spi(void) | 210 | static void __init littleton_init_spi(void) |
204 | { | 211 | { |
205 | int err; | ||
206 | |||
207 | err = gpio_request(LITTLETON_GPIO_LCD_CS, "LCD_CS"); | ||
208 | if (err) { | ||
209 | pr_warning("failed to request GPIO for LCS CS\n"); | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | gpio_direction_output(LITTLETON_GPIO_LCD_CS, 1); | ||
214 | |||
215 | pxa2xx_set_spi_info(2, &littleton_spi_info); | 212 | pxa2xx_set_spi_info(2, &littleton_spi_info); |
216 | spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices)); | 213 | spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices)); |
217 | } | 214 | } |
@@ -267,6 +264,56 @@ static void __init littleton_init_keypad(void) | |||
267 | static inline void littleton_init_keypad(void) {} | 264 | static inline void littleton_init_keypad(void) {} |
268 | #endif | 265 | #endif |
269 | 266 | ||
267 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
268 | static int littleton_mci_init(struct device *dev, | ||
269 | irq_handler_t littleton_detect_int, void *data) | ||
270 | { | ||
271 | int err, gpio_cd = GPIO_MMC1_CARD_DETECT; | ||
272 | |||
273 | err = gpio_request(gpio_cd, "mmc card detect"); | ||
274 | if (err) | ||
275 | goto err_request_cd; | ||
276 | |||
277 | gpio_direction_input(gpio_cd); | ||
278 | |||
279 | err = request_irq(gpio_to_irq(gpio_cd), littleton_detect_int, | ||
280 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
281 | "mmc card detect", data); | ||
282 | if (err) { | ||
283 | dev_err(dev, "failed to request card detect IRQ\n"); | ||
284 | goto err_request_irq; | ||
285 | } | ||
286 | return 0; | ||
287 | |||
288 | err_request_irq: | ||
289 | gpio_free(gpio_cd); | ||
290 | err_request_cd: | ||
291 | return err; | ||
292 | } | ||
293 | |||
294 | static void littleton_mci_exit(struct device *dev, void *data) | ||
295 | { | ||
296 | int gpio_cd = GPIO_MMC1_CARD_DETECT; | ||
297 | |||
298 | free_irq(gpio_to_irq(gpio_cd), data); | ||
299 | gpio_free(gpio_cd); | ||
300 | } | ||
301 | |||
302 | static struct pxamci_platform_data littleton_mci_platform_data = { | ||
303 | .detect_delay = 20, | ||
304 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
305 | .init = littleton_mci_init, | ||
306 | .exit = littleton_mci_exit, | ||
307 | }; | ||
308 | |||
309 | static void __init littleton_init_mmc(void) | ||
310 | { | ||
311 | pxa_set_mci_info(&littleton_mci_platform_data); | ||
312 | } | ||
313 | #else | ||
314 | static inline void littleton_init_mmc(void) {} | ||
315 | #endif | ||
316 | |||
270 | #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) | 317 | #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) |
271 | static struct mtd_partition littleton_nand_partitions[] = { | 318 | static struct mtd_partition littleton_nand_partitions[] = { |
272 | [0] = { | 319 | [0] = { |
@@ -407,6 +454,7 @@ static void __init littleton_init(void) | |||
407 | 454 | ||
408 | littleton_init_spi(); | 455 | littleton_init_spi(); |
409 | littleton_init_i2c(); | 456 | littleton_init_i2c(); |
457 | littleton_init_mmc(); | ||
410 | littleton_init_lcd(); | 458 | littleton_init_lcd(); |
411 | littleton_init_keypad(); | 459 | littleton_init_keypad(); |
412 | littleton_init_nand(); | 460 | littleton_init_nand(); |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index c899bbd94dc0..ca39669cffc5 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <mach/pxa27x.h> | 36 | #include <mach/pxa27x.h> |
37 | #include <mach/magician.h> | 37 | #include <mach/magician.h> |
38 | #include <mach/pxafb.h> | 38 | #include <mach/pxafb.h> |
39 | #include <mach/i2c.h> | 39 | #include <plat/i2c.h> |
40 | #include <mach/mmc.h> | 40 | #include <mach/mmc.h> |
41 | #include <mach/irda.h> | 41 | #include <mach/irda.h> |
42 | #include <mach/ohci.h> | 42 | #include <mach/ohci.h> |
@@ -745,6 +745,14 @@ static struct platform_device strataflash = { | |||
745 | }; | 745 | }; |
746 | 746 | ||
747 | /* | 747 | /* |
748 | * I2C | ||
749 | */ | ||
750 | |||
751 | static struct i2c_pxa_platform_data i2c_info = { | ||
752 | .fast_mode = 1, | ||
753 | }; | ||
754 | |||
755 | /* | ||
748 | * Platform devices | 756 | * Platform devices |
749 | */ | 757 | */ |
750 | 758 | ||
@@ -771,7 +779,7 @@ static void __init magician_init(void) | |||
771 | 779 | ||
772 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); | 780 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); |
773 | 781 | ||
774 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 782 | platform_add_devices(ARRAY_AND_SIZE(devices)); |
775 | 783 | ||
776 | err = gpio_request(GPIO83_MAGICIAN_nIR_EN, "nIR_EN"); | 784 | err = gpio_request(GPIO83_MAGICIAN_nIR_EN, "nIR_EN"); |
777 | if (!err) { | 785 | if (!err) { |
@@ -779,7 +787,7 @@ static void __init magician_init(void) | |||
779 | pxa_set_ficp_info(&magician_ficp_info); | 787 | pxa_set_ficp_info(&magician_ficp_info); |
780 | } | 788 | } |
781 | pxa27x_set_i2c_power_info(NULL); | 789 | pxa27x_set_i2c_power_info(NULL); |
782 | pxa_set_i2c_info(NULL); | 790 | pxa_set_i2c_info(&i2c_info); |
783 | pxa_set_mci_info(&magician_mci_info); | 791 | pxa_set_mci_info(&magician_mci_info); |
784 | pxa_set_ohci_info(&magician_ohci_info); | 792 | pxa_set_ohci_info(&magician_ohci_info); |
785 | 793 | ||
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index a6c8429e975f..f4dabf0273ca 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <mach/mainstone.h> | 46 | #include <mach/mainstone.h> |
47 | #include <mach/audio.h> | 47 | #include <mach/audio.h> |
48 | #include <mach/pxafb.h> | 48 | #include <mach/pxafb.h> |
49 | #include <mach/i2c.h> | 49 | #include <plat/i2c.h> |
50 | #include <mach/mmc.h> | 50 | #include <mach/mmc.h> |
51 | #include <mach/irda.h> | 51 | #include <mach/irda.h> |
52 | #include <mach/ohci.h> | 52 | #include <mach/ohci.h> |
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index ff8052ce0a05..4dc8c2ec40a9 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <mach/mmc.h> | 48 | #include <mach/mmc.h> |
49 | #include <mach/udc.h> | 49 | #include <mach/udc.h> |
50 | #include <mach/pxa27x-udc.h> | 50 | #include <mach/pxa27x-udc.h> |
51 | #include <mach/i2c.h> | 51 | #include <plat/i2c.h> |
52 | #include <mach/camera.h> | 52 | #include <mach/camera.h> |
53 | #include <mach/audio.h> | 53 | #include <mach/audio.h> |
54 | #include <media/soc_camera.h> | 54 | #include <media/soc_camera.h> |
@@ -798,7 +798,7 @@ static void mioa701_restart(char c, const char *cmd) | |||
798 | arm_machine_restart('s', cmd); | 798 | arm_machine_restart('s', cmd); |
799 | } | 799 | } |
800 | 800 | ||
801 | struct gpio_ress global_gpios[] = { | 801 | static struct gpio_ress global_gpios[] = { |
802 | MIO_GPIO_OUT(GPIO9_CHARGE_EN, 1, "Charger enable"), | 802 | MIO_GPIO_OUT(GPIO9_CHARGE_EN, 1, "Charger enable"), |
803 | MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"), | 803 | MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"), |
804 | MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power") | 804 | MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power") |
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 471a853e548b..ed70f281dd09 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c | |||
@@ -129,7 +129,7 @@ static unsigned long palmld_pin_config[] __initdata = { | |||
129 | GPIO81_GPIO, /* wifi reset */ | 129 | GPIO81_GPIO, /* wifi reset */ |
130 | 130 | ||
131 | /* HDD */ | 131 | /* HDD */ |
132 | GPIO95_GPIO, /* HDD irq */ | 132 | GPIO98_GPIO, /* HDD reset */ |
133 | GPIO115_GPIO, /* HDD power */ | 133 | GPIO115_GPIO, /* HDD power */ |
134 | 134 | ||
135 | /* MISC */ | 135 | /* MISC */ |
@@ -496,6 +496,14 @@ static struct platform_device palmld_asoc = { | |||
496 | }; | 496 | }; |
497 | 497 | ||
498 | /****************************************************************************** | 498 | /****************************************************************************** |
499 | * HDD | ||
500 | ******************************************************************************/ | ||
501 | static struct platform_device palmld_hdd = { | ||
502 | .name = "pata_palmld", | ||
503 | .id = -1, | ||
504 | }; | ||
505 | |||
506 | /****************************************************************************** | ||
499 | * Framebuffer | 507 | * Framebuffer |
500 | ******************************************************************************/ | 508 | ******************************************************************************/ |
501 | static struct pxafb_mode_info palmld_lcd_modes[] = { | 509 | static struct pxafb_mode_info palmld_lcd_modes[] = { |
@@ -524,30 +532,18 @@ static struct pxafb_mach_info palmld_lcd_screen = { | |||
524 | /****************************************************************************** | 532 | /****************************************************************************** |
525 | * Power management - standby | 533 | * Power management - standby |
526 | ******************************************************************************/ | 534 | ******************************************************************************/ |
527 | #ifdef CONFIG_PM | 535 | static void __init palmld_pm_init(void) |
528 | static u32 *addr __initdata; | ||
529 | static u32 resume[3] __initdata = { | ||
530 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
531 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
532 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
533 | }; | ||
534 | |||
535 | static int __init palmld_pm_init(void) | ||
536 | { | 536 | { |
537 | int i; | 537 | static u32 resume[] = { |
538 | 538 | 0xe3a00101, /* mov r0, #0x40000000 */ | |
539 | /* this is where the bootloader jumps */ | 539 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ |
540 | addr = phys_to_virt(PALMLD_STR_BASE); | 540 | 0xe590f008, /* ldr pc, [r0, #0x08] */ |
541 | 541 | }; | |
542 | for (i = 0; i < 3; i++) | 542 | |
543 | addr[i] = resume[i]; | 543 | /* copy the bootloader */ |
544 | 544 | memcpy(phys_to_virt(PALMLD_STR_BASE), resume, sizeof(resume)); | |
545 | return 0; | ||
546 | } | 545 | } |
547 | 546 | ||
548 | device_initcall(palmld_pm_init); | ||
549 | #endif | ||
550 | |||
551 | /****************************************************************************** | 547 | /****************************************************************************** |
552 | * Machine init | 548 | * Machine init |
553 | ******************************************************************************/ | 549 | ******************************************************************************/ |
@@ -559,6 +555,7 @@ static struct platform_device *devices[] __initdata = { | |||
559 | &palmld_leds, | 555 | &palmld_leds, |
560 | &power_supply, | 556 | &power_supply, |
561 | &palmld_asoc, | 557 | &palmld_asoc, |
558 | &palmld_hdd, | ||
562 | }; | 559 | }; |
563 | 560 | ||
564 | static struct map_desc palmld_io_desc[] __initdata = { | 561 | static struct map_desc palmld_io_desc[] __initdata = { |
@@ -586,6 +583,7 @@ static void __init palmld_init(void) | |||
586 | { | 583 | { |
587 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config)); | 584 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config)); |
588 | 585 | ||
586 | palmld_pm_init(); | ||
589 | set_pxa_fb_info(&palmld_lcd_screen); | 587 | set_pxa_fb_info(&palmld_lcd_screen); |
590 | pxa_set_mci_info(&palmld_mci_platform_data); | 588 | pxa_set_mci_info(&palmld_mci_platform_data); |
591 | pxa_set_ac97_info(&palmld_ac97_pdata); | 589 | pxa_set_ac97_info(&palmld_ac97_pdata); |
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index 05bf979b78a6..aae64a12a734 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
27 | #include <linux/wm97xx_batt.h> | 27 | #include <linux/wm97xx_batt.h> |
28 | #include <linux/power_supply.h> | 28 | #include <linux/power_supply.h> |
29 | #include <linux/usb/gpio_vbus.h> | ||
29 | 30 | ||
30 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
31 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
@@ -343,11 +344,18 @@ static struct pxaficp_platform_data palmt5_ficp_platform_data = { | |||
343 | /****************************************************************************** | 344 | /****************************************************************************** |
344 | * UDC | 345 | * UDC |
345 | ******************************************************************************/ | 346 | ******************************************************************************/ |
346 | static struct pxa2xx_udc_mach_info palmt5_udc_info __initdata = { | 347 | static struct gpio_vbus_mach_info palmt5_udc_info = { |
347 | .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N, | 348 | .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N, |
348 | .gpio_vbus_inverted = 1, | 349 | .gpio_vbus_inverted = 1, |
349 | .gpio_pullup = GPIO_NR_PALMT5_USB_PULLUP, | 350 | .gpio_pullup = GPIO_NR_PALMT5_USB_PULLUP, |
350 | .gpio_pullup_inverted = 0, | 351 | }; |
352 | |||
353 | static struct platform_device palmt5_gpio_vbus = { | ||
354 | .name = "gpio-vbus", | ||
355 | .id = -1, | ||
356 | .dev = { | ||
357 | .platform_data = &palmt5_udc_info, | ||
358 | }, | ||
351 | }; | 359 | }; |
352 | 360 | ||
353 | /****************************************************************************** | 361 | /****************************************************************************** |
@@ -466,30 +474,18 @@ static struct pxafb_mach_info palmt5_lcd_screen = { | |||
466 | /****************************************************************************** | 474 | /****************************************************************************** |
467 | * Power management - standby | 475 | * Power management - standby |
468 | ******************************************************************************/ | 476 | ******************************************************************************/ |
469 | #ifdef CONFIG_PM | 477 | static void __init palmt5_pm_init(void) |
470 | static u32 *addr __initdata; | ||
471 | static u32 resume[3] __initdata = { | ||
472 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
473 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
474 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
475 | }; | ||
476 | |||
477 | static int __init palmt5_pm_init(void) | ||
478 | { | 478 | { |
479 | int i; | 479 | static u32 resume[] = { |
480 | 480 | 0xe3a00101, /* mov r0, #0x40000000 */ | |
481 | /* this is where the bootloader jumps */ | 481 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ |
482 | addr = phys_to_virt(PALMT5_STR_BASE); | 482 | 0xe590f008, /* ldr pc, [r0, #0x08] */ |
483 | 483 | }; | |
484 | for (i = 0; i < 3; i++) | 484 | |
485 | addr[i] = resume[i]; | 485 | /* copy the bootloader */ |
486 | 486 | memcpy(phys_to_virt(PALMT5_STR_BASE), resume, sizeof(resume)); | |
487 | return 0; | ||
488 | } | 487 | } |
489 | 488 | ||
490 | device_initcall(palmt5_pm_init); | ||
491 | #endif | ||
492 | |||
493 | /****************************************************************************** | 489 | /****************************************************************************** |
494 | * Machine init | 490 | * Machine init |
495 | ******************************************************************************/ | 491 | ******************************************************************************/ |
@@ -500,6 +496,7 @@ static struct platform_device *devices[] __initdata = { | |||
500 | &palmt5_backlight, | 496 | &palmt5_backlight, |
501 | &power_supply, | 497 | &power_supply, |
502 | &palmt5_asoc, | 498 | &palmt5_asoc, |
499 | &palmt5_gpio_vbus, | ||
503 | }; | 500 | }; |
504 | 501 | ||
505 | /* setup udc GPIOs initial state */ | 502 | /* setup udc GPIOs initial state */ |
@@ -515,14 +512,15 @@ static void __init palmt5_init(void) | |||
515 | { | 512 | { |
516 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); | 513 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); |
517 | 514 | ||
515 | palmt5_pm_init(); | ||
518 | set_pxa_fb_info(&palmt5_lcd_screen); | 516 | set_pxa_fb_info(&palmt5_lcd_screen); |
519 | pxa_set_mci_info(&palmt5_mci_platform_data); | 517 | pxa_set_mci_info(&palmt5_mci_platform_data); |
520 | palmt5_udc_init(); | 518 | palmt5_udc_init(); |
521 | pxa_set_ac97_info(&palmt5_ac97_pdata); | 519 | pxa_set_ac97_info(&palmt5_ac97_pdata); |
522 | pxa_set_udc_info(&palmt5_udc_info); | ||
523 | pxa_set_ficp_info(&palmt5_ficp_platform_data); | 520 | pxa_set_ficp_info(&palmt5_ficp_platform_data); |
524 | pxa_set_keypad_info(&palmt5_keypad_platform_data); | 521 | pxa_set_keypad_info(&palmt5_keypad_platform_data); |
525 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | 522 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
523 | |||
526 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 524 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
527 | } | 525 | } |
528 | 526 | ||
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c index 43fcf2e86887..d823b09801df 100644 --- a/arch/arm/mach-pxa/palmte2.c +++ b/arch/arm/mach-pxa/palmte2.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
26 | #include <linux/wm97xx_batt.h> | 26 | #include <linux/wm97xx_batt.h> |
27 | #include <linux/power_supply.h> | 27 | #include <linux/power_supply.h> |
28 | #include <linux/usb/gpio_vbus.h> | ||
28 | 29 | ||
29 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
30 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
@@ -37,6 +38,7 @@ | |||
37 | #include <mach/mfp-pxa25x.h> | 38 | #include <mach/mfp-pxa25x.h> |
38 | #include <mach/irda.h> | 39 | #include <mach/irda.h> |
39 | #include <mach/udc.h> | 40 | #include <mach/udc.h> |
41 | #include <mach/palmasoc.h> | ||
40 | 42 | ||
41 | #include "generic.h" | 43 | #include "generic.h" |
42 | #include "devices.h" | 44 | #include "devices.h" |
@@ -107,6 +109,7 @@ static unsigned long palmte2_pin_config[] __initdata = { | |||
107 | GPIO1_RST, /* reset */ | 109 | GPIO1_RST, /* reset */ |
108 | GPIO4_GPIO, /* Hotsync button */ | 110 | GPIO4_GPIO, /* Hotsync button */ |
109 | GPIO9_GPIO, /* power detect */ | 111 | GPIO9_GPIO, /* power detect */ |
112 | GPIO15_GPIO, /* earphone detect */ | ||
110 | GPIO37_GPIO, /* LCD power */ | 113 | GPIO37_GPIO, /* LCD power */ |
111 | GPIO56_GPIO, /* Backlight power */ | 114 | GPIO56_GPIO, /* Backlight power */ |
112 | }; | 115 | }; |
@@ -318,11 +321,18 @@ static struct pxaficp_platform_data palmte2_ficp_platform_data = { | |||
318 | /****************************************************************************** | 321 | /****************************************************************************** |
319 | * UDC | 322 | * UDC |
320 | ******************************************************************************/ | 323 | ******************************************************************************/ |
321 | static struct pxa2xx_udc_mach_info palmte2_udc_info __initdata = { | 324 | static struct gpio_vbus_mach_info palmte2_udc_info = { |
322 | .gpio_vbus = GPIO_NR_PALMTE2_USB_DETECT_N, | 325 | .gpio_vbus = GPIO_NR_PALMTE2_USB_DETECT_N, |
323 | .gpio_vbus_inverted = 1, | 326 | .gpio_vbus_inverted = 1, |
324 | .gpio_pullup = GPIO_NR_PALMTE2_USB_PULLUP, | 327 | .gpio_pullup = GPIO_NR_PALMTE2_USB_PULLUP, |
325 | .gpio_pullup_inverted = 0, | 328 | }; |
329 | |||
330 | static struct platform_device palmte2_gpio_vbus = { | ||
331 | .name = "gpio-vbus", | ||
332 | .id = -1, | ||
333 | .dev = { | ||
334 | .platform_data = &palmte2_udc_info, | ||
335 | }, | ||
326 | }; | 336 | }; |
327 | 337 | ||
328 | /****************************************************************************** | 338 | /****************************************************************************** |
@@ -395,6 +405,21 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { | |||
395 | }; | 405 | }; |
396 | 406 | ||
397 | /****************************************************************************** | 407 | /****************************************************************************** |
408 | * aSoC audio | ||
409 | ******************************************************************************/ | ||
410 | static struct palm27x_asoc_info palmte2_asoc_pdata = { | ||
411 | .jack_gpio = GPIO_NR_PALMTE2_EARPHONE_DETECT, | ||
412 | }; | ||
413 | |||
414 | static struct platform_device palmte2_asoc = { | ||
415 | .name = "palm27x-asoc", | ||
416 | .id = -1, | ||
417 | .dev = { | ||
418 | .platform_data = &palmte2_asoc_pdata, | ||
419 | }, | ||
420 | }; | ||
421 | |||
422 | /****************************************************************************** | ||
398 | * Framebuffer | 423 | * Framebuffer |
399 | ******************************************************************************/ | 424 | ******************************************************************************/ |
400 | static struct pxafb_mode_info palmte2_lcd_modes[] = { | 425 | static struct pxafb_mode_info palmte2_lcd_modes[] = { |
@@ -429,6 +454,8 @@ static struct platform_device *devices[] __initdata = { | |||
429 | #endif | 454 | #endif |
430 | &palmte2_backlight, | 455 | &palmte2_backlight, |
431 | &power_supply, | 456 | &power_supply, |
457 | &palmte2_asoc, | ||
458 | &palmte2_gpio_vbus, | ||
432 | }; | 459 | }; |
433 | 460 | ||
434 | /* setup udc GPIOs initial state */ | 461 | /* setup udc GPIOs initial state */ |
@@ -447,7 +474,6 @@ static void __init palmte2_init(void) | |||
447 | set_pxa_fb_info(&palmte2_lcd_screen); | 474 | set_pxa_fb_info(&palmte2_lcd_screen); |
448 | pxa_set_mci_info(&palmte2_mci_platform_data); | 475 | pxa_set_mci_info(&palmte2_mci_platform_data); |
449 | palmte2_udc_init(); | 476 | palmte2_udc_init(); |
450 | pxa_set_udc_info(&palmte2_udc_info); | ||
451 | pxa_set_ac97_info(NULL); | 477 | pxa_set_ac97_info(NULL); |
452 | pxa_set_ficp_info(&palmte2_ficp_platform_data); | 478 | pxa_set_ficp_info(&palmte2_ficp_platform_data); |
453 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | 479 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index e99a893c58a7..6c15d84bde53 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <linux/wm97xx_batt.h> | 28 | #include <linux/wm97xx_batt.h> |
29 | #include <linux/power_supply.h> | 29 | #include <linux/power_supply.h> |
30 | #include <linux/usb/gpio_vbus.h> | ||
30 | 31 | ||
31 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
32 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
@@ -359,11 +360,18 @@ static struct pxaficp_platform_data palmtx_ficp_platform_data = { | |||
359 | /****************************************************************************** | 360 | /****************************************************************************** |
360 | * UDC | 361 | * UDC |
361 | ******************************************************************************/ | 362 | ******************************************************************************/ |
362 | static struct pxa2xx_udc_mach_info palmtx_udc_info __initdata = { | 363 | static struct gpio_vbus_mach_info palmtx_udc_info = { |
363 | .gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N, | 364 | .gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N, |
364 | .gpio_vbus_inverted = 1, | 365 | .gpio_vbus_inverted = 1, |
365 | .gpio_pullup = GPIO_NR_PALMTX_USB_PULLUP, | 366 | .gpio_pullup = GPIO_NR_PALMTX_USB_PULLUP, |
366 | .gpio_pullup_inverted = 0, | 367 | }; |
368 | |||
369 | static struct platform_device palmtx_gpio_vbus = { | ||
370 | .name = "gpio-vbus", | ||
371 | .id = -1, | ||
372 | .dev = { | ||
373 | .platform_data = &palmtx_udc_info, | ||
374 | }, | ||
367 | }; | 375 | }; |
368 | 376 | ||
369 | /****************************************************************************** | 377 | /****************************************************************************** |
@@ -483,30 +491,18 @@ static struct pxafb_mach_info palmtx_lcd_screen = { | |||
483 | /****************************************************************************** | 491 | /****************************************************************************** |
484 | * Power management - standby | 492 | * Power management - standby |
485 | ******************************************************************************/ | 493 | ******************************************************************************/ |
486 | #ifdef CONFIG_PM | 494 | static void __init palmtx_pm_init(void) |
487 | static u32 *addr __initdata; | ||
488 | static u32 resume[3] __initdata = { | ||
489 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
490 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
491 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
492 | }; | ||
493 | |||
494 | static int __init palmtx_pm_init(void) | ||
495 | { | 495 | { |
496 | int i; | 496 | static u32 resume[] = { |
497 | 497 | 0xe3a00101, /* mov r0, #0x40000000 */ | |
498 | /* this is where the bootloader jumps */ | 498 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ |
499 | addr = phys_to_virt(PALMTX_STR_BASE); | 499 | 0xe590f008, /* ldr pc, [r0, #0x08] */ |
500 | 500 | }; | |
501 | for (i = 0; i < 3; i++) | 501 | |
502 | addr[i] = resume[i]; | 502 | /* copy the bootloader */ |
503 | 503 | memcpy(phys_to_virt(PALMTX_STR_BASE), resume, sizeof(resume)); | |
504 | return 0; | ||
505 | } | 504 | } |
506 | 505 | ||
507 | device_initcall(palmtx_pm_init); | ||
508 | #endif | ||
509 | |||
510 | /****************************************************************************** | 506 | /****************************************************************************** |
511 | * Machine init | 507 | * Machine init |
512 | ******************************************************************************/ | 508 | ******************************************************************************/ |
@@ -517,6 +513,7 @@ static struct platform_device *devices[] __initdata = { | |||
517 | &palmtx_backlight, | 513 | &palmtx_backlight, |
518 | &power_supply, | 514 | &power_supply, |
519 | &palmtx_asoc, | 515 | &palmtx_asoc, |
516 | &palmtx_gpio_vbus, | ||
520 | }; | 517 | }; |
521 | 518 | ||
522 | static struct map_desc palmtx_io_desc[] __initdata = { | 519 | static struct map_desc palmtx_io_desc[] __initdata = { |
@@ -548,11 +545,11 @@ static void __init palmtx_init(void) | |||
548 | { | 545 | { |
549 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); | 546 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); |
550 | 547 | ||
548 | palmtx_pm_init(); | ||
551 | set_pxa_fb_info(&palmtx_lcd_screen); | 549 | set_pxa_fb_info(&palmtx_lcd_screen); |
552 | pxa_set_mci_info(&palmtx_mci_platform_data); | 550 | pxa_set_mci_info(&palmtx_mci_platform_data); |
553 | palmtx_udc_init(); | 551 | palmtx_udc_init(); |
554 | pxa_set_ac97_info(&palmtx_ac97_pdata); | 552 | pxa_set_ac97_info(&palmtx_ac97_pdata); |
555 | pxa_set_udc_info(&palmtx_udc_info); | ||
556 | pxa_set_ficp_info(&palmtx_ficp_platform_data); | 553 | pxa_set_ficp_info(&palmtx_ficp_platform_data); |
557 | pxa_set_keypad_info(&palmtx_keypad_platform_data); | 554 | pxa_set_keypad_info(&palmtx_keypad_platform_data); |
558 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | 555 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index 6c12b5a3132f..095521e9ee24 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <media/soc_camera.h> | 28 | #include <media/soc_camera.h> |
29 | 29 | ||
30 | #include <asm/gpio.h> | 30 | #include <asm/gpio.h> |
31 | #include <mach/i2c.h> | 31 | #include <plat/i2c.h> |
32 | #include <mach/camera.h> | 32 | #include <mach/camera.h> |
33 | #include <asm/mach/map.h> | 33 | #include <asm/mach/map.h> |
34 | #include <mach/pxa27x.h> | 34 | #include <mach/pxa27x.h> |
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c index 884b174c8ead..7693355ee637 100644 --- a/arch/arm/mach-pxa/pm.c +++ b/arch/arm/mach-pxa/pm.c | |||
@@ -79,7 +79,7 @@ static int pxa_pm_valid(suspend_state_t state) | |||
79 | return -EINVAL; | 79 | return -EINVAL; |
80 | } | 80 | } |
81 | 81 | ||
82 | static int pxa_pm_prepare(void) | 82 | int pxa_pm_prepare(void) |
83 | { | 83 | { |
84 | int ret = 0; | 84 | int ret = 0; |
85 | 85 | ||
@@ -89,7 +89,7 @@ static int pxa_pm_prepare(void) | |||
89 | return ret; | 89 | return ret; |
90 | } | 90 | } |
91 | 91 | ||
92 | static void pxa_pm_finish(void) | 92 | void pxa_pm_finish(void) |
93 | { | 93 | { |
94 | if (pxa_cpu_pm_fns && pxa_cpu_pm_fns->finish) | 94 | if (pxa_cpu_pm_fns && pxa_cpu_pm_fns->finish) |
95 | pxa_cpu_pm_fns->finish(); | 95 | pxa_cpu_pm_fns->finish(); |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 036bbde4d221..ac431ed10399 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <mach/pxa25x.h> | 39 | #include <mach/pxa25x.h> |
40 | #include <mach/mmc.h> | 40 | #include <mach/mmc.h> |
41 | #include <mach/udc.h> | 41 | #include <mach/udc.h> |
42 | #include <mach/i2c.h> | 42 | #include <plat/i2c.h> |
43 | #include <mach/irda.h> | 43 | #include <mach/irda.h> |
44 | #include <mach/poodle.h> | 44 | #include <mach/poodle.h> |
45 | #include <mach/pxafb.h> | 45 | #include <mach/pxafb.h> |
@@ -214,13 +214,8 @@ static struct ads7846_platform_data poodle_ads7846_info = { | |||
214 | .gpio_pendown = POODLE_GPIO_TP_INT, | 214 | .gpio_pendown = POODLE_GPIO_TP_INT, |
215 | }; | 215 | }; |
216 | 216 | ||
217 | static void ads7846_cs(u32 command) | ||
218 | { | ||
219 | gpio_set_value(POODLE_GPIO_TP_CS, !(command == PXA2XX_CS_ASSERT)); | ||
220 | } | ||
221 | |||
222 | static struct pxa2xx_spi_chip poodle_ads7846_chip = { | 217 | static struct pxa2xx_spi_chip poodle_ads7846_chip = { |
223 | .cs_control = ads7846_cs, | 218 | .gpio_cs = POODLE_GPIO_TP_CS, |
224 | }; | 219 | }; |
225 | 220 | ||
226 | static struct spi_board_info poodle_spi_devices[] = { | 221 | static struct spi_board_info poodle_spi_devices[] = { |
@@ -236,14 +231,6 @@ static struct spi_board_info poodle_spi_devices[] = { | |||
236 | 231 | ||
237 | static void __init poodle_init_spi(void) | 232 | static void __init poodle_init_spi(void) |
238 | { | 233 | { |
239 | int err; | ||
240 | |||
241 | err = gpio_request(POODLE_GPIO_TP_CS, "ADS7846_CS"); | ||
242 | if (err) | ||
243 | return; | ||
244 | |||
245 | gpio_direction_output(POODLE_GPIO_TP_CS, 1); | ||
246 | |||
247 | pxa2xx_set_spi_info(1, &poodle_spi_info); | 234 | pxa2xx_set_spi_info(1, &poodle_spi_info); |
248 | spi_register_board_info(ARRAY_AND_SIZE(poodle_spi_devices)); | 235 | spi_register_board_info(ARRAY_AND_SIZE(poodle_spi_devices)); |
249 | } | 236 | } |
diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c deleted file mode 100644 index fcdd374437a8..000000000000 --- a/arch/arm/mach-pxa/pwm.c +++ /dev/null | |||
@@ -1,318 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/pwm.c | ||
3 | * | ||
4 | * simple driver for PWM (Pulse Width Modulator) controller | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * 2008-02-13 initial version | ||
11 | * eric miao <eric.miao@marvell.com> | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/pwm.h> | ||
21 | |||
22 | #include <asm/div64.h> | ||
23 | |||
24 | /* PWM registers and bits definitions */ | ||
25 | #define PWMCR (0x00) | ||
26 | #define PWMDCR (0x04) | ||
27 | #define PWMPCR (0x08) | ||
28 | |||
29 | #define PWMCR_SD (1 << 6) | ||
30 | #define PWMDCR_FD (1 << 10) | ||
31 | |||
32 | struct pwm_device { | ||
33 | struct list_head node; | ||
34 | struct platform_device *pdev; | ||
35 | |||
36 | const char *label; | ||
37 | struct clk *clk; | ||
38 | int clk_enabled; | ||
39 | void __iomem *mmio_base; | ||
40 | |||
41 | unsigned int use_count; | ||
42 | unsigned int pwm_id; | ||
43 | }; | ||
44 | |||
45 | /* | ||
46 | * period_ns = 10^9 * (PRESCALE + 1) * (PV + 1) / PWM_CLK_RATE | ||
47 | * duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE | ||
48 | */ | ||
49 | int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) | ||
50 | { | ||
51 | unsigned long long c; | ||
52 | unsigned long period_cycles, prescale, pv, dc; | ||
53 | |||
54 | if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) | ||
55 | return -EINVAL; | ||
56 | |||
57 | c = clk_get_rate(pwm->clk); | ||
58 | c = c * period_ns; | ||
59 | do_div(c, 1000000000); | ||
60 | period_cycles = c; | ||
61 | |||
62 | if (period_cycles < 1) | ||
63 | period_cycles = 1; | ||
64 | prescale = (period_cycles - 1) / 1024; | ||
65 | pv = period_cycles / (prescale + 1) - 1; | ||
66 | |||
67 | if (prescale > 63) | ||
68 | return -EINVAL; | ||
69 | |||
70 | if (duty_ns == period_ns) | ||
71 | dc = PWMDCR_FD; | ||
72 | else | ||
73 | dc = (pv + 1) * duty_ns / period_ns; | ||
74 | |||
75 | /* NOTE: the clock to PWM has to be enabled first | ||
76 | * before writing to the registers | ||
77 | */ | ||
78 | clk_enable(pwm->clk); | ||
79 | __raw_writel(prescale, pwm->mmio_base + PWMCR); | ||
80 | __raw_writel(dc, pwm->mmio_base + PWMDCR); | ||
81 | __raw_writel(pv, pwm->mmio_base + PWMPCR); | ||
82 | clk_disable(pwm->clk); | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | EXPORT_SYMBOL(pwm_config); | ||
87 | |||
88 | int pwm_enable(struct pwm_device *pwm) | ||
89 | { | ||
90 | int rc = 0; | ||
91 | |||
92 | if (!pwm->clk_enabled) { | ||
93 | rc = clk_enable(pwm->clk); | ||
94 | if (!rc) | ||
95 | pwm->clk_enabled = 1; | ||
96 | } | ||
97 | return rc; | ||
98 | } | ||
99 | EXPORT_SYMBOL(pwm_enable); | ||
100 | |||
101 | void pwm_disable(struct pwm_device *pwm) | ||
102 | { | ||
103 | if (pwm->clk_enabled) { | ||
104 | clk_disable(pwm->clk); | ||
105 | pwm->clk_enabled = 0; | ||
106 | } | ||
107 | } | ||
108 | EXPORT_SYMBOL(pwm_disable); | ||
109 | |||
110 | static DEFINE_MUTEX(pwm_lock); | ||
111 | static LIST_HEAD(pwm_list); | ||
112 | |||
113 | struct pwm_device *pwm_request(int pwm_id, const char *label) | ||
114 | { | ||
115 | struct pwm_device *pwm; | ||
116 | int found = 0; | ||
117 | |||
118 | mutex_lock(&pwm_lock); | ||
119 | |||
120 | list_for_each_entry(pwm, &pwm_list, node) { | ||
121 | if (pwm->pwm_id == pwm_id) { | ||
122 | found = 1; | ||
123 | break; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | if (found) { | ||
128 | if (pwm->use_count == 0) { | ||
129 | pwm->use_count++; | ||
130 | pwm->label = label; | ||
131 | } else | ||
132 | pwm = ERR_PTR(-EBUSY); | ||
133 | } else | ||
134 | pwm = ERR_PTR(-ENOENT); | ||
135 | |||
136 | mutex_unlock(&pwm_lock); | ||
137 | return pwm; | ||
138 | } | ||
139 | EXPORT_SYMBOL(pwm_request); | ||
140 | |||
141 | void pwm_free(struct pwm_device *pwm) | ||
142 | { | ||
143 | mutex_lock(&pwm_lock); | ||
144 | |||
145 | if (pwm->use_count) { | ||
146 | pwm->use_count--; | ||
147 | pwm->label = NULL; | ||
148 | } else | ||
149 | pr_warning("PWM device already freed\n"); | ||
150 | |||
151 | mutex_unlock(&pwm_lock); | ||
152 | } | ||
153 | EXPORT_SYMBOL(pwm_free); | ||
154 | |||
155 | static inline void __add_pwm(struct pwm_device *pwm) | ||
156 | { | ||
157 | mutex_lock(&pwm_lock); | ||
158 | list_add_tail(&pwm->node, &pwm_list); | ||
159 | mutex_unlock(&pwm_lock); | ||
160 | } | ||
161 | |||
162 | static struct pwm_device *pwm_probe(struct platform_device *pdev, | ||
163 | unsigned int pwm_id, struct pwm_device *parent_pwm) | ||
164 | { | ||
165 | struct pwm_device *pwm; | ||
166 | struct resource *r; | ||
167 | int ret = 0; | ||
168 | |||
169 | pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL); | ||
170 | if (pwm == NULL) { | ||
171 | dev_err(&pdev->dev, "failed to allocate memory\n"); | ||
172 | return ERR_PTR(-ENOMEM); | ||
173 | } | ||
174 | |||
175 | pwm->clk = clk_get(&pdev->dev, NULL); | ||
176 | if (IS_ERR(pwm->clk)) { | ||
177 | ret = PTR_ERR(pwm->clk); | ||
178 | goto err_free; | ||
179 | } | ||
180 | pwm->clk_enabled = 0; | ||
181 | |||
182 | pwm->use_count = 0; | ||
183 | pwm->pwm_id = pwm_id; | ||
184 | pwm->pdev = pdev; | ||
185 | |||
186 | if (parent_pwm != NULL) { | ||
187 | /* registers for the second PWM has offset of 0x10 */ | ||
188 | pwm->mmio_base = parent_pwm->mmio_base + 0x10; | ||
189 | __add_pwm(pwm); | ||
190 | return pwm; | ||
191 | } | ||
192 | |||
193 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
194 | if (r == NULL) { | ||
195 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
196 | ret = -ENODEV; | ||
197 | goto err_free_clk; | ||
198 | } | ||
199 | |||
200 | r = request_mem_region(r->start, r->end - r->start + 1, pdev->name); | ||
201 | if (r == NULL) { | ||
202 | dev_err(&pdev->dev, "failed to request memory resource\n"); | ||
203 | ret = -EBUSY; | ||
204 | goto err_free_clk; | ||
205 | } | ||
206 | |||
207 | pwm->mmio_base = ioremap(r->start, r->end - r->start + 1); | ||
208 | if (pwm->mmio_base == NULL) { | ||
209 | dev_err(&pdev->dev, "failed to ioremap() registers\n"); | ||
210 | ret = -ENODEV; | ||
211 | goto err_free_mem; | ||
212 | } | ||
213 | |||
214 | __add_pwm(pwm); | ||
215 | platform_set_drvdata(pdev, pwm); | ||
216 | return pwm; | ||
217 | |||
218 | err_free_mem: | ||
219 | release_mem_region(r->start, r->end - r->start + 1); | ||
220 | err_free_clk: | ||
221 | clk_put(pwm->clk); | ||
222 | err_free: | ||
223 | kfree(pwm); | ||
224 | return ERR_PTR(ret); | ||
225 | } | ||
226 | |||
227 | static int __devinit pxa25x_pwm_probe(struct platform_device *pdev) | ||
228 | { | ||
229 | struct pwm_device *pwm = pwm_probe(pdev, pdev->id, NULL); | ||
230 | |||
231 | if (IS_ERR(pwm)) | ||
232 | return PTR_ERR(pwm); | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | static int __devinit pxa27x_pwm_probe(struct platform_device *pdev) | ||
238 | { | ||
239 | struct pwm_device *pwm; | ||
240 | |||
241 | pwm = pwm_probe(pdev, pdev->id, NULL); | ||
242 | if (IS_ERR(pwm)) | ||
243 | return PTR_ERR(pwm); | ||
244 | |||
245 | pwm = pwm_probe(pdev, pdev->id + 2, pwm); | ||
246 | if (IS_ERR(pwm)) | ||
247 | return PTR_ERR(pwm); | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int __devexit pwm_remove(struct platform_device *pdev) | ||
253 | { | ||
254 | struct pwm_device *pwm; | ||
255 | struct resource *r; | ||
256 | |||
257 | pwm = platform_get_drvdata(pdev); | ||
258 | if (pwm == NULL) | ||
259 | return -ENODEV; | ||
260 | |||
261 | mutex_lock(&pwm_lock); | ||
262 | list_del(&pwm->node); | ||
263 | mutex_unlock(&pwm_lock); | ||
264 | |||
265 | iounmap(pwm->mmio_base); | ||
266 | |||
267 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
268 | release_mem_region(r->start, r->end - r->start + 1); | ||
269 | |||
270 | clk_put(pwm->clk); | ||
271 | kfree(pwm); | ||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | static struct platform_driver pxa25x_pwm_driver = { | ||
276 | .driver = { | ||
277 | .name = "pxa25x-pwm", | ||
278 | }, | ||
279 | .probe = pxa25x_pwm_probe, | ||
280 | .remove = __devexit_p(pwm_remove), | ||
281 | }; | ||
282 | |||
283 | static struct platform_driver pxa27x_pwm_driver = { | ||
284 | .driver = { | ||
285 | .name = "pxa27x-pwm", | ||
286 | }, | ||
287 | .probe = pxa27x_pwm_probe, | ||
288 | .remove = __devexit_p(pwm_remove), | ||
289 | }; | ||
290 | |||
291 | static int __init pwm_init(void) | ||
292 | { | ||
293 | int ret = 0; | ||
294 | |||
295 | ret = platform_driver_register(&pxa25x_pwm_driver); | ||
296 | if (ret) { | ||
297 | printk(KERN_ERR "failed to register pxa25x_pwm_driver\n"); | ||
298 | return ret; | ||
299 | } | ||
300 | |||
301 | ret = platform_driver_register(&pxa27x_pwm_driver); | ||
302 | if (ret) { | ||
303 | printk(KERN_ERR "failed to register pxa27x_pwm_driver\n"); | ||
304 | return ret; | ||
305 | } | ||
306 | |||
307 | return ret; | ||
308 | } | ||
309 | arch_initcall(pwm_init); | ||
310 | |||
311 | static void __exit pwm_exit(void) | ||
312 | { | ||
313 | platform_driver_unregister(&pxa25x_pwm_driver); | ||
314 | platform_driver_unregister(&pxa27x_pwm_driver); | ||
315 | } | ||
316 | module_exit(pwm_exit); | ||
317 | |||
318 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index a425ec71e657..ec68cc16b4e3 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <mach/ohci.h> | 27 | #include <mach/ohci.h> |
28 | #include <mach/pm.h> | 28 | #include <mach/pm.h> |
29 | #include <mach/dma.h> | 29 | #include <mach/dma.h> |
30 | #include <mach/i2c.h> | 30 | #include <plat/i2c.h> |
31 | 31 | ||
32 | #include "generic.h" | 32 | #include "generic.h" |
33 | #include "devices.h" | 33 | #include "devices.h" |
@@ -204,6 +204,23 @@ static struct clk_lookup pxa27x_clkregs[] = { | |||
204 | #define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] | 204 | #define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] |
205 | 205 | ||
206 | /* | 206 | /* |
207 | * allow platforms to override default PWRMODE setting used for PM_SUSPEND_MEM | ||
208 | */ | ||
209 | static unsigned int pwrmode = PWRMODE_SLEEP; | ||
210 | |||
211 | int __init pxa27x_set_pwrmode(unsigned int mode) | ||
212 | { | ||
213 | switch (mode) { | ||
214 | case PWRMODE_SLEEP: | ||
215 | case PWRMODE_DEEPSLEEP: | ||
216 | pwrmode = mode; | ||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | return -EINVAL; | ||
221 | } | ||
222 | |||
223 | /* | ||
207 | * List of global PXA peripheral registers to preserve. | 224 | * List of global PXA peripheral registers to preserve. |
208 | * More ones like CP and general purpose register values are preserved | 225 | * More ones like CP and general purpose register values are preserved |
209 | * with the stack pointer in sleep.S. | 226 | * with the stack pointer in sleep.S. |
@@ -254,7 +271,7 @@ void pxa27x_cpu_pm_enter(suspend_state_t state) | |||
254 | pxa_cpu_standby(); | 271 | pxa_cpu_standby(); |
255 | break; | 272 | break; |
256 | case PM_SUSPEND_MEM: | 273 | case PM_SUSPEND_MEM: |
257 | pxa27x_cpu_suspend(PWRMODE_SLEEP); | 274 | pxa27x_cpu_suspend(pwrmode); |
258 | break; | 275 | break; |
259 | } | 276 | } |
260 | } | 277 | } |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index b02d4544dc95..6f678d93bf4e 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <mach/pm.h> | 30 | #include <mach/pm.h> |
31 | #include <mach/dma.h> | 31 | #include <mach/dma.h> |
32 | #include <mach/ssp.h> | 32 | #include <mach/ssp.h> |
33 | #include <mach/i2c.h> | 33 | #include <plat/i2c.h> |
34 | 34 | ||
35 | #include "generic.h" | 35 | #include "generic.h" |
36 | #include "devices.h" | 36 | #include "devices.h" |
@@ -552,7 +552,7 @@ void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info) | |||
552 | } | 552 | } |
553 | 553 | ||
554 | static struct platform_device *devices[] __initdata = { | 554 | static struct platform_device *devices[] __initdata = { |
555 | /* &pxa_device_udc, The UDC driver is PXA25x only */ | 555 | &pxa27x_device_udc, |
556 | &pxa_device_ffuart, | 556 | &pxa_device_ffuart, |
557 | &pxa_device_btuart, | 557 | &pxa_device_btuart, |
558 | &pxa_device_stuart, | 558 | &pxa_device_stuart, |
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c index ff8239991430..8241a63ea589 100644 --- a/arch/arm/mach-pxa/saar.c +++ b/arch/arm/mach-pxa/saar.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
28 | 28 | ||
29 | #include <mach/pxa930.h> | 29 | #include <mach/pxa930.h> |
30 | #include <mach/i2c.h> | 30 | #include <plat/i2c.h> |
31 | #include <mach/pxafb.h> | 31 | #include <mach/pxafb.h> |
32 | 32 | ||
33 | #include "devices.h" | 33 | #include "devices.h" |
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h index 047909a76651..55259f4756c8 100644 --- a/arch/arm/mach-pxa/sharpsl.h +++ b/arch/arm/mach-pxa/sharpsl.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <asm/hardware/sharpsl_pm.h> | 10 | #include <mach/sharpsl_pm.h> |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * SharpSL SSP Driver | 13 | * SharpSL SSP Driver |
@@ -44,8 +44,6 @@ void corgi_lcdtg_hw_init(int mode); | |||
44 | 44 | ||
45 | extern struct battery_thresh spitz_battery_levels_acin[]; | 45 | extern struct battery_thresh spitz_battery_levels_acin[]; |
46 | extern struct battery_thresh spitz_battery_levels_noac[]; | 46 | extern struct battery_thresh spitz_battery_levels_noac[]; |
47 | void sharpsl_pm_pxa_init(void); | ||
48 | void sharpsl_pm_pxa_remove(void); | ||
49 | int sharpsl_pm_pxa_read_max1111(int channel); | 47 | int sharpsl_pm_pxa_read_max1111(int channel); |
50 | 48 | ||
51 | 49 | ||
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index 16b4ec67e3b6..2546c066cd6e 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c | |||
@@ -15,20 +15,69 @@ | |||
15 | #undef DEBUG | 15 | #undef DEBUG |
16 | 16 | ||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/init.h> | ||
19 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
20 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
21 | #include <linux/irq.h> | ||
22 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
23 | #include <linux/apm-emulation.h> | 21 | #include <linux/apm-emulation.h> |
22 | #include <linux/timer.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/leds.h> | ||
25 | #include <linux/suspend.h> | ||
26 | #include <linux/gpio.h> | ||
24 | 27 | ||
25 | #include <mach/hardware.h> | ||
26 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
27 | #include <mach/pm.h> | 29 | #include <mach/pm.h> |
30 | #include <mach/pxa2xx-regs.h> | ||
28 | #include <mach/pxa2xx-gpio.h> | 31 | #include <mach/pxa2xx-gpio.h> |
32 | #include <mach/regs-rtc.h> | ||
29 | #include <mach/sharpsl.h> | 33 | #include <mach/sharpsl.h> |
34 | #include <mach/sharpsl_pm.h> | ||
35 | |||
30 | #include "sharpsl.h" | 36 | #include "sharpsl.h" |
31 | 37 | ||
38 | /* | ||
39 | * Constants | ||
40 | */ | ||
41 | #define SHARPSL_CHARGE_ON_TIME_INTERVAL (msecs_to_jiffies(1*60*1000)) /* 1 min */ | ||
42 | #define SHARPSL_CHARGE_FINISH_TIME (msecs_to_jiffies(10*60*1000)) /* 10 min */ | ||
43 | #define SHARPSL_BATCHK_TIME (msecs_to_jiffies(15*1000)) /* 15 sec */ | ||
44 | #define SHARPSL_BATCHK_TIME_SUSPEND (60*10) /* 10 min */ | ||
45 | |||
46 | #define SHARPSL_WAIT_CO_TIME 15 /* 15 sec */ | ||
47 | #define SHARPSL_WAIT_DISCHARGE_ON 100 /* 100 msec */ | ||
48 | #define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */ | ||
49 | #define SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT 10 /* 10 msec */ | ||
50 | #define SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN 10 /* 10 msec */ | ||
51 | #define SHARPSL_CHARGE_WAIT_TIME 15 /* 15 msec */ | ||
52 | #define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */ | ||
53 | #define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */ | ||
54 | |||
55 | /* | ||
56 | * Prototypes | ||
57 | */ | ||
58 | #ifdef CONFIG_PM | ||
59 | static int sharpsl_off_charge_battery(void); | ||
60 | static int sharpsl_check_battery_voltage(void); | ||
61 | static int sharpsl_fatal_check(void); | ||
62 | #endif | ||
63 | static int sharpsl_check_battery_temp(void); | ||
64 | static int sharpsl_ac_check(void); | ||
65 | static int sharpsl_average_value(int ad); | ||
66 | static void sharpsl_average_clear(void); | ||
67 | static void sharpsl_charge_toggle(struct work_struct *private_); | ||
68 | static void sharpsl_battery_thread(struct work_struct *private_); | ||
69 | |||
70 | |||
71 | /* | ||
72 | * Variables | ||
73 | */ | ||
74 | struct sharpsl_pm_status sharpsl_pm; | ||
75 | static DECLARE_DELAYED_WORK(toggle_charger, sharpsl_charge_toggle); | ||
76 | static DECLARE_DELAYED_WORK(sharpsl_bat, sharpsl_battery_thread); | ||
77 | DEFINE_LED_TRIGGER(sharpsl_charge_led_trigger); | ||
78 | |||
79 | |||
80 | |||
32 | struct battery_thresh spitz_battery_levels_acin[] = { | 81 | struct battery_thresh spitz_battery_levels_acin[] = { |
33 | { 213, 100}, | 82 | { 213, 100}, |
34 | { 212, 98}, | 83 | { 212, 98}, |
@@ -144,42 +193,789 @@ int sharpsl_pm_pxa_read_max1111(int channel) | |||
144 | #endif | 193 | #endif |
145 | } | 194 | } |
146 | 195 | ||
147 | void sharpsl_pm_pxa_init(void) | 196 | static int get_percentage(int voltage) |
197 | { | ||
198 | int i = sharpsl_pm.machinfo->bat_levels - 1; | ||
199 | int bl_status = sharpsl_pm.machinfo->backlight_get_status ? sharpsl_pm.machinfo->backlight_get_status() : 0; | ||
200 | struct battery_thresh *thresh; | ||
201 | |||
202 | if (sharpsl_pm.charge_mode == CHRG_ON) | ||
203 | thresh = bl_status ? sharpsl_pm.machinfo->bat_levels_acin_bl : sharpsl_pm.machinfo->bat_levels_acin; | ||
204 | else | ||
205 | thresh = bl_status ? sharpsl_pm.machinfo->bat_levels_noac_bl : sharpsl_pm.machinfo->bat_levels_noac; | ||
206 | |||
207 | while (i > 0 && (voltage > thresh[i].voltage)) | ||
208 | i--; | ||
209 | |||
210 | return thresh[i].percentage; | ||
211 | } | ||
212 | |||
213 | static int get_apm_status(int voltage) | ||
214 | { | ||
215 | int low_thresh, high_thresh; | ||
216 | |||
217 | if (sharpsl_pm.charge_mode == CHRG_ON) { | ||
218 | high_thresh = sharpsl_pm.machinfo->status_high_acin; | ||
219 | low_thresh = sharpsl_pm.machinfo->status_low_acin; | ||
220 | } else { | ||
221 | high_thresh = sharpsl_pm.machinfo->status_high_noac; | ||
222 | low_thresh = sharpsl_pm.machinfo->status_low_noac; | ||
223 | } | ||
224 | |||
225 | if (voltage >= high_thresh) | ||
226 | return APM_BATTERY_STATUS_HIGH; | ||
227 | if (voltage >= low_thresh) | ||
228 | return APM_BATTERY_STATUS_LOW; | ||
229 | return APM_BATTERY_STATUS_CRITICAL; | ||
230 | } | ||
231 | |||
232 | void sharpsl_battery_kick(void) | ||
233 | { | ||
234 | schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(125)); | ||
235 | } | ||
236 | EXPORT_SYMBOL(sharpsl_battery_kick); | ||
237 | |||
238 | |||
239 | static void sharpsl_battery_thread(struct work_struct *private_) | ||
240 | { | ||
241 | int voltage, percent, apm_status, i = 0; | ||
242 | |||
243 | if (!sharpsl_pm.machinfo) | ||
244 | return; | ||
245 | |||
246 | sharpsl_pm.battstat.ac_status = (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN) ? APM_AC_ONLINE : APM_AC_OFFLINE); | ||
247 | |||
248 | /* Corgi cannot confirm when battery fully charged so periodically kick! */ | ||
249 | if (!sharpsl_pm.machinfo->batfull_irq && (sharpsl_pm.charge_mode == CHRG_ON) | ||
250 | && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL)) | ||
251 | schedule_delayed_work(&toggle_charger, 0); | ||
252 | |||
253 | while(1) { | ||
254 | voltage = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT); | ||
255 | |||
256 | if (voltage > 0) break; | ||
257 | if (i++ > 5) { | ||
258 | voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage; | ||
259 | dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n"); | ||
260 | break; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | voltage = sharpsl_average_value(voltage); | ||
265 | apm_status = get_apm_status(voltage); | ||
266 | percent = get_percentage(voltage); | ||
267 | |||
268 | /* At low battery voltages, the voltage has a tendency to start | ||
269 | creeping back up so we try to avoid this here */ | ||
270 | if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE) || (apm_status == APM_BATTERY_STATUS_HIGH) || percent <= sharpsl_pm.battstat.mainbat_percent) { | ||
271 | sharpsl_pm.battstat.mainbat_voltage = voltage; | ||
272 | sharpsl_pm.battstat.mainbat_status = apm_status; | ||
273 | sharpsl_pm.battstat.mainbat_percent = percent; | ||
274 | } | ||
275 | |||
276 | dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %ld\n", voltage, | ||
277 | sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies); | ||
278 | |||
279 | #ifdef CONFIG_BACKLIGHT_CORGI | ||
280 | /* If battery is low. limit backlight intensity to save power. */ | ||
281 | if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE) | ||
282 | && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) || | ||
283 | (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) { | ||
284 | if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) { | ||
285 | sharpsl_pm.machinfo->backlight_limit(1); | ||
286 | sharpsl_pm.flags |= SHARPSL_BL_LIMIT; | ||
287 | } | ||
288 | } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) { | ||
289 | sharpsl_pm.machinfo->backlight_limit(0); | ||
290 | sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT; | ||
291 | } | ||
292 | #endif | ||
293 | |||
294 | /* Suspend if critical battery level */ | ||
295 | if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE) | ||
296 | && (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL) | ||
297 | && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) { | ||
298 | sharpsl_pm.flags |= SHARPSL_APM_QUEUED; | ||
299 | dev_err(sharpsl_pm.dev, "Fatal Off\n"); | ||
300 | apm_queue_event(APM_CRITICAL_SUSPEND); | ||
301 | } | ||
302 | |||
303 | schedule_delayed_work(&sharpsl_bat, SHARPSL_BATCHK_TIME); | ||
304 | } | ||
305 | |||
306 | void sharpsl_pm_led(int val) | ||
307 | { | ||
308 | if (val == SHARPSL_LED_ERROR) { | ||
309 | dev_err(sharpsl_pm.dev, "Charging Error!\n"); | ||
310 | } else if (val == SHARPSL_LED_ON) { | ||
311 | dev_dbg(sharpsl_pm.dev, "Charge LED On\n"); | ||
312 | led_trigger_event(sharpsl_charge_led_trigger, LED_FULL); | ||
313 | } else { | ||
314 | dev_dbg(sharpsl_pm.dev, "Charge LED Off\n"); | ||
315 | led_trigger_event(sharpsl_charge_led_trigger, LED_OFF); | ||
316 | } | ||
317 | } | ||
318 | |||
319 | static void sharpsl_charge_on(void) | ||
320 | { | ||
321 | dev_dbg(sharpsl_pm.dev, "Turning Charger On\n"); | ||
322 | |||
323 | sharpsl_pm.full_count = 0; | ||
324 | sharpsl_pm.charge_mode = CHRG_ON; | ||
325 | schedule_delayed_work(&toggle_charger, msecs_to_jiffies(250)); | ||
326 | schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(500)); | ||
327 | } | ||
328 | |||
329 | static void sharpsl_charge_off(void) | ||
330 | { | ||
331 | dev_dbg(sharpsl_pm.dev, "Turning Charger Off\n"); | ||
332 | |||
333 | sharpsl_pm.machinfo->charge(0); | ||
334 | sharpsl_pm_led(SHARPSL_LED_OFF); | ||
335 | sharpsl_pm.charge_mode = CHRG_OFF; | ||
336 | |||
337 | schedule_delayed_work(&sharpsl_bat, 0); | ||
338 | } | ||
339 | |||
340 | static void sharpsl_charge_error(void) | ||
148 | { | 341 | { |
149 | pxa_gpio_mode(sharpsl_pm.machinfo->gpio_acin | GPIO_IN); | 342 | sharpsl_pm_led(SHARPSL_LED_ERROR); |
150 | pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batfull | GPIO_IN); | 343 | sharpsl_pm.machinfo->charge(0); |
151 | pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batlock | GPIO_IN); | 344 | sharpsl_pm.charge_mode = CHRG_ERROR; |
345 | } | ||
346 | |||
347 | static void sharpsl_charge_toggle(struct work_struct *private_) | ||
348 | { | ||
349 | dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies); | ||
350 | |||
351 | if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) { | ||
352 | sharpsl_charge_off(); | ||
353 | return; | ||
354 | } else if ((sharpsl_check_battery_temp() < 0) || (sharpsl_ac_check() < 0)) { | ||
355 | sharpsl_charge_error(); | ||
356 | return; | ||
357 | } | ||
358 | |||
359 | sharpsl_pm_led(SHARPSL_LED_ON); | ||
360 | sharpsl_pm.machinfo->charge(0); | ||
361 | mdelay(SHARPSL_CHARGE_WAIT_TIME); | ||
362 | sharpsl_pm.machinfo->charge(1); | ||
363 | |||
364 | sharpsl_pm.charge_start_time = jiffies; | ||
365 | } | ||
366 | |||
367 | static void sharpsl_ac_timer(unsigned long data) | ||
368 | { | ||
369 | int acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN); | ||
370 | |||
371 | dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin); | ||
372 | |||
373 | sharpsl_average_clear(); | ||
374 | if (acin && (sharpsl_pm.charge_mode != CHRG_ON)) | ||
375 | sharpsl_charge_on(); | ||
376 | else if (sharpsl_pm.charge_mode == CHRG_ON) | ||
377 | sharpsl_charge_off(); | ||
378 | |||
379 | schedule_delayed_work(&sharpsl_bat, 0); | ||
380 | } | ||
381 | |||
382 | |||
383 | static irqreturn_t sharpsl_ac_isr(int irq, void *dev_id) | ||
384 | { | ||
385 | /* Delay the event slightly to debounce */ | ||
386 | /* Must be a smaller delay than the chrg_full_isr below */ | ||
387 | mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250)); | ||
388 | |||
389 | return IRQ_HANDLED; | ||
390 | } | ||
391 | |||
392 | static void sharpsl_chrg_full_timer(unsigned long data) | ||
393 | { | ||
394 | dev_dbg(sharpsl_pm.dev, "Charge Full at time: %lx\n", jiffies); | ||
395 | |||
396 | sharpsl_pm.full_count++; | ||
397 | |||
398 | if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) { | ||
399 | dev_dbg(sharpsl_pm.dev, "Charge Full: AC removed - stop charging!\n"); | ||
400 | if (sharpsl_pm.charge_mode == CHRG_ON) | ||
401 | sharpsl_charge_off(); | ||
402 | } else if (sharpsl_pm.full_count < 2) { | ||
403 | dev_dbg(sharpsl_pm.dev, "Charge Full: Count too low\n"); | ||
404 | schedule_delayed_work(&toggle_charger, 0); | ||
405 | } else if (time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_FINISH_TIME)) { | ||
406 | dev_dbg(sharpsl_pm.dev, "Charge Full: Interrupt generated too slowly - retry.\n"); | ||
407 | schedule_delayed_work(&toggle_charger, 0); | ||
408 | } else { | ||
409 | sharpsl_charge_off(); | ||
410 | sharpsl_pm.charge_mode = CHRG_DONE; | ||
411 | dev_dbg(sharpsl_pm.dev, "Charge Full: Charging Finished\n"); | ||
412 | } | ||
413 | } | ||
414 | |||
415 | /* Charging Finished Interrupt (Not present on Corgi) */ | ||
416 | /* Can trigger at the same time as an AC status change so | ||
417 | delay until after that has been processed */ | ||
418 | static irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id) | ||
419 | { | ||
420 | if (sharpsl_pm.flags & SHARPSL_SUSPENDED) | ||
421 | return IRQ_HANDLED; | ||
422 | |||
423 | /* delay until after any ac interrupt */ | ||
424 | mod_timer(&sharpsl_pm.chrg_full_timer, jiffies + msecs_to_jiffies(500)); | ||
425 | |||
426 | return IRQ_HANDLED; | ||
427 | } | ||
428 | |||
429 | static irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id) | ||
430 | { | ||
431 | int is_fatal = 0; | ||
432 | |||
433 | if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_LOCK)) { | ||
434 | dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n"); | ||
435 | is_fatal = 1; | ||
436 | } | ||
437 | |||
438 | if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_FATAL)) { | ||
439 | dev_err(sharpsl_pm.dev, "Fatal Batt Error! Suspending.\n"); | ||
440 | is_fatal = 1; | ||
441 | } | ||
442 | |||
443 | if (!(sharpsl_pm.flags & SHARPSL_APM_QUEUED) && is_fatal) { | ||
444 | sharpsl_pm.flags |= SHARPSL_APM_QUEUED; | ||
445 | apm_queue_event(APM_CRITICAL_SUSPEND); | ||
446 | } | ||
447 | |||
448 | return IRQ_HANDLED; | ||
449 | } | ||
450 | |||
451 | /* | ||
452 | * Maintain an average of the last 10 readings | ||
453 | */ | ||
454 | #define SHARPSL_CNV_VALUE_NUM 10 | ||
455 | static int sharpsl_ad_index; | ||
456 | |||
457 | static void sharpsl_average_clear(void) | ||
458 | { | ||
459 | sharpsl_ad_index = 0; | ||
460 | } | ||
461 | |||
462 | static int sharpsl_average_value(int ad) | ||
463 | { | ||
464 | int i, ad_val = 0; | ||
465 | static int sharpsl_ad[SHARPSL_CNV_VALUE_NUM+1]; | ||
466 | |||
467 | if (sharpsl_pm.battstat.mainbat_status != APM_BATTERY_STATUS_HIGH) { | ||
468 | sharpsl_ad_index = 0; | ||
469 | return ad; | ||
470 | } | ||
471 | |||
472 | sharpsl_ad[sharpsl_ad_index] = ad; | ||
473 | sharpsl_ad_index++; | ||
474 | if (sharpsl_ad_index >= SHARPSL_CNV_VALUE_NUM) { | ||
475 | for (i=0; i < (SHARPSL_CNV_VALUE_NUM-1); i++) | ||
476 | sharpsl_ad[i] = sharpsl_ad[i+1]; | ||
477 | sharpsl_ad_index = SHARPSL_CNV_VALUE_NUM - 1; | ||
478 | } | ||
479 | for (i=0; i < sharpsl_ad_index; i++) | ||
480 | ad_val += sharpsl_ad[i]; | ||
481 | |||
482 | return (ad_val / sharpsl_ad_index); | ||
483 | } | ||
484 | |||
485 | /* | ||
486 | * Take an array of 5 integers, remove the maximum and minimum values | ||
487 | * and return the average. | ||
488 | */ | ||
489 | static int get_select_val(int *val) | ||
490 | { | ||
491 | int i, j, k, temp, sum = 0; | ||
492 | |||
493 | /* Find MAX val */ | ||
494 | temp = val[0]; | ||
495 | j=0; | ||
496 | for (i=1; i<5; i++) { | ||
497 | if (temp < val[i]) { | ||
498 | temp = val[i]; | ||
499 | j = i; | ||
500 | } | ||
501 | } | ||
502 | |||
503 | /* Find MIN val */ | ||
504 | temp = val[4]; | ||
505 | k=4; | ||
506 | for (i=3; i>=0; i--) { | ||
507 | if (temp > val[i]) { | ||
508 | temp = val[i]; | ||
509 | k = i; | ||
510 | } | ||
511 | } | ||
512 | |||
513 | for (i=0; i<5; i++) | ||
514 | if (i != j && i != k ) | ||
515 | sum += val[i]; | ||
516 | |||
517 | dev_dbg(sharpsl_pm.dev, "Average: %d from values: %d, %d, %d, %d, %d\n", sum/3, val[0], val[1], val[2], val[3], val[4]); | ||
518 | |||
519 | return (sum/3); | ||
520 | } | ||
521 | |||
522 | static int sharpsl_check_battery_temp(void) | ||
523 | { | ||
524 | int val, i, buff[5]; | ||
525 | |||
526 | /* Check battery temperature */ | ||
527 | for (i=0; i<5; i++) { | ||
528 | mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP); | ||
529 | sharpsl_pm.machinfo->measure_temp(1); | ||
530 | mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP); | ||
531 | buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_TEMP); | ||
532 | sharpsl_pm.machinfo->measure_temp(0); | ||
533 | } | ||
534 | |||
535 | val = get_select_val(buff); | ||
536 | |||
537 | dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val); | ||
538 | if (val > sharpsl_pm.machinfo->charge_on_temp) { | ||
539 | printk(KERN_WARNING "Not charging: temperature out of limits.\n"); | ||
540 | return -1; | ||
541 | } | ||
542 | |||
543 | return 0; | ||
544 | } | ||
545 | |||
546 | #ifdef CONFIG_PM | ||
547 | static int sharpsl_check_battery_voltage(void) | ||
548 | { | ||
549 | int val, i, buff[5]; | ||
550 | |||
551 | /* disable charge, enable discharge */ | ||
552 | sharpsl_pm.machinfo->charge(0); | ||
553 | sharpsl_pm.machinfo->discharge(1); | ||
554 | mdelay(SHARPSL_WAIT_DISCHARGE_ON); | ||
555 | |||
556 | if (sharpsl_pm.machinfo->discharge1) | ||
557 | sharpsl_pm.machinfo->discharge1(1); | ||
558 | |||
559 | /* Check battery voltage */ | ||
560 | for (i=0; i<5; i++) { | ||
561 | buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT); | ||
562 | mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT); | ||
563 | } | ||
564 | |||
565 | if (sharpsl_pm.machinfo->discharge1) | ||
566 | sharpsl_pm.machinfo->discharge1(0); | ||
567 | |||
568 | sharpsl_pm.machinfo->discharge(0); | ||
569 | |||
570 | val = get_select_val(buff); | ||
571 | dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val); | ||
572 | |||
573 | if (val < sharpsl_pm.machinfo->charge_on_volt) | ||
574 | return -1; | ||
575 | |||
576 | return 0; | ||
577 | } | ||
578 | #endif | ||
579 | |||
580 | static int sharpsl_ac_check(void) | ||
581 | { | ||
582 | int temp, i, buff[5]; | ||
583 | |||
584 | for (i=0; i<5; i++) { | ||
585 | buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_ACIN_VOLT); | ||
586 | mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN); | ||
587 | } | ||
588 | |||
589 | temp = get_select_val(buff); | ||
590 | dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp); | ||
591 | |||
592 | if ((temp > sharpsl_pm.machinfo->charge_acin_high) || (temp < sharpsl_pm.machinfo->charge_acin_low)) { | ||
593 | dev_err(sharpsl_pm.dev, "Error: AC check failed.\n"); | ||
594 | return -1; | ||
595 | } | ||
596 | |||
597 | return 0; | ||
598 | } | ||
599 | |||
600 | #ifdef CONFIG_PM | ||
601 | static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state) | ||
602 | { | ||
603 | sharpsl_pm.flags |= SHARPSL_SUSPENDED; | ||
604 | flush_scheduled_work(); | ||
605 | |||
606 | if (sharpsl_pm.charge_mode == CHRG_ON) | ||
607 | sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG; | ||
608 | else | ||
609 | sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG; | ||
610 | |||
611 | return 0; | ||
612 | } | ||
613 | |||
614 | static int sharpsl_pm_resume(struct platform_device *pdev) | ||
615 | { | ||
616 | /* Clear the reset source indicators as they break the bootloader upon reboot */ | ||
617 | RCSR = 0x0f; | ||
618 | sharpsl_average_clear(); | ||
619 | sharpsl_pm.flags &= ~SHARPSL_APM_QUEUED; | ||
620 | sharpsl_pm.flags &= ~SHARPSL_SUSPENDED; | ||
621 | |||
622 | return 0; | ||
623 | } | ||
624 | |||
625 | static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state) | ||
626 | { | ||
627 | dev_dbg(sharpsl_pm.dev, "Time is: %08x\n",RCNR); | ||
628 | |||
629 | dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG); | ||
630 | /* not charging and AC-IN! */ | ||
631 | |||
632 | if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN))) { | ||
633 | dev_dbg(sharpsl_pm.dev, "Activating Offline Charger...\n"); | ||
634 | sharpsl_pm.charge_mode = CHRG_OFF; | ||
635 | sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG; | ||
636 | sharpsl_off_charge_battery(); | ||
637 | } | ||
638 | |||
639 | sharpsl_pm.machinfo->presuspend(); | ||
640 | |||
641 | PEDR = 0xffffffff; /* clear it */ | ||
642 | |||
643 | sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE; | ||
644 | if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) { | ||
645 | RTSR &= RTSR_ALE; | ||
646 | RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND; | ||
647 | dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n",RTAR); | ||
648 | sharpsl_pm.flags |= SHARPSL_ALARM_ACTIVE; | ||
649 | } else if (alarm_enable) { | ||
650 | RTSR &= RTSR_ALE; | ||
651 | RTAR = alarm_time; | ||
652 | dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n",RTAR); | ||
653 | } else { | ||
654 | dev_dbg(sharpsl_pm.dev, "No alarms set.\n"); | ||
655 | } | ||
656 | |||
657 | pxa_pm_enter(state); | ||
658 | |||
659 | sharpsl_pm.machinfo->postsuspend(); | ||
660 | |||
661 | dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",PEDR); | ||
662 | } | ||
663 | |||
664 | static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state) | ||
665 | { | ||
666 | if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable) ) | ||
667 | { | ||
668 | if (!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE)) { | ||
669 | dev_dbg(sharpsl_pm.dev, "No user triggered wakeup events and not charging. Strange. Suspend.\n"); | ||
670 | corgi_goto_sleep(alarm_time, alarm_enable, state); | ||
671 | return 1; | ||
672 | } | ||
673 | if(sharpsl_off_charge_battery()) { | ||
674 | dev_dbg(sharpsl_pm.dev, "Charging. Suspend...\n"); | ||
675 | corgi_goto_sleep(alarm_time, alarm_enable, state); | ||
676 | return 1; | ||
677 | } | ||
678 | dev_dbg(sharpsl_pm.dev, "User triggered wakeup in offline charger.\n"); | ||
679 | } | ||
680 | |||
681 | if ((!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_LOCK)) || (sharpsl_fatal_check() < 0) ) | ||
682 | { | ||
683 | dev_err(sharpsl_pm.dev, "Fatal condition. Suspend.\n"); | ||
684 | corgi_goto_sleep(alarm_time, alarm_enable, state); | ||
685 | return 1; | ||
686 | } | ||
687 | |||
688 | return 0; | ||
689 | } | ||
690 | |||
691 | static int corgi_pxa_pm_enter(suspend_state_t state) | ||
692 | { | ||
693 | unsigned long alarm_time = RTAR; | ||
694 | unsigned int alarm_status = ((RTSR & RTSR_ALE) != 0); | ||
695 | |||
696 | dev_dbg(sharpsl_pm.dev, "SharpSL suspending for first time.\n"); | ||
697 | |||
698 | corgi_goto_sleep(alarm_time, alarm_status, state); | ||
699 | |||
700 | while (corgi_enter_suspend(alarm_time,alarm_status,state)) | ||
701 | {} | ||
702 | |||
703 | if (sharpsl_pm.machinfo->earlyresume) | ||
704 | sharpsl_pm.machinfo->earlyresume(); | ||
705 | |||
706 | dev_dbg(sharpsl_pm.dev, "SharpSL resuming...\n"); | ||
707 | |||
708 | return 0; | ||
709 | } | ||
710 | |||
711 | /* | ||
712 | * Check for fatal battery errors | ||
713 | * Fatal returns -1 | ||
714 | */ | ||
715 | static int sharpsl_fatal_check(void) | ||
716 | { | ||
717 | int buff[5], temp, i, acin; | ||
718 | |||
719 | dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n"); | ||
720 | |||
721 | /* Check AC-Adapter */ | ||
722 | acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN); | ||
723 | |||
724 | if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) { | ||
725 | sharpsl_pm.machinfo->charge(0); | ||
726 | udelay(100); | ||
727 | sharpsl_pm.machinfo->discharge(1); /* enable discharge */ | ||
728 | mdelay(SHARPSL_WAIT_DISCHARGE_ON); | ||
729 | } | ||
730 | |||
731 | if (sharpsl_pm.machinfo->discharge1) | ||
732 | sharpsl_pm.machinfo->discharge1(1); | ||
733 | |||
734 | /* Check battery : check inserting battery ? */ | ||
735 | for (i=0; i<5; i++) { | ||
736 | buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT); | ||
737 | mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT); | ||
738 | } | ||
739 | |||
740 | if (sharpsl_pm.machinfo->discharge1) | ||
741 | sharpsl_pm.machinfo->discharge1(0); | ||
742 | |||
743 | if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) { | ||
744 | udelay(100); | ||
745 | sharpsl_pm.machinfo->charge(1); | ||
746 | sharpsl_pm.machinfo->discharge(0); | ||
747 | } | ||
748 | |||
749 | temp = get_select_val(buff); | ||
750 | dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %ld\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT)); | ||
751 | |||
752 | if ((acin && (temp < sharpsl_pm.machinfo->fatal_acin_volt)) || | ||
753 | (!acin && (temp < sharpsl_pm.machinfo->fatal_noacin_volt))) | ||
754 | return -1; | ||
755 | return 0; | ||
756 | } | ||
757 | |||
758 | static int sharpsl_off_charge_error(void) | ||
759 | { | ||
760 | dev_err(sharpsl_pm.dev, "Offline Charger: Error occurred.\n"); | ||
761 | sharpsl_pm.machinfo->charge(0); | ||
762 | sharpsl_pm_led(SHARPSL_LED_ERROR); | ||
763 | sharpsl_pm.charge_mode = CHRG_ERROR; | ||
764 | return 1; | ||
765 | } | ||
766 | |||
767 | /* | ||
768 | * Charging Control while suspended | ||
769 | * Return 1 - go straight to sleep | ||
770 | * Return 0 - sleep or wakeup depending on other factors | ||
771 | */ | ||
772 | static int sharpsl_off_charge_battery(void) | ||
773 | { | ||
774 | int time; | ||
775 | |||
776 | dev_dbg(sharpsl_pm.dev, "Charge Mode: %d\n", sharpsl_pm.charge_mode); | ||
777 | |||
778 | if (sharpsl_pm.charge_mode == CHRG_OFF) { | ||
779 | dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 1\n"); | ||
780 | |||
781 | /* AC Check */ | ||
782 | if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery_temp() < 0)) | ||
783 | return sharpsl_off_charge_error(); | ||
784 | |||
785 | /* Start Charging */ | ||
786 | sharpsl_pm_led(SHARPSL_LED_ON); | ||
787 | sharpsl_pm.machinfo->charge(0); | ||
788 | mdelay(SHARPSL_CHARGE_WAIT_TIME); | ||
789 | sharpsl_pm.machinfo->charge(1); | ||
790 | |||
791 | sharpsl_pm.charge_mode = CHRG_ON; | ||
792 | sharpsl_pm.full_count = 0; | ||
793 | |||
794 | return 1; | ||
795 | } else if (sharpsl_pm.charge_mode != CHRG_ON) { | ||
796 | return 1; | ||
797 | } | ||
798 | |||
799 | if (sharpsl_pm.full_count == 0) { | ||
800 | int time; | ||
801 | |||
802 | dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 2\n"); | ||
803 | |||
804 | if ((sharpsl_check_battery_temp() < 0) || (sharpsl_check_battery_voltage() < 0)) | ||
805 | return sharpsl_off_charge_error(); | ||
806 | |||
807 | sharpsl_pm.machinfo->charge(0); | ||
808 | mdelay(SHARPSL_CHARGE_WAIT_TIME); | ||
809 | sharpsl_pm.machinfo->charge(1); | ||
810 | sharpsl_pm.charge_mode = CHRG_ON; | ||
811 | |||
812 | mdelay(SHARPSL_CHARGE_CO_CHECK_TIME); | ||
813 | |||
814 | time = RCNR; | ||
815 | while(1) { | ||
816 | /* Check if any wakeup event had occurred */ | ||
817 | if (sharpsl_pm.machinfo->charger_wakeup() != 0) | ||
818 | return 0; | ||
819 | /* Check for timeout */ | ||
820 | if ((RCNR - time) > SHARPSL_WAIT_CO_TIME) | ||
821 | return 1; | ||
822 | if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_CHRGFULL)) { | ||
823 | dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occurred. Retrying to check\n"); | ||
824 | sharpsl_pm.full_count++; | ||
825 | sharpsl_pm.machinfo->charge(0); | ||
826 | mdelay(SHARPSL_CHARGE_WAIT_TIME); | ||
827 | sharpsl_pm.machinfo->charge(1); | ||
828 | return 1; | ||
829 | } | ||
830 | } | ||
831 | } | ||
832 | |||
833 | dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 3\n"); | ||
834 | |||
835 | mdelay(SHARPSL_CHARGE_CO_CHECK_TIME); | ||
836 | |||
837 | time = RCNR; | ||
838 | while(1) { | ||
839 | /* Check if any wakeup event had occurred */ | ||
840 | if (sharpsl_pm.machinfo->charger_wakeup() != 0) | ||
841 | return 0; | ||
842 | /* Check for timeout */ | ||
843 | if ((RCNR-time) > SHARPSL_WAIT_CO_TIME) { | ||
844 | if (sharpsl_pm.full_count > SHARPSL_CHARGE_RETRY_CNT) { | ||
845 | dev_dbg(sharpsl_pm.dev, "Offline Charger: Not charged sufficiently. Retrying.\n"); | ||
846 | sharpsl_pm.full_count = 0; | ||
847 | } | ||
848 | sharpsl_pm.full_count++; | ||
849 | return 1; | ||
850 | } | ||
851 | if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_CHRGFULL)) { | ||
852 | dev_dbg(sharpsl_pm.dev, "Offline Charger: Charging complete.\n"); | ||
853 | sharpsl_pm_led(SHARPSL_LED_OFF); | ||
854 | sharpsl_pm.machinfo->charge(0); | ||
855 | sharpsl_pm.charge_mode = CHRG_DONE; | ||
856 | return 1; | ||
857 | } | ||
858 | } | ||
859 | } | ||
860 | #else | ||
861 | #define sharpsl_pm_suspend NULL | ||
862 | #define sharpsl_pm_resume NULL | ||
863 | #endif | ||
864 | |||
865 | static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
866 | { | ||
867 | return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_percent); | ||
868 | } | ||
869 | |||
870 | static ssize_t battery_voltage_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
871 | { | ||
872 | return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_voltage); | ||
873 | } | ||
874 | |||
875 | static DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL); | ||
876 | static DEVICE_ATTR(battery_voltage, 0444, battery_voltage_show, NULL); | ||
877 | |||
878 | extern void (*apm_get_power_status)(struct apm_power_info *); | ||
879 | |||
880 | static void sharpsl_apm_get_power_status(struct apm_power_info *info) | ||
881 | { | ||
882 | info->ac_line_status = sharpsl_pm.battstat.ac_status; | ||
883 | |||
884 | if (sharpsl_pm.charge_mode == CHRG_ON) | ||
885 | info->battery_status = APM_BATTERY_STATUS_CHARGING; | ||
886 | else | ||
887 | info->battery_status = sharpsl_pm.battstat.mainbat_status; | ||
888 | |||
889 | info->battery_flag = (1 << info->battery_status); | ||
890 | info->battery_life = sharpsl_pm.battstat.mainbat_percent; | ||
891 | } | ||
892 | |||
893 | #ifdef CONFIG_PM | ||
894 | static struct platform_suspend_ops sharpsl_pm_ops = { | ||
895 | .prepare = pxa_pm_prepare, | ||
896 | .finish = pxa_pm_finish, | ||
897 | .enter = corgi_pxa_pm_enter, | ||
898 | .valid = suspend_valid_only_mem, | ||
899 | }; | ||
900 | #endif | ||
901 | |||
902 | static int __init sharpsl_pm_probe(struct platform_device *pdev) | ||
903 | { | ||
904 | int ret; | ||
905 | |||
906 | if (!pdev->dev.platform_data) | ||
907 | return -EINVAL; | ||
908 | |||
909 | sharpsl_pm.dev = &pdev->dev; | ||
910 | sharpsl_pm.machinfo = pdev->dev.platform_data; | ||
911 | sharpsl_pm.charge_mode = CHRG_OFF; | ||
912 | sharpsl_pm.flags = 0; | ||
913 | |||
914 | init_timer(&sharpsl_pm.ac_timer); | ||
915 | sharpsl_pm.ac_timer.function = sharpsl_ac_timer; | ||
916 | |||
917 | init_timer(&sharpsl_pm.chrg_full_timer); | ||
918 | sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer; | ||
919 | |||
920 | led_trigger_register_simple("sharpsl-charge", &sharpsl_charge_led_trigger); | ||
921 | |||
922 | sharpsl_pm.machinfo->init(); | ||
923 | |||
924 | gpio_request(sharpsl_pm.machinfo->gpio_acin, "AC IN"); | ||
925 | gpio_direction_input(sharpsl_pm.machinfo->gpio_acin); | ||
926 | gpio_request(sharpsl_pm.machinfo->gpio_batfull, "Battery Full"); | ||
927 | gpio_direction_input(sharpsl_pm.machinfo->gpio_batfull); | ||
928 | gpio_request(sharpsl_pm.machinfo->gpio_batlock, "Battery Lock"); | ||
929 | gpio_direction_input(sharpsl_pm.machinfo->gpio_batlock); | ||
152 | 930 | ||
153 | /* Register interrupt handlers */ | 931 | /* Register interrupt handlers */ |
154 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr, IRQF_DISABLED, "AC Input Detect", sharpsl_ac_isr)) { | 932 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) { |
155 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin)); | 933 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin)); |
156 | } | 934 | } |
157 | else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin),IRQ_TYPE_EDGE_BOTH); | ||
158 | 935 | ||
159 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr, IRQF_DISABLED, "Battery Cover", sharpsl_fatal_isr)) { | 936 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) { |
160 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock)); | 937 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock)); |
161 | } | 938 | } |
162 | else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock),IRQ_TYPE_EDGE_FALLING); | ||
163 | 939 | ||
164 | if (sharpsl_pm.machinfo->gpio_fatal) { | 940 | if (sharpsl_pm.machinfo->gpio_fatal) { |
165 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr, IRQF_DISABLED, "Fatal Battery", sharpsl_fatal_isr)) { | 941 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) { |
166 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal)); | 942 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal)); |
167 | } | 943 | } |
168 | else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal),IRQ_TYPE_EDGE_FALLING); | ||
169 | } | 944 | } |
170 | 945 | ||
171 | if (sharpsl_pm.machinfo->batfull_irq) | 946 | if (sharpsl_pm.machinfo->batfull_irq) |
172 | { | 947 | { |
173 | /* Register interrupt handler. */ | 948 | /* Register interrupt handler. */ |
174 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED, "CO", sharpsl_chrg_full_isr)) { | 949 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) { |
175 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull)); | 950 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull)); |
176 | } | 951 | } |
177 | else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull),IRQ_TYPE_EDGE_RISING); | ||
178 | } | 952 | } |
953 | |||
954 | ret = device_create_file(&pdev->dev, &dev_attr_battery_percentage); | ||
955 | ret |= device_create_file(&pdev->dev, &dev_attr_battery_voltage); | ||
956 | if (ret != 0) | ||
957 | dev_warn(&pdev->dev, "Failed to register attributes (%d)\n", ret); | ||
958 | |||
959 | apm_get_power_status = sharpsl_apm_get_power_status; | ||
960 | |||
961 | #ifdef CONFIG_PM | ||
962 | suspend_set_ops(&sharpsl_pm_ops); | ||
963 | #endif | ||
964 | |||
965 | mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250)); | ||
966 | |||
967 | return 0; | ||
179 | } | 968 | } |
180 | 969 | ||
181 | void sharpsl_pm_pxa_remove(void) | 970 | static int sharpsl_pm_remove(struct platform_device *pdev) |
182 | { | 971 | { |
972 | suspend_set_ops(NULL); | ||
973 | |||
974 | device_remove_file(&pdev->dev, &dev_attr_battery_percentage); | ||
975 | device_remove_file(&pdev->dev, &dev_attr_battery_voltage); | ||
976 | |||
977 | led_trigger_unregister_simple(sharpsl_charge_led_trigger); | ||
978 | |||
183 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr); | 979 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr); |
184 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr); | 980 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr); |
185 | 981 | ||
@@ -188,4 +984,39 @@ void sharpsl_pm_pxa_remove(void) | |||
188 | 984 | ||
189 | if (sharpsl_pm.machinfo->batfull_irq) | 985 | if (sharpsl_pm.machinfo->batfull_irq) |
190 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr); | 986 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr); |
987 | |||
988 | gpio_free(sharpsl_pm.machinfo->gpio_batlock); | ||
989 | gpio_free(sharpsl_pm.machinfo->gpio_batfull); | ||
990 | gpio_free(sharpsl_pm.machinfo->gpio_acin); | ||
991 | |||
992 | if (sharpsl_pm.machinfo->exit) | ||
993 | sharpsl_pm.machinfo->exit(); | ||
994 | |||
995 | del_timer_sync(&sharpsl_pm.chrg_full_timer); | ||
996 | del_timer_sync(&sharpsl_pm.ac_timer); | ||
997 | |||
998 | return 0; | ||
191 | } | 999 | } |
1000 | |||
1001 | static struct platform_driver sharpsl_pm_driver = { | ||
1002 | .probe = sharpsl_pm_probe, | ||
1003 | .remove = sharpsl_pm_remove, | ||
1004 | .suspend = sharpsl_pm_suspend, | ||
1005 | .resume = sharpsl_pm_resume, | ||
1006 | .driver = { | ||
1007 | .name = "sharpsl-pm", | ||
1008 | }, | ||
1009 | }; | ||
1010 | |||
1011 | static int __devinit sharpsl_pm_init(void) | ||
1012 | { | ||
1013 | return platform_driver_register(&sharpsl_pm_driver); | ||
1014 | } | ||
1015 | |||
1016 | static void sharpsl_pm_exit(void) | ||
1017 | { | ||
1018 | platform_driver_unregister(&sharpsl_pm_driver); | ||
1019 | } | ||
1020 | |||
1021 | late_initcall(sharpsl_pm_init); | ||
1022 | module_exit(sharpsl_pm_exit); | ||
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 5a45fe340a10..dda310fe71c8 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -13,19 +13,11 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/init.h> | ||
17 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
18 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
19 | #include <linux/major.h> | ||
20 | #include <linux/fs.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
23 | #include <linux/leds.h> | 19 | #include <linux/leds.h> |
24 | #include <linux/mmc/host.h> | ||
25 | #include <linux/mtd/physmap.h> | 20 | #include <linux/mtd/physmap.h> |
26 | #include <linux/pm.h> | ||
27 | #include <linux/backlight.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
30 | #include <linux/i2c/pca953x.h> | 22 | #include <linux/i2c/pca953x.h> |
31 | #include <linux/spi/spi.h> | 23 | #include <linux/spi/spi.h> |
@@ -34,31 +26,22 @@ | |||
34 | #include <linux/mtd/sharpsl.h> | 26 | #include <linux/mtd/sharpsl.h> |
35 | 27 | ||
36 | #include <asm/setup.h> | 28 | #include <asm/setup.h> |
37 | #include <asm/memory.h> | ||
38 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
39 | #include <mach/hardware.h> | ||
40 | #include <asm/irq.h> | ||
41 | #include <asm/system.h> | ||
42 | |||
43 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
44 | #include <asm/mach/map.h> | 31 | #include <asm/mach/sharpsl_param.h> |
45 | #include <asm/mach/irq.h> | 32 | #include <asm/hardware/scoop.h> |
33 | |||
46 | 34 | ||
47 | #include <mach/pxa27x.h> | 35 | #include <mach/pxa27x.h> |
48 | #include <mach/pxa27x-udc.h> | 36 | #include <mach/pxa27x-udc.h> |
49 | #include <mach/reset.h> | 37 | #include <mach/reset.h> |
50 | #include <mach/i2c.h> | 38 | #include <plat/i2c.h> |
51 | #include <mach/irda.h> | 39 | #include <mach/irda.h> |
52 | #include <mach/mmc.h> | 40 | #include <mach/mmc.h> |
53 | #include <mach/ohci.h> | 41 | #include <mach/ohci.h> |
54 | #include <mach/udc.h> | ||
55 | #include <mach/pxafb.h> | 42 | #include <mach/pxafb.h> |
56 | #include <mach/pxa2xx_spi.h> | 43 | #include <mach/pxa2xx_spi.h> |
57 | #include <mach/spitz.h> | 44 | #include <mach/spitz.h> |
58 | #include <mach/sharpsl.h> | ||
59 | |||
60 | #include <asm/mach/sharpsl_param.h> | ||
61 | #include <asm/hardware/scoop.h> | ||
62 | 45 | ||
63 | #include "generic.h" | 46 | #include "generic.h" |
64 | #include "devices.h" | 47 | #include "devices.h" |
@@ -317,13 +300,8 @@ static struct ads7846_platform_data spitz_ads7846_info = { | |||
317 | .wait_for_sync = spitz_wait_for_hsync, | 300 | .wait_for_sync = spitz_wait_for_hsync, |
318 | }; | 301 | }; |
319 | 302 | ||
320 | static void spitz_ads7846_cs(u32 command) | ||
321 | { | ||
322 | gpio_set_value(SPITZ_GPIO_ADS7846_CS, !(command == PXA2XX_CS_ASSERT)); | ||
323 | } | ||
324 | |||
325 | static struct pxa2xx_spi_chip spitz_ads7846_chip = { | 303 | static struct pxa2xx_spi_chip spitz_ads7846_chip = { |
326 | .cs_control = spitz_ads7846_cs, | 304 | .gpio_cs = SPITZ_GPIO_ADS7846_CS, |
327 | }; | 305 | }; |
328 | 306 | ||
329 | static void spitz_bl_kick_battery(void) | 307 | static void spitz_bl_kick_battery(void) |
@@ -347,22 +325,12 @@ static struct corgi_lcd_platform_data spitz_lcdcon_info = { | |||
347 | .kick_battery = spitz_bl_kick_battery, | 325 | .kick_battery = spitz_bl_kick_battery, |
348 | }; | 326 | }; |
349 | 327 | ||
350 | static void spitz_lcdcon_cs(u32 command) | ||
351 | { | ||
352 | gpio_set_value(SPITZ_GPIO_LCDCON_CS, !(command == PXA2XX_CS_ASSERT)); | ||
353 | } | ||
354 | |||
355 | static struct pxa2xx_spi_chip spitz_lcdcon_chip = { | 328 | static struct pxa2xx_spi_chip spitz_lcdcon_chip = { |
356 | .cs_control = spitz_lcdcon_cs, | 329 | .gpio_cs = SPITZ_GPIO_LCDCON_CS, |
357 | }; | 330 | }; |
358 | 331 | ||
359 | static void spitz_max1111_cs(u32 command) | ||
360 | { | ||
361 | gpio_set_value(SPITZ_GPIO_MAX1111_CS, !(command == PXA2XX_CS_ASSERT)); | ||
362 | } | ||
363 | |||
364 | static struct pxa2xx_spi_chip spitz_max1111_chip = { | 332 | static struct pxa2xx_spi_chip spitz_max1111_chip = { |
365 | .cs_control = spitz_max1111_cs, | 333 | .gpio_cs = SPITZ_GPIO_MAX1111_CS, |
366 | }; | 334 | }; |
367 | 335 | ||
368 | static struct spi_board_info spitz_spi_devices[] = { | 336 | static struct spi_board_info spitz_spi_devices[] = { |
@@ -392,30 +360,6 @@ static struct spi_board_info spitz_spi_devices[] = { | |||
392 | 360 | ||
393 | static void __init spitz_init_spi(void) | 361 | static void __init spitz_init_spi(void) |
394 | { | 362 | { |
395 | int err; | ||
396 | |||
397 | err = gpio_request(SPITZ_GPIO_ADS7846_CS, "ADS7846_CS"); | ||
398 | if (err) | ||
399 | return; | ||
400 | |||
401 | err = gpio_request(SPITZ_GPIO_LCDCON_CS, "LCDCON_CS"); | ||
402 | if (err) | ||
403 | goto err_free_1; | ||
404 | |||
405 | err = gpio_request(SPITZ_GPIO_MAX1111_CS, "MAX1111_CS"); | ||
406 | if (err) | ||
407 | goto err_free_2; | ||
408 | |||
409 | err = gpio_direction_output(SPITZ_GPIO_ADS7846_CS, 1); | ||
410 | if (err) | ||
411 | goto err_free_3; | ||
412 | err = gpio_direction_output(SPITZ_GPIO_LCDCON_CS, 1); | ||
413 | if (err) | ||
414 | goto err_free_3; | ||
415 | err = gpio_direction_output(SPITZ_GPIO_MAX1111_CS, 1); | ||
416 | if (err) | ||
417 | goto err_free_3; | ||
418 | |||
419 | if (machine_is_akita()) { | 363 | if (machine_is_akita()) { |
420 | spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; | 364 | spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; |
421 | spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; | 365 | spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; |
@@ -423,14 +367,6 @@ static void __init spitz_init_spi(void) | |||
423 | 367 | ||
424 | pxa2xx_set_spi_info(2, &spitz_spi_info); | 368 | pxa2xx_set_spi_info(2, &spitz_spi_info); |
425 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); | 369 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); |
426 | return; | ||
427 | |||
428 | err_free_3: | ||
429 | gpio_free(SPITZ_GPIO_MAX1111_CS); | ||
430 | err_free_2: | ||
431 | gpio_free(SPITZ_GPIO_LCDCON_CS); | ||
432 | err_free_1: | ||
433 | gpio_free(SPITZ_GPIO_ADS7846_CS); | ||
434 | } | 370 | } |
435 | #else | 371 | #else |
436 | static inline void spitz_init_spi(void) {} | 372 | static inline void spitz_init_spi(void) {} |
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c index 2e4490562c9e..724ffb030317 100644 --- a/arch/arm/mach-pxa/spitz_pm.c +++ b/arch/arm/mach-pxa/spitz_pm.c | |||
@@ -41,7 +41,6 @@ static void spitz_charger_init(void) | |||
41 | { | 41 | { |
42 | pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN); | 42 | pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN); |
43 | pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN); | 43 | pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN); |
44 | sharpsl_pm_pxa_init(); | ||
45 | } | 44 | } |
46 | 45 | ||
47 | static void spitz_measure_temp(int on) | 46 | static void spitz_measure_temp(int on) |
@@ -182,7 +181,7 @@ unsigned long spitzpm_read_devdata(int type) | |||
182 | 181 | ||
183 | struct sharpsl_charger_machinfo spitz_pm_machinfo = { | 182 | struct sharpsl_charger_machinfo spitz_pm_machinfo = { |
184 | .init = spitz_charger_init, | 183 | .init = spitz_charger_init, |
185 | .exit = sharpsl_pm_pxa_remove, | 184 | .exit = NULL, |
186 | .gpio_batlock = SPITZ_GPIO_BAT_COVER, | 185 | .gpio_batlock = SPITZ_GPIO_BAT_COVER, |
187 | .gpio_acin = SPITZ_GPIO_AC_IN, | 186 | .gpio_acin = SPITZ_GPIO_AC_IN, |
188 | .gpio_batfull = SPITZ_GPIO_CHRG_FULL, | 187 | .gpio_batfull = SPITZ_GPIO_CHRG_FULL, |
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c new file mode 100644 index 000000000000..3b205b69f3fb --- /dev/null +++ b/arch/arm/mach-pxa/stargate2.c | |||
@@ -0,0 +1,796 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/stargate2.c | ||
3 | * | ||
4 | * Author: Ed C. Epp | ||
5 | * Created: Nov 05, 2002 | ||
6 | * Copyright: Intel Corp. | ||
7 | * | ||
8 | * Modified 2009: Jonathan Cameron <jic23@cam.ac.uk> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/init.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/sched.h> | ||
19 | #include <linux/bitops.h> | ||
20 | #include <linux/fb.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/regulator/machine.h> | ||
24 | #include <linux/mtd/mtd.h> | ||
25 | #include <linux/mtd/plat-ram.h> | ||
26 | #include <linux/mtd/partitions.h> | ||
27 | |||
28 | #include <linux/i2c/pcf857x.h> | ||
29 | #include <linux/i2c/at24.h> | ||
30 | #include <linux/smc91x.h> | ||
31 | #include <linux/gpio.h> | ||
32 | |||
33 | #include <asm/types.h> | ||
34 | #include <asm/setup.h> | ||
35 | #include <asm/memory.h> | ||
36 | #include <asm/mach-types.h> | ||
37 | #include <asm/irq.h> | ||
38 | |||
39 | #include <asm/mach/arch.h> | ||
40 | #include <asm/mach/map.h> | ||
41 | #include <asm/mach/irq.h> | ||
42 | #include <asm/mach/flash.h> | ||
43 | |||
44 | #include <mach/pxa27x.h> | ||
45 | #include <plat/i2c.h> | ||
46 | #include <mach/mmc.h> | ||
47 | #include <mach/udc.h> | ||
48 | #include <mach/pxa2xx_spi.h> | ||
49 | #include <mach/pxa27x-udc.h> | ||
50 | |||
51 | #include <linux/spi/spi.h> | ||
52 | #include <linux/mfd/da903x.h> | ||
53 | #include <linux/sht15.h> | ||
54 | |||
55 | #include "devices.h" | ||
56 | #include "generic.h" | ||
57 | |||
58 | /* Bluetooth */ | ||
59 | #define SG2_BT_RESET 81 | ||
60 | |||
61 | /* SD */ | ||
62 | #define SG2_GPIO_nSD_DETECT 90 | ||
63 | #define SG2_SD_POWER_ENABLE 89 | ||
64 | |||
65 | static unsigned long stargate2_pin_config[] __initdata = { | ||
66 | |||
67 | GPIO15_nCS_1, /* SRAM */ | ||
68 | /* SMC91x */ | ||
69 | GPIO80_nCS_4, | ||
70 | GPIO40_GPIO, /*cable detect?*/ | ||
71 | /* Device Identification for wakeup*/ | ||
72 | GPIO102_GPIO, | ||
73 | |||
74 | /* Button */ | ||
75 | GPIO91_GPIO | WAKEUP_ON_LEVEL_HIGH, | ||
76 | |||
77 | /* DA9030 */ | ||
78 | GPIO1_GPIO, | ||
79 | |||
80 | /* Compact Flash */ | ||
81 | GPIO79_PSKTSEL, | ||
82 | GPIO48_nPOE, | ||
83 | GPIO49_nPWE, | ||
84 | GPIO50_nPIOR, | ||
85 | GPIO51_nPIOW, | ||
86 | GPIO85_nPCE_1, | ||
87 | GPIO54_nPCE_2, | ||
88 | GPIO55_nPREG, | ||
89 | GPIO56_nPWAIT, | ||
90 | GPIO57_nIOIS16, | ||
91 | GPIO120_GPIO, /* Buff ctrl */ | ||
92 | GPIO108_GPIO, /* Power ctrl */ | ||
93 | GPIO82_GPIO, /* Reset */ | ||
94 | GPIO53_GPIO, /* SG2_S0_GPIO_DETECT */ | ||
95 | |||
96 | /* MMC */ | ||
97 | GPIO32_MMC_CLK, | ||
98 | GPIO112_MMC_CMD, | ||
99 | GPIO92_MMC_DAT_0, | ||
100 | GPIO109_MMC_DAT_1, | ||
101 | GPIO110_MMC_DAT_2, | ||
102 | GPIO111_MMC_DAT_3, | ||
103 | GPIO90_GPIO, /* nSD detect */ | ||
104 | GPIO89_GPIO, /* SD_POWER_ENABLE */ | ||
105 | |||
106 | /* Bluetooth */ | ||
107 | GPIO81_GPIO, /* reset */ | ||
108 | |||
109 | /* cc2420 802.15.4 radio */ | ||
110 | GPIO22_GPIO, /* CC_RSTN (out)*/ | ||
111 | GPIO114_GPIO, /* CC_FIFO (in) */ | ||
112 | GPIO116_GPIO, /* CC_CCA (in) */ | ||
113 | GPIO0_GPIO, /* CC_FIFOP (in) */ | ||
114 | GPIO16_GPIO, /* CCSFD (in) */ | ||
115 | GPIO39_GPIO, /* CSn (out) */ | ||
116 | |||
117 | /* I2C */ | ||
118 | GPIO117_I2C_SCL, | ||
119 | GPIO118_I2C_SDA, | ||
120 | |||
121 | /* SSP 3 - 802.15.4 radio */ | ||
122 | GPIO39_GPIO, /* chip select */ | ||
123 | GPIO34_SSP3_SCLK, | ||
124 | GPIO35_SSP3_TXD, | ||
125 | GPIO41_SSP3_RXD, | ||
126 | |||
127 | /* SSP 2 */ | ||
128 | GPIO11_SSP2_RXD, | ||
129 | GPIO38_SSP2_TXD, | ||
130 | GPIO36_SSP2_SCLK, | ||
131 | GPIO37_GPIO, /* chip select */ | ||
132 | |||
133 | /* SSP 1 */ | ||
134 | GPIO26_SSP1_RXD, | ||
135 | GPIO25_SSP1_TXD, | ||
136 | GPIO23_SSP1_SCLK, | ||
137 | GPIO24_GPIO, /* chip select */ | ||
138 | |||
139 | /* BTUART */ | ||
140 | GPIO42_BTUART_RXD, | ||
141 | GPIO43_BTUART_TXD, | ||
142 | GPIO44_BTUART_CTS, | ||
143 | GPIO45_BTUART_RTS, | ||
144 | |||
145 | /* STUART */ | ||
146 | GPIO46_STUART_RXD, | ||
147 | GPIO47_STUART_TXD, | ||
148 | |||
149 | /* Basic sensor board */ | ||
150 | GPIO96_GPIO, /* accelerometer interrupt */ | ||
151 | GPIO99_GPIO, /* ADC interrupt */ | ||
152 | |||
153 | /* Connector pins specified as gpios */ | ||
154 | GPIO94_GPIO, /* large basic connector pin 14 */ | ||
155 | GPIO10_GPIO, /* large basic connector pin 23 */ | ||
156 | |||
157 | /* SHT15 */ | ||
158 | GPIO100_GPIO, | ||
159 | GPIO98_GPIO, | ||
160 | }; | ||
161 | |||
162 | /** | ||
163 | * stargate2_reset_bluetooth() reset the bluecore to ensure consistent state | ||
164 | **/ | ||
165 | static int stargate2_reset_bluetooth(void) | ||
166 | { | ||
167 | int err; | ||
168 | err = gpio_request(SG2_BT_RESET, "SG2_BT_RESET"); | ||
169 | if (err) { | ||
170 | printk(KERN_ERR "Could not get gpio for bluetooth reset \n"); | ||
171 | return err; | ||
172 | } | ||
173 | gpio_direction_output(SG2_BT_RESET, 1); | ||
174 | mdelay(5); | ||
175 | /* now reset it - 5 msec minimum */ | ||
176 | gpio_set_value(SG2_BT_RESET, 0); | ||
177 | mdelay(10); | ||
178 | gpio_set_value(SG2_BT_RESET, 1); | ||
179 | gpio_free(SG2_BT_RESET); | ||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static struct led_info stargate2_leds[] = { | ||
184 | { | ||
185 | .name = "sg2:red", | ||
186 | .flags = DA9030_LED_RATE_ON, | ||
187 | }, { | ||
188 | .name = "sg2:blue", | ||
189 | .flags = DA9030_LED_RATE_ON, | ||
190 | }, { | ||
191 | .name = "sg2:green", | ||
192 | .flags = DA9030_LED_RATE_ON, | ||
193 | }, | ||
194 | }; | ||
195 | |||
196 | static struct sht15_platform_data platform_data_sht15 = { | ||
197 | .gpio_data = 100, | ||
198 | .gpio_sck = 98, | ||
199 | }; | ||
200 | |||
201 | static struct platform_device sht15 = { | ||
202 | .name = "sht15", | ||
203 | .id = -1, | ||
204 | .dev = { | ||
205 | .platform_data = &platform_data_sht15, | ||
206 | }, | ||
207 | }; | ||
208 | |||
209 | static struct regulator_consumer_supply stargate2_sensor_3_con[] = { | ||
210 | { | ||
211 | .dev = &sht15.dev, | ||
212 | .supply = "vcc", | ||
213 | }, | ||
214 | }; | ||
215 | |||
216 | enum stargate2_ldos{ | ||
217 | vcc_vref, | ||
218 | vcc_cc2420, | ||
219 | /* a mote connector? */ | ||
220 | vcc_mica, | ||
221 | /* the CSR bluecore chip */ | ||
222 | vcc_bt, | ||
223 | /* The two voltages available to sensor boards */ | ||
224 | vcc_sensor_1_8, | ||
225 | vcc_sensor_3, | ||
226 | /* directly connected to the pxa27x */ | ||
227 | vcc_sram_ext, | ||
228 | vcc_pxa_pll, | ||
229 | vcc_pxa_usim, /* Reference voltage for certain gpios */ | ||
230 | vcc_pxa_mem, | ||
231 | vcc_pxa_flash, | ||
232 | vcc_pxa_core, /*Dc-Dc buck not yet supported */ | ||
233 | vcc_lcd, | ||
234 | vcc_bb, | ||
235 | vcc_bbio, /*not sure!*/ | ||
236 | vcc_io, /* cc2420 802.15.4 radio and pxa vcc_io ?*/ | ||
237 | }; | ||
238 | |||
239 | /* The values of the various regulator constraints are obviously dependent | ||
240 | * on exactly what is wired to each ldo. Unfortunately this information is | ||
241 | * not generally available. More information has been requested from Xbow. | ||
242 | */ | ||
243 | static struct regulator_init_data stargate2_ldo_init_data[] = { | ||
244 | [vcc_bbio] = { | ||
245 | .constraints = { /* board default 1.8V */ | ||
246 | .name = "vcc_bbio", | ||
247 | .min_uV = 1800000, | ||
248 | .max_uV = 1800000, | ||
249 | }, | ||
250 | }, | ||
251 | [vcc_bb] = { | ||
252 | .constraints = { /* board default 2.8V */ | ||
253 | .name = "vcc_bb", | ||
254 | .min_uV = 2700000, | ||
255 | .max_uV = 3000000, | ||
256 | }, | ||
257 | }, | ||
258 | [vcc_pxa_flash] = { | ||
259 | .constraints = {/* default is 1.8V */ | ||
260 | .name = "vcc_pxa_flash", | ||
261 | .min_uV = 1800000, | ||
262 | .max_uV = 1800000, | ||
263 | }, | ||
264 | }, | ||
265 | [vcc_cc2420] = { /* also vcc_io */ | ||
266 | .constraints = { | ||
267 | /* board default is 2.8V */ | ||
268 | .name = "vcc_cc2420", | ||
269 | .min_uV = 2700000, | ||
270 | .max_uV = 3300000, | ||
271 | }, | ||
272 | }, | ||
273 | [vcc_vref] = { /* Reference for what? */ | ||
274 | .constraints = { /* default 1.8V */ | ||
275 | .name = "vcc_vref", | ||
276 | .min_uV = 1800000, | ||
277 | .max_uV = 1800000, | ||
278 | }, | ||
279 | }, | ||
280 | [vcc_sram_ext] = { | ||
281 | .constraints = { /* default 2.8V */ | ||
282 | .name = "vcc_sram_ext", | ||
283 | .min_uV = 2800000, | ||
284 | .max_uV = 2800000, | ||
285 | }, | ||
286 | }, | ||
287 | [vcc_mica] = { | ||
288 | .constraints = { /* default 2.8V */ | ||
289 | .name = "vcc_mica", | ||
290 | .min_uV = 2800000, | ||
291 | .max_uV = 2800000, | ||
292 | }, | ||
293 | }, | ||
294 | [vcc_bt] = { | ||
295 | .constraints = { /* default 2.8V */ | ||
296 | .name = "vcc_bt", | ||
297 | .min_uV = 2800000, | ||
298 | .max_uV = 2800000, | ||
299 | }, | ||
300 | }, | ||
301 | [vcc_lcd] = { | ||
302 | .constraints = { /* default 2.8V */ | ||
303 | .name = "vcc_lcd", | ||
304 | .min_uV = 2700000, | ||
305 | .max_uV = 3300000, | ||
306 | }, | ||
307 | }, | ||
308 | [vcc_io] = { /* Same or higher than everything | ||
309 | * bar vccbat and vccusb */ | ||
310 | .constraints = { /* default 2.8V */ | ||
311 | .name = "vcc_io", | ||
312 | .min_uV = 2692000, | ||
313 | .max_uV = 3300000, | ||
314 | }, | ||
315 | }, | ||
316 | [vcc_sensor_1_8] = { | ||
317 | .constraints = { /* default 1.8V */ | ||
318 | .name = "vcc_sensor_1_8", | ||
319 | .min_uV = 1800000, | ||
320 | .max_uV = 1800000, | ||
321 | }, | ||
322 | }, | ||
323 | [vcc_sensor_3] = { /* curiously default 2.8V */ | ||
324 | .constraints = { | ||
325 | .name = "vcc_sensor_3", | ||
326 | .min_uV = 2800000, | ||
327 | .max_uV = 3000000, | ||
328 | }, | ||
329 | .num_consumer_supplies = ARRAY_SIZE(stargate2_sensor_3_con), | ||
330 | .consumer_supplies = stargate2_sensor_3_con, | ||
331 | }, | ||
332 | [vcc_pxa_pll] = { /* 1.17V - 1.43V, default 1.3V*/ | ||
333 | .constraints = { | ||
334 | .name = "vcc_pxa_pll", | ||
335 | .min_uV = 1170000, | ||
336 | .max_uV = 1430000, | ||
337 | }, | ||
338 | }, | ||
339 | [vcc_pxa_usim] = { | ||
340 | .constraints = { /* default 1.8V */ | ||
341 | .name = "vcc_pxa_usim", | ||
342 | .min_uV = 1710000, | ||
343 | .max_uV = 2160000, | ||
344 | }, | ||
345 | }, | ||
346 | [vcc_pxa_mem] = { | ||
347 | .constraints = { /* default 1.8V */ | ||
348 | .name = "vcc_pxa_mem", | ||
349 | .min_uV = 1800000, | ||
350 | .max_uV = 1800000, | ||
351 | }, | ||
352 | }, | ||
353 | }; | ||
354 | |||
355 | static struct da903x_subdev_info stargate2_da9030_subdevs[] = { | ||
356 | { | ||
357 | .name = "da903x-led", | ||
358 | .id = DA9030_ID_LED_2, | ||
359 | .platform_data = &stargate2_leds[0], | ||
360 | }, { | ||
361 | .name = "da903x-led", | ||
362 | .id = DA9030_ID_LED_3, | ||
363 | .platform_data = &stargate2_leds[2], | ||
364 | }, { | ||
365 | .name = "da903x-led", | ||
366 | .id = DA9030_ID_LED_4, | ||
367 | .platform_data = &stargate2_leds[1], | ||
368 | }, { | ||
369 | .name = "da903x-regulator", | ||
370 | .id = DA9030_ID_LDO2, | ||
371 | .platform_data = &stargate2_ldo_init_data[vcc_bbio], | ||
372 | }, { | ||
373 | .name = "da903x-regulator", | ||
374 | .id = DA9030_ID_LDO3, | ||
375 | .platform_data = &stargate2_ldo_init_data[vcc_bb], | ||
376 | }, { | ||
377 | .name = "da903x-regulator", | ||
378 | .id = DA9030_ID_LDO4, | ||
379 | .platform_data = &stargate2_ldo_init_data[vcc_pxa_flash], | ||
380 | }, { | ||
381 | .name = "da903x-regulator", | ||
382 | .id = DA9030_ID_LDO5, | ||
383 | .platform_data = &stargate2_ldo_init_data[vcc_cc2420], | ||
384 | }, { | ||
385 | .name = "da903x-regulator", | ||
386 | .id = DA9030_ID_LDO6, | ||
387 | .platform_data = &stargate2_ldo_init_data[vcc_vref], | ||
388 | }, { | ||
389 | .name = "da903x-regulator", | ||
390 | .id = DA9030_ID_LDO7, | ||
391 | .platform_data = &stargate2_ldo_init_data[vcc_sram_ext], | ||
392 | }, { | ||
393 | .name = "da903x-regulator", | ||
394 | .id = DA9030_ID_LDO8, | ||
395 | .platform_data = &stargate2_ldo_init_data[vcc_mica], | ||
396 | }, { | ||
397 | .name = "da903x-regulator", | ||
398 | .id = DA9030_ID_LDO9, | ||
399 | .platform_data = &stargate2_ldo_init_data[vcc_bt], | ||
400 | }, { | ||
401 | .name = "da903x-regulator", | ||
402 | .id = DA9030_ID_LDO10, | ||
403 | .platform_data = &stargate2_ldo_init_data[vcc_sensor_1_8], | ||
404 | }, { | ||
405 | .name = "da903x-regulator", | ||
406 | .id = DA9030_ID_LDO11, | ||
407 | .platform_data = &stargate2_ldo_init_data[vcc_sensor_3], | ||
408 | }, { | ||
409 | .name = "da903x-regulator", | ||
410 | .id = DA9030_ID_LDO12, | ||
411 | .platform_data = &stargate2_ldo_init_data[vcc_lcd], | ||
412 | }, { | ||
413 | .name = "da903x-regulator", | ||
414 | .id = DA9030_ID_LDO15, | ||
415 | .platform_data = &stargate2_ldo_init_data[vcc_pxa_pll], | ||
416 | }, { | ||
417 | .name = "da903x-regulator", | ||
418 | .id = DA9030_ID_LDO17, | ||
419 | .platform_data = &stargate2_ldo_init_data[vcc_pxa_usim], | ||
420 | }, { | ||
421 | .name = "da903x-regulator", /*pxa vcc i/o and cc2420 vcc i/o */ | ||
422 | .id = DA9030_ID_LDO18, | ||
423 | .platform_data = &stargate2_ldo_init_data[vcc_io], | ||
424 | }, { | ||
425 | .name = "da903x-regulator", | ||
426 | .id = DA9030_ID_LDO19, | ||
427 | .platform_data = &stargate2_ldo_init_data[vcc_pxa_mem], | ||
428 | }, | ||
429 | }; | ||
430 | |||
431 | static struct da903x_platform_data stargate2_da9030_pdata = { | ||
432 | .num_subdevs = ARRAY_SIZE(stargate2_da9030_subdevs), | ||
433 | .subdevs = stargate2_da9030_subdevs, | ||
434 | }; | ||
435 | |||
436 | static struct resource smc91x_resources[] = { | ||
437 | [0] = { | ||
438 | .name = "smc91x-regs", | ||
439 | .start = (PXA_CS4_PHYS + 0x300), | ||
440 | .end = (PXA_CS4_PHYS + 0xfffff), | ||
441 | .flags = IORESOURCE_MEM, | ||
442 | }, | ||
443 | [1] = { | ||
444 | .start = IRQ_GPIO(40), | ||
445 | .end = IRQ_GPIO(40), | ||
446 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
447 | } | ||
448 | }; | ||
449 | |||
450 | static struct smc91x_platdata stargate2_smc91x_info = { | ||
451 | .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | ||
452 | | SMC91X_NOWAIT | SMC91X_USE_DMA, | ||
453 | }; | ||
454 | |||
455 | static struct platform_device smc91x_device = { | ||
456 | .name = "smc91x", | ||
457 | .id = -1, | ||
458 | .num_resources = ARRAY_SIZE(smc91x_resources), | ||
459 | .resource = smc91x_resources, | ||
460 | .dev = { | ||
461 | .platform_data = &stargate2_smc91x_info, | ||
462 | }, | ||
463 | }; | ||
464 | |||
465 | |||
466 | |||
467 | static struct pxamci_platform_data stargate2_mci_platform_data; | ||
468 | |||
469 | /* | ||
470 | * The card detect interrupt isn't debounced so we delay it by 250ms | ||
471 | * to give the card a chance to fully insert / eject. | ||
472 | */ | ||
473 | static int stargate2_mci_init(struct device *dev, | ||
474 | irq_handler_t stargate2_detect_int, | ||
475 | void *data) | ||
476 | { | ||
477 | int err; | ||
478 | |||
479 | err = gpio_request(SG2_SD_POWER_ENABLE, "SG2_sd_power_enable"); | ||
480 | if (err) { | ||
481 | printk(KERN_ERR "Can't get the gpio for SD power control"); | ||
482 | goto return_err; | ||
483 | } | ||
484 | gpio_direction_output(SG2_SD_POWER_ENABLE, 0); | ||
485 | |||
486 | err = gpio_request(SG2_GPIO_nSD_DETECT, "SG2_sd_detect"); | ||
487 | if (err) { | ||
488 | printk(KERN_ERR "Can't get the sd detect gpio"); | ||
489 | goto free_power_en; | ||
490 | } | ||
491 | gpio_direction_input(SG2_GPIO_nSD_DETECT); | ||
492 | /* Delay to allow for full insertion */ | ||
493 | stargate2_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
494 | |||
495 | err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), | ||
496 | stargate2_detect_int, | ||
497 | IRQ_TYPE_EDGE_BOTH, | ||
498 | "MMC card detect", | ||
499 | data); | ||
500 | if (err) { | ||
501 | printk(KERN_ERR "can't request MMC card detect IRQ\n"); | ||
502 | goto free_nsd_detect; | ||
503 | } | ||
504 | return 0; | ||
505 | |||
506 | free_nsd_detect: | ||
507 | gpio_free(SG2_GPIO_nSD_DETECT); | ||
508 | free_power_en: | ||
509 | gpio_free(SG2_SD_POWER_ENABLE); | ||
510 | return_err: | ||
511 | return err; | ||
512 | } | ||
513 | |||
514 | /** | ||
515 | * stargate2_mci_setpower() - set state of mmc power supply | ||
516 | * | ||
517 | * Very simple control. Either it is on or off and is controlled by | ||
518 | * a gpio pin */ | ||
519 | static void stargate2_mci_setpower(struct device *dev, unsigned int vdd) | ||
520 | { | ||
521 | gpio_set_value(SG2_SD_POWER_ENABLE, !!vdd); | ||
522 | } | ||
523 | |||
524 | static void stargate2_mci_exit(struct device *dev, void *data) | ||
525 | { | ||
526 | free_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), data); | ||
527 | gpio_free(SG2_SD_POWER_ENABLE); | ||
528 | gpio_free(SG2_GPIO_nSD_DETECT); | ||
529 | } | ||
530 | |||
531 | static struct pxamci_platform_data stargate2_mci_platform_data = { | ||
532 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
533 | .init = stargate2_mci_init, | ||
534 | .setpower = stargate2_mci_setpower, | ||
535 | .exit = stargate2_mci_exit, | ||
536 | }; | ||
537 | |||
538 | static struct mtd_partition stargate2flash_partitions[] = { | ||
539 | { | ||
540 | .name = "Bootloader", | ||
541 | .size = 0x00040000, | ||
542 | .offset = 0, | ||
543 | .mask_flags = 0, | ||
544 | }, { | ||
545 | .name = "Kernel", | ||
546 | .size = 0x00200000, | ||
547 | .offset = 0x00040000, | ||
548 | .mask_flags = 0 | ||
549 | }, { | ||
550 | .name = "Filesystem", | ||
551 | .size = 0x01DC0000, | ||
552 | .offset = 0x00240000, | ||
553 | .mask_flags = 0 | ||
554 | }, | ||
555 | }; | ||
556 | |||
557 | static struct resource flash_resources = { | ||
558 | .start = PXA_CS0_PHYS, | ||
559 | .end = PXA_CS0_PHYS + SZ_32M - 1, | ||
560 | .flags = IORESOURCE_MEM, | ||
561 | }; | ||
562 | |||
563 | static struct flash_platform_data stargate2_flash_data = { | ||
564 | .map_name = "cfi_probe", | ||
565 | .parts = stargate2flash_partitions, | ||
566 | .nr_parts = ARRAY_SIZE(stargate2flash_partitions), | ||
567 | .name = "PXA27xOnChipROM", | ||
568 | .width = 2, | ||
569 | }; | ||
570 | |||
571 | static struct platform_device stargate2_flash_device = { | ||
572 | .name = "pxa2xx-flash", | ||
573 | .id = 0, | ||
574 | .dev = { | ||
575 | .platform_data = &stargate2_flash_data, | ||
576 | }, | ||
577 | .resource = &flash_resources, | ||
578 | .num_resources = 1, | ||
579 | }; | ||
580 | |||
581 | /* | ||
582 | * SRAM - The Stargate 2 has 32MB of SRAM. | ||
583 | * | ||
584 | * Here it is made available as an MTD. This will then | ||
585 | * typically have a cifs filesystem created on it to provide | ||
586 | * fast temporary storage. | ||
587 | */ | ||
588 | static struct resource sram_resources = { | ||
589 | .start = PXA_CS1_PHYS, | ||
590 | .end = PXA_CS1_PHYS + SZ_32M-1, | ||
591 | .flags = IORESOURCE_MEM, | ||
592 | }; | ||
593 | |||
594 | static struct platdata_mtd_ram stargate2_sram_pdata = { | ||
595 | .mapname = "Stargate2 SRAM", | ||
596 | .bankwidth = 2, | ||
597 | }; | ||
598 | |||
599 | static struct platform_device stargate2_sram = { | ||
600 | .name = "mtd-ram", | ||
601 | .id = 0, | ||
602 | .resource = &sram_resources, | ||
603 | .num_resources = 1, | ||
604 | .dev = { | ||
605 | .platform_data = &stargate2_sram_pdata, | ||
606 | }, | ||
607 | }; | ||
608 | |||
609 | static struct pcf857x_platform_data platform_data_pcf857x = { | ||
610 | .gpio_base = 128, | ||
611 | .n_latch = 0, | ||
612 | .setup = NULL, | ||
613 | .teardown = NULL, | ||
614 | .context = NULL, | ||
615 | }; | ||
616 | |||
617 | static struct at24_platform_data pca9500_eeprom_pdata = { | ||
618 | .byte_len = 256, | ||
619 | .page_size = 4, | ||
620 | }; | ||
621 | |||
622 | |||
623 | static struct i2c_board_info __initdata stargate2_i2c_board_info[] = { | ||
624 | /* Techically this a pca9500 - but it's compatible with the 8574 | ||
625 | * for gpio expansion and the 24c02 for eeprom access. | ||
626 | */ | ||
627 | { | ||
628 | .type = "pcf8574", | ||
629 | .addr = 0x27, | ||
630 | .platform_data = &platform_data_pcf857x, | ||
631 | }, { | ||
632 | .type = "24c02", | ||
633 | .addr = 0x57, | ||
634 | .platform_data = &pca9500_eeprom_pdata, | ||
635 | }, { | ||
636 | .type = "max1238", | ||
637 | .addr = 0x35, | ||
638 | }, { /* ITS400 Sensor board only */ | ||
639 | .type = "max1363", | ||
640 | .addr = 0x34, | ||
641 | /* Through a nand gate - Also beware, on V2 sensor board the | ||
642 | * pull up resistors are missing. | ||
643 | */ | ||
644 | .irq = IRQ_GPIO(99), | ||
645 | }, { /* ITS400 Sensor board only */ | ||
646 | .type = "tsl2561", | ||
647 | .addr = 0x49, | ||
648 | /* Through a nand gate - Also beware, on V2 sensor board the | ||
649 | * pull up resistors are missing. | ||
650 | */ | ||
651 | .irq = IRQ_GPIO(99), | ||
652 | }, { /* ITS400 Sensor board only */ | ||
653 | .type = "tmp175", | ||
654 | .addr = 0x4A, | ||
655 | .irq = IRQ_GPIO(96), | ||
656 | }, | ||
657 | }; | ||
658 | |||
659 | static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = { | ||
660 | { | ||
661 | .type = "da9030", | ||
662 | .addr = 0x49, | ||
663 | .platform_data = &stargate2_da9030_pdata, | ||
664 | .irq = gpio_to_irq(1), | ||
665 | }, | ||
666 | }; | ||
667 | |||
668 | static struct pxa2xx_spi_master pxa_ssp_master_0_info = { | ||
669 | .num_chipselect = 1, | ||
670 | }; | ||
671 | |||
672 | static struct pxa2xx_spi_master pxa_ssp_master_1_info = { | ||
673 | .num_chipselect = 1, | ||
674 | }; | ||
675 | |||
676 | static struct pxa2xx_spi_master pxa_ssp_master_2_info = { | ||
677 | .num_chipselect = 1, | ||
678 | }; | ||
679 | |||
680 | /* An upcoming kernel change will scrap SFRM usage so these | ||
681 | * drivers have been moved to use gpio's via cs_control */ | ||
682 | static struct pxa2xx_spi_chip staccel_chip_info = { | ||
683 | .tx_threshold = 8, | ||
684 | .rx_threshold = 8, | ||
685 | .dma_burst_size = 8, | ||
686 | .timeout = 235, | ||
687 | .gpio_cs = 24, | ||
688 | }; | ||
689 | |||
690 | static struct pxa2xx_spi_chip cc2420_info = { | ||
691 | .tx_threshold = 8, | ||
692 | .rx_threshold = 8, | ||
693 | .dma_burst_size = 8, | ||
694 | .timeout = 235, | ||
695 | .gpio_cs = 39, | ||
696 | }; | ||
697 | |||
698 | static struct spi_board_info spi_board_info[] __initdata = { | ||
699 | { | ||
700 | .modalias = "lis3l02dq", | ||
701 | .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */ | ||
702 | .bus_num = 1, | ||
703 | .chip_select = 0, | ||
704 | .controller_data = &staccel_chip_info, | ||
705 | .irq = IRQ_GPIO(96), | ||
706 | }, { | ||
707 | .modalias = "cc2420", | ||
708 | .max_speed_hz = 6500000, | ||
709 | .bus_num = 3, | ||
710 | .chip_select = 0, | ||
711 | .controller_data = &cc2420_info, | ||
712 | }, | ||
713 | }; | ||
714 | |||
715 | static void sg2_udc_command(int cmd) | ||
716 | { | ||
717 | switch (cmd) { | ||
718 | case PXA2XX_UDC_CMD_CONNECT: | ||
719 | UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE; | ||
720 | break; | ||
721 | case PXA2XX_UDC_CMD_DISCONNECT: | ||
722 | UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE); | ||
723 | break; | ||
724 | } | ||
725 | } | ||
726 | |||
727 | /* Board doesn't support cable detection - so always lie and say | ||
728 | * something is there. | ||
729 | */ | ||
730 | static int sg2_udc_detect(void) | ||
731 | { | ||
732 | return 1; | ||
733 | } | ||
734 | |||
735 | static struct pxa2xx_udc_mach_info stargate2_udc_info __initdata = { | ||
736 | .udc_is_connected = sg2_udc_detect, | ||
737 | .udc_command = sg2_udc_command, | ||
738 | }; | ||
739 | |||
740 | static struct platform_device *stargate2_devices[] = { | ||
741 | &stargate2_flash_device, | ||
742 | &stargate2_sram, | ||
743 | &smc91x_device, | ||
744 | &sht15, | ||
745 | }; | ||
746 | |||
747 | static struct i2c_pxa_platform_data i2c_pwr_pdata = { | ||
748 | .fast_mode = 1, | ||
749 | }; | ||
750 | |||
751 | static struct i2c_pxa_platform_data i2c_pdata = { | ||
752 | .fast_mode = 1, | ||
753 | }; | ||
754 | |||
755 | static void __init stargate2_init(void) | ||
756 | { | ||
757 | /* This is probably a board specific hack as this must be set | ||
758 | prior to connecting the MFP stuff up. */ | ||
759 | MECR &= ~MECR_NOS; | ||
760 | |||
761 | pxa2xx_mfp_config(ARRAY_AND_SIZE(stargate2_pin_config)); | ||
762 | |||
763 | /* spi chip selects */ | ||
764 | gpio_direction_output(37, 0); | ||
765 | gpio_direction_output(24, 0); | ||
766 | gpio_direction_output(39, 0); | ||
767 | |||
768 | platform_add_devices(ARRAY_AND_SIZE(stargate2_devices)); | ||
769 | |||
770 | pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info); | ||
771 | pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info); | ||
772 | pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info); | ||
773 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); | ||
774 | |||
775 | i2c_register_board_info(0, ARRAY_AND_SIZE(stargate2_i2c_board_info)); | ||
776 | i2c_register_board_info(1, | ||
777 | ARRAY_AND_SIZE(stargate2_pwr_i2c_board_info)); | ||
778 | pxa27x_set_i2c_power_info(&i2c_pwr_pdata); | ||
779 | pxa_set_i2c_info(&i2c_pdata); | ||
780 | |||
781 | pxa_set_mci_info(&stargate2_mci_platform_data); | ||
782 | |||
783 | pxa_set_udc_info(&stargate2_udc_info); | ||
784 | |||
785 | stargate2_reset_bluetooth(); | ||
786 | } | ||
787 | |||
788 | MACHINE_START(STARGATE2, "Stargate 2") | ||
789 | .phys_io = 0x40000000, | ||
790 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
791 | .map_io = pxa_map_io, | ||
792 | .init_irq = pxa27x_init_irq, | ||
793 | .timer = &pxa_timer, | ||
794 | .init_machine = stargate2_init, | ||
795 | .boot_params = 0xA0000100, | ||
796 | MACHINE_END | ||
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index a0bd46ef5d30..168267a5dfb3 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <mach/pxa25x.h> | 40 | #include <mach/pxa25x.h> |
41 | #include <mach/reset.h> | 41 | #include <mach/reset.h> |
42 | #include <mach/irda.h> | 42 | #include <mach/irda.h> |
43 | #include <mach/i2c.h> | 43 | #include <plat/i2c.h> |
44 | #include <mach/mmc.h> | 44 | #include <mach/mmc.h> |
45 | #include <mach/udc.h> | 45 | #include <mach/udc.h> |
46 | #include <mach/tosa_bt.h> | 46 | #include <mach/tosa_bt.h> |
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index f79c9cb70ae4..825f540176d2 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <mach/mmc.h> | 47 | #include <mach/mmc.h> |
48 | #include <mach/irda.h> | 48 | #include <mach/irda.h> |
49 | #include <mach/ohci.h> | 49 | #include <mach/ohci.h> |
50 | #include <mach/i2c.h> | 50 | #include <plat/i2c.h> |
51 | 51 | ||
52 | #include "generic.h" | 52 | #include "generic.h" |
53 | #include "devices.h" | 53 | #include "devices.h" |
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index dd031cc41847..d33c232b686c 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #include <mach/pxa25x.h> | 45 | #include <mach/pxa25x.h> |
46 | #include <mach/audio.h> | 46 | #include <mach/audio.h> |
47 | #include <mach/pxafb.h> | 47 | #include <mach/pxafb.h> |
48 | #include <mach/i2c.h> | 48 | #include <plat/i2c.h> |
49 | #include <mach/regs-uart.h> | 49 | #include <mach/regs-uart.h> |
50 | #include <mach/viper.h> | 50 | #include <mach/viper.h> |
51 | 51 | ||
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c index c256c57642c0..cefd1c0a854a 100644 --- a/arch/arm/mach-pxa/zylonite_pxa300.c +++ b/arch/arm/mach-pxa/zylonite_pxa300.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | 22 | ||
23 | #include <mach/pxa300.h> | 23 | #include <mach/pxa300.h> |
24 | #include <mach/i2c.h> | 24 | #include <plat/i2c.h> |
25 | #include <mach/zylonite.h> | 25 | #include <mach/zylonite.h> |
26 | 26 | ||
27 | #include "generic.h" | 27 | #include "generic.h" |