aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2009-05-12 09:31:13 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-06-04 22:50:23 -0400
commit76e3fc36eb3d78997e7f4dcdc01cc38dc3178201 (patch)
treed4ccdf2c74aa69a975c5370436dda084f7431f68 /arch/arm/mach-pxa
parent1ce2c51e6d594d19126f51bba88aa9f57eb7cea6 (diff)
[ARM] pxa/em-x270: add exeda GPIO extender and update GPIO mappings
Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/em-x270.c64
1 files changed, 46 insertions, 18 deletions
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 3503f523070b..e2f9834e2daa 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
@@ -52,15 +54,18 @@
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)
55 58
56/* eXeda specific GPIOs */ 59/* eXeda specific GPIOs */
57#define GPIO114_MMC_CD (114) 60#define GPIO114_MMC_CD (114)
58#define GPIO20_NAND_RB (20) 61#define GPIO20_NAND_RB (20)
59#define GPIO38_SD_PWEN (38) 62#define GPIO38_SD_PWEN (38)
63#define GPIO37_WLAN_RST (37)
64#define GPIO95_TOUCHPAD_INT (95)
65#define GPIO130_CAM_RESET (130)
60 66
61/* common GPIOs */ 67/* common GPIOs */
62#define GPIO11_NAND_CS (11) 68#define GPIO11_NAND_CS (11)
63#define GPIO93_CAM_RESET (93)
64#define GPIO41_ETHIRQ (41) 69#define GPIO41_ETHIRQ (41)
65#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) 70#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
66#define GPIO115_WLAN_PWEN (115) 71#define GPIO115_WLAN_PWEN (115)
@@ -69,6 +74,7 @@
69static int mmc_cd; 74static int mmc_cd;
70static int nand_rb; 75static int nand_rb;
71static int dm9000_flags; 76static int dm9000_flags;
77static int cam_reset;
72 78
73static unsigned long common_pin_config[] = { 79static unsigned long common_pin_config[] = {
74 /* AC'97 */ 80 /* AC'97 */
@@ -180,7 +186,6 @@ static unsigned long common_pin_config[] = {
180 186
181 /* power controls */ 187 /* power controls */
182 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */ 188 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 */ 189 GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */
185 190
186 /* NAND controls */ 191 /* NAND controls */
@@ -191,14 +196,16 @@ static unsigned long common_pin_config[] = {
191}; 196};
192 197
193static unsigned long em_x270_pin_config[] = { 198static unsigned long em_x270_pin_config[] = {
194 GPIO13_GPIO, /* MMC card detect */ 199 GPIO13_GPIO, /* MMC card detect */
195 GPIO56_GPIO, /* NAND Ready/Busy */ 200 GPIO56_GPIO, /* NAND Ready/Busy */
196 GPIO95_GPIO, /* MMC Write protect */ 201 GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */
202 GPIO95_GPIO, /* MMC Write protect */
197}; 203};
198 204
199static unsigned long exeda_pin_config[] = { 205static unsigned long exeda_pin_config[] = {
200 GPIO20_GPIO, /* NAND Ready/Busy */ 206 GPIO20_GPIO, /* NAND Ready/Busy */
201 GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */ 207 GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */
208 GPIO95_GPIO, /* touchpad IRQ */
202 GPIO114_GPIO, /* MMC card detect */ 209 GPIO114_GPIO, /* MMC card detect */
203}; 210};
204 211
@@ -863,26 +870,26 @@ static int em_x270_sensor_init(struct device *dev)
863{ 870{
864 int ret; 871 int ret;
865 872
866 ret = gpio_request(GPIO93_CAM_RESET, "camera reset"); 873 ret = gpio_request(cam_reset, "camera reset");
867 if (ret) 874 if (ret)
868 return ret; 875 return ret;
869 876
870 gpio_direction_output(GPIO93_CAM_RESET, 0); 877 gpio_direction_output(cam_reset, 0);
871 878
872 em_x270_camera_ldo = regulator_get(NULL, "vcc cam"); 879 em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
873 if (em_x270_camera_ldo == NULL) { 880 if (em_x270_camera_ldo == NULL) {
874 gpio_free(GPIO93_CAM_RESET); 881 gpio_free(cam_reset);
875 return -ENODEV; 882 return -ENODEV;
876 } 883 }
877 884
878 ret = regulator_enable(em_x270_camera_ldo); 885 ret = regulator_enable(em_x270_camera_ldo);
879 if (ret) { 886 if (ret) {
880 regulator_put(em_x270_camera_ldo); 887 regulator_put(em_x270_camera_ldo);
881 gpio_free(GPIO93_CAM_RESET); 888 gpio_free(cam_reset);
882 return ret; 889 return ret;
883 } 890 }
884 891
885 gpio_set_value(GPIO93_CAM_RESET, 1); 892 gpio_set_value(cam_reset, 1);
886 893
887 return 0; 894 return 0;
888} 895}
@@ -902,7 +909,7 @@ static int em_x270_sensor_power(struct device *dev, int on)
902 if (on == is_on) 909 if (on == is_on)
903 return 0; 910 return 0;
904 911
905 gpio_set_value(GPIO93_CAM_RESET, !on); 912 gpio_set_value(cam_reset, !on);
906 913
907 if (on) 914 if (on)
908 ret = regulator_enable(em_x270_camera_ldo); 915 ret = regulator_enable(em_x270_camera_ldo);
@@ -912,7 +919,7 @@ static int em_x270_sensor_power(struct device *dev, int on)
912 if (ret) 919 if (ret)
913 return ret; 920 return ret;
914 921
915 gpio_set_value(GPIO93_CAM_RESET, on); 922 gpio_set_value(cam_reset, on);
916 923
917 return 0; 924 return 0;
918} 925}
@@ -929,13 +936,8 @@ static struct i2c_board_info em_x270_i2c_cam_info[] = {
929 }, 936 },
930}; 937};
931 938
932static struct i2c_pxa_platform_data em_x270_i2c_info = {
933 .fast_mode = 1,
934};
935
936static void __init em_x270_init_camera(void) 939static void __init em_x270_init_camera(void)
937{ 940{
938 pxa_set_i2c_info(&em_x270_i2c_info);
939 i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info)); 941 i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info));
940 pxa_set_camera_info(&em_x270_camera_platform_data); 942 pxa_set_camera_info(&em_x270_camera_platform_data);
941} 943}
@@ -1069,6 +1071,29 @@ static void __init em_x270_init_da9030(void)
1069 i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1); 1071 i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
1070} 1072}
1071 1073
1074static struct pca953x_platform_data exeda_gpio_ext_pdata = {
1075 .gpio_base = 128,
1076};
1077
1078static struct i2c_board_info exeda_i2c_info[] = {
1079 {
1080 I2C_BOARD_INFO("pca9555", 0x21),
1081 .platform_data = &exeda_gpio_ext_pdata,
1082 },
1083};
1084
1085static struct i2c_pxa_platform_data em_x270_i2c_info = {
1086 .fast_mode = 1,
1087};
1088
1089static void __init em_x270_init_i2c(void)
1090{
1091 pxa_set_i2c_info(&em_x270_i2c_info);
1092
1093 if (machine_is_exeda())
1094 i2c_register_board_info(0, ARRAY_AND_SIZE(exeda_i2c_info));
1095}
1096
1072static void __init em_x270_module_init(void) 1097static void __init em_x270_module_init(void)
1073{ 1098{
1074 pr_info("%s\n", __func__); 1099 pr_info("%s\n", __func__);
@@ -1077,6 +1102,7 @@ static void __init em_x270_module_init(void)
1077 mmc_cd = GPIO13_MMC_CD; 1102 mmc_cd = GPIO13_MMC_CD;
1078 nand_rb = GPIO56_NAND_RB; 1103 nand_rb = GPIO56_NAND_RB;
1079 dm9000_flags = DM9000_PLATF_32BITONLY; 1104 dm9000_flags = DM9000_PLATF_32BITONLY;
1105 cam_reset = GPIO93_CAM_RESET;
1080} 1106}
1081 1107
1082static void __init em_x270_exeda_init(void) 1108static void __init em_x270_exeda_init(void)
@@ -1087,6 +1113,7 @@ static void __init em_x270_exeda_init(void)
1087 mmc_cd = GPIO114_MMC_CD; 1113 mmc_cd = GPIO114_MMC_CD;
1088 nand_rb = GPIO20_NAND_RB; 1114 nand_rb = GPIO20_NAND_RB;
1089 dm9000_flags = DM9000_PLATF_16BITONLY; 1115 dm9000_flags = DM9000_PLATF_16BITONLY;
1116 cam_reset = GPIO130_CAM_RESET;
1090} 1117}
1091 1118
1092static void __init em_x270_init(void) 1119static void __init em_x270_init(void)
@@ -1111,8 +1138,9 @@ static void __init em_x270_init(void)
1111 em_x270_init_keypad(); 1138 em_x270_init_keypad();
1112 em_x270_init_gpio_keys(); 1139 em_x270_init_gpio_keys();
1113 em_x270_init_ac97(); 1140 em_x270_init_ac97();
1114 em_x270_init_camera();
1115 em_x270_init_spi(); 1141 em_x270_init_spi();
1142 em_x270_init_i2c();
1143 em_x270_init_camera();
1116} 1144}
1117 1145
1118MACHINE_START(EM_X270, "Compulab EM-X270") 1146MACHINE_START(EM_X270, "Compulab EM-X270")