diff options
Diffstat (limited to 'arch/arm/mach-pxa/poodle.c')
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 108 |
1 files changed, 102 insertions, 6 deletions
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index a042473deedd..9a9fa87cea9f 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -18,11 +18,14 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/fb.h> | 20 | #include <linux/fb.h> |
21 | #include <linux/pm.h> | ||
22 | #include <linux/delay.h> | ||
21 | 23 | ||
22 | #include <asm/hardware.h> | 24 | #include <asm/hardware.h> |
23 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
24 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
25 | #include <asm/setup.h> | 27 | #include <asm/setup.h> |
28 | #include <asm/system.h> | ||
26 | 29 | ||
27 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
28 | #include <asm/mach/map.h> | 31 | #include <asm/mach/map.h> |
@@ -34,12 +37,15 @@ | |||
34 | #include <asm/arch/irda.h> | 37 | #include <asm/arch/irda.h> |
35 | #include <asm/arch/poodle.h> | 38 | #include <asm/arch/poodle.h> |
36 | #include <asm/arch/pxafb.h> | 39 | #include <asm/arch/pxafb.h> |
40 | #include <asm/arch/sharpsl.h> | ||
41 | #include <asm/arch/ssp.h> | ||
37 | 42 | ||
38 | #include <asm/hardware/scoop.h> | 43 | #include <asm/hardware/scoop.h> |
39 | #include <asm/hardware/locomo.h> | 44 | #include <asm/hardware/locomo.h> |
40 | #include <asm/mach/sharpsl_param.h> | 45 | #include <asm/mach/sharpsl_param.h> |
41 | 46 | ||
42 | #include "generic.h" | 47 | #include "generic.h" |
48 | #include "sharpsl.h" | ||
43 | 49 | ||
44 | static struct resource poodle_scoop_resources[] = { | 50 | static struct resource poodle_scoop_resources[] = { |
45 | [0] = { | 51 | [0] = { |
@@ -117,13 +123,71 @@ static struct resource locomo_resources[] = { | |||
117 | }, | 123 | }, |
118 | }; | 124 | }; |
119 | 125 | ||
120 | static struct platform_device locomo_device = { | 126 | struct platform_device poodle_locomo_device = { |
121 | .name = "locomo", | 127 | .name = "locomo", |
122 | .id = 0, | 128 | .id = 0, |
123 | .num_resources = ARRAY_SIZE(locomo_resources), | 129 | .num_resources = ARRAY_SIZE(locomo_resources), |
124 | .resource = locomo_resources, | 130 | .resource = locomo_resources, |
125 | }; | 131 | }; |
126 | 132 | ||
133 | EXPORT_SYMBOL(poodle_locomo_device); | ||
134 | |||
135 | /* | ||
136 | * Poodle SSP Device | ||
137 | */ | ||
138 | |||
139 | struct platform_device poodle_ssp_device = { | ||
140 | .name = "corgi-ssp", | ||
141 | .id = -1, | ||
142 | }; | ||
143 | |||
144 | struct corgissp_machinfo poodle_ssp_machinfo = { | ||
145 | .port = 1, | ||
146 | .cs_lcdcon = -1, | ||
147 | .cs_ads7846 = -1, | ||
148 | .cs_max1111 = -1, | ||
149 | .clk_lcdcon = 2, | ||
150 | .clk_ads7846 = 36, | ||
151 | .clk_max1111 = 2, | ||
152 | }; | ||
153 | |||
154 | |||
155 | /* | ||
156 | * Poodle Touch Screen Device | ||
157 | */ | ||
158 | static struct resource poodlets_resources[] = { | ||
159 | [0] = { | ||
160 | .start = POODLE_IRQ_GPIO_TP_INT, | ||
161 | .end = POODLE_IRQ_GPIO_TP_INT, | ||
162 | .flags = IORESOURCE_IRQ, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | static unsigned long poodle_get_hsync_len(void) | ||
167 | { | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static void poodle_null_hsync(void) | ||
172 | { | ||
173 | } | ||
174 | |||
175 | static struct corgits_machinfo poodle_ts_machinfo = { | ||
176 | .get_hsync_len = poodle_get_hsync_len, | ||
177 | .put_hsync = poodle_null_hsync, | ||
178 | .wait_hsync = poodle_null_hsync, | ||
179 | }; | ||
180 | |||
181 | static struct platform_device poodle_ts_device = { | ||
182 | .name = "corgi-ts", | ||
183 | .dev = { | ||
184 | .platform_data = &poodle_ts_machinfo, | ||
185 | }, | ||
186 | .id = -1, | ||
187 | .num_resources = ARRAY_SIZE(poodlets_resources), | ||
188 | .resource = poodlets_resources, | ||
189 | }; | ||
190 | |||
127 | 191 | ||
128 | /* | 192 | /* |
129 | * MMC/SD Device | 193 | * MMC/SD Device |
@@ -141,7 +205,9 @@ static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)( | |||
141 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | 205 | pxa_gpio_mode(GPIO6_MMCCLK_MD); |
142 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | 206 | pxa_gpio_mode(GPIO8_MMCCS0_MD); |
143 | pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN); | 207 | pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN); |
208 | pxa_gpio_mode(POODLE_GPIO_nSD_WP | GPIO_IN); | ||
144 | pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT); | 209 | pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT); |
210 | pxa_gpio_mode(POODLE_GPIO_SD_PWR1 | GPIO_OUT); | ||
145 | 211 | ||
146 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); | 212 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
147 | 213 | ||
@@ -160,12 +226,22 @@ static void poodle_mci_setpower(struct device *dev, unsigned int vdd) | |||
160 | { | 226 | { |
161 | struct pxamci_platform_data* p_d = dev->platform_data; | 227 | struct pxamci_platform_data* p_d = dev->platform_data; |
162 | 228 | ||
163 | if (( 1 << vdd) & p_d->ocr_mask) | 229 | if (( 1 << vdd) & p_d->ocr_mask) { |
164 | GPSR1 = GPIO_bit(POODLE_GPIO_SD_PWR); | 230 | GPSR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR); |
165 | else | 231 | mdelay(2); |
166 | GPCR1 = GPIO_bit(POODLE_GPIO_SD_PWR); | 232 | GPSR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1); |
233 | } else { | ||
234 | GPCR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1); | ||
235 | GPCR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR); | ||
236 | } | ||
237 | } | ||
238 | |||
239 | static int poodle_mci_get_ro(struct device *dev) | ||
240 | { | ||
241 | return GPLR(POODLE_GPIO_nSD_WP) & GPIO_bit(POODLE_GPIO_nSD_WP); | ||
167 | } | 242 | } |
168 | 243 | ||
244 | |||
169 | static void poodle_mci_exit(struct device *dev, void *data) | 245 | static void poodle_mci_exit(struct device *dev, void *data) |
170 | { | 246 | { |
171 | free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data); | 247 | free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data); |
@@ -174,6 +250,7 @@ static void poodle_mci_exit(struct device *dev, void *data) | |||
174 | static struct pxamci_platform_data poodle_mci_platform_data = { | 250 | static struct pxamci_platform_data poodle_mci_platform_data = { |
175 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 251 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
176 | .init = poodle_mci_init, | 252 | .init = poodle_mci_init, |
253 | .get_ro = poodle_mci_get_ro, | ||
177 | .setpower = poodle_mci_setpower, | 254 | .setpower = poodle_mci_setpower, |
178 | .exit = poodle_mci_exit, | 255 | .exit = poodle_mci_exit, |
179 | }; | 256 | }; |
@@ -243,14 +320,31 @@ static struct pxafb_mach_info poodle_fb_info __initdata = { | |||
243 | }; | 320 | }; |
244 | 321 | ||
245 | static struct platform_device *devices[] __initdata = { | 322 | static struct platform_device *devices[] __initdata = { |
246 | &locomo_device, | 323 | &poodle_locomo_device, |
247 | &poodle_scoop_device, | 324 | &poodle_scoop_device, |
325 | &poodle_ssp_device, | ||
326 | &poodle_ts_device, | ||
248 | }; | 327 | }; |
249 | 328 | ||
329 | static void poodle_poweroff(void) | ||
330 | { | ||
331 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
332 | arm_machine_restart('h'); | ||
333 | } | ||
334 | |||
335 | static void poodle_restart(char mode) | ||
336 | { | ||
337 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
338 | arm_machine_restart('h'); | ||
339 | } | ||
340 | |||
250 | static void __init poodle_init(void) | 341 | static void __init poodle_init(void) |
251 | { | 342 | { |
252 | int ret = 0; | 343 | int ret = 0; |
253 | 344 | ||
345 | pm_power_off = poodle_poweroff; | ||
346 | arm_pm_restart = poodle_restart; | ||
347 | |||
254 | /* setup sleep mode values */ | 348 | /* setup sleep mode values */ |
255 | PWER = 0x00000002; | 349 | PWER = 0x00000002; |
256 | PFER = 0x00000000; | 350 | PFER = 0x00000000; |
@@ -288,6 +382,7 @@ static void __init poodle_init(void) | |||
288 | GPSR1 = 0x00000000; | 382 | GPSR1 = 0x00000000; |
289 | GPSR2 = 0x00000000; | 383 | GPSR2 = 0x00000000; |
290 | 384 | ||
385 | set_pxa_fb_parent(&poodle_locomo_device.dev); | ||
291 | set_pxa_fb_info(&poodle_fb_info); | 386 | set_pxa_fb_info(&poodle_fb_info); |
292 | pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT); | 387 | pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT); |
293 | pxa_gpio_mode(POODLE_GPIO_IR_ON | GPIO_OUT); | 388 | pxa_gpio_mode(POODLE_GPIO_IR_ON | GPIO_OUT); |
@@ -301,6 +396,7 @@ static void __init poodle_init(void) | |||
301 | if (ret) { | 396 | if (ret) { |
302 | printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n"); | 397 | printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n"); |
303 | } | 398 | } |
399 | corgi_ssp_set_machinfo(&poodle_ssp_machinfo); | ||
304 | } | 400 | } |
305 | 401 | ||
306 | static void __init fixup_poodle(struct machine_desc *desc, | 402 | static void __init fixup_poodle(struct machine_desc *desc, |