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>
23 #include <asm/hardware.h>
24 #include <asm/mach-types.h>
26 #include <asm/setup.h>
27 #include <asm/system.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31 #include <asm/mach/irq.h>
33 #include <asm/arch/pxa-regs.h>
34 #include <asm/arch/mmc.h>
35 #include <asm/arch/udc.h>
36 #include <asm/arch/irda.h>
37 #include <asm/arch/poodle.h>
38 #include <asm/arch/pxafb.h>
40 #include <asm/hardware/scoop.h>
41 #include <asm/hardware/locomo.h>
42 #include <asm/mach/sharpsl_param.h>
46 static struct resource poodle_scoop_resources[] = {
50 .flags = IORESOURCE_MEM,
54 static struct scoop_config poodle_scoop_setup = {
55 .io_dir = POODLE_SCOOP_IO_DIR,
56 .io_out = POODLE_SCOOP_IO_OUT,
59 struct platform_device poodle_scoop_device = {
60 .name = "sharp-scoop",
63 .platform_data = &poodle_scoop_setup,
65 .num_resources = ARRAY_SIZE(poodle_scoop_resources),
66 .resource = poodle_scoop_resources,
69 static void poodle_pcmcia_init(void)
71 /* Setup default state of GPIO outputs
72 before we enable them as outputs. */
73 GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
74 GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) |
75 GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) |
76 GPIO_bit(GPIO53_nPCE_2);
78 pxa_gpio_mode(GPIO48_nPOE_MD);
79 pxa_gpio_mode(GPIO49_nPWE_MD);
80 pxa_gpio_mode(GPIO50_nPIOR_MD);
81 pxa_gpio_mode(GPIO51_nPIOW_MD);
82 pxa_gpio_mode(GPIO55_nPREG_MD);
83 pxa_gpio_mode(GPIO56_nPWAIT_MD);
84 pxa_gpio_mode(GPIO57_nIOIS16_MD);
85 pxa_gpio_mode(GPIO52_nPCE_1_MD);
86 pxa_gpio_mode(GPIO53_nPCE_2_MD);
87 pxa_gpio_mode(GPIO54_pSKTSEL_MD);
90 static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
92 .dev = &poodle_scoop_device.dev,
93 .irq = POODLE_IRQ_GPIO_CF_IRQ,
94 .cd_irq = POODLE_IRQ_GPIO_CF_CD,
95 .cd_irq_str = "PCMCIA0 CD",
99 static struct scoop_pcmcia_config poodle_pcmcia_config = {
100 .devs = &poodle_pcmcia_scoop[0],
102 .pcmcia_init = poodle_pcmcia_init,
105 EXPORT_SYMBOL(poodle_scoop_device);
109 static struct resource locomo_resources[] = {
113 .flags = IORESOURCE_MEM,
116 .start = IRQ_GPIO(10),
118 .flags = IORESOURCE_IRQ,
122 static struct platform_device locomo_device = {
125 .num_resources = ARRAY_SIZE(locomo_resources),
126 .resource = locomo_resources,
133 * The card detect interrupt isn't debounced so we delay it by 250ms
134 * to give the card a chance to fully insert/eject.
136 static struct pxamci_platform_data poodle_mci_platform_data;
138 static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)(int, void *, struct pt_regs *), void *data)
142 /* setup GPIO for PXA25x MMC controller */
143 pxa_gpio_mode(GPIO6_MMCCLK_MD);
144 pxa_gpio_mode(GPIO8_MMCCS0_MD);
145 pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN);
146 pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT);
148 poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250);
150 err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int,
151 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING,
152 "MMC card detect", data);
154 printk(KERN_ERR "poodle_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
161 static void poodle_mci_setpower(struct device *dev, unsigned int vdd)
163 struct pxamci_platform_data* p_d = dev->platform_data;
165 if (( 1 << vdd) & p_d->ocr_mask)
166 GPSR1 = GPIO_bit(POODLE_GPIO_SD_PWR);
168 GPCR1 = GPIO_bit(POODLE_GPIO_SD_PWR);
171 static void poodle_mci_exit(struct device *dev, void *data)
173 free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data);
176 static struct pxamci_platform_data poodle_mci_platform_data = {
177 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
178 .init = poodle_mci_init,
179 .setpower = poodle_mci_setpower,
180 .exit = poodle_mci_exit,
187 static void poodle_irda_transceiver_mode(struct device *dev, int mode)
190 GPSR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON);
192 GPCR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON);
196 static struct pxaficp_platform_data poodle_ficp_platform_data = {
197 .transceiver_cap = IR_SIRMODE | IR_OFF,
198 .transceiver_mode = poodle_irda_transceiver_mode,
203 * USB Device Controller
205 static void poodle_udc_command(int cmd)
208 case PXA2XX_UDC_CMD_CONNECT:
209 GPSR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP);
211 case PXA2XX_UDC_CMD_DISCONNECT:
212 GPCR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP);
217 static struct pxa2xx_udc_mach_info udc_info __initdata = {
218 /* no connect GPIO; poodle can't tell connection status */
219 .udc_command = poodle_udc_command,
224 static struct pxafb_mach_info poodle_fb_info __initdata = {
238 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
240 .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
243 .pxafb_backlight_power = NULL,
244 .pxafb_lcd_power = NULL,
247 static struct platform_device *devices[] __initdata = {
249 &poodle_scoop_device,
252 static void poodle_poweroff(void)
254 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
255 arm_machine_restart('h');
258 static void poodle_restart(char mode)
260 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
261 arm_machine_restart('h');
264 static void __init poodle_init(void)
268 pm_power_off = poodle_poweroff;
269 arm_pm_restart = poodle_restart;
271 /* setup sleep mode values */
286 /* Alternate Register */
287 GAFR0_L = 0x01001000;
288 GAFR0_U = 0x591a8010;
289 GAFR1_L = 0x900a8451;
290 GAFR1_U = 0xaaa5aaaa;
291 GAFR2_L = 0x8aaaaaaa;
292 GAFR2_U = 0x00000002;
294 /* Direction Register */
299 /* Output Register */
308 set_pxa_fb_info(&poodle_fb_info);
309 pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT);
310 pxa_gpio_mode(POODLE_GPIO_IR_ON | GPIO_OUT);
311 pxa_set_udc_info(&udc_info);
312 pxa_set_mci_info(&poodle_mci_platform_data);
313 pxa_set_ficp_info(&poodle_ficp_platform_data);
315 platform_scoop_config = &poodle_pcmcia_config;
317 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
319 printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n");
323 static void __init fixup_poodle(struct machine_desc *desc,
324 struct tag *tags, char **cmdline, struct meminfo *mi)
326 sharpsl_save_param();
328 mi->bank[0].start = 0xa0000000;
329 mi->bank[0].node = 0;
330 mi->bank[0].size = (32*1024*1024);
333 MACHINE_START(POODLE, "SHARP Poodle")
334 .phys_io = 0x40000000,
335 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
336 .fixup = fixup_poodle,
337 .map_io = pxa_map_io,
338 .init_irq = pxa_init_irq,
340 .init_machine = poodle_init,