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>
23 #include <linux/gpio.h>
25 #include <mach/hardware.h>
26 #include <asm/mach-types.h>
28 #include <asm/setup.h>
29 #include <asm/system.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
33 #include <asm/mach/irq.h>
35 #include <mach/pxa-regs.h>
36 #include <mach/pxa2xx-regs.h>
37 #include <mach/mfp-pxa25x.h>
41 #include <mach/irda.h>
42 #include <mach/poodle.h>
43 #include <mach/pxafb.h>
44 #include <mach/sharpsl.h>
47 #include <asm/hardware/scoop.h>
48 #include <asm/hardware/locomo.h>
49 #include <asm/mach/sharpsl_param.h>
55 static unsigned long poodle_pin_config[] __initdata = {
71 GPIO28_I2S_BITCLK_OUT,
128 GPIO9_GPIO, /* POODLE_GPIO_nSD_DETECT */
129 GPIO7_GPIO, /* POODLE_GPIO_nSD_WP */
130 GPIO3_GPIO, /* POODLE_GPIO_SD_PWR */
131 GPIO33_GPIO, /* POODLE_GPIO_SD_PWR1 */
133 GPIO20_GPIO, /* POODLE_GPIO_USB_PULLUP */
134 GPIO22_GPIO, /* POODLE_GPIO_IR_ON */
137 static struct resource poodle_scoop_resources[] = {
141 .flags = IORESOURCE_MEM,
145 static struct scoop_config poodle_scoop_setup = {
146 .io_dir = POODLE_SCOOP_IO_DIR,
147 .io_out = POODLE_SCOOP_IO_OUT,
150 struct platform_device poodle_scoop_device = {
151 .name = "sharp-scoop",
154 .platform_data = &poodle_scoop_setup,
156 .num_resources = ARRAY_SIZE(poodle_scoop_resources),
157 .resource = poodle_scoop_resources,
160 static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
162 .dev = &poodle_scoop_device.dev,
163 .irq = POODLE_IRQ_GPIO_CF_IRQ,
164 .cd_irq = POODLE_IRQ_GPIO_CF_CD,
165 .cd_irq_str = "PCMCIA0 CD",
169 static struct scoop_pcmcia_config poodle_pcmcia_config = {
170 .devs = &poodle_pcmcia_scoop[0],
174 EXPORT_SYMBOL(poodle_scoop_device);
178 static struct resource locomo_resources[] = {
182 .flags = IORESOURCE_MEM,
185 .start = IRQ_GPIO(10),
187 .flags = IORESOURCE_IRQ,
191 struct platform_device poodle_locomo_device = {
194 .num_resources = ARRAY_SIZE(locomo_resources),
195 .resource = locomo_resources,
198 EXPORT_SYMBOL(poodle_locomo_device);
204 struct platform_device poodle_ssp_device = {
209 struct corgissp_machinfo poodle_ssp_machinfo = {
221 * Poodle Touch Screen Device
223 static struct resource poodlets_resources[] = {
225 .start = POODLE_IRQ_GPIO_TP_INT,
226 .end = POODLE_IRQ_GPIO_TP_INT,
227 .flags = IORESOURCE_IRQ,
231 static unsigned long poodle_get_hsync_invperiod(void)
236 static void poodle_null_hsync(void)
240 static struct corgits_machinfo poodle_ts_machinfo = {
241 .get_hsync_invperiod = poodle_get_hsync_invperiod,
242 .put_hsync = poodle_null_hsync,
243 .wait_hsync = poodle_null_hsync,
246 static struct platform_device poodle_ts_device = {
249 .platform_data = &poodle_ts_machinfo,
252 .num_resources = ARRAY_SIZE(poodlets_resources),
253 .resource = poodlets_resources,
260 * The card detect interrupt isn't debounced so we delay it by 250ms
261 * to give the card a chance to fully insert/eject.
263 static struct pxamci_platform_data poodle_mci_platform_data;
265 static int poodle_mci_init(struct device *dev, irq_handler_t poodle_detect_int, void *data)
269 err = gpio_request(POODLE_GPIO_nSD_DETECT, "nSD_DETECT");
273 err = gpio_request(POODLE_GPIO_nSD_WP, "nSD_WP");
277 err = gpio_request(POODLE_GPIO_SD_PWR, "SD_PWR");
281 err = gpio_request(POODLE_GPIO_SD_PWR1, "SD_PWR1");
285 gpio_direction_input(POODLE_GPIO_nSD_DETECT);
286 gpio_direction_input(POODLE_GPIO_nSD_WP);
288 gpio_direction_output(POODLE_GPIO_SD_PWR, 0);
289 gpio_direction_output(POODLE_GPIO_SD_PWR1, 0);
291 poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250);
293 err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int,
294 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
295 "MMC card detect", data);
297 pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n",
305 gpio_free(POODLE_GPIO_SD_PWR1);
307 gpio_free(POODLE_GPIO_SD_PWR);
309 gpio_free(POODLE_GPIO_nSD_WP);
311 gpio_free(POODLE_GPIO_nSD_DETECT);
316 static void poodle_mci_setpower(struct device *dev, unsigned int vdd)
318 struct pxamci_platform_data* p_d = dev->platform_data;
320 if ((1 << vdd) & p_d->ocr_mask) {
321 gpio_set_value(POODLE_GPIO_SD_PWR, 1);
323 gpio_set_value(POODLE_GPIO_SD_PWR1, 1);
325 gpio_set_value(POODLE_GPIO_SD_PWR1, 0);
326 gpio_set_value(POODLE_GPIO_SD_PWR, 0);
330 static int poodle_mci_get_ro(struct device *dev)
332 return !!gpio_get_value(POODLE_GPIO_nSD_WP);
333 return GPLR(POODLE_GPIO_nSD_WP) & GPIO_bit(POODLE_GPIO_nSD_WP);
337 static void poodle_mci_exit(struct device *dev, void *data)
339 free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data);
340 gpio_free(POODLE_GPIO_SD_PWR1);
341 gpio_free(POODLE_GPIO_SD_PWR);
342 gpio_free(POODLE_GPIO_nSD_WP);
343 gpio_free(POODLE_GPIO_nSD_DETECT);
346 static struct pxamci_platform_data poodle_mci_platform_data = {
347 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
348 .init = poodle_mci_init,
349 .get_ro = poodle_mci_get_ro,
350 .setpower = poodle_mci_setpower,
351 .exit = poodle_mci_exit,
358 static void poodle_irda_transceiver_mode(struct device *dev, int mode)
360 gpio_set_value(POODLE_GPIO_IR_ON, mode & IR_OFF);
361 pxa2xx_transceiver_mode(dev, mode);
364 static int poodle_irda_startup(struct device *dev)
368 err = gpio_request(POODLE_GPIO_IR_ON, "IR_ON");
372 gpio_direction_output(POODLE_GPIO_IR_ON, 1);
376 static void poodle_irda_shutdown(struct device *dev)
378 gpio_free(POODLE_GPIO_IR_ON);
381 static struct pxaficp_platform_data poodle_ficp_platform_data = {
382 .transceiver_cap = IR_SIRMODE | IR_OFF,
383 .transceiver_mode = poodle_irda_transceiver_mode,
384 .startup = poodle_irda_startup,
385 .shutdown = poodle_irda_shutdown,
390 * USB Device Controller
392 static struct pxa2xx_udc_mach_info udc_info __initdata = {
393 /* no connect GPIO; poodle can't tell connection status */
394 .gpio_pullup = POODLE_GPIO_USB_PULLUP,
399 static struct pxafb_mode_info poodle_fb_mode = {
410 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
413 static struct pxafb_mach_info poodle_fb_info = {
414 .modes = &poodle_fb_mode,
416 .lcd_conn = LCD_COLOR_TFT_16BPP,
419 static struct platform_device *devices[] __initdata = {
420 &poodle_locomo_device,
421 &poodle_scoop_device,
426 static void poodle_poweroff(void)
428 arm_machine_restart('h');
431 static void poodle_restart(char mode)
433 arm_machine_restart('h');
436 static void __init poodle_init(void)
440 pm_power_off = poodle_poweroff;
441 arm_pm_restart = poodle_restart;
445 pxa2xx_mfp_config(ARRAY_AND_SIZE(poodle_pin_config));
447 platform_scoop_config = &poodle_pcmcia_config;
448 corgi_ssp_set_machinfo(&poodle_ssp_machinfo);
450 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
452 pr_warning("poodle: Unable to register LoCoMo device\n");
454 set_pxa_fb_parent(&poodle_locomo_device.dev);
455 set_pxa_fb_info(&poodle_fb_info);
456 pxa_set_udc_info(&udc_info);
457 pxa_set_mci_info(&poodle_mci_platform_data);
458 pxa_set_ficp_info(&poodle_ficp_platform_data);
459 pxa_set_i2c_info(NULL);
462 static void __init fixup_poodle(struct machine_desc *desc,
463 struct tag *tags, char **cmdline, struct meminfo *mi)
465 sharpsl_save_param();
467 mi->bank[0].start = 0xa0000000;
468 mi->bank[0].node = 0;
469 mi->bank[0].size = (32*1024*1024);
472 MACHINE_START(POODLE, "SHARP Poodle")
473 .phys_io = 0x40000000,
474 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
475 .fixup = fixup_poodle,
476 .map_io = pxa_map_io,
477 .init_irq = pxa25x_init_irq,
479 .init_machine = poodle_init,