aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/Kconfig10
-rw-r--r--arch/arm/mach-pxa/Makefile1
-rw-r--r--arch/arm/mach-pxa/corgi.c6
-rw-r--r--arch/arm/mach-pxa/em-x270.c63
-rw-r--r--arch/arm/mach-pxa/hx4700.c41
-rw-r--r--arch/arm/mach-pxa/include/mach/palmz72.h5
-rw-r--r--arch/arm/mach-pxa/include/mach/treo680.h49
-rw-r--r--arch/arm/mach-pxa/mioa701.c42
-rw-r--r--arch/arm/mach-pxa/palmz72.c65
-rw-r--r--arch/arm/mach-pxa/poodle.c6
-rw-r--r--arch/arm/mach-pxa/treo680.c612
11 files changed, 890 insertions, 10 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index f4533f8ff4e8..89c992b8f75b 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -401,6 +401,16 @@ config MACH_PALMZ72
401 Say Y here if you intend to run this kernel on Palm Zire 72 401 Say Y here if you intend to run this kernel on Palm Zire 72
402 handheld computer. 402 handheld computer.
403 403
404config MACH_TREO680
405 bool "Palm Treo 680"
406 default y
407 depends on ARCH_PXA_PALM
408 select PXA27x
409 select IWMMXT
410 help
411 Say Y here if you intend to run this kernel on Palm Treo 680
412 smartphone.
413
404config MACH_PALMLD 414config MACH_PALMLD
405 bool "Palm LifeDrive" 415 bool "Palm LifeDrive"
406 default y 416 default y
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index d18ffef44b8c..d4c6122a342f 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_MACH_PALMT5) += palmt5.o
62obj-$(CONFIG_MACH_PALMTX) += palmtx.o 62obj-$(CONFIG_MACH_PALMTX) += palmtx.o
63obj-$(CONFIG_MACH_PALMLD) += palmld.o 63obj-$(CONFIG_MACH_PALMLD) += palmld.o
64obj-$(CONFIG_MACH_PALMZ72) += palmz72.o 64obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
65obj-$(CONFIG_MACH_TREO680) += treo680.o
65obj-$(CONFIG_ARCH_VIPER) += viper.o 66obj-$(CONFIG_ARCH_VIPER) += viper.o
66 67
67ifeq ($(CONFIG_MACH_ZYLONITE),y) 68ifeq ($(CONFIG_MACH_ZYLONITE),y)
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 962dda2e154a..5363e1aea3fb 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -23,6 +23,7 @@
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/backlight.h> 25#include <linux/backlight.h>
26#include <linux/i2c.h>
26#include <linux/io.h> 27#include <linux/io.h>
27#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h> 29#include <linux/spi/ads7846.h>
@@ -600,6 +601,10 @@ static struct platform_device *devices[] __initdata = {
600 &sharpsl_rom_device, 601 &sharpsl_rom_device,
601}; 602};
602 603
604static struct i2c_board_info __initdata corgi_i2c_devices[] = {
605 { I2C_BOARD_INFO("wm8731", 0x1b) },
606};
607
603static void corgi_poweroff(void) 608static void corgi_poweroff(void)
604{ 609{
605 if (!machine_is_corgi()) 610 if (!machine_is_corgi())
@@ -634,6 +639,7 @@ static void __init corgi_init(void)
634 pxa_set_mci_info(&corgi_mci_platform_data); 639 pxa_set_mci_info(&corgi_mci_platform_data);
635 pxa_set_ficp_info(&corgi_ficp_platform_data); 640 pxa_set_ficp_info(&corgi_ficp_platform_data);
636 pxa_set_i2c_info(NULL); 641 pxa_set_i2c_info(NULL);
642 i2c_register_board_info(0, ARRAY_AND_SIZE(corgi_i2c_devices));
637 643
638 platform_scoop_config = &corgi_pcmcia_config; 644 platform_scoop_config = &corgi_pcmcia_config;
639 645
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 243e0802b5f4..63b10d9bb1d3 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -30,6 +30,7 @@
30#include <linux/apm-emulation.h> 30#include <linux/apm-emulation.h>
31#include <linux/i2c.h> 31#include <linux/i2c.h>
32#include <linux/i2c/pca953x.h> 32#include <linux/i2c/pca953x.h>
33#include <linux/regulator/userspace-consumer.h>
33 34
34#include <media/soc_camera.h> 35#include <media/soc_camera.h>
35 36
@@ -735,6 +736,7 @@ static struct pxa2xx_spi_chip em_x270_libertas_chip = {
735 .rx_threshold = 1, 736 .rx_threshold = 1,
736 .tx_threshold = 1, 737 .tx_threshold = 1,
737 .timeout = 1000, 738 .timeout = 1000,
739 .gpio_cs = 14,
738}; 740};
739 741
740static unsigned long em_x270_libertas_pin_config[] = { 742static unsigned long em_x270_libertas_pin_config[] = {
@@ -803,7 +805,6 @@ static int em_x270_libertas_teardown(struct spi_device *spi)
803 805
804struct libertas_spi_platform_data em_x270_libertas_pdata = { 806struct libertas_spi_platform_data em_x270_libertas_pdata = {
805 .use_dummy_writes = 1, 807 .use_dummy_writes = 1,
806 .gpio_cs = 14,
807 .setup = em_x270_libertas_setup, 808 .setup = em_x270_libertas_setup,
808 .teardown = em_x270_libertas_teardown, 809 .teardown = em_x270_libertas_teardown,
809}; 810};
@@ -838,10 +839,14 @@ static void __init em_x270_init_spi(void)
838static inline void em_x270_init_spi(void) {} 839static inline void em_x270_init_spi(void) {}
839#endif 840#endif
840 841
841#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE) 842#if defined(CONFIG_SND_PXA2XX_LIB_AC97)
843static pxa2xx_audio_ops_t em_x270_ac97_info = {
844 .reset_gpio = 113,
845};
846
842static void __init em_x270_init_ac97(void) 847static void __init em_x270_init_ac97(void)
843{ 848{
844 pxa_set_ac97_info(NULL); 849 pxa_set_ac97_info(&em_x270_ac97_info);
845} 850}
846#else 851#else
847static inline void em_x270_init_ac97(void) {} 852static inline void em_x270_init_ac97(void) {}
@@ -1038,6 +1043,52 @@ static void __init em_x270_init_camera(void)
1038static inline void em_x270_init_camera(void) {} 1043static inline void em_x270_init_camera(void) {}
1039#endif 1044#endif
1040 1045
1046static struct regulator_bulk_data em_x270_gps_consumer_supply = {
1047 .supply = "vcc gps",
1048};
1049
1050static struct regulator_userspace_consumer_data em_x270_gps_consumer_data = {
1051 .name = "vcc gps",
1052 .num_supplies = 1,
1053 .supplies = &em_x270_gps_consumer_supply,
1054};
1055
1056static struct platform_device em_x270_gps_userspace_consumer = {
1057 .name = "reg-userspace-consumer",
1058 .id = 0,
1059 .dev = {
1060 .platform_data = &em_x270_gps_consumer_data,
1061 },
1062};
1063
1064static struct regulator_bulk_data em_x270_gprs_consumer_supply = {
1065 .supply = "vcc gprs",
1066};
1067
1068static struct regulator_userspace_consumer_data em_x270_gprs_consumer_data = {
1069 .name = "vcc gprs",
1070 .num_supplies = 1,
1071 .supplies = &em_x270_gprs_consumer_supply
1072};
1073
1074static struct platform_device em_x270_gprs_userspace_consumer = {
1075 .name = "reg-userspace-consumer",
1076 .id = 1,
1077 .dev = {
1078 .platform_data = &em_x270_gprs_consumer_data,
1079 }
1080};
1081
1082static struct platform_device *em_x270_userspace_consumers[] = {
1083 &em_x270_gps_userspace_consumer,
1084 &em_x270_gprs_userspace_consumer,
1085};
1086
1087static void __init em_x270_userspace_consumers_init(void)
1088{
1089 platform_add_devices(ARRAY_AND_SIZE(em_x270_userspace_consumers));
1090}
1091
1041/* DA9030 related initializations */ 1092/* DA9030 related initializations */
1042#define REGULATOR_CONSUMER(_name, _dev, _supply) \ 1093#define REGULATOR_CONSUMER(_name, _dev, _supply) \
1043 static struct regulator_consumer_supply _name##_consumers[] = { \ 1094 static struct regulator_consumer_supply _name##_consumers[] = { \
@@ -1047,11 +1098,11 @@ static inline void em_x270_init_camera(void) {}
1047 }, \ 1098 }, \
1048 } 1099 }
1049 1100
1050REGULATOR_CONSUMER(ldo3, NULL, "vcc gps"); 1101REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps");
1051REGULATOR_CONSUMER(ldo5, NULL, "vcc cam"); 1102REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
1052REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio"); 1103REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
1053REGULATOR_CONSUMER(ldo12, NULL, "vcc usb"); 1104REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
1054REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs"); 1105REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs");
1055 1106
1056#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \ 1107#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
1057 static struct regulator_init_data _ldo##_data = { \ 1108 static struct regulator_init_data _ldo##_data = { \
@@ -1062,6 +1113,7 @@ REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs");
1062 .enabled = 0, \ 1113 .enabled = 0, \
1063 }, \ 1114 }, \
1064 .valid_ops_mask = _ops_mask, \ 1115 .valid_ops_mask = _ops_mask, \
1116 .apply_uV = 1, \
1065 }, \ 1117 }, \
1066 .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \ 1118 .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \
1067 .consumer_supplies = _ldo##_consumers, \ 1119 .consumer_supplies = _ldo##_consumers, \
@@ -1240,6 +1292,7 @@ static void __init em_x270_init(void)
1240 em_x270_init_spi(); 1292 em_x270_init_spi();
1241 em_x270_init_i2c(); 1293 em_x270_init_i2c();
1242 em_x270_init_camera(); 1294 em_x270_init_camera();
1295 em_x270_userspace_consumers_init();
1243} 1296}
1244 1297
1245MACHINE_START(EM_X270, "Compulab EM-X270") 1298MACHINE_START(EM_X270, "Compulab EM-X270")
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 7fff467e84fc..81359d574f88 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -30,6 +30,7 @@
30#include <linux/pwm_backlight.h> 30#include <linux/pwm_backlight.h>
31#include <linux/regulator/bq24022.h> 31#include <linux/regulator/bq24022.h>
32#include <linux/regulator/machine.h> 32#include <linux/regulator/machine.h>
33#include <linux/regulator/max1586.h>
33#include <linux/spi/ads7846.h> 34#include <linux/spi/ads7846.h>
34#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
35#include <linux/usb/gpio_vbus.h> 36#include <linux/usb/gpio_vbus.h>
@@ -775,6 +776,45 @@ static struct platform_device strataflash = {
775}; 776};
776 777
777/* 778/*
779 * Maxim MAX1587A on PI2C
780 */
781
782static struct regulator_consumer_supply max1587a_consumer = {
783 .supply = "vcc_core",
784};
785
786static struct regulator_init_data max1587a_v3_info = {
787 .constraints = {
788 .name = "vcc_core range",
789 .min_uV = 900000,
790 .max_uV = 1705000,
791 .always_on = 1,
792 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
793 },
794 .num_consumer_supplies = 1,
795 .consumer_supplies = &max1587a_consumer,
796};
797
798static struct max1586_subdev_data max1587a_subdev = {
799 .name = "vcc_core",
800 .id = MAX1586_V3,
801 .platform_data = &max1587a_v3_info,
802};
803
804static struct max1586_platform_data max1587a_info = {
805 .num_subdevs = 1,
806 .subdevs = &max1587a_subdev,
807 .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
808};
809
810static struct i2c_board_info __initdata pi2c_board_info[] = {
811 {
812 I2C_BOARD_INFO("max1586", 0x14),
813 .platform_data = &max1587a_info,
814 },
815};
816
817/*
778 * PCMCIA 818 * PCMCIA
779 */ 819 */
780 820
@@ -828,6 +868,7 @@ static void __init hx4700_init(void)
828 pxa_set_ficp_info(&ficp_info); 868 pxa_set_ficp_info(&ficp_info);
829 pxa27x_set_i2c_power_info(NULL); 869 pxa27x_set_i2c_power_info(NULL);
830 pxa_set_i2c_info(NULL); 870 pxa_set_i2c_info(NULL);
871 i2c_register_board_info(1, ARRAY_AND_SIZE(pi2c_board_info));
831 pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); 872 pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
832 spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info)); 873 spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info));
833 874
diff --git a/arch/arm/mach-pxa/include/mach/palmz72.h b/arch/arm/mach-pxa/include/mach/palmz72.h
index 5032307ebf7d..2806ef69ba5a 100644
--- a/arch/arm/mach-pxa/include/mach/palmz72.h
+++ b/arch/arm/mach-pxa/include/mach/palmz72.h
@@ -21,7 +21,7 @@
21/* SD/MMC */ 21/* SD/MMC */
22#define GPIO_NR_PALMZ72_SD_DETECT_N 14 22#define GPIO_NR_PALMZ72_SD_DETECT_N 14
23#define GPIO_NR_PALMZ72_SD_POWER_N 98 23#define GPIO_NR_PALMZ72_SD_POWER_N 98
24#define GPIO_NR_PALMZ72_SD_RO 115 24#define GPIO_NR_PALMZ72_SD_RO 115
25 25
26/* Touchscreen */ 26/* Touchscreen */
27#define GPIO_NR_PALMZ72_WM9712_IRQ 27 27#define GPIO_NR_PALMZ72_WM9712_IRQ 27
@@ -31,8 +31,7 @@
31 31
32/* USB */ 32/* USB */
33#define GPIO_NR_PALMZ72_USB_DETECT_N 15 33#define GPIO_NR_PALMZ72_USB_DETECT_N 15
34#define GPIO_NR_PALMZ72_USB_POWER 95 34#define GPIO_NR_PALMZ72_USB_PULLUP 95
35#define GPIO_NR_PALMZ72_USB_PULLUP 12
36 35
37/* LCD/Backlight */ 36/* LCD/Backlight */
38#define GPIO_NR_PALMZ72_BL_POWER 20 37#define GPIO_NR_PALMZ72_BL_POWER 20
diff --git a/arch/arm/mach-pxa/include/mach/treo680.h b/arch/arm/mach-pxa/include/mach/treo680.h
new file mode 100644
index 000000000000..af443b24d99a
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/treo680.h
@@ -0,0 +1,49 @@
1/*
2 * GPIOs and interrupts for Palm Treo 680 smartphone
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#ifndef _INCLUDE_TREO680_H_
11#define _INCLUDE_TREO680_H_
12
13/* GPIOs */
14#define GPIO_NR_TREO680_POWER_DETECT 0
15#define GPIO_NR_TREO680_AMP_EN 27
16#define GPIO_NR_TREO680_KEYB_BL 24
17#define GPIO_NR_TREO680_VIBRATE_EN 44
18#define GPIO_NR_TREO680_GREEN_LED 20
19#define GPIO_NR_TREO680_RED_LED 79
20#define GPIO_NR_TREO680_SD_DETECT_N 113
21#define GPIO_NR_TREO680_SD_READONLY 33
22#define GPIO_NR_TREO680_EP_DETECT_N 116
23#define GPIO_NR_TREO680_SD_POWER 42
24#define GPIO_NR_TREO680_USB_DETECT 1
25#define GPIO_NR_TREO680_USB_PULLUP 114
26#define GPIO_NR_TREO680_GSM_POWER 40
27#define GPIO_NR_TREO680_GSM_RESET 87
28#define GPIO_NR_TREO680_GSM_WAKE 57
29#define GPIO_NR_TREO680_GSM_HOST_WAKE 14
30#define GPIO_NR_TREO680_GSM_TRIGGER 10
31#define GPIO_NR_TREO680_BT_EN 43
32#define GPIO_NR_TREO680_IR_EN 115
33#define GPIO_NR_TREO680_IR_TXD 47
34#define GPIO_NR_TREO680_BL_POWER 38
35#define GPIO_NR_TREO680_LCD_POWER 25
36
37/* Various addresses */
38#define TREO680_PHYS_RAM_START 0xa0000000
39#define TREO680_PHYS_IO_START 0x40000000
40#define TREO680_STR_BASE 0xa2000000
41
42/* BACKLIGHT */
43#define TREO680_MAX_INTENSITY 254
44#define TREO680_DEFAULT_INTENSITY 160
45#define TREO680_LIMIT_MASK 0x7F
46#define TREO680_PRESCALER 63
47#define TREO680_PERIOD_NS 3500
48
49#endif
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 4dc8c2ec40a9..2d28132c725b 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -37,6 +37,7 @@
37#include <linux/wm97xx_batt.h> 37#include <linux/wm97xx_batt.h>
38#include <linux/mtd/physmap.h> 38#include <linux/mtd/physmap.h>
39#include <linux/usb/gpio_vbus.h> 39#include <linux/usb/gpio_vbus.h>
40#include <linux/regulator/max1586.h>
40 41
41#include <asm/mach-types.h> 42#include <asm/mach-types.h>
42#include <asm/mach/arch.h> 43#include <asm/mach/arch.h>
@@ -717,6 +718,38 @@ static struct wm97xx_batt_info mioa701_battery_data = {
717}; 718};
718 719
719/* 720/*
721 * Voltage regulation
722 */
723static struct regulator_consumer_supply max1586_consumers[] = {
724 {
725 .supply = "vcc_core",
726 }
727};
728
729static struct regulator_init_data max1586_v3_info = {
730 .constraints = {
731 .name = "vcc_core range",
732 .min_uV = 1000000,
733 .max_uV = 1705000,
734 .always_on = 1,
735 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
736 },
737 .num_consumer_supplies = ARRAY_SIZE(max1586_consumers),
738 .consumer_supplies = max1586_consumers,
739};
740
741static struct max1586_subdev_data max1586_subdevs[] = {
742 { .name = "vcc_core", .id = MAX1586_V3,
743 .platform_data = &max1586_v3_info },
744};
745
746static struct max1586_platform_data max1586_info = {
747 .subdevs = max1586_subdevs,
748 .num_subdevs = ARRAY_SIZE(max1586_subdevs),
749 .v3_gain = MAX1586_GAIN_NO_R24, /* 700..1475 mV */
750};
751
752/*
720 * Camera interface 753 * Camera interface
721 */ 754 */
722struct pxacamera_platform_data mioa701_pxacamera_platform_data = { 755struct pxacamera_platform_data mioa701_pxacamera_platform_data = {
@@ -725,6 +758,13 @@ struct pxacamera_platform_data mioa701_pxacamera_platform_data = {
725 .mclk_10khz = 5000, 758 .mclk_10khz = 5000,
726}; 759};
727 760
761static struct i2c_board_info __initdata mioa701_pi2c_devices[] = {
762 {
763 I2C_BOARD_INFO("max1586", 0x14),
764 .platform_data = &max1586_info,
765 },
766};
767
728static struct soc_camera_link iclink = { 768static struct soc_camera_link iclink = {
729 .bus_id = 0, /* Must match id in pxa27x_device_camera in device.c */ 769 .bus_id = 0, /* Must match id in pxa27x_device_camera in device.c */
730}; 770};
@@ -825,7 +865,9 @@ static void __init mioa701_machine_init(void)
825 platform_add_devices(devices, ARRAY_SIZE(devices)); 865 platform_add_devices(devices, ARRAY_SIZE(devices));
826 gsm_init(); 866 gsm_init();
827 867
868 i2c_register_board_info(1, ARRAY_AND_SIZE(mioa701_pi2c_devices));
828 pxa_set_i2c_info(&i2c_pdata); 869 pxa_set_i2c_info(&i2c_pdata);
870 pxa27x_set_i2c_power_info(NULL);
829 pxa_set_camera_info(&mioa701_pxacamera_platform_data); 871 pxa_set_camera_info(&mioa701_pxacamera_platform_data);
830 i2c_register_board_info(0, ARRAY_AND_SIZE(mioa701_i2c_devices)); 872 i2c_register_board_info(0, ARRAY_AND_SIZE(mioa701_i2c_devices));
831} 873}
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index b88eb4dd2c84..c3645aa3fa3d 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -27,7 +27,9 @@
27#include <linux/pda_power.h> 27#include <linux/pda_power.h>
28#include <linux/pwm_backlight.h> 28#include <linux/pwm_backlight.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/wm97xx_batt.h>
30#include <linux/power_supply.h> 31#include <linux/power_supply.h>
32#include <linux/usb/gpio_vbus.h>
31 33
32#include <asm/mach-types.h> 34#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
@@ -41,6 +43,8 @@
41#include <mach/irda.h> 43#include <mach/irda.h>
42#include <mach/pxa27x_keypad.h> 44#include <mach/pxa27x_keypad.h>
43#include <mach/udc.h> 45#include <mach/udc.h>
46#include <mach/palmasoc.h>
47
44#include <mach/pm.h> 48#include <mach/pm.h>
45 49
46#include "generic.h" 50#include "generic.h"
@@ -66,6 +70,8 @@ static unsigned long palmz72_pin_config[] __initdata = {
66 GPIO29_AC97_SDATA_IN_0, 70 GPIO29_AC97_SDATA_IN_0,
67 GPIO30_AC97_SDATA_OUT, 71 GPIO30_AC97_SDATA_OUT,
68 GPIO31_AC97_SYNC, 72 GPIO31_AC97_SYNC,
73 GPIO89_AC97_SYSCLK,
74 GPIO113_AC97_nRESET,
69 75
70 /* IrDA */ 76 /* IrDA */
71 GPIO49_GPIO, /* ir disable */ 77 GPIO49_GPIO, /* ir disable */
@@ -77,8 +83,7 @@ static unsigned long palmz72_pin_config[] __initdata = {
77 83
78 /* USB */ 84 /* USB */
79 GPIO15_GPIO, /* usb detect */ 85 GPIO15_GPIO, /* usb detect */
80 GPIO12_GPIO, /* usb pullup */ 86 GPIO95_GPIO, /* usb pullup */
81 GPIO95_GPIO, /* usb power */
82 87
83 /* Matrix keypad */ 88 /* Matrix keypad */
84 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, 89 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
@@ -355,6 +360,22 @@ static struct platform_device palmz72_leds = {
355}; 360};
356 361
357/****************************************************************************** 362/******************************************************************************
363 * UDC
364 ******************************************************************************/
365static struct gpio_vbus_mach_info palmz72_udc_info = {
366 .gpio_vbus = GPIO_NR_PALMZ72_USB_DETECT_N,
367 .gpio_pullup = GPIO_NR_PALMZ72_USB_PULLUP,
368};
369
370static struct platform_device palmz72_gpio_vbus = {
371 .name = "gpio-vbus",
372 .id = -1,
373 .dev = {
374 .platform_data = &palmz72_udc_info,
375 },
376};
377
378/******************************************************************************
358 * Power supply 379 * Power supply
359 ******************************************************************************/ 380 ******************************************************************************/
360static int power_supply_init(struct device *dev) 381static int power_supply_init(struct device *dev)
@@ -422,6 +443,31 @@ static struct platform_device power_supply = {
422}; 443};
423 444
424/****************************************************************************** 445/******************************************************************************
446 * WM97xx battery
447 ******************************************************************************/
448static struct wm97xx_batt_info wm97xx_batt_pdata = {
449 .batt_aux = WM97XX_AUX_ID3,
450 .temp_aux = WM97XX_AUX_ID2,
451 .charge_gpio = -1,
452 .max_voltage = PALMZ72_BAT_MAX_VOLTAGE,
453 .min_voltage = PALMZ72_BAT_MIN_VOLTAGE,
454 .batt_mult = 1000,
455 .batt_div = 414,
456 .temp_mult = 1,
457 .temp_div = 1,
458 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
459 .batt_name = "main-batt",
460};
461
462/******************************************************************************
463 * aSoC audio
464 ******************************************************************************/
465static struct platform_device palmz72_asoc = {
466 .name = "palm27x-asoc",
467 .id = -1,
468};
469
470/******************************************************************************
425 * Framebuffer 471 * Framebuffer
426 ******************************************************************************/ 472 ******************************************************************************/
427static struct pxafb_mode_info palmz72_lcd_modes[] = { 473static struct pxafb_mode_info palmz72_lcd_modes[] = {
@@ -527,17 +573,32 @@ device_initcall(palmz72_pm_init);
527static struct platform_device *devices[] __initdata = { 573static struct platform_device *devices[] __initdata = {
528 &palmz72_backlight, 574 &palmz72_backlight,
529 &palmz72_leds, 575 &palmz72_leds,
576 &palmz72_asoc,
530 &power_supply, 577 &power_supply,
578 &palmz72_gpio_vbus,
531}; 579};
532 580
581/* setup udc GPIOs initial state */
582static void __init palmz72_udc_init(void)
583{
584 if (!gpio_request(GPIO_NR_PALMZ72_USB_PULLUP, "USB Pullup")) {
585 gpio_direction_output(GPIO_NR_PALMZ72_USB_PULLUP, 0);
586 gpio_free(GPIO_NR_PALMZ72_USB_PULLUP);
587 }
588}
589
533static void __init palmz72_init(void) 590static void __init palmz72_init(void)
534{ 591{
535 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config)); 592 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config));
593
536 set_pxa_fb_info(&palmz72_lcd_screen); 594 set_pxa_fb_info(&palmz72_lcd_screen);
537 pxa_set_mci_info(&palmz72_mci_platform_data); 595 pxa_set_mci_info(&palmz72_mci_platform_data);
596 palmz72_udc_init();
538 pxa_set_ac97_info(NULL); 597 pxa_set_ac97_info(NULL);
539 pxa_set_ficp_info(&palmz72_ficp_platform_data); 598 pxa_set_ficp_info(&palmz72_ficp_platform_data);
540 pxa_set_keypad_info(&palmz72_keypad_platform_data); 599 pxa_set_keypad_info(&palmz72_keypad_platform_data);
600 wm97xx_bat_set_pdata(&wm97xx_batt_pdata);
601
541 platform_add_devices(devices, ARRAY_SIZE(devices)); 602 platform_add_devices(devices, ARRAY_SIZE(devices));
542} 603}
543 604
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index ac431ed10399..9352d4a34837 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -22,6 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/i2c.h>
25#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
26#include <linux/spi/ads7846.h> 27#include <linux/spi/ads7846.h>
27#include <linux/mtd/sharpsl.h> 28#include <linux/mtd/sharpsl.h>
@@ -486,6 +487,10 @@ static struct platform_device *devices[] __initdata = {
486 &sharpsl_rom_device, 487 &sharpsl_rom_device,
487}; 488};
488 489
490static struct i2c_board_info __initdata poodle_i2c_devices[] = {
491 { I2C_BOARD_INFO("wm8731", 0x1b) },
492};
493
489static void poodle_poweroff(void) 494static void poodle_poweroff(void)
490{ 495{
491 arm_machine_restart('h', NULL); 496 arm_machine_restart('h', NULL);
@@ -519,6 +524,7 @@ static void __init poodle_init(void)
519 pxa_set_mci_info(&poodle_mci_platform_data); 524 pxa_set_mci_info(&poodle_mci_platform_data);
520 pxa_set_ficp_info(&poodle_ficp_platform_data); 525 pxa_set_ficp_info(&poodle_ficp_platform_data);
521 pxa_set_i2c_info(NULL); 526 pxa_set_i2c_info(NULL);
527 i2c_register_board_info(0, ARRAY_AND_SIZE(poodle_i2c_devices));
522 poodle_init_spi(); 528 poodle_init_spi();
523} 529}
524 530
diff --git a/arch/arm/mach-pxa/treo680.c b/arch/arm/mach-pxa/treo680.c
new file mode 100644
index 000000000000..a06f19edebb3
--- /dev/null
+++ b/arch/arm/mach-pxa/treo680.c
@@ -0,0 +1,612 @@
1/*
2 * Hardware definitions for Palm Treo 680
3 *
4 * Author: Tomas Cech <sleep_walker@suse.cz>
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 * (find more info at www.hackndev.com)
11 *
12 */
13
14#include <linux/platform_device.h>
15#include <linux/delay.h>
16#include <linux/irq.h>
17#include <linux/gpio_keys.h>
18#include <linux/input.h>
19#include <linux/pda_power.h>
20#include <linux/pwm_backlight.h>
21#include <linux/gpio.h>
22#include <linux/wm97xx_batt.h>
23#include <linux/power_supply.h>
24#include <linux/sysdev.h>
25#include <linux/w1-gpio.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30
31#include <mach/pxa27x.h>
32#include <mach/pxa27x-udc.h>
33#include <mach/audio.h>
34#include <mach/treo680.h>
35#include <mach/mmc.h>
36#include <mach/pxafb.h>
37#include <mach/irda.h>
38#include <mach/pxa27x_keypad.h>
39#include <mach/udc.h>
40#include <mach/ohci.h>
41#include <mach/pxa2xx-regs.h>
42#include <mach/palmasoc.h>
43#include <mach/camera.h>
44
45#include <sound/pxa2xx-lib.h>
46
47#include "generic.h"
48#include "devices.h"
49
50/******************************************************************************
51 * Pin configuration
52 ******************************************************************************/
53static unsigned long treo680_pin_config[] __initdata = {
54 /* MMC */
55 GPIO32_MMC_CLK,
56 GPIO92_MMC_DAT_0,
57 GPIO109_MMC_DAT_1,
58 GPIO110_MMC_DAT_2,
59 GPIO111_MMC_DAT_3,
60 GPIO112_MMC_CMD,
61 GPIO33_GPIO, /* SD read only */
62 GPIO113_GPIO, /* SD detect */
63
64 /* AC97 */
65 GPIO28_AC97_BITCLK,
66 GPIO29_AC97_SDATA_IN_0,
67 GPIO30_AC97_SDATA_OUT,
68 GPIO31_AC97_SYNC,
69 GPIO89_AC97_SYSCLK,
70 GPIO95_AC97_nRESET,
71
72 /* IrDA */
73 GPIO46_FICP_RXD,
74 GPIO47_FICP_TXD,
75
76 /* PWM */
77 GPIO16_PWM0_OUT,
78
79 /* USB */
80 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* usb detect */
81
82 /* MATRIX KEYPAD */
83 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
84 GPIO101_KP_MKIN_1,
85 GPIO102_KP_MKIN_2,
86 GPIO97_KP_MKIN_3,
87 GPIO98_KP_MKIN_4,
88 GPIO99_KP_MKIN_5,
89 GPIO91_KP_MKIN_6,
90 GPIO13_KP_MKIN_7,
91 GPIO103_KP_MKOUT_0 | MFP_LPM_DRIVE_HIGH,
92 GPIO104_KP_MKOUT_1,
93 GPIO105_KP_MKOUT_2,
94 GPIO106_KP_MKOUT_3,
95 GPIO107_KP_MKOUT_4,
96 GPIO108_KP_MKOUT_5,
97 GPIO96_KP_MKOUT_6,
98 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */
99
100 /* LCD */
101 GPIO58_LCD_LDD_0,
102 GPIO59_LCD_LDD_1,
103 GPIO60_LCD_LDD_2,
104 GPIO61_LCD_LDD_3,
105 GPIO62_LCD_LDD_4,
106 GPIO63_LCD_LDD_5,
107 GPIO64_LCD_LDD_6,
108 GPIO65_LCD_LDD_7,
109 GPIO66_LCD_LDD_8,
110 GPIO67_LCD_LDD_9,
111 GPIO68_LCD_LDD_10,
112 GPIO69_LCD_LDD_11,
113 GPIO70_LCD_LDD_12,
114 GPIO71_LCD_LDD_13,
115 GPIO72_LCD_LDD_14,
116 GPIO73_LCD_LDD_15,
117 GPIO74_LCD_FCLK,
118 GPIO75_LCD_LCLK,
119 GPIO76_LCD_PCLK,
120
121 /* Quick Capture Interface */
122 GPIO84_CIF_FV,
123 GPIO85_CIF_LV,
124 GPIO53_CIF_MCLK,
125 GPIO54_CIF_PCLK,
126 GPIO81_CIF_DD_0,
127 GPIO55_CIF_DD_1,
128 GPIO51_CIF_DD_2,
129 GPIO50_CIF_DD_3,
130 GPIO52_CIF_DD_4,
131 GPIO48_CIF_DD_5,
132 GPIO17_CIF_DD_6,
133 GPIO12_CIF_DD_7,
134
135 /* I2C */
136 GPIO117_I2C_SCL,
137 GPIO118_I2C_SDA,
138
139 /* GSM */
140 GPIO14_GPIO | WAKEUP_ON_EDGE_BOTH, /* GSM host wake up */
141 GPIO34_FFUART_RXD,
142 GPIO35_FFUART_CTS,
143 GPIO39_FFUART_TXD,
144 GPIO41_FFUART_RTS,
145
146 /* MISC. */
147 GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* external power detect */
148 GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH, /* silent switch */
149 GPIO116_GPIO, /* headphone detect */
150 GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* bluetooth host wake up */
151};
152
153/******************************************************************************
154 * SD/MMC card controller
155 ******************************************************************************/
156static int treo680_mci_init(struct device *dev,
157 irq_handler_t treo680_detect_int, void *data)
158{
159 int err = 0;
160
161 /* Setup an interrupt for detecting card insert/remove events */
162 err = gpio_request(GPIO_NR_TREO680_SD_DETECT_N, "SD IRQ");
163
164 if (err)
165 goto err;
166
167 err = gpio_direction_input(GPIO_NR_TREO680_SD_DETECT_N);
168 if (err)
169 goto err2;
170
171 err = request_irq(gpio_to_irq(GPIO_NR_TREO680_SD_DETECT_N),
172 treo680_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
173 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
174 "SD/MMC card detect", data);
175
176 if (err) {
177 dev_err(dev, "%s: cannot request SD/MMC card detect IRQ\n",
178 __func__);
179 goto err2;
180 }
181
182 err = gpio_request(GPIO_NR_TREO680_SD_POWER, "SD_POWER");
183 if (err)
184 goto err3;
185
186 err = gpio_direction_output(GPIO_NR_TREO680_SD_POWER, 1);
187 if (err)
188 goto err4;
189
190 err = gpio_request(GPIO_NR_TREO680_SD_READONLY, "SD_READONLY");
191 if (err)
192 goto err4;
193
194 err = gpio_direction_input(GPIO_NR_TREO680_SD_READONLY);
195 if (err)
196 goto err5;
197
198 return 0;
199
200err5:
201 gpio_free(GPIO_NR_TREO680_SD_READONLY);
202err4:
203 gpio_free(GPIO_NR_TREO680_SD_POWER);
204err3:
205 free_irq(gpio_to_irq(GPIO_NR_TREO680_SD_DETECT_N), data);
206err2:
207 gpio_free(GPIO_NR_TREO680_SD_DETECT_N);
208err:
209 return err;
210}
211
212static void treo680_mci_exit(struct device *dev, void *data)
213{
214 gpio_free(GPIO_NR_TREO680_SD_READONLY);
215 gpio_free(GPIO_NR_TREO680_SD_POWER);
216 free_irq(gpio_to_irq(GPIO_NR_TREO680_SD_DETECT_N), data);
217 gpio_free(GPIO_NR_TREO680_SD_DETECT_N);
218}
219
220static void treo680_mci_power(struct device *dev, unsigned int vdd)
221{
222 struct pxamci_platform_data *p_d = dev->platform_data;
223 gpio_set_value(GPIO_NR_TREO680_SD_POWER, p_d->ocr_mask & (1 << vdd));
224}
225
226static int treo680_mci_get_ro(struct device *dev)
227{
228 return gpio_get_value(GPIO_NR_TREO680_SD_READONLY);
229}
230
231static struct pxamci_platform_data treo680_mci_platform_data = {
232 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
233 .setpower = treo680_mci_power,
234 .get_ro = treo680_mci_get_ro,
235 .init = treo680_mci_init,
236 .exit = treo680_mci_exit,
237};
238
239/******************************************************************************
240 * GPIO keyboard
241 ******************************************************************************/
242static unsigned int treo680_matrix_keys[] = {
243 KEY(0, 0, KEY_F8), /* Red/Off/Power */
244 KEY(0, 1, KEY_LEFT),
245 KEY(0, 2, KEY_LEFTCTRL), /* Alternate */
246 KEY(0, 3, KEY_L),
247 KEY(0, 4, KEY_A),
248 KEY(0, 5, KEY_Q),
249 KEY(0, 6, KEY_P),
250
251 KEY(1, 0, KEY_RIGHTCTRL), /* Menu */
252 KEY(1, 1, KEY_RIGHT),
253 KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */
254 KEY(1, 3, KEY_Z),
255 KEY(1, 4, KEY_S),
256 KEY(1, 5, KEY_W),
257
258 KEY(2, 0, KEY_F1), /* Phone */
259 KEY(2, 1, KEY_UP),
260 KEY(2, 2, KEY_0),
261 KEY(2, 3, KEY_X),
262 KEY(2, 4, KEY_D),
263 KEY(2, 5, KEY_E),
264
265 KEY(3, 0, KEY_F10), /* Calendar */
266 KEY(3, 1, KEY_DOWN),
267 KEY(3, 2, KEY_SPACE),
268 KEY(3, 3, KEY_C),
269 KEY(3, 4, KEY_F),
270 KEY(3, 5, KEY_R),
271
272 KEY(4, 0, KEY_F12), /* Mail */
273 KEY(4, 1, KEY_KPENTER),
274 KEY(4, 2, KEY_RIGHTALT), /* Alt */
275 KEY(4, 3, KEY_V),
276 KEY(4, 4, KEY_G),
277 KEY(4, 5, KEY_T),
278
279 KEY(5, 0, KEY_F9), /* Home */
280 KEY(5, 1, KEY_PAGEUP), /* Side up */
281 KEY(5, 2, KEY_DOT),
282 KEY(5, 3, KEY_B),
283 KEY(5, 4, KEY_H),
284 KEY(5, 5, KEY_Y),
285
286 KEY(6, 0, KEY_TAB), /* Side Activate */
287 KEY(6, 1, KEY_PAGEDOWN), /* Side down */
288 KEY(6, 2, KEY_ENTER),
289 KEY(6, 3, KEY_N),
290 KEY(6, 4, KEY_J),
291 KEY(6, 5, KEY_U),
292
293 KEY(7, 0, KEY_F6), /* Green/Call */
294 KEY(7, 1, KEY_O),
295 KEY(7, 2, KEY_BACKSPACE),
296 KEY(7, 3, KEY_M),
297 KEY(7, 4, KEY_K),
298 KEY(7, 5, KEY_I),
299};
300
301static struct pxa27x_keypad_platform_data treo680_keypad_platform_data = {
302 .matrix_key_rows = 8,
303 .matrix_key_cols = 7,
304 .matrix_key_map = treo680_matrix_keys,
305 .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
306 .direct_key_map = { KEY_CONNECT },
307 .direct_key_num = 1,
308
309 .debounce_interval = 30,
310};
311
312/******************************************************************************
313 * aSoC audio
314 ******************************************************************************/
315
316static pxa2xx_audio_ops_t treo680_ac97_pdata = {
317 .reset_gpio = 95,
318};
319
320/******************************************************************************
321 * Backlight
322 ******************************************************************************/
323static int treo680_backlight_init(struct device *dev)
324{
325 int ret;
326
327 ret = gpio_request(GPIO_NR_TREO680_BL_POWER, "BL POWER");
328 if (ret)
329 goto err;
330 ret = gpio_direction_output(GPIO_NR_TREO680_BL_POWER, 0);
331 if (ret)
332 goto err2;
333 ret = gpio_request(GPIO_NR_TREO680_LCD_POWER, "LCD POWER");
334 if (ret)
335 goto err2;
336 ret = gpio_direction_output(GPIO_NR_TREO680_LCD_POWER, 0);
337 if (ret)
338 goto err3;
339
340 return 0;
341err3:
342 gpio_free(GPIO_NR_TREO680_LCD_POWER);
343err2:
344 gpio_free(GPIO_NR_TREO680_BL_POWER);
345err:
346 return ret;
347}
348
349static int treo680_backlight_notify(int brightness)
350{
351 gpio_set_value(GPIO_NR_TREO680_BL_POWER, brightness);
352 return TREO680_MAX_INTENSITY - brightness;
353};
354
355static void treo680_backlight_exit(struct device *dev)
356{
357 gpio_free(GPIO_NR_TREO680_BL_POWER);
358 gpio_free(GPIO_NR_TREO680_LCD_POWER);
359}
360
361static struct platform_pwm_backlight_data treo680_backlight_data = {
362 .pwm_id = 0,
363 .max_brightness = TREO680_MAX_INTENSITY,
364 .dft_brightness = TREO680_DEFAULT_INTENSITY,
365 .pwm_period_ns = TREO680_PERIOD_NS,
366 .init = treo680_backlight_init,
367 .notify = treo680_backlight_notify,
368 .exit = treo680_backlight_exit,
369};
370
371static struct platform_device treo680_backlight = {
372 .name = "pwm-backlight",
373 .dev = {
374 .parent = &pxa27x_device_pwm0.dev,
375 .platform_data = &treo680_backlight_data,
376 },
377};
378
379/******************************************************************************
380 * IrDA
381 ******************************************************************************/
382static void treo680_transceiver_mode(struct device *dev, int mode)
383{
384 gpio_set_value(GPIO_NR_TREO680_IR_EN, mode & IR_OFF);
385 pxa2xx_transceiver_mode(dev, mode);
386}
387
388static int treo680_irda_startup(struct device *dev)
389{
390 int err;
391
392 err = gpio_request(GPIO_NR_TREO680_IR_EN, "Ir port disable");
393 if (err)
394 goto err1;
395
396 err = gpio_direction_output(GPIO_NR_TREO680_IR_EN, 1);
397 if (err)
398 goto err2;
399
400 return 0;
401
402err2:
403 dev_err(dev, "treo680_irda: cannot change IR gpio direction\n");
404 gpio_free(GPIO_NR_TREO680_IR_EN);
405err1:
406 dev_err(dev, "treo680_irda: cannot allocate IR gpio\n");
407 return err;
408}
409
410static void treo680_irda_shutdown(struct device *dev)
411{
412 gpio_free(GPIO_NR_TREO680_AMP_EN);
413}
414
415static struct pxaficp_platform_data treo680_ficp_info = {
416 .transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF,
417 .startup = treo680_irda_startup,
418 .shutdown = treo680_irda_shutdown,
419 .transceiver_mode = treo680_transceiver_mode,
420};
421
422/******************************************************************************
423 * UDC
424 ******************************************************************************/
425static struct pxa2xx_udc_mach_info treo680_udc_info __initdata = {
426 .gpio_vbus = GPIO_NR_TREO680_USB_DETECT,
427 .gpio_vbus_inverted = 1,
428 .gpio_pullup = GPIO_NR_TREO680_USB_PULLUP,
429};
430
431
432/******************************************************************************
433 * USB host
434 ******************************************************************************/
435static struct pxaohci_platform_data treo680_ohci_info = {
436 .port_mode = PMM_PERPORT_MODE,
437 .flags = ENABLE_PORT1 | ENABLE_PORT3,
438 .power_budget = 0,
439};
440
441/******************************************************************************
442 * Power supply
443 ******************************************************************************/
444static int power_supply_init(struct device *dev)
445{
446 int ret;
447
448 ret = gpio_request(GPIO_NR_TREO680_POWER_DETECT, "CABLE_STATE_AC");
449 if (ret)
450 goto err1;
451 ret = gpio_direction_input(GPIO_NR_TREO680_POWER_DETECT);
452 if (ret)
453 goto err2;
454
455 return 0;
456
457err2:
458 gpio_free(GPIO_NR_TREO680_POWER_DETECT);
459err1:
460 return ret;
461}
462
463static int treo680_is_ac_online(void)
464{
465 return gpio_get_value(GPIO_NR_TREO680_POWER_DETECT);
466}
467
468static void power_supply_exit(struct device *dev)
469{
470 gpio_free(GPIO_NR_TREO680_POWER_DETECT);
471}
472
473static char *treo680_supplicants[] = {
474 "main-battery",
475};
476
477static struct pda_power_pdata power_supply_info = {
478 .init = power_supply_init,
479 .is_ac_online = treo680_is_ac_online,
480 .exit = power_supply_exit,
481 .supplied_to = treo680_supplicants,
482 .num_supplicants = ARRAY_SIZE(treo680_supplicants),
483};
484
485static struct platform_device power_supply = {
486 .name = "pda-power",
487 .id = -1,
488 .dev = {
489 .platform_data = &power_supply_info,
490 },
491};
492
493/******************************************************************************
494 * Vibra and LEDs
495 ******************************************************************************/
496static struct gpio_led gpio_leds[] = {
497 {
498 .name = "treo680:vibra:vibra",
499 .default_trigger = "none",
500 .gpio = GPIO_NR_TREO680_VIBRATE_EN,
501 },
502 {
503 .name = "treo680:green:led",
504 .default_trigger = "mmc0",
505 .gpio = GPIO_NR_TREO680_GREEN_LED,
506 },
507 {
508 .name = "treo680:keybbl:keybbl",
509 .default_trigger = "none",
510 .gpio = GPIO_NR_TREO680_KEYB_BL,
511 },
512};
513
514static struct gpio_led_platform_data gpio_led_info = {
515 .leds = gpio_leds,
516 .num_leds = ARRAY_SIZE(gpio_leds),
517};
518
519static struct platform_device treo680_leds = {
520 .name = "leds-gpio",
521 .id = -1,
522 .dev = {
523 .platform_data = &gpio_led_info,
524 }
525};
526
527
528/******************************************************************************
529 * Framebuffer
530 ******************************************************************************/
531/* TODO: add support for 324x324 */
532static struct pxafb_mode_info treo680_lcd_modes[] = {
533{
534 .pixclock = 86538,
535 .xres = 320,
536 .yres = 320,
537 .bpp = 16,
538
539 .left_margin = 20,
540 .right_margin = 8,
541 .upper_margin = 8,
542 .lower_margin = 5,
543
544 .hsync_len = 4,
545 .vsync_len = 1,
546},
547};
548
549static struct pxafb_mach_info treo680_lcd_screen = {
550 .modes = treo680_lcd_modes,
551 .num_modes = ARRAY_SIZE(treo680_lcd_modes),
552 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
553};
554
555/******************************************************************************
556 * Power management - standby
557 ******************************************************************************/
558static void __init treo680_pm_init(void)
559{
560 static u32 resume[] = {
561 0xe3a00101, /* mov r0, #0x40000000 */
562 0xe380060f, /* orr r0, r0, #0x00f00000 */
563 0xe590f008, /* ldr pc, [r0, #0x08] */
564 };
565
566 /* this is where the bootloader jumps */
567 memcpy(phys_to_virt(TREO680_STR_BASE), resume, sizeof(resume));
568}
569
570/******************************************************************************
571 * Machine init
572 ******************************************************************************/
573static struct platform_device *devices[] __initdata = {
574 &treo680_backlight,
575 &treo680_leds,
576 &power_supply,
577};
578
579/* setup udc GPIOs initial state */
580static void __init treo680_udc_init(void)
581{
582 if (!gpio_request(GPIO_NR_TREO680_USB_PULLUP, "UDC Vbus")) {
583 gpio_direction_output(GPIO_NR_TREO680_USB_PULLUP, 1);
584 gpio_free(GPIO_NR_TREO680_USB_PULLUP);
585 }
586}
587
588static void __init treo680_init(void)
589{
590 treo680_pm_init();
591 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
592 pxa_set_keypad_info(&treo680_keypad_platform_data);
593 set_pxa_fb_info(&treo680_lcd_screen);
594 pxa_set_mci_info(&treo680_mci_platform_data);
595 treo680_udc_init();
596 pxa_set_udc_info(&treo680_udc_info);
597 pxa_set_ac97_info(&treo680_ac97_pdata);
598 pxa_set_ficp_info(&treo680_ficp_info);
599 pxa_set_ohci_info(&treo680_ohci_info);
600
601 platform_add_devices(devices, ARRAY_SIZE(devices));
602}
603
604MACHINE_START(TREO680, "Palm Treo 680")
605 .phys_io = TREO680_PHYS_IO_START,
606 .io_pg_offst = io_p2v(0x40000000),
607 .boot_params = 0xa0000100,
608 .map_io = pxa_map_io,
609 .init_irq = pxa27x_init_irq,
610 .timer = &pxa_timer,
611 .init_machine = treo680_init,
612MACHINE_END