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 <asm/hardware.h>
23 #include <asm/mach-types.h>
25 #include <asm/setup.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29 #include <asm/mach/irq.h>
31 #include <asm/arch/pxa-regs.h>
32 #include <asm/arch/irq.h>
33 #include <asm/arch/mmc.h>
34 #include <asm/arch/udc.h>
35 #include <asm/arch/irda.h>
36 #include <asm/arch/poodle.h>
37 #include <asm/arch/pxafb.h>
39 #include <asm/hardware/scoop.h>
40 #include <asm/hardware/locomo.h>
41 #include <asm/mach/sharpsl_param.h>
45 static struct resource poodle_scoop_resources[] = {
49 .flags = IORESOURCE_MEM,
53 static struct scoop_config poodle_scoop_setup = {
54 .io_dir = POODLE_SCOOP_IO_DIR,
55 .io_out = POODLE_SCOOP_IO_OUT,
58 struct platform_device poodle_scoop_device = {
59 .name = "sharp-scoop",
62 .platform_data = &poodle_scoop_setup,
64 .num_resources = ARRAY_SIZE(poodle_scoop_resources),
65 .resource = poodle_scoop_resources,
68 static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
70 .dev = &poodle_scoop_device.dev,
71 .irq = POODLE_IRQ_GPIO_CF_IRQ,
72 .cd_irq = POODLE_IRQ_GPIO_CF_CD,
73 .cd_irq_str = "PCMCIA0 CD",
79 static struct resource locomo_resources[] = {
83 .flags = IORESOURCE_MEM,
86 .start = IRQ_GPIO(10),
88 .flags = IORESOURCE_IRQ,
92 static struct platform_device locomo_device = {
95 .num_resources = ARRAY_SIZE(locomo_resources),
96 .resource = locomo_resources,
103 * The card detect interrupt isn't debounced so we delay it by 250ms
104 * to give the card a chance to fully insert/eject.
106 static struct pxamci_platform_data poodle_mci_platform_data;
108 static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)(int, void *, struct pt_regs *), void *data)
112 /* setup GPIO for PXA25x MMC controller */
113 pxa_gpio_mode(GPIO6_MMCCLK_MD);
114 pxa_gpio_mode(GPIO8_MMCCS0_MD);
115 pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN);
116 pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT);
118 poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250);
120 err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int, SA_INTERRUPT,
121 "MMC card detect", data);
123 printk(KERN_ERR "poodle_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
127 set_irq_type(POODLE_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
132 static void poodle_mci_setpower(struct device *dev, unsigned int vdd)
134 struct pxamci_platform_data* p_d = dev->platform_data;
136 if (( 1 << vdd) & p_d->ocr_mask)
137 GPSR1 = GPIO_bit(POODLE_GPIO_SD_PWR);
139 GPCR1 = GPIO_bit(POODLE_GPIO_SD_PWR);
142 static void poodle_mci_exit(struct device *dev, void *data)
144 free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data);
147 static struct pxamci_platform_data poodle_mci_platform_data = {
148 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
149 .init = poodle_mci_init,
150 .setpower = poodle_mci_setpower,
151 .exit = poodle_mci_exit,
158 static void poodle_irda_transceiver_mode(struct device *dev, int mode)
161 GPSR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON);
163 GPCR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON);
167 static struct pxaficp_platform_data poodle_ficp_platform_data = {
168 .transceiver_cap = IR_SIRMODE | IR_OFF,
169 .transceiver_mode = poodle_irda_transceiver_mode,
174 * USB Device Controller
176 static void poodle_udc_command(int cmd)
179 case PXA2XX_UDC_CMD_CONNECT:
180 GPSR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP);
182 case PXA2XX_UDC_CMD_DISCONNECT:
183 GPCR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP);
188 static struct pxa2xx_udc_mach_info udc_info __initdata = {
189 /* no connect GPIO; poodle can't tell connection status */
190 .udc_command = poodle_udc_command,
195 static struct pxafb_mach_info poodle_fb_info __initdata = {
209 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
211 .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
214 .pxafb_backlight_power = NULL,
215 .pxafb_lcd_power = NULL,
218 static struct platform_device *devices[] __initdata = {
220 &poodle_scoop_device,
223 static void __init poodle_init(void)
227 /* setup sleep mode values */
242 /* Alternate Register */
243 GAFR0_L = 0x01001000;
244 GAFR0_U = 0x591a8010;
245 GAFR1_L = 0x900a8451;
246 GAFR1_U = 0xaaa5aaaa;
247 GAFR2_L = 0x8aaaaaaa;
248 GAFR2_U = 0x00000002;
250 /* Direction Register */
255 /* Output Register */
264 set_pxa_fb_info(&poodle_fb_info);
265 pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT);
266 pxa_gpio_mode(POODLE_GPIO_IR_ON | GPIO_OUT);
267 pxa_set_udc_info(&udc_info);
268 pxa_set_mci_info(&poodle_mci_platform_data);
269 pxa_set_ficp_info(&poodle_ficp_platform_data);
272 scoop_devs = &poodle_pcmcia_scoop[0];
274 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
276 printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n");
280 static void __init fixup_poodle(struct machine_desc *desc,
281 struct tag *tags, char **cmdline, struct meminfo *mi)
283 sharpsl_save_param();
286 MACHINE_START(POODLE, "SHARP Poodle")
287 .phys_ram = 0xa0000000,
288 .phys_io = 0x40000000,
289 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
290 .fixup = fixup_poodle,
291 .map_io = pxa_map_io,
292 .init_irq = pxa_init_irq,
294 .init_machine = poodle_init,