aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2008-07-17 21:05:17 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-09-23 17:04:34 -0400
commit26b4c8dddd98ba9f759f1986e0116adaa9dce710 (patch)
treefcd2b2cf979e32e1274088090a85afd637cc5aa9
parentce5291478c64bab3ae301c385c6c2a6575b08355 (diff)
[ARM] pxa/poodle: convert to use the new MFP API to configure pins
The MFP configuration table is reverse engineered from those magic GAFRx_{L|U} values, and it looks much better now. Also, the deprecated pxa_gpio_mode() invocations are removed. Signed-off-by: Eric Miao <eric.miao@marvell.com> Acked-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-pxa/poodle.c147
1 files changed, 84 insertions, 63 deletions
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 00f0c897e5f8..461af1c582bb 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -34,7 +34,7 @@
34 34
35#include <mach/pxa-regs.h> 35#include <mach/pxa-regs.h>
36#include <mach/pxa2xx-regs.h> 36#include <mach/pxa2xx-regs.h>
37#include <mach/pxa2xx-gpio.h> 37#include <mach/mfp-pxa25x.h>
38#include <mach/mmc.h> 38#include <mach/mmc.h>
39#include <mach/udc.h> 39#include <mach/udc.h>
40#include <mach/i2c.h> 40#include <mach/i2c.h>
@@ -52,6 +52,88 @@
52#include "devices.h" 52#include "devices.h"
53#include "sharpsl.h" 53#include "sharpsl.h"
54 54
55static unsigned long poodle_pin_config[] __initdata = {
56 /* I/O */
57 GPIO79_nCS_3,
58 GPIO80_nCS_4,
59 GPIO18_RDY,
60
61 /* Clock */
62 GPIO12_32KHz,
63
64 /* SSP1 */
65 GPIO23_SSP1_SCLK,
66 GPIO24_SSP1_SFRM,
67 GPIO25_SSP1_TXD,
68 GPIO26_SSP1_RXD,
69
70 /* I2S */
71 GPIO28_I2S_BITCLK_OUT,
72 GPIO29_I2S_SDATA_IN,
73 GPIO30_I2S_SDATA_OUT,
74 GPIO31_I2S_SYNC,
75 GPIO32_I2S_SYSCLK,
76
77 /* Infra-Red */
78 GPIO47_FICP_TXD,
79 GPIO46_FICP_RXD,
80
81 /* FFUART */
82 GPIO40_FFUART_DTR,
83 GPIO41_FFUART_RTS,
84 GPIO39_FFUART_TXD,
85 GPIO37_FFUART_DSR,
86 GPIO34_FFUART_RXD,
87 GPIO35_FFUART_CTS,
88
89 /* LCD */
90 GPIO58_LCD_LDD_0,
91 GPIO59_LCD_LDD_1,
92 GPIO60_LCD_LDD_2,
93 GPIO61_LCD_LDD_3,
94 GPIO62_LCD_LDD_4,
95 GPIO63_LCD_LDD_5,
96 GPIO64_LCD_LDD_6,
97 GPIO65_LCD_LDD_7,
98 GPIO66_LCD_LDD_8,
99 GPIO67_LCD_LDD_9,
100 GPIO68_LCD_LDD_10,
101 GPIO69_LCD_LDD_11,
102 GPIO70_LCD_LDD_12,
103 GPIO71_LCD_LDD_13,
104 GPIO72_LCD_LDD_14,
105 GPIO73_LCD_LDD_15,
106 GPIO74_LCD_FCLK,
107 GPIO75_LCD_LCLK,
108 GPIO76_LCD_PCLK,
109 GPIO77_LCD_ACBIAS,
110
111 /* PC Card */
112 GPIO48_nPOE,
113 GPIO49_nPWE,
114 GPIO50_nPIOR,
115 GPIO51_nPIOW,
116 GPIO52_nPCE_1,
117 GPIO53_nPCE_2,
118 GPIO54_nPSKTSEL,
119 GPIO55_nPREG,
120 GPIO56_nPWAIT,
121 GPIO57_nIOIS16,
122
123 /* MMC */
124 GPIO6_MMC_CLK,
125 GPIO8_MMC_CS0,
126
127 /* GPIO */
128 GPIO9_GPIO, /* POODLE_GPIO_nSD_DETECT */
129 GPIO7_GPIO, /* POODLE_GPIO_nSD_WP */
130 GPIO3_GPIO, /* POODLE_GPIO_SD_PWR */
131 GPIO33_GPIO, /* POODLE_GPIO_SD_PWR1 */
132
133 GPIO20_GPIO, /* POODLE_GPIO_USB_PULLUP */
134 GPIO22_GPIO, /* POODLE_GPIO_IR_ON */
135};
136
55static struct resource poodle_scoop_resources[] = { 137static struct resource poodle_scoop_resources[] = {
56 [0] = { 138 [0] = {
57 .start = 0x10800000, 139 .start = 0x10800000,
@@ -75,27 +157,6 @@ struct platform_device poodle_scoop_device = {
75 .resource = poodle_scoop_resources, 157 .resource = poodle_scoop_resources,
76}; 158};
77 159
78static void poodle_pcmcia_init(void)
79{
80 /* Setup default state of GPIO outputs
81 before we enable them as outputs. */
82 GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
83 GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) |
84 GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) |
85 GPIO_bit(GPIO53_nPCE_2);
86
87 pxa_gpio_mode(GPIO48_nPOE_MD);
88 pxa_gpio_mode(GPIO49_nPWE_MD);
89 pxa_gpio_mode(GPIO50_nPIOR_MD);
90 pxa_gpio_mode(GPIO51_nPIOW_MD);
91 pxa_gpio_mode(GPIO55_nPREG_MD);
92 pxa_gpio_mode(GPIO56_nPWAIT_MD);
93 pxa_gpio_mode(GPIO57_nIOIS16_MD);
94 pxa_gpio_mode(GPIO52_nPCE_1_MD);
95 pxa_gpio_mode(GPIO53_nPCE_2_MD);
96 pxa_gpio_mode(GPIO54_pSKTSEL_MD);
97}
98
99static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = { 160static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
100{ 161{
101 .dev = &poodle_scoop_device.dev, 162 .dev = &poodle_scoop_device.dev,
@@ -108,7 +169,6 @@ static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
108static struct scoop_pcmcia_config poodle_pcmcia_config = { 169static struct scoop_pcmcia_config poodle_pcmcia_config = {
109 .devs = &poodle_pcmcia_scoop[0], 170 .devs = &poodle_pcmcia_scoop[0],
110 .num_devs = 1, 171 .num_devs = 1,
111 .pcmcia_init = poodle_pcmcia_init,
112}; 172};
113 173
114EXPORT_SYMBOL(poodle_scoop_device); 174EXPORT_SYMBOL(poodle_scoop_device);
@@ -206,10 +266,6 @@ static int poodle_mci_init(struct device *dev, irq_handler_t poodle_detect_int,
206{ 266{
207 int err; 267 int err;
208 268
209 /* setup GPIO for PXA25x MMC controller */
210 pxa_gpio_mode(GPIO6_MMCCLK_MD);
211 pxa_gpio_mode(GPIO8_MMCCS0_MD);
212
213 err = gpio_request(POODLE_GPIO_nSD_DETECT, "nSD_DETECT"); 269 err = gpio_request(POODLE_GPIO_nSD_DETECT, "nSD_DETECT");
214 if (err) 270 if (err)
215 goto err_out; 271 goto err_out;
@@ -384,42 +440,9 @@ static void __init poodle_init(void)
384 pm_power_off = poodle_poweroff; 440 pm_power_off = poodle_poweroff;
385 arm_pm_restart = poodle_restart; 441 arm_pm_restart = poodle_restart;
386 442
387 /* setup sleep mode values */
388 PWER = 0x00000002;
389 PFER = 0x00000000;
390 PRER = 0x00000002;
391 PGSR0 = 0x00008000;
392 PGSR1 = 0x003F0202;
393 PGSR2 = 0x0001C000;
394 PCFR |= PCFR_OPDE; 443 PCFR |= PCFR_OPDE;
395 444
396 /* cpu initialize */ 445 pxa2xx_mfp_config(ARRAY_AND_SIZE(poodle_pin_config));
397 /* Pgsr Register */
398 PGSR0 = 0x0146dd80;
399 PGSR1 = 0x03bf0890;
400 PGSR2 = 0x0001c000;
401
402 /* Alternate Register */
403 GAFR0_L = 0x01001000;
404 GAFR0_U = 0x591a8010;
405 GAFR1_L = 0x900a8451;
406 GAFR1_U = 0xaaa5aaaa;
407 GAFR2_L = 0x8aaaaaaa;
408 GAFR2_U = 0x00000002;
409
410 /* Direction Register */
411 GPDR0 = 0xd3f0904c;
412 GPDR1 = 0xfcffb7d3;
413 GPDR2 = 0x0001ffff;
414
415 /* Output Register */
416 GPCR0 = 0x00000000;
417 GPCR1 = 0x00000000;
418 GPCR2 = 0x00000000;
419
420 GPSR0 = 0x00400000;
421 GPSR1 = 0x00000000;
422 GPSR2 = 0x00000000;
423 446
424 platform_scoop_config = &poodle_pcmcia_config; 447 platform_scoop_config = &poodle_pcmcia_config;
425 corgi_ssp_set_machinfo(&poodle_ssp_machinfo); 448 corgi_ssp_set_machinfo(&poodle_ssp_machinfo);
@@ -430,8 +453,6 @@ static void __init poodle_init(void)
430 453
431 set_pxa_fb_parent(&poodle_locomo_device.dev); 454 set_pxa_fb_parent(&poodle_locomo_device.dev);
432 set_pxa_fb_info(&poodle_fb_info); 455 set_pxa_fb_info(&poodle_fb_info);
433 pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT);
434 pxa_gpio_mode(POODLE_GPIO_IR_ON | GPIO_OUT);
435 pxa_set_udc_info(&udc_info); 456 pxa_set_udc_info(&udc_info);
436 pxa_set_mci_info(&poodle_mci_platform_data); 457 pxa_set_mci_info(&poodle_mci_platform_data);
437 pxa_set_ficp_info(&poodle_ficp_platform_data); 458 pxa_set_ficp_info(&poodle_ficp_platform_data);