2 * linux/arch/arm/mach-pxa/poodle.c
4 * Support for the SHARP Poodle Board.
7 * linux/arch/arm/mach-pxa/lubbock.c Author: Nicolas Pitre
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 * 12-Dec-2002 Sharp Corporation for Poodle
15 * John Lenz <lenz@cs.wisc.edu> updates to 2.6
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/platform_device.h>
22 #include <linux/delay.h>
24 #include <mach/hardware.h>
25 #include <asm/mach-types.h>
27 #include <asm/setup.h>
28 #include <asm/system.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
32 #include <asm/mach/irq.h>
34 #include <mach/pxa-regs.h>
35 #include <mach/pxa2xx-regs.h>
36 #include <mach/pxa2xx-gpio.h>
40 #include <mach/irda.h>
41 #include <mach/poodle.h>
42 #include <mach/pxafb.h>
43 #include <mach/sharpsl.h>
46 #include <asm/hardware/scoop.h>
47 #include <asm/hardware/locomo.h>
48 #include <asm/mach/sharpsl_param.h>
54 static struct resource poodle_scoop_resources[] = {
58 .flags = IORESOURCE_MEM,
62 static struct scoop_config poodle_scoop_setup = {
63 .io_dir = POODLE_SCOOP_IO_DIR,
64 .io_out = POODLE_SCOOP_IO_OUT,
67 struct platform_device poodle_scoop_device = {
68 .name = "sharp-scoop",
71 .platform_data = &poodle_scoop_setup,
73 .num_resources = ARRAY_SIZE(poodle_scoop_resources),
74 .resource = poodle_scoop_resources,
77 static void poodle_pcmcia_init(void)
79 /* Setup default state of GPIO outputs
80 before we enable them as outputs. */
81 GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
82 GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) |
83 GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) |
84 GPIO_bit(GPIO53_nPCE_2);
86 pxa_gpio_mode(GPIO48_nPOE_MD);
87 pxa_gpio_mode(GPIO49_nPWE_MD);
88 pxa_gpio_mode(GPIO50_nPIOR_MD);
89 pxa_gpio_mode(GPIO51_nPIOW_MD);
90 pxa_gpio_mode(GPIO55_nPREG_MD);
91 pxa_gpio_mode(GPIO56_nPWAIT_MD);
92 pxa_gpio_mode(GPIO57_nIOIS16_MD);
93 pxa_gpio_mode(GPIO52_nPCE_1_MD);
94 pxa_gpio_mode(GPIO53_nPCE_2_MD);
95 pxa_gpio_mode(GPIO54_pSKTSEL_MD);
98 static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
100 .dev = &poodle_scoop_device.dev,
101 .irq = POODLE_IRQ_GPIO_CF_IRQ,
102 .cd_irq = POODLE_IRQ_GPIO_CF_CD,
103 .cd_irq_str = "PCMCIA0 CD",
107 static struct scoop_pcmcia_config poodle_pcmcia_config = {
108 .devs = &poodle_pcmcia_scoop[0],
110 .pcmcia_init = poodle_pcmcia_init,
113 EXPORT_SYMBOL(poodle_scoop_device);
117 static struct resource locomo_resources[] = {
121 .flags = IORESOURCE_MEM,
124 .start = IRQ_GPIO(10),
126 .flags = IORESOURCE_IRQ,
130 struct platform_device poodle_locomo_device = {
133 .num_resources = ARRAY_SIZE(locomo_resources),
134 .resource = locomo_resources,
137 EXPORT_SYMBOL(poodle_locomo_device);
143 struct platform_device poodle_ssp_device = {
148 struct corgissp_machinfo poodle_ssp_machinfo = {
160 * Poodle Touch Screen Device
162 static struct resource poodlets_resources[] = {
164 .start = POODLE_IRQ_GPIO_TP_INT,
165 .end = POODLE_IRQ_GPIO_TP_INT,
166 .flags = IORESOURCE_IRQ,
170 static unsigned long poodle_get_hsync_invperiod(void)
175 static void poodle_null_hsync(void)
179 static struct corgits_machinfo poodle_ts_machinfo = {
180 .get_hsync_invperiod = poodle_get_hsync_invperiod,
181 .put_hsync = poodle_null_hsync,
182 .wait_hsync = poodle_null_hsync,
185 static struct platform_device poodle_ts_device = {
188 .platform_data = &poodle_ts_machinfo,
191 .num_resources = ARRAY_SIZE(poodlets_resources),
192 .resource = poodlets_resources,
199 * The card detect interrupt isn't debounced so we delay it by 250ms
200 * to give the card a chance to fully insert/eject.
202 static struct pxamci_platform_data poodle_mci_platform_data;
204 static int poodle_mci_init(struct device *dev, irq_handler_t poodle_detect_int, void *data)
208 /* setup GPIO for PXA25x MMC controller */
209 pxa_gpio_mode(GPIO6_MMCCLK_MD);
210 pxa_gpio_mode(GPIO8_MMCCS0_MD);
211 pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN);
212 pxa_gpio_mode(POODLE_GPIO_nSD_WP | GPIO_IN);
213 pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT);
214 pxa_gpio_mode(POODLE_GPIO_SD_PWR1 | GPIO_OUT);
216 poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250);
218 err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int,
219 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
220 "MMC card detect", data);
222 printk(KERN_ERR "poodle_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
227 static void poodle_mci_setpower(struct device *dev, unsigned int vdd)
229 struct pxamci_platform_data* p_d = dev->platform_data;
231 if (( 1 << vdd) & p_d->ocr_mask) {
232 GPSR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR);
234 GPSR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1);
236 GPCR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1);
237 GPCR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR);
241 static int poodle_mci_get_ro(struct device *dev)
243 return GPLR(POODLE_GPIO_nSD_WP) & GPIO_bit(POODLE_GPIO_nSD_WP);
247 static void poodle_mci_exit(struct device *dev, void *data)
249 free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data);
252 static struct pxamci_platform_data poodle_mci_platform_data = {
253 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
254 .init = poodle_mci_init,
255 .get_ro = poodle_mci_get_ro,
256 .setpower = poodle_mci_setpower,
257 .exit = poodle_mci_exit,
264 static void poodle_irda_transceiver_mode(struct device *dev, int mode)
267 GPSR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON);
269 GPCR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON);
271 pxa2xx_transceiver_mode(dev, mode);
274 static struct pxaficp_platform_data poodle_ficp_platform_data = {
275 .transceiver_cap = IR_SIRMODE | IR_OFF,
276 .transceiver_mode = poodle_irda_transceiver_mode,
281 * USB Device Controller
283 static void poodle_udc_command(int cmd)
286 case PXA2XX_UDC_CMD_CONNECT:
287 GPSR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP);
289 case PXA2XX_UDC_CMD_DISCONNECT:
290 GPCR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP);
295 static struct pxa2xx_udc_mach_info udc_info __initdata = {
296 /* no connect GPIO; poodle can't tell connection status */
297 .udc_command = poodle_udc_command,
302 static struct pxafb_mode_info poodle_fb_mode = {
313 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
316 static struct pxafb_mach_info poodle_fb_info = {
317 .modes = &poodle_fb_mode,
319 .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
323 static struct platform_device *devices[] __initdata = {
324 &poodle_locomo_device,
325 &poodle_scoop_device,
330 static void poodle_poweroff(void)
332 arm_machine_restart('h');
335 static void poodle_restart(char mode)
337 arm_machine_restart('h');
340 static void __init poodle_init(void)
344 pm_power_off = poodle_poweroff;
345 arm_pm_restart = poodle_restart;
347 /* setup sleep mode values */
362 /* Alternate Register */
363 GAFR0_L = 0x01001000;
364 GAFR0_U = 0x591a8010;
365 GAFR1_L = 0x900a8451;
366 GAFR1_U = 0xaaa5aaaa;
367 GAFR2_L = 0x8aaaaaaa;
368 GAFR2_U = 0x00000002;
370 /* Direction Register */
375 /* Output Register */
384 set_pxa_fb_parent(&poodle_locomo_device.dev);
385 set_pxa_fb_info(&poodle_fb_info);
386 pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT);
387 pxa_gpio_mode(POODLE_GPIO_IR_ON | GPIO_OUT);
388 pxa_set_udc_info(&udc_info);
389 pxa_set_mci_info(&poodle_mci_platform_data);
390 pxa_set_ficp_info(&poodle_ficp_platform_data);
391 pxa_set_i2c_info(NULL);
393 platform_scoop_config = &poodle_pcmcia_config;
395 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
397 printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n");
399 corgi_ssp_set_machinfo(&poodle_ssp_machinfo);
402 static void __init fixup_poodle(struct machine_desc *desc,
403 struct tag *tags, char **cmdline, struct meminfo *mi)
405 sharpsl_save_param();
407 mi->bank[0].start = 0xa0000000;
408 mi->bank[0].node = 0;
409 mi->bank[0].size = (32*1024*1024);
412 MACHINE_START(POODLE, "SHARP Poodle")
413 .phys_io = 0x40000000,
414 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
415 .fixup = fixup_poodle,
416 .map_io = pxa_map_io,
417 .init_irq = pxa25x_init_irq,
419 .init_machine = poodle_init,