diff options
Diffstat (limited to 'arch/arm/mach-pxa/cm-x300.c')
-rw-r--r-- | arch/arm/mach-pxa/cm-x300.c | 104 |
1 files changed, 91 insertions, 13 deletions
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index d37cfa132a65..fdda6be6c391 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -30,6 +30,9 @@ | |||
30 | #include <linux/i2c/pca953x.h> | 30 | #include <linux/i2c/pca953x.h> |
31 | 31 | ||
32 | #include <linux/mfd/da903x.h> | 32 | #include <linux/mfd/da903x.h> |
33 | #include <linux/regulator/machine.h> | ||
34 | #include <linux/power_supply.h> | ||
35 | #include <linux/apm-emulation.h> | ||
33 | 36 | ||
34 | #include <linux/spi/spi.h> | 37 | #include <linux/spi/spi.h> |
35 | #include <linux/spi/spi_gpio.h> | 38 | #include <linux/spi/spi_gpio.h> |
@@ -430,7 +433,7 @@ static inline void cm_x300_init_nand(void) {} | |||
430 | 433 | ||
431 | #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) | 434 | #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) |
432 | static struct pxamci_platform_data cm_x300_mci_platform_data = { | 435 | static struct pxamci_platform_data cm_x300_mci_platform_data = { |
433 | .detect_delay = 20, | 436 | .detect_delay_ms = 200, |
434 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 437 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
435 | .gpio_card_detect = GPIO82_MMC_IRQ, | 438 | .gpio_card_detect = GPIO82_MMC_IRQ, |
436 | .gpio_card_ro = GPIO85_MMC_WP, | 439 | .gpio_card_ro = GPIO85_MMC_WP, |
@@ -451,7 +454,7 @@ static void cm_x300_mci2_exit(struct device *dev, void *data) | |||
451 | } | 454 | } |
452 | 455 | ||
453 | static struct pxamci_platform_data cm_x300_mci2_platform_data = { | 456 | static struct pxamci_platform_data cm_x300_mci2_platform_data = { |
454 | .detect_delay = 20, | 457 | .detect_delay_ms = 200, |
455 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 458 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
456 | .init = cm_x300_mci2_init, | 459 | .init = cm_x300_mci2_init, |
457 | .exit = cm_x300_mci2_exit, | 460 | .exit = cm_x300_mci2_exit, |
@@ -584,12 +587,87 @@ static void __init cm_x300_init_rtc(void) | |||
584 | static inline void cm_x300_init_rtc(void) {} | 587 | static inline void cm_x300_init_rtc(void) {} |
585 | #endif | 588 | #endif |
586 | 589 | ||
590 | /* Battery */ | ||
591 | struct power_supply_info cm_x300_psy_info = { | ||
592 | .name = "battery", | ||
593 | .technology = POWER_SUPPLY_TECHNOLOGY_LIPO, | ||
594 | .voltage_max_design = 4200000, | ||
595 | .voltage_min_design = 3000000, | ||
596 | .use_for_apm = 1, | ||
597 | }; | ||
598 | |||
599 | static void cm_x300_battery_low(void) | ||
600 | { | ||
601 | #if defined(CONFIG_APM_EMULATION) | ||
602 | apm_queue_event(APM_LOW_BATTERY); | ||
603 | #endif | ||
604 | } | ||
605 | |||
606 | static void cm_x300_battery_critical(void) | ||
607 | { | ||
608 | #if defined(CONFIG_APM_EMULATION) | ||
609 | apm_queue_event(APM_CRITICAL_SUSPEND); | ||
610 | #endif | ||
611 | } | ||
612 | |||
613 | struct da9030_battery_info cm_x300_battery_info = { | ||
614 | .battery_info = &cm_x300_psy_info, | ||
615 | |||
616 | .charge_milliamp = 1000, | ||
617 | .charge_millivolt = 4200, | ||
618 | |||
619 | .vbat_low = 3600, | ||
620 | .vbat_crit = 3400, | ||
621 | .vbat_charge_start = 4100, | ||
622 | .vbat_charge_stop = 4200, | ||
623 | .vbat_charge_restart = 4000, | ||
624 | |||
625 | .vcharge_min = 3200, | ||
626 | .vcharge_max = 5500, | ||
627 | |||
628 | .tbat_low = 197, | ||
629 | .tbat_high = 78, | ||
630 | .tbat_restart = 100, | ||
631 | |||
632 | .batmon_interval = 0, | ||
633 | |||
634 | .battery_low = cm_x300_battery_low, | ||
635 | .battery_critical = cm_x300_battery_critical, | ||
636 | }; | ||
637 | |||
638 | static struct regulator_consumer_supply buck2_consumers[] = { | ||
639 | { | ||
640 | .dev = NULL, | ||
641 | .supply = "vcc_core", | ||
642 | }, | ||
643 | }; | ||
644 | |||
645 | static struct regulator_init_data buck2_data = { | ||
646 | .constraints = { | ||
647 | .min_uV = 1375000, | ||
648 | .max_uV = 1375000, | ||
649 | .state_mem = { | ||
650 | .enabled = 0, | ||
651 | }, | ||
652 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
653 | .apply_uV = 1, | ||
654 | }, | ||
655 | .num_consumer_supplies = ARRAY_SIZE(buck2_consumers), | ||
656 | .consumer_supplies = buck2_consumers, | ||
657 | }; | ||
658 | |||
587 | /* DA9030 */ | 659 | /* DA9030 */ |
588 | struct da903x_subdev_info cm_x300_da9030_subdevs[] = { | 660 | struct da903x_subdev_info cm_x300_da9030_subdevs[] = { |
589 | { | 661 | { |
590 | .name = "da903x-backlight", | 662 | .name = "da903x-battery", |
591 | .id = DA9030_ID_WLED, | 663 | .id = DA9030_ID_BAT, |
592 | } | 664 | .platform_data = &cm_x300_battery_info, |
665 | }, | ||
666 | { | ||
667 | .name = "da903x-regulator", | ||
668 | .id = DA9030_ID_BUCK2, | ||
669 | .platform_data = &buck2_data, | ||
670 | }, | ||
593 | }; | 671 | }; |
594 | 672 | ||
595 | static struct da903x_platform_data cm_x300_da9030_info = { | 673 | static struct da903x_platform_data cm_x300_da9030_info = { |
@@ -599,7 +677,7 @@ static struct da903x_platform_data cm_x300_da9030_info = { | |||
599 | 677 | ||
600 | static struct i2c_board_info cm_x300_pmic_info = { | 678 | static struct i2c_board_info cm_x300_pmic_info = { |
601 | I2C_BOARD_INFO("da9030", 0x49), | 679 | I2C_BOARD_INFO("da9030", 0x49), |
602 | .irq = IRQ_GPIO(0), | 680 | .irq = IRQ_WAKEUP0, |
603 | .platform_data = &cm_x300_da9030_info, | 681 | .platform_data = &cm_x300_da9030_info, |
604 | }; | 682 | }; |
605 | 683 | ||
@@ -689,13 +767,13 @@ static void __init cm_x300_init(void) | |||
689 | static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags, | 767 | static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags, |
690 | char **cmdline, struct meminfo *mi) | 768 | char **cmdline, struct meminfo *mi) |
691 | { | 769 | { |
692 | mi->nr_banks = 2; | 770 | /* Make sure that mi->bank[0].start = PHYS_ADDR */ |
693 | mi->bank[0].start = 0xa0000000; | 771 | for (; tags->hdr.size; tags = tag_next(tags)) |
694 | mi->bank[0].node = 0; | 772 | if (tags->hdr.tag == ATAG_MEM && |
695 | mi->bank[0].size = (64*1024*1024); | 773 | tags->u.mem.start == 0x80000000) { |
696 | mi->bank[1].start = 0xc0000000; | 774 | tags->u.mem.start = 0xa0000000; |
697 | mi->bank[1].node = 0; | 775 | break; |
698 | mi->bank[1].size = (64*1024*1024); | 776 | } |
699 | } | 777 | } |
700 | 778 | ||
701 | MACHINE_START(CM_X300, "CM-X300 module") | 779 | MACHINE_START(CM_X300, "CM-X300 module") |