aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/em-x270.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-14 16:42:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-14 16:42:43 -0400
commit2cf4d4514d5b43c1f3b64bd0ec8b9853bde8f1dc (patch)
treee35a625496acc6ac852846d40b8851186b9d1ac4 /arch/arm/mach-pxa/em-x270.c
parent44b7532b8b464f606053562400719c9c21276037 (diff)
parentce53895a5d24e0ee19fb92f56c17323fb4c9ab27 (diff)
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (417 commits) MAINTAINERS: EB110ATX is not ebsa110 MAINTAINERS: update Eric Miao's email address and status fb: add support of LCD display controller on pxa168/910 (base layer) [ARM] 5552/1: ep93xx get_uart_rate(): use EP93XX_SYSCON_PWRCNT and EP93XX_SYSCON_PWRCN [ARM] pxa/sharpsl_pm: zaurus needs generic pxa suspend/resume routines [ARM] 5544/1: Trust PrimeCell resource sizes [ARM] pxa/sharpsl_pm: cleanup of gpio-related code. [ARM] pxa/sharpsl_pm: drop set_irq_type calls [ARM] pxa/sharpsl_pm: merge pxa-specific code into generic one [ARM] pxa/sharpsl_pm: merge the two sharpsl_pm.c since it's now pxa specific [ARM] sa1100: remove unused collie_pm.c [ARM] pxa: fix the conflicting non-static declarations of global_gpios[] [ARM] 5550/1: Add default configure file for w90p910 platform [ARM] 5549/1: Add clock api for w90p910 platform. [ARM] 5548/1: Add gpio api for w90p910 platform [ARM] 5551/1: Add multi-function pin api for w90p910 platform. [ARM] Make ARM_VIC_NR depend on ARM_VIC [ARM] 5546/1: ARM PL022 SSP/SPI driver v3 ARM: OMAP4: SMP: Update defconfig for OMAP4430 ARM: OMAP4: SMP: Enable SMP support for OMAP4430 ...
Diffstat (limited to 'arch/arm/mach-pxa/em-x270.c')
-rw-r--r--arch/arm/mach-pxa/em-x270.c173
1 files changed, 150 insertions, 23 deletions
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
69static int mmc_cd; 77static int mmc_cd;
70static int nand_rb; 78static int nand_rb;
71static int dm9000_flags; 79static int dm9000_flags;
80static int cam_reset;
81static int usb_hub_reset;
72 82
73static unsigned long common_pin_config[] = { 83static 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
193static unsigned long em_x270_pin_config[] = { 202static 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
199static unsigned long exeda_pin_config[] = { 210static 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)
480static struct regulator *em_x270_usb_ldo;
481
482static 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
512err_free_vbus_gpio:
513 gpio_free(GPIO9_USB_VBUS_EN);
514err_free_usb_ldo:
515 regulator_put(em_x270_usb_ldo);
516
517 return err;
518}
519
467static int em_x270_ohci_init(struct device *dev) 520static 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
535static 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
475static struct pxaohci_platform_data em_x270_ohci_platform_data = { 548static 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
481static void __init em_x270_init_ohci(void) 555static 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
782err_free_strap:
783 gpio_free(GPIO19_WLAN_STRAP);
784err_free_pwen:
785 gpio_free(GPIO115_WLAN_PWEN);
786
787 return err;
694} 788}
695 789
696static int em_x270_libertas_teardown(struct spi_device *spi) 790static 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
932static struct i2c_pxa_platform_data em_x270_i2c_info = {
933 .fast_mode = 1,
934};
935
936static void __init em_x270_init_camera(void) 1032static 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
987struct power_supply_info em_x270_psy_info = { 1082struct 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
1167static struct pca953x_platform_data exeda_gpio_ext_pdata = {
1168 .gpio_base = 128,
1169};
1170
1171static struct i2c_board_info exeda_i2c_info[] = {
1172 {
1173 I2C_BOARD_INFO("pca9555", 0x21),
1174 .platform_data = &exeda_gpio_ext_pdata,
1175 },
1176};
1177
1178static struct i2c_pxa_platform_data em_x270_i2c_info = {
1179 .fast_mode = 1,
1180};
1181
1182static 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
1072static void __init em_x270_module_init(void) 1190static 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
1082static void __init em_x270_exeda_init(void) 1202static 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
1092static void __init em_x270_init(void) 1214static 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
1118MACHINE_START(EM_X270, "Compulab EM-X270") 1245MACHINE_START(EM_X270, "Compulab EM-X270")