switch fat to ->s_d_op, close exportfs races there
[linux-2.6/x86.git] / arch / arm / mach-pxa / balloon3.c
blobccb2d0cebcc3bb2c857391aadc3632f1da63d78a
1 /*
2 * linux/arch/arm/mach-pxa/balloon3.c
4 * Support for Balloonboard.org Balloon3 board.
6 * Author: Nick Bane, Wookey, Jonathan McDowell
7 * Created: June, 2006
8 * Copyright: Toby Churchill Ltd
9 * Derived from mainstone.c, by Nico Pitre
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/sysdev.h>
19 #include <linux/interrupt.h>
20 #include <linux/sched.h>
21 #include <linux/bitops.h>
22 #include <linux/fb.h>
23 #include <linux/gpio.h>
24 #include <linux/ioport.h>
25 #include <linux/ucb1400.h>
26 #include <linux/mtd/mtd.h>
27 #include <linux/mtd/partitions.h>
28 #include <linux/types.h>
29 #include <linux/i2c/pcf857x.h>
30 #include <linux/mtd/nand.h>
31 #include <linux/mtd/physmap.h>
32 #include <linux/regulator/max1586.h>
34 #include <asm/setup.h>
35 #include <asm/mach-types.h>
36 #include <asm/irq.h>
37 #include <asm/sizes.h>
39 #include <asm/mach/arch.h>
40 #include <asm/mach/map.h>
41 #include <asm/mach/irq.h>
42 #include <asm/mach/flash.h>
44 #include <mach/pxa27x.h>
45 #include <mach/balloon3.h>
46 #include <mach/audio.h>
47 #include <mach/pxafb.h>
48 #include <mach/mmc.h>
49 #include <mach/udc.h>
50 #include <mach/pxa27x-udc.h>
51 #include <mach/irda.h>
52 #include <mach/ohci.h>
54 #include <plat/i2c.h>
56 #include "generic.h"
57 #include "devices.h"
59 /******************************************************************************
60 * Pin configuration
61 ******************************************************************************/
62 static unsigned long balloon3_pin_config[] __initdata = {
63 /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */
64 GPIO42_BTUART_RXD,
65 GPIO43_BTUART_TXD,
66 GPIO44_BTUART_CTS,
67 GPIO45_BTUART_RTS,
69 /* Reset, configured as GPIO wakeup source */
70 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
73 /******************************************************************************
74 * Compatibility: Parameter parsing
75 ******************************************************************************/
76 static unsigned long balloon3_irq_enabled;
78 static unsigned long balloon3_features_present =
79 (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
80 (1 << BALLOON3_FEATURE_AUDIO) |
81 (1 << BALLOON3_FEATURE_TOPPOLY);
83 int balloon3_has(enum balloon3_features feature)
85 return (balloon3_features_present & (1 << feature)) ? 1 : 0;
87 EXPORT_SYMBOL_GPL(balloon3_has);
89 int __init parse_balloon3_features(char *arg)
91 if (!arg)
92 return 0;
94 return strict_strtoul(arg, 0, &balloon3_features_present);
96 early_param("balloon3_features", parse_balloon3_features);
98 /******************************************************************************
99 * Compact Flash slot
100 ******************************************************************************/
101 #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
102 static unsigned long balloon3_cf_pin_config[] __initdata = {
103 GPIO48_nPOE,
104 GPIO49_nPWE,
105 GPIO50_nPIOR,
106 GPIO51_nPIOW,
107 GPIO85_nPCE_1,
108 GPIO54_nPCE_2,
109 GPIO79_PSKTSEL,
110 GPIO55_nPREG,
111 GPIO56_nPWAIT,
112 GPIO57_nIOIS16,
115 static void __init balloon3_cf_init(void)
117 if (!balloon3_has(BALLOON3_FEATURE_CF))
118 return;
120 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_cf_pin_config));
122 #else
123 static inline void balloon3_cf_init(void) {}
124 #endif
126 /******************************************************************************
127 * NOR Flash
128 ******************************************************************************/
129 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
130 static struct mtd_partition balloon3_nor_partitions[] = {
132 .name = "Flash",
133 .offset = 0x00000000,
134 .size = MTDPART_SIZ_FULL,
138 static struct physmap_flash_data balloon3_flash_data[] = {
140 .width = 2, /* bankwidth in bytes */
141 .parts = balloon3_nor_partitions,
142 .nr_parts = ARRAY_SIZE(balloon3_nor_partitions)
146 static struct resource balloon3_flash_resource = {
147 .start = PXA_CS0_PHYS,
148 .end = PXA_CS0_PHYS + SZ_64M - 1,
149 .flags = IORESOURCE_MEM,
152 static struct platform_device balloon3_flash = {
153 .name = "physmap-flash",
154 .id = 0,
155 .resource = &balloon3_flash_resource,
156 .num_resources = 1,
157 .dev = {
158 .platform_data = balloon3_flash_data,
161 static void __init balloon3_nor_init(void)
163 platform_device_register(&balloon3_flash);
165 #else
166 static inline void balloon3_nor_init(void) {}
167 #endif
169 /******************************************************************************
170 * Audio and Touchscreen
171 ******************************************************************************/
172 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
173 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
174 static unsigned long balloon3_ac97_pin_config[] __initdata = {
175 GPIO28_AC97_BITCLK,
176 GPIO29_AC97_SDATA_IN_0,
177 GPIO30_AC97_SDATA_OUT,
178 GPIO31_AC97_SYNC,
179 GPIO113_AC97_nRESET,
180 GPIO95_GPIO,
183 static struct ucb1400_pdata vpac270_ucb1400_pdata = {
184 .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ),
188 static struct platform_device balloon3_ucb1400_device = {
189 .name = "ucb1400_core",
190 .id = -1,
191 .dev = {
192 .platform_data = &vpac270_ucb1400_pdata,
196 static void __init balloon3_ts_init(void)
198 if (!balloon3_has(BALLOON3_FEATURE_AUDIO))
199 return;
201 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config));
202 pxa_set_ac97_info(NULL);
203 platform_device_register(&balloon3_ucb1400_device);
205 #else
206 static inline void balloon3_ts_init(void) {}
207 #endif
209 /******************************************************************************
210 * Framebuffer
211 ******************************************************************************/
212 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
213 static unsigned long balloon3_lcd_pin_config[] __initdata = {
214 GPIOxx_LCD_TFT_16BPP,
215 GPIO99_GPIO,
218 static struct pxafb_mode_info balloon3_lcd_modes[] = {
220 .pixclock = 38000,
221 .xres = 480,
222 .yres = 640,
223 .bpp = 16,
224 .hsync_len = 8,
225 .left_margin = 8,
226 .right_margin = 8,
227 .vsync_len = 2,
228 .upper_margin = 4,
229 .lower_margin = 5,
230 .sync = 0,
234 static struct pxafb_mach_info balloon3_lcd_screen = {
235 .modes = balloon3_lcd_modes,
236 .num_modes = ARRAY_SIZE(balloon3_lcd_modes),
237 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
240 static void balloon3_backlight_power(int on)
242 gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
245 static void __init balloon3_lcd_init(void)
247 int ret;
249 if (!balloon3_has(BALLOON3_FEATURE_TOPPOLY))
250 return;
252 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_lcd_pin_config));
254 ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON");
255 if (ret) {
256 pr_err("Requesting BKL-ON GPIO failed!\n");
257 goto err;
260 ret = gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
261 if (ret) {
262 pr_err("Setting BKL-ON GPIO direction failed!\n");
263 goto err2;
266 balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power;
267 set_pxa_fb_info(&balloon3_lcd_screen);
268 return;
270 err2:
271 gpio_free(BALLOON3_GPIO_RUN_BACKLIGHT);
272 err:
273 return;
275 #else
276 static inline void balloon3_lcd_init(void) {}
277 #endif
279 /******************************************************************************
280 * SD/MMC card controller
281 ******************************************************************************/
282 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
283 static unsigned long balloon3_mmc_pin_config[] __initdata = {
284 GPIO32_MMC_CLK,
285 GPIO92_MMC_DAT_0,
286 GPIO109_MMC_DAT_1,
287 GPIO110_MMC_DAT_2,
288 GPIO111_MMC_DAT_3,
289 GPIO112_MMC_CMD,
292 static struct pxamci_platform_data balloon3_mci_platform_data = {
293 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
294 .gpio_card_detect = -1,
295 .gpio_card_ro = -1,
296 .gpio_power = -1,
297 .detect_delay_ms = 200,
300 static void __init balloon3_mmc_init(void)
302 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_mmc_pin_config));
303 pxa_set_mci_info(&balloon3_mci_platform_data);
305 #else
306 static inline void balloon3_mmc_init(void) {}
307 #endif
309 /******************************************************************************
310 * USB Gadget
311 ******************************************************************************/
312 #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
313 static void balloon3_udc_command(int cmd)
315 if (cmd == PXA2XX_UDC_CMD_CONNECT)
316 UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
317 else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
318 UP2OCR &= ~UP2OCR_DPPUE;
321 static int balloon3_udc_is_connected(void)
323 return 1;
326 static struct pxa2xx_udc_mach_info balloon3_udc_info __initdata = {
327 .udc_command = balloon3_udc_command,
328 .udc_is_connected = balloon3_udc_is_connected,
329 .gpio_pullup = -1,
332 static void __init balloon3_udc_init(void)
334 pxa_set_udc_info(&balloon3_udc_info);
335 platform_device_register(&balloon3_gpio_vbus);
337 #else
338 static inline void balloon3_udc_init(void) {}
339 #endif
341 /******************************************************************************
342 * IrDA
343 ******************************************************************************/
344 #if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
345 static struct pxaficp_platform_data balloon3_ficp_platform_data = {
346 .transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF,
349 static void __init balloon3_irda_init(void)
351 pxa_set_ficp_info(&balloon3_ficp_platform_data);
353 #else
354 static inline void balloon3_irda_init(void) {}
355 #endif
357 /******************************************************************************
358 * USB Host
359 ******************************************************************************/
360 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
361 static unsigned long balloon3_uhc_pin_config[] __initdata = {
362 GPIO88_USBH1_PWR,
363 GPIO89_USBH1_PEN,
366 static struct pxaohci_platform_data balloon3_ohci_info = {
367 .port_mode = PMM_PERPORT_MODE,
368 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
371 static void __init balloon3_uhc_init(void)
373 if (!balloon3_has(BALLOON3_FEATURE_OHCI))
374 return;
375 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_uhc_pin_config));
376 pxa_set_ohci_info(&balloon3_ohci_info);
378 #else
379 static inline void balloon3_uhc_init(void) {}
380 #endif
382 /******************************************************************************
383 * LEDs
384 ******************************************************************************/
385 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
386 static unsigned long balloon3_led_pin_config[] __initdata = {
387 GPIO9_GPIO, /* NAND activity LED */
388 GPIO10_GPIO, /* Heartbeat LED */
391 struct gpio_led balloon3_gpio_leds[] = {
393 .name = "balloon3:green:idle",
394 .default_trigger = "heartbeat",
395 .gpio = BALLOON3_GPIO_LED_IDLE,
396 .active_low = 1,
397 }, {
398 .name = "balloon3:green:nand",
399 .default_trigger = "nand-disk",
400 .gpio = BALLOON3_GPIO_LED_NAND,
401 .active_low = 1,
405 static struct gpio_led_platform_data balloon3_gpio_led_info = {
406 .leds = balloon3_gpio_leds,
407 .num_leds = ARRAY_SIZE(balloon3_gpio_leds),
410 static struct platform_device balloon3_leds = {
411 .name = "leds-gpio",
412 .id = 0,
413 .dev = {
414 .platform_data = &balloon3_gpio_led_info,
418 struct gpio_led balloon3_pcf_gpio_leds[] = {
420 .name = "balloon3:green:led0",
421 .gpio = BALLOON3_PCF_GPIO_LED0,
422 .active_low = 1,
423 }, {
424 .name = "balloon3:green:led1",
425 .gpio = BALLOON3_PCF_GPIO_LED1,
426 .active_low = 1,
427 }, {
428 .name = "balloon3:orange:led2",
429 .gpio = BALLOON3_PCF_GPIO_LED2,
430 .active_low = 1,
431 }, {
432 .name = "balloon3:orange:led3",
433 .gpio = BALLOON3_PCF_GPIO_LED3,
434 .active_low = 1,
435 }, {
436 .name = "balloon3:orange:led4",
437 .gpio = BALLOON3_PCF_GPIO_LED4,
438 .active_low = 1,
439 }, {
440 .name = "balloon3:orange:led5",
441 .gpio = BALLOON3_PCF_GPIO_LED5,
442 .active_low = 1,
443 }, {
444 .name = "balloon3:red:led6",
445 .gpio = BALLOON3_PCF_GPIO_LED6,
446 .active_low = 1,
447 }, {
448 .name = "balloon3:red:led7",
449 .gpio = BALLOON3_PCF_GPIO_LED7,
450 .active_low = 1,
454 static struct gpio_led_platform_data balloon3_pcf_gpio_led_info = {
455 .leds = balloon3_pcf_gpio_leds,
456 .num_leds = ARRAY_SIZE(balloon3_pcf_gpio_leds),
459 static struct platform_device balloon3_pcf_leds = {
460 .name = "leds-gpio",
461 .id = 1,
462 .dev = {
463 .platform_data = &balloon3_pcf_gpio_led_info,
467 static void __init balloon3_leds_init(void)
469 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_led_pin_config));
470 platform_device_register(&balloon3_leds);
471 platform_device_register(&balloon3_pcf_leds);
473 #else
474 static inline void balloon3_leds_init(void) {}
475 #endif
477 /******************************************************************************
478 * FPGA IRQ
479 ******************************************************************************/
480 static void balloon3_mask_irq(unsigned int irq)
482 int balloon3_irq = (irq - BALLOON3_IRQ(0));
483 balloon3_irq_enabled &= ~(1 << balloon3_irq);
484 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
487 static void balloon3_unmask_irq(unsigned int irq)
489 int balloon3_irq = (irq - BALLOON3_IRQ(0));
490 balloon3_irq_enabled |= (1 << balloon3_irq);
491 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
494 static struct irq_chip balloon3_irq_chip = {
495 .name = "FPGA",
496 .ack = balloon3_mask_irq,
497 .mask = balloon3_mask_irq,
498 .unmask = balloon3_unmask_irq,
501 static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
503 unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
504 balloon3_irq_enabled;
505 do {
506 /* clear useless edge notification */
507 if (desc->chip->ack)
508 desc->chip->ack(BALLOON3_AUX_NIRQ);
509 while (pending) {
510 irq = BALLOON3_IRQ(0) + __ffs(pending);
511 generic_handle_irq(irq);
512 pending &= pending - 1;
514 pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
515 balloon3_irq_enabled;
516 } while (pending);
519 static void __init balloon3_init_irq(void)
521 int irq;
523 pxa27x_init_irq();
524 /* setup extra Balloon3 irqs */
525 for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) {
526 set_irq_chip(irq, &balloon3_irq_chip);
527 set_irq_handler(irq, handle_level_irq);
528 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
531 set_irq_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler);
532 set_irq_type(BALLOON3_AUX_NIRQ, IRQ_TYPE_EDGE_FALLING);
534 pr_debug("%s: chained handler installed - irq %d automatically "
535 "enabled\n", __func__, BALLOON3_AUX_NIRQ);
538 /******************************************************************************
539 * GPIO expander
540 ******************************************************************************/
541 #if defined(CONFIG_GPIO_PCF857X) || defined(CONFIG_GPIO_PCF857X_MODULE)
542 static struct pcf857x_platform_data balloon3_pcf857x_pdata = {
543 .gpio_base = BALLOON3_PCF_GPIO_BASE,
544 .n_latch = 0,
545 .setup = NULL,
546 .teardown = NULL,
547 .context = NULL,
550 static struct i2c_board_info __initdata balloon3_i2c_devs[] = {
552 I2C_BOARD_INFO("pcf8574a", 0x38),
553 .platform_data = &balloon3_pcf857x_pdata,
557 static void __init balloon3_i2c_init(void)
559 pxa_set_i2c_info(NULL);
560 i2c_register_board_info(0, ARRAY_AND_SIZE(balloon3_i2c_devs));
562 #else
563 static inline void balloon3_i2c_init(void) {}
564 #endif
566 /******************************************************************************
567 * NAND
568 ******************************************************************************/
569 #if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
570 static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
572 struct nand_chip *this = mtd->priv;
573 uint8_t balloon3_ctl_set = 0, balloon3_ctl_clr = 0;
575 if (ctrl & NAND_CTRL_CHANGE) {
576 if (ctrl & NAND_CLE)
577 balloon3_ctl_set |= BALLOON3_NAND_CONTROL_FLCLE;
578 else
579 balloon3_ctl_clr |= BALLOON3_NAND_CONTROL_FLCLE;
581 if (ctrl & NAND_ALE)
582 balloon3_ctl_set |= BALLOON3_NAND_CONTROL_FLALE;
583 else
584 balloon3_ctl_clr |= BALLOON3_NAND_CONTROL_FLALE;
586 if (balloon3_ctl_clr)
587 __raw_writel(balloon3_ctl_clr,
588 BALLOON3_NAND_CONTROL_REG);
589 if (balloon3_ctl_set)
590 __raw_writel(balloon3_ctl_set,
591 BALLOON3_NAND_CONTROL_REG |
592 BALLOON3_FPGA_SETnCLR);
595 if (cmd != NAND_CMD_NONE)
596 writeb(cmd, this->IO_ADDR_W);
599 static void balloon3_nand_select_chip(struct mtd_info *mtd, int chip)
601 if (chip < 0 || chip > 3)
602 return;
604 /* Assert all nCE lines */
605 __raw_writew(
606 BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 |
607 BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3,
608 BALLOON3_NAND_CONTROL_REG | BALLOON3_FPGA_SETnCLR);
610 /* Deassert correct nCE line */
611 __raw_writew(BALLOON3_NAND_CONTROL_FLCE0 << chip,
612 BALLOON3_NAND_CONTROL_REG);
615 static int balloon3_nand_dev_ready(struct mtd_info *mtd)
617 return __raw_readl(BALLOON3_NAND_STAT_REG) & BALLOON3_NAND_STAT_RNB;
620 static int balloon3_nand_probe(struct platform_device *pdev)
622 uint16_t ver;
623 int ret;
625 __raw_writew(BALLOON3_NAND_CONTROL2_16BIT,
626 BALLOON3_NAND_CONTROL2_REG | BALLOON3_FPGA_SETnCLR);
628 ver = __raw_readw(BALLOON3_FPGA_VER);
629 if (ver < 0x4f08)
630 pr_warn("The FPGA code, version 0x%04x, is too old. "
631 "NAND support might be broken in this version!", ver);
633 /* Power up the NAND chips */
634 ret = gpio_request(BALLOON3_GPIO_RUN_NAND, "NAND");
635 if (ret)
636 goto err1;
638 ret = gpio_direction_output(BALLOON3_GPIO_RUN_NAND, 1);
639 if (ret)
640 goto err2;
642 gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1);
644 /* Deassert all nCE lines and write protect line */
645 __raw_writel(
646 BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 |
647 BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3 |
648 BALLOON3_NAND_CONTROL_FLWP,
649 BALLOON3_NAND_CONTROL_REG | BALLOON3_FPGA_SETnCLR);
650 return 0;
652 err2:
653 gpio_free(BALLOON3_GPIO_RUN_NAND);
654 err1:
655 return ret;
658 static void balloon3_nand_remove(struct platform_device *pdev)
660 /* Power down the NAND chips */
661 gpio_set_value(BALLOON3_GPIO_RUN_NAND, 0);
662 gpio_free(BALLOON3_GPIO_RUN_NAND);
665 static struct mtd_partition balloon3_partition_info[] = {
666 [0] = {
667 .name = "Boot",
668 .offset = 0,
669 .size = SZ_4M,
671 [1] = {
672 .name = "RootFS",
673 .offset = MTDPART_OFS_APPEND,
674 .size = MTDPART_SIZ_FULL
678 static const char *balloon3_part_probes[] = { "cmdlinepart", NULL };
680 struct platform_nand_data balloon3_nand_pdata = {
681 .chip = {
682 .nr_chips = 4,
683 .chip_offset = 0,
684 .nr_partitions = ARRAY_SIZE(balloon3_partition_info),
685 .partitions = balloon3_partition_info,
686 .chip_delay = 50,
687 .part_probe_types = balloon3_part_probes,
689 .ctrl = {
690 .hwcontrol = 0,
691 .dev_ready = balloon3_nand_dev_ready,
692 .select_chip = balloon3_nand_select_chip,
693 .cmd_ctrl = balloon3_nand_cmd_ctl,
694 .probe = balloon3_nand_probe,
695 .remove = balloon3_nand_remove,
699 static struct resource balloon3_nand_resource[] = {
700 [0] = {
701 .start = BALLOON3_NAND_BASE,
702 .end = BALLOON3_NAND_BASE + 0x4,
703 .flags = IORESOURCE_MEM,
707 static struct platform_device balloon3_nand = {
708 .name = "gen_nand",
709 .num_resources = ARRAY_SIZE(balloon3_nand_resource),
710 .resource = balloon3_nand_resource,
711 .id = -1,
712 .dev = {
713 .platform_data = &balloon3_nand_pdata,
717 static void __init balloon3_nand_init(void)
719 platform_device_register(&balloon3_nand);
721 #else
722 static inline void balloon3_nand_init(void) {}
723 #endif
725 /******************************************************************************
726 * Core power regulator
727 ******************************************************************************/
728 #if defined(CONFIG_REGULATOR_MAX1586) || \
729 defined(CONFIG_REGULATOR_MAX1586_MODULE)
730 static struct regulator_consumer_supply balloon3_max1587a_consumers[] = {
732 .supply = "vcc_core",
736 static struct regulator_init_data balloon3_max1587a_v3_info = {
737 .constraints = {
738 .name = "vcc_core range",
739 .min_uV = 900000,
740 .max_uV = 1705000,
741 .always_on = 1,
742 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
744 .consumer_supplies = balloon3_max1587a_consumers,
745 .num_consumer_supplies = ARRAY_SIZE(balloon3_max1587a_consumers),
748 static struct max1586_subdev_data balloon3_max1587a_subdevs[] = {
750 .name = "vcc_core",
751 .id = MAX1586_V3,
752 .platform_data = &balloon3_max1587a_v3_info,
756 static struct max1586_platform_data balloon3_max1587a_info = {
757 .subdevs = balloon3_max1587a_subdevs,
758 .num_subdevs = ARRAY_SIZE(balloon3_max1587a_subdevs),
759 .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
762 static struct i2c_board_info __initdata balloon3_pi2c_board_info[] = {
764 I2C_BOARD_INFO("max1586", 0x14),
765 .platform_data = &balloon3_max1587a_info,
769 static void __init balloon3_pmic_init(void)
771 pxa27x_set_i2c_power_info(NULL);
772 i2c_register_board_info(1, ARRAY_AND_SIZE(balloon3_pi2c_board_info));
774 #else
775 static inline void balloon3_pmic_init(void) {}
776 #endif
778 /******************************************************************************
779 * Machine init
780 ******************************************************************************/
781 static void __init balloon3_init(void)
783 ARB_CNTRL = ARB_CORE_PARK | 0x234;
785 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config));
787 pxa_set_ffuart_info(NULL);
788 pxa_set_btuart_info(NULL);
789 pxa_set_stuart_info(NULL);
791 balloon3_i2c_init();
792 balloon3_irda_init();
793 balloon3_lcd_init();
794 balloon3_leds_init();
795 balloon3_mmc_init();
796 balloon3_nand_init();
797 balloon3_nor_init();
798 balloon3_pmic_init();
799 balloon3_ts_init();
800 balloon3_udc_init();
801 balloon3_uhc_init();
802 balloon3_cf_init();
805 static struct map_desc balloon3_io_desc[] __initdata = {
806 { /* CPLD/FPGA */
807 .virtual = BALLOON3_FPGA_VIRT,
808 .pfn = __phys_to_pfn(BALLOON3_FPGA_PHYS),
809 .length = BALLOON3_FPGA_LENGTH,
810 .type = MT_DEVICE,
814 static void __init balloon3_map_io(void)
816 pxa27x_map_io();
817 iotable_init(balloon3_io_desc, ARRAY_SIZE(balloon3_io_desc));
820 MACHINE_START(BALLOON3, "Balloon3")
821 /* Maintainer: Nick Bane. */
822 .map_io = balloon3_map_io,
823 .nr_irqs = BALLOON3_NR_IRQS,
824 .init_irq = balloon3_init_irq,
825 .timer = &pxa_timer,
826 .init_machine = balloon3_init,
827 .boot_params = PHYS_OFFSET + 0x100,
828 MACHINE_END