diff options
author | Eric Miao <eric.miao@marvell.com> | 2008-09-02 21:47:42 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-23 17:04:36 -0400 |
commit | 5e96adec6b6bc616259d8bd64e8a80d6dfc4403a (patch) | |
tree | 4f39413896b684ff80e8fafd7a6dce1338180429 /arch/arm/mach-pxa/spitz.c | |
parent | dd5980d68af4457e600ef6add5b541ce952147e6 (diff) |
[ARM] pxa/spitz: convert to use new MFP API
Original patch from Dmitry Baryshkov's initial scoop gpio conversion
work at http://git.infradead.org/users/dbaryshkov/zaurus-2.6.git.
TODO: figure out the MFP configuration of the SSP2 which looks like
to be already configured by the boot loader, though.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/spitz.c')
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 113 |
1 files changed, 66 insertions, 47 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index fef5018d547d..1a53c2c92af3 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #include <mach/pxa-regs.h> | 39 | #include <mach/pxa-regs.h> |
40 | #include <mach/pxa2xx-regs.h> | 40 | #include <mach/pxa2xx-regs.h> |
41 | #include <mach/pxa2xx-gpio.h> | 41 | #include <mach/mfp-pxa27x.h> |
42 | #include <mach/pxa27x-udc.h> | 42 | #include <mach/pxa27x-udc.h> |
43 | #include <mach/reset.h> | 43 | #include <mach/reset.h> |
44 | #include <mach/i2c.h> | 44 | #include <mach/i2c.h> |
@@ -58,6 +58,66 @@ | |||
58 | #include "devices.h" | 58 | #include "devices.h" |
59 | #include "sharpsl.h" | 59 | #include "sharpsl.h" |
60 | 60 | ||
61 | static unsigned long spitz_pin_config[] __initdata = { | ||
62 | /* Chip Selects */ | ||
63 | GPIO78_nCS_2, /* SCOOP #2 */ | ||
64 | GPIO80_nCS_4, /* SCOOP #1 */ | ||
65 | |||
66 | /* LCD - 16bpp Active TFT */ | ||
67 | GPIO58_LCD_LDD_0, | ||
68 | GPIO59_LCD_LDD_1, | ||
69 | GPIO60_LCD_LDD_2, | ||
70 | GPIO61_LCD_LDD_3, | ||
71 | GPIO62_LCD_LDD_4, | ||
72 | GPIO63_LCD_LDD_5, | ||
73 | GPIO64_LCD_LDD_6, | ||
74 | GPIO65_LCD_LDD_7, | ||
75 | GPIO66_LCD_LDD_8, | ||
76 | GPIO67_LCD_LDD_9, | ||
77 | GPIO68_LCD_LDD_10, | ||
78 | GPIO69_LCD_LDD_11, | ||
79 | GPIO70_LCD_LDD_12, | ||
80 | GPIO71_LCD_LDD_13, | ||
81 | GPIO72_LCD_LDD_14, | ||
82 | GPIO73_LCD_LDD_15, | ||
83 | GPIO74_LCD_FCLK, | ||
84 | GPIO75_LCD_LCLK, | ||
85 | GPIO76_LCD_PCLK, | ||
86 | |||
87 | /* PC Card */ | ||
88 | GPIO48_nPOE, | ||
89 | GPIO49_nPWE, | ||
90 | GPIO50_nPIOR, | ||
91 | GPIO51_nPIOW, | ||
92 | GPIO85_nPCE_1, | ||
93 | GPIO54_nPCE_2, | ||
94 | GPIO79_PSKTSEL, | ||
95 | GPIO55_nPREG, | ||
96 | GPIO56_nPWAIT, | ||
97 | GPIO57_nIOIS16, | ||
98 | |||
99 | /* MMC */ | ||
100 | GPIO32_MMC_CLK, | ||
101 | GPIO112_MMC_CMD, | ||
102 | GPIO92_MMC_DAT_0, | ||
103 | GPIO109_MMC_DAT_1, | ||
104 | GPIO110_MMC_DAT_2, | ||
105 | GPIO111_MMC_DAT_3, | ||
106 | |||
107 | /* GPIOs */ | ||
108 | GPIO9_GPIO, /* SPITZ_GPIO_nSD_DETECT */ | ||
109 | GPIO81_GPIO, /* SPITZ_GPIO_nSD_WP */ | ||
110 | GPIO41_GPIO, /* SPITZ_GPIO_USB_CONNECT */ | ||
111 | GPIO37_GPIO, /* SPITZ_GPIO_USB_HOST */ | ||
112 | GPIO35_GPIO, /* SPITZ_GPIO_USB_DEVICE */ | ||
113 | GPIO22_GPIO, /* SPITZ_GPIO_HSYNC */ | ||
114 | GPIO94_GPIO, /* SPITZ_GPIO_CF_CD */ | ||
115 | GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */ | ||
116 | GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */ | ||
117 | |||
118 | GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, | ||
119 | }; | ||
120 | |||
61 | /* | 121 | /* |
62 | * Spitz SCOOP Device #1 | 122 | * Spitz SCOOP Device #1 |
63 | */ | 123 | */ |
@@ -146,27 +206,6 @@ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) | |||
146 | } | 206 | } |
147 | } | 207 | } |
148 | 208 | ||
149 | static void spitz_pcmcia_init(void) | ||
150 | { | ||
151 | /* Setup default state of GPIO outputs | ||
152 | before we enable them as outputs. */ | ||
153 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | | ||
154 | GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | | ||
155 | GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO54_nPCE_2); | ||
156 | GPSR(GPIO85_nPCE_1) = GPIO_bit(GPIO85_nPCE_1); | ||
157 | |||
158 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
159 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
160 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
161 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
162 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
163 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
164 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
165 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | ||
166 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | ||
167 | pxa_gpio_mode(GPIO104_pSKTSEL_MD); | ||
168 | } | ||
169 | |||
170 | static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr) | 209 | static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr) |
171 | { | 210 | { |
172 | /* Only need to override behaviour for slot 0 */ | 211 | /* Only need to override behaviour for slot 0 */ |
@@ -192,7 +231,6 @@ static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { | |||
192 | static struct scoop_pcmcia_config spitz_pcmcia_config = { | 231 | static struct scoop_pcmcia_config spitz_pcmcia_config = { |
193 | .devs = &spitz_pcmcia_scoop[0], | 232 | .devs = &spitz_pcmcia_scoop[0], |
194 | .num_devs = 2, | 233 | .num_devs = 2, |
195 | .pcmcia_init = spitz_pcmcia_init, | ||
196 | .power_ctrl = spitz_pcmcia_pwr, | 234 | .power_ctrl = spitz_pcmcia_pwr, |
197 | }; | 235 | }; |
198 | 236 | ||
@@ -365,14 +403,6 @@ static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, vo | |||
365 | { | 403 | { |
366 | int err; | 404 | int err; |
367 | 405 | ||
368 | /* setup GPIO for PXA27x MMC controller */ | ||
369 | pxa_gpio_mode(GPIO32_MMCCLK_MD); | ||
370 | pxa_gpio_mode(GPIO112_MMCCMD_MD); | ||
371 | pxa_gpio_mode(GPIO92_MMCDAT0_MD); | ||
372 | pxa_gpio_mode(GPIO109_MMCDAT1_MD); | ||
373 | pxa_gpio_mode(GPIO110_MMCDAT2_MD); | ||
374 | pxa_gpio_mode(GPIO111_MMCDAT3_MD); | ||
375 | |||
376 | err = gpio_request(SPITZ_GPIO_nSD_DETECT, "nSD_DETECT"); | 406 | err = gpio_request(SPITZ_GPIO_nSD_DETECT, "nSD_DETECT"); |
377 | if (err) | 407 | if (err) |
378 | goto err_out; | 408 | goto err_out; |
@@ -447,12 +477,9 @@ static int spitz_ohci_init(struct device *dev) | |||
447 | if (err) | 477 | if (err) |
448 | return err; | 478 | return err; |
449 | 479 | ||
450 | /* Only Port 2 is connected */ | 480 | /* Only Port 2 is connected |
451 | pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN); | 481 | * Setup USB Port 2 Output Control Register |
452 | pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT); | 482 | */ |
453 | pxa_gpio_mode(SPITZ_GPIO_USB_DEVICE | GPIO_IN); | ||
454 | |||
455 | /* Setup USB Port 2 Output Control Register */ | ||
456 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | 483 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
457 | 484 | ||
458 | gpio_direction_output(SPITZ_GPIO_USB_HOST, 1); | 485 | gpio_direction_output(SPITZ_GPIO_USB_HOST, 1); |
@@ -582,20 +609,12 @@ static void __init common_init(void) | |||
582 | 609 | ||
583 | PMCR = 0x00; | 610 | PMCR = 0x00; |
584 | 611 | ||
585 | /* setup sleep mode values */ | ||
586 | PWER = 0x00000002; | ||
587 | PFER = 0x00000000; | ||
588 | PRER = 0x00000002; | ||
589 | PGSR0 = 0x0158C000; | ||
590 | PGSR1 = 0x00FF0080; | ||
591 | PGSR2 = 0x0001C004; | ||
592 | |||
593 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ | 612 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ |
594 | PCFR |= PCFR_OPDE; | 613 | PCFR |= PCFR_OPDE; |
595 | 614 | ||
596 | corgi_ssp_set_machinfo(&spitz_ssp_machinfo); | 615 | pxa2xx_mfp_config(ARRAY_AND_SIZE(spitz_pin_config)); |
597 | 616 | ||
598 | pxa_gpio_mode(SPITZ_GPIO_HSYNC | GPIO_IN); | 617 | corgi_ssp_set_machinfo(&spitz_ssp_machinfo); |
599 | 618 | ||
600 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 619 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
601 | pxa_set_mci_info(&spitz_mci_platform_data); | 620 | pxa_set_mci_info(&spitz_mci_platform_data); |