diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2005-09-15 09:53:22 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-09-15 09:53:22 -0400 |
commit | 13b9d47ed36e8019a99c798b84c341ef75868e02 (patch) | |
tree | b57481481efeb11fd2853f6737bf936ce35873ad /arch/arm/mach-pxa | |
parent | f29d245549aa38325c37716dbecea8d817c00274 (diff) |
[ARM] 2914/1: PXA Poodle: Add MMC and UDC support
Patch from Richard Purdie
This patch adds MMC and UDC support to the PXA Poodle platform.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 7c4a1cebfd6b..f25638810017 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -30,6 +30,8 @@ | |||
30 | 30 | ||
31 | #include <asm/arch/pxa-regs.h> | 31 | #include <asm/arch/pxa-regs.h> |
32 | #include <asm/arch/irq.h> | 32 | #include <asm/arch/irq.h> |
33 | #include <asm/arch/mmc.h> | ||
34 | #include <asm/arch/udc.h> | ||
33 | #include <asm/arch/poodle.h> | 35 | #include <asm/arch/poodle.h> |
34 | #include <asm/arch/pxafb.h> | 36 | #include <asm/arch/pxafb.h> |
35 | 37 | ||
@@ -93,6 +95,83 @@ static struct platform_device locomo_device = { | |||
93 | .resource = locomo_resources, | 95 | .resource = locomo_resources, |
94 | }; | 96 | }; |
95 | 97 | ||
98 | |||
99 | /* | ||
100 | * MMC/SD Device | ||
101 | * | ||
102 | * The card detect interrupt isn't debounced so we delay it by 250ms | ||
103 | * to give the card a chance to fully insert/eject. | ||
104 | */ | ||
105 | static struct pxamci_platform_data poodle_mci_platform_data; | ||
106 | |||
107 | static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)(int, void *, struct pt_regs *), void *data) | ||
108 | { | ||
109 | int err; | ||
110 | |||
111 | /* setup GPIO for PXA25x MMC controller */ | ||
112 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | ||
113 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | ||
114 | pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN); | ||
115 | pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT); | ||
116 | |||
117 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
118 | |||
119 | err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int, SA_INTERRUPT, | ||
120 | "MMC card detect", data); | ||
121 | if (err) { | ||
122 | printk(KERN_ERR "poodle_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | ||
123 | return -1; | ||
124 | } | ||
125 | |||
126 | set_irq_type(POODLE_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE); | ||
127 | |||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static void poodle_mci_setpower(struct device *dev, unsigned int vdd) | ||
132 | { | ||
133 | struct pxamci_platform_data* p_d = dev->platform_data; | ||
134 | |||
135 | if (( 1 << vdd) & p_d->ocr_mask) | ||
136 | GPSR1 = GPIO_bit(POODLE_GPIO_SD_PWR); | ||
137 | else | ||
138 | GPCR1 = GPIO_bit(POODLE_GPIO_SD_PWR); | ||
139 | } | ||
140 | |||
141 | static void poodle_mci_exit(struct device *dev, void *data) | ||
142 | { | ||
143 | free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data); | ||
144 | } | ||
145 | |||
146 | static struct pxamci_platform_data poodle_mci_platform_data = { | ||
147 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | ||
148 | .init = poodle_mci_init, | ||
149 | .setpower = poodle_mci_setpower, | ||
150 | .exit = poodle_mci_exit, | ||
151 | }; | ||
152 | |||
153 | |||
154 | /* | ||
155 | * USB Device Controller | ||
156 | */ | ||
157 | static void poodle_udc_command(int cmd) | ||
158 | { | ||
159 | switch(cmd) { | ||
160 | case PXA2XX_UDC_CMD_CONNECT: | ||
161 | GPSR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP); | ||
162 | break; | ||
163 | case PXA2XX_UDC_CMD_DISCONNECT: | ||
164 | GPCR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP); | ||
165 | break; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | static struct pxa2xx_udc_mach_info udc_info __initdata = { | ||
170 | /* no connect GPIO; poodle can't tell connection status */ | ||
171 | .udc_command = poodle_udc_command, | ||
172 | }; | ||
173 | |||
174 | |||
96 | /* PXAFB device */ | 175 | /* PXAFB device */ |
97 | static struct pxafb_mach_info poodle_fb_info __initdata = { | 176 | static struct pxafb_mach_info poodle_fb_info __initdata = { |
98 | .pixclock = 144700, | 177 | .pixclock = 144700, |
@@ -164,6 +243,9 @@ static void __init poodle_init(void) | |||
164 | GPSR2 = 0x00000000; | 243 | GPSR2 = 0x00000000; |
165 | 244 | ||
166 | set_pxa_fb_info(&poodle_fb_info); | 245 | set_pxa_fb_info(&poodle_fb_info); |
246 | pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT); | ||
247 | pxa_set_udc_info(&udc_info); | ||
248 | pxa_set_mci_info(&poodle_mci_platform_data); | ||
167 | 249 | ||
168 | scoop_num = 1; | 250 | scoop_num = 1; |
169 | scoop_devs = &poodle_pcmcia_scoop[0]; | 251 | scoop_devs = &poodle_pcmcia_scoop[0]; |