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/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/poodle.h>
36 #include <asm/arch/pxafb.h>
38 #include <asm/hardware/scoop.h>
39 #include <asm/hardware/locomo.h>
40 #include <asm/mach/sharpsl_param.h>
44 static struct resource poodle_scoop_resources[] = {
48 .flags = IORESOURCE_MEM,
52 static struct scoop_config poodle_scoop_setup = {
53 .io_dir = POODLE_SCOOP_IO_DIR,
54 .io_out = POODLE_SCOOP_IO_OUT,
57 struct platform_device poodle_scoop_device = {
58 .name = "sharp-scoop",
61 .platform_data = &poodle_scoop_setup,
63 .num_resources = ARRAY_SIZE(poodle_scoop_resources),
64 .resource = poodle_scoop_resources,
67 static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
69 .dev = &poodle_scoop_device.dev,
70 .irq = POODLE_IRQ_GPIO_CF_IRQ,
71 .cd_irq = POODLE_IRQ_GPIO_CF_CD,
72 .cd_irq_str = "PCMCIA0 CD",
78 static struct resource locomo_resources[] = {
82 .flags = IORESOURCE_MEM,
85 .start = IRQ_GPIO(10),
87 .flags = IORESOURCE_IRQ,
91 static struct platform_device locomo_device = {
94 .num_resources = ARRAY_SIZE(locomo_resources),
95 .resource = locomo_resources,
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.
105 static struct pxamci_platform_data poodle_mci_platform_data;
107 static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)(int, void *, struct pt_regs *), void *data)
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);
117 poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250);
119 err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int, SA_INTERRUPT,
120 "MMC card detect", data);
122 printk(KERN_ERR "poodle_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
126 set_irq_type(POODLE_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
131 static void poodle_mci_setpower(struct device *dev, unsigned int vdd)
133 struct pxamci_platform_data* p_d = dev->platform_data;
135 if (( 1 << vdd) & p_d->ocr_mask)
136 GPSR1 = GPIO_bit(POODLE_GPIO_SD_PWR);
138 GPCR1 = GPIO_bit(POODLE_GPIO_SD_PWR);
141 static void poodle_mci_exit(struct device *dev, void *data)
143 free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data);
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,
155 * USB Device Controller
157 static void poodle_udc_command(int cmd)
160 case PXA2XX_UDC_CMD_CONNECT:
161 GPSR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP);
163 case PXA2XX_UDC_CMD_DISCONNECT:
164 GPCR(POODLE_GPIO_USB_PULLUP) = GPIO_bit(POODLE_GPIO_USB_PULLUP);
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,
176 static struct pxafb_mach_info poodle_fb_info __initdata = {
190 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
192 .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
195 .pxafb_backlight_power = NULL,
196 .pxafb_lcd_power = NULL,
199 static struct platform_device *devices[] __initdata = {
201 &poodle_scoop_device,
204 static void __init poodle_init(void)
208 /* setup sleep mode values */
223 /* Alternate Register */
224 GAFR0_L = 0x01001000;
225 GAFR0_U = 0x591a8010;
226 GAFR1_L = 0x900a8451;
227 GAFR1_U = 0xaaa5aaaa;
228 GAFR2_L = 0x8aaaaaaa;
229 GAFR2_U = 0x00000002;
231 /* Direction Register */
236 /* Output Register */
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);
251 scoop_devs = &poodle_pcmcia_scoop[0];
253 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
255 printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n");
259 static void __init fixup_poodle(struct machine_desc *desc,
260 struct tag *tags, char **cmdline, struct meminfo *mi)
262 sharpsl_save_param();
265 MACHINE_START(POODLE, "SHARP Poodle")
266 .phys_ram = 0xa0000000,
267 .phys_io = 0x40000000,
268 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
269 .fixup = fixup_poodle,
270 .map_io = pxa_map_io,
271 .init_irq = pxa_init_irq,
273 .init_machine = poodle_init,