aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/em-x270.c
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2009-02-02 01:57:54 -0500
committerEric Miao <eric.miao@marvell.com>2009-02-02 04:40:17 -0500
commit4a697e83cf8b20b35942c93b873fe17e54d7e6c5 (patch)
treed768693963b18799977444dc968794cc0cd8ac65 /arch/arm/mach-pxa/em-x270.c
parent9f055c49c6a1afe6e8b75a2622ac29f3a4290b9d (diff)
[ARM] pxa/em-x270: prepare addition of eXeda machine to em-x270.c
Change several GPIO assignment from static to run-time Split MFP table to common and EM-X270 specific parts Introduce em_x270_module_init 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/em-x270.c')
-rw-r--r--arch/arm/mach-pxa/em-x270.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 20ed10c67c6c..ea099183773d 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -60,7 +60,11 @@
60#define GPIO93_CAM_RESET (93) 60#define GPIO93_CAM_RESET (93)
61#define GPIO95_MMC_WP (95) 61#define GPIO95_MMC_WP (95)
62 62
63static unsigned long em_x270_pin_config[] = { 63static int mmc_cd;
64static int nand_rb;
65static int dm9000_flags;
66
67static unsigned long common_pin_config[] = {
64 /* AC'97 */ 68 /* AC'97 */
65 GPIO28_AC97_BITCLK, 69 GPIO28_AC97_BITCLK,
66 GPIO29_AC97_SDATA_IN_0, 70 GPIO29_AC97_SDATA_IN_0,
@@ -167,7 +171,6 @@ static unsigned long em_x270_pin_config[] = {
167 171
168 /* GPIO */ 172 /* GPIO */
169 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */ 173 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */
170 GPIO95_GPIO, /* MMC Write protect */
171 174
172 /* power controls */ 175 /* power controls */
173 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */ 176 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
@@ -176,13 +179,17 @@ static unsigned long em_x270_pin_config[] = {
176 179
177 /* NAND controls */ 180 /* NAND controls */
178 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */ 181 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
179 GPIO56_GPIO, /* NAND Ready/Busy */
180 182
181 /* interrupts */ 183 /* interrupts */
182 GPIO13_GPIO, /* MMC card detect */
183 GPIO41_GPIO, /* DM9000 interrupt */ 184 GPIO41_GPIO, /* DM9000 interrupt */
184}; 185};
185 186
187static unsigned long em_x270_pin_config[] = {
188 GPIO13_GPIO, /* MMC card detect */
189 GPIO56_GPIO, /* NAND Ready/Busy */
190 GPIO95_GPIO, /* MMC Write protect */
191};
192
186#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) 193#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
187static struct resource em_x270_dm9000_resource[] = { 194static struct resource em_x270_dm9000_resource[] = {
188 [0] = { 195 [0] = {
@@ -203,7 +210,7 @@ static struct resource em_x270_dm9000_resource[] = {
203}; 210};
204 211
205static struct dm9000_plat_data em_x270_dm9000_platdata = { 212static struct dm9000_plat_data em_x270_dm9000_platdata = {
206 .flags = DM9000_PLATF_32BITONLY, 213 .flags = DM9000_PLATF_NO_EEPROM,
207}; 214};
208 215
209static struct platform_device em_x270_dm9000 = { 216static struct platform_device em_x270_dm9000 = {
@@ -218,6 +225,7 @@ static struct platform_device em_x270_dm9000 = {
218 225
219static void __init em_x270_init_dm9000(void) 226static void __init em_x270_init_dm9000(void)
220{ 227{
228 em_x270_dm9000_platdata.flags |= dm9000_flags;
221 platform_device_register(&em_x270_dm9000); 229 platform_device_register(&em_x270_dm9000);
222} 230}
223#else 231#else
@@ -307,7 +315,7 @@ static int em_x270_nand_device_ready(struct mtd_info *mtd)
307{ 315{
308 dsb(); 316 dsb();
309 317
310 return gpio_get_value(GPIO56_NAND_RB); 318 return gpio_get_value(nand_rb);
311} 319}
312 320
313static struct mtd_partition em_x270_partition_info[] = { 321static struct mtd_partition em_x270_partition_info[] = {
@@ -372,14 +380,14 @@ static void __init em_x270_init_nand(void)
372 380
373 gpio_direction_output(GPIO11_NAND_CS, 1); 381 gpio_direction_output(GPIO11_NAND_CS, 1);
374 382
375 err = gpio_request(GPIO56_NAND_RB, "NAND R/B"); 383 err = gpio_request(nand_rb, "NAND R/B");
376 if (err) { 384 if (err) {
377 pr_warning("EM-X270: failed to request NAND R/B gpio\n"); 385 pr_warning("EM-X270: failed to request NAND R/B gpio\n");
378 gpio_free(GPIO11_NAND_CS); 386 gpio_free(GPIO11_NAND_CS);
379 return; 387 return;
380 } 388 }
381 389
382 gpio_direction_input(GPIO56_NAND_RB); 390 gpio_direction_input(nand_rb);
383 391
384 platform_device_register(&em_x270_nand); 392 platform_device_register(&em_x270_nand);
385} 393}
@@ -483,7 +491,7 @@ static int em_x270_mci_init(struct device *dev,
483 return PTR_ERR(em_x270_sdio_ldo); 491 return PTR_ERR(em_x270_sdio_ldo);
484 } 492 }
485 493
486 err = request_irq(gpio_to_irq(GPIO13_MMC_CD), em_x270_detect_int, 494 err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
487 IRQF_DISABLED | IRQF_TRIGGER_RISING | 495 IRQF_DISABLED | IRQF_TRIGGER_RISING |
488 IRQF_TRIGGER_FALLING, 496 IRQF_TRIGGER_FALLING,
489 "MMC card detect", data); 497 "MMC card detect", data);
@@ -503,7 +511,7 @@ static int em_x270_mci_init(struct device *dev,
503 return 0; 511 return 0;
504 512
505err_gpio_wp: 513err_gpio_wp:
506 free_irq(gpio_to_irq(GPIO13_MMC_CD), data); 514 free_irq(gpio_to_irq(mmc_cd), data);
507err_irq: 515err_irq:
508 regulator_put(em_x270_sdio_ldo); 516 regulator_put(em_x270_sdio_ldo);
509 517
@@ -526,7 +534,7 @@ static void em_x270_mci_setpower(struct device *dev, unsigned int vdd)
526 534
527static void em_x270_mci_exit(struct device *dev, void *data) 535static void em_x270_mci_exit(struct device *dev, void *data)
528{ 536{
529 free_irq(gpio_to_irq(GPIO13_MMC_CD), data); 537 free_irq(gpio_to_irq(mmc_cd), data);
530} 538}
531 539
532static int em_x270_mci_get_ro(struct device *dev) 540static int em_x270_mci_get_ro(struct device *dev)
@@ -911,10 +919,21 @@ static void __init em_x270_init_da9030(void)
911 i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1); 919 i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
912} 920}
913 921
914static void __init em_x270_init(void) 922static void __init em_x270_module_init(void)
915{ 923{
916 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config)); 924 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
917 925
926 mmc_cd = GPIO13_MMC_CD;
927 nand_rb = GPIO56_NAND_RB;
928 dm9000_flags = DM9000_PLATF_32BITONLY;
929}
930
931static void __init em_x270_init(void)
932{
933 pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config));
934
935 em_x270_module_init();
936
918 em_x270_init_da9030(); 937 em_x270_init_da9030();
919 em_x270_init_dm9000(); 938 em_x270_init_dm9000();
920 em_x270_init_rtc(); 939 em_x270_init_rtc();