blob: 9041340fee1db17cdb6aa670ba43a2457a8193bf [file] [log] [blame]
Jonathan McDowell2a23ec32009-07-04 14:43:56 +01001/*
2 * linux/arch/arm/mach-pxa/balloon3.c
3 *
4 * Support for Balloonboard.org Balloon3 board.
5 *
6 * Author: Nick Bane, Wookey, Jonathan McDowell
7 * Created: June, 2006
8 * Copyright: Toby Churchill Ltd
9 * Derived from mainstone.c, by Nico Pitre
10 *
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.
14 */
15
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>
Marek Vasut12a24492010-07-27 01:37:44 +020025#include <linux/ucb1400.h>
Jonathan McDowell2a23ec32009-07-04 14:43:56 +010026#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h>
28#include <linux/types.h>
Marek Vasut02a453e2010-07-27 23:11:03 +020029#include <linux/i2c/pcf857x.h>
Marek Vasute6a8ef52010-07-28 03:32:05 +020030#include <linux/mtd/nand.h>
31#include <linux/mtd/physmap.h>
Marek Vasut3a27f6e2010-07-28 08:27:49 +020032#include <linux/regulator/max1586.h>
Jonathan McDowell2a23ec32009-07-04 14:43:56 +010033
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37#include <asm/sizes.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/irq.h>
42#include <asm/mach/flash.h>
43
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>
53
54#include <plat/i2c.h>
55
56#include "generic.h"
57#include "devices.h"
58
Marek Vasutb0240bf2010-07-26 23:24:44 +020059/******************************************************************************
60 * Pin configuration
61 ******************************************************************************/
62static 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,
68
Marek Vasut12a24492010-07-27 01:37:44 +020069 /* Reset, configured as GPIO wakeup source */
Marek Vasutb0240bf2010-07-26 23:24:44 +020070 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
71
Marek Vasut12a24492010-07-27 01:37:44 +020072 /* LEDs */
73 GPIO9_GPIO, /* NAND activity LED */
74 GPIO10_GPIO, /* Heartbeat LED */
Marek Vasutb0240bf2010-07-26 23:24:44 +020075
Marek Vasut12a24492010-07-27 01:37:44 +020076 /* AC97 */
Marek Vasutb0240bf2010-07-26 23:24:44 +020077 GPIO28_AC97_BITCLK,
78 GPIO29_AC97_SDATA_IN_0,
79 GPIO30_AC97_SDATA_OUT,
80 GPIO31_AC97_SYNC,
81 GPIO113_AC97_nRESET,
Marek Vasut12a24492010-07-27 01:37:44 +020082 GPIO95_GPIO,
Marek Vasutb0240bf2010-07-26 23:24:44 +020083
Marek Vasut12a24492010-07-27 01:37:44 +020084 /* MMC */
Marek Vasutb0240bf2010-07-26 23:24:44 +020085 GPIO32_MMC_CLK,
86 GPIO92_MMC_DAT_0,
87 GPIO109_MMC_DAT_1,
88 GPIO110_MMC_DAT_2,
89 GPIO111_MMC_DAT_3,
90 GPIO112_MMC_CMD,
Marek Vasutb0240bf2010-07-26 23:24:44 +020091
Marek Vasut12a24492010-07-27 01:37:44 +020092 /* USB Host */
Marek Vasutb0240bf2010-07-26 23:24:44 +020093 GPIO88_USBH1_PWR,
94 GPIO89_USBH1_PEN,
Marek Vasuta9c06292010-07-27 21:48:10 +020095
96 /* PC Card */
97 GPIO48_nPOE,
98 GPIO49_nPWE,
99 GPIO50_nPIOR,
100 GPIO51_nPIOW,
101 GPIO85_nPCE_1,
102 GPIO54_nPCE_2,
103 GPIO79_PSKTSEL,
104 GPIO55_nPREG,
105 GPIO56_nPWAIT,
106 GPIO57_nIOIS16,
Marek Vasutb0240bf2010-07-26 23:24:44 +0200107};
108
Marek Vasutb0240bf2010-07-26 23:24:44 +0200109/******************************************************************************
110 * Compatibility: Parameter parsing
111 ******************************************************************************/
Jonathan McDowell2a23ec32009-07-04 14:43:56 +0100112static unsigned long balloon3_irq_enabled;
113
114static unsigned long balloon3_features_present =
115 (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
116 (1 << BALLOON3_FEATURE_AUDIO) |
117 (1 << BALLOON3_FEATURE_TOPPOLY);
118
119int balloon3_has(enum balloon3_features feature)
120{
121 return (balloon3_features_present & (1 << feature)) ? 1 : 0;
122}
123EXPORT_SYMBOL_GPL(balloon3_has);
124
125int __init parse_balloon3_features(char *arg)
126{
127 if (!arg)
128 return 0;
129
130 return strict_strtoul(arg, 0, &balloon3_features_present);
131}
132early_param("balloon3_features", parse_balloon3_features);
133
Marek Vasutb0240bf2010-07-26 23:24:44 +0200134/******************************************************************************
Marek Vasut12a24492010-07-27 01:37:44 +0200135 * NOR Flash
136 ******************************************************************************/
137#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
138static struct mtd_partition balloon3_nor_partitions[] = {
139 {
140 .name = "Flash",
141 .offset = 0x00000000,
142 .size = MTDPART_SIZ_FULL,
143 }
144};
145
146static struct physmap_flash_data balloon3_flash_data[] = {
147 {
148 .width = 2, /* bankwidth in bytes */
149 .parts = balloon3_nor_partitions,
150 .nr_parts = ARRAY_SIZE(balloon3_nor_partitions)
151 }
152};
153
154static struct resource balloon3_flash_resource = {
155 .start = PXA_CS0_PHYS,
156 .end = PXA_CS0_PHYS + SZ_64M - 1,
157 .flags = IORESOURCE_MEM,
158};
159
160static struct platform_device balloon3_flash = {
161 .name = "physmap-flash",
162 .id = 0,
163 .resource = &balloon3_flash_resource,
164 .num_resources = 1,
165 .dev = {
166 .platform_data = balloon3_flash_data,
167 },
168};
169static void __init balloon3_nor_init(void)
170{
171 platform_device_register(&balloon3_flash);
172}
173#else
174static inline void balloon3_nor_init(void) {}
175#endif
176
177/******************************************************************************
178 * Audio and Touchscreen
179 ******************************************************************************/
180#if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
181 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
182static struct ucb1400_pdata vpac270_ucb1400_pdata = {
183 .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ),
184};
185
186
187static struct platform_device balloon3_ucb1400_device = {
188 .name = "ucb1400_core",
189 .id = -1,
190 .dev = {
191 .platform_data = &vpac270_ucb1400_pdata,
192 },
193};
194
195static void __init balloon3_ts_init(void)
196{
197 if (!balloon3_has(BALLOON3_FEATURE_AUDIO))
198 return;
199
200 pxa_set_ac97_info(NULL);
201 platform_device_register(&balloon3_ucb1400_device);
202}
203#else
204static inline void balloon3_ts_init(void) {}
205#endif
206
207/******************************************************************************
208 * Framebuffer
209 ******************************************************************************/
210#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
211static struct pxafb_mode_info balloon3_lcd_modes[] = {
212 {
213 .pixclock = 38000,
214 .xres = 480,
215 .yres = 640,
216 .bpp = 16,
217 .hsync_len = 8,
218 .left_margin = 8,
219 .right_margin = 8,
220 .vsync_len = 2,
221 .upper_margin = 4,
222 .lower_margin = 5,
223 .sync = 0,
224 },
225};
226
227static struct pxafb_mach_info balloon3_lcd_screen = {
228 .modes = balloon3_lcd_modes,
229 .num_modes = ARRAY_SIZE(balloon3_lcd_modes),
230 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
231};
232
233static void balloon3_backlight_power(int on)
234{
235 gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
236}
237
238static void __init balloon3_lcd_init(void)
239{
240 int ret;
241
242 if (!balloon3_has(BALLOON3_FEATURE_TOPPOLY))
243 return;
244
245 ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON");
246 if (ret) {
247 pr_err("Requesting BKL-ON GPIO failed!\n");
248 goto err;
249 }
250
251 ret = gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
252 if (ret) {
253 pr_err("Setting BKL-ON GPIO direction failed!\n");
254 goto err2;
255 }
256
257 balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power;
258 set_pxa_fb_info(&balloon3_lcd_screen);
259 return;
260
261err2:
262 gpio_free(BALLOON3_GPIO_RUN_BACKLIGHT);
263err:
264 return;
265}
266#else
267static inline void balloon3_lcd_init(void) {}
268#endif
269
270/******************************************************************************
271 * SD/MMC card controller
272 ******************************************************************************/
273#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
274static struct pxamci_platform_data balloon3_mci_platform_data = {
275 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
276 .gpio_card_detect = -1,
277 .gpio_card_ro = -1,
278 .gpio_power = -1,
279 .detect_delay_ms = 200,
280};
281
282static void __init balloon3_mmc_init(void)
283{
284 pxa_set_mci_info(&balloon3_mci_platform_data);
285}
286#else
287static inline void balloon3_mmc_init(void) {}
288#endif
289
290/******************************************************************************
291 * USB Gadget
292 ******************************************************************************/
293#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
294static void balloon3_udc_command(int cmd)
295{
296 if (cmd == PXA2XX_UDC_CMD_CONNECT)
297 UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
298 else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
299 UP2OCR &= ~UP2OCR_DPPUE;
300}
301
302static int balloon3_udc_is_connected(void)
303{
304 return 1;
305}
306
307static struct pxa2xx_udc_mach_info balloon3_udc_info __initdata = {
308 .udc_command = balloon3_udc_command,
309 .udc_is_connected = balloon3_udc_is_connected,
310 .gpio_pullup = -1,
311};
312
313static void __init balloon3_udc_init(void)
314{
315 pxa_set_udc_info(&balloon3_udc_info);
316 platform_device_register(&balloon3_gpio_vbus);
317}
318#else
319static inline void balloon3_udc_init(void) {}
320#endif
321
322/******************************************************************************
323 * IrDA
324 ******************************************************************************/
325#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
326static struct pxaficp_platform_data balloon3_ficp_platform_data = {
327 .transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF,
328};
329
330static void __init balloon3_irda_init(void)
331{
332 pxa_set_ficp_info(&balloon3_ficp_platform_data);
333}
334#else
335static inline void balloon3_irda_init(void) {}
336#endif
337
338/******************************************************************************
339 * USB Host
340 ******************************************************************************/
341#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
342static struct pxaohci_platform_data balloon3_ohci_info = {
343 .port_mode = PMM_PERPORT_MODE,
344 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
345};
346
347static void __init balloon3_uhc_init(void)
348{
349 if (!balloon3_has(BALLOON3_FEATURE_OHCI))
350 return;
351 pxa_set_ohci_info(&balloon3_ohci_info);
352}
353#else
354static inline void balloon3_uhc_init(void) {}
355#endif
356
357/******************************************************************************
358 * LEDs
359 ******************************************************************************/
360#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
361struct gpio_led balloon3_gpio_leds[] = {
362 {
363 .name = "balloon3:green:idle",
364 .default_trigger = "heartbeat",
365 .gpio = BALLOON3_GPIO_LED_IDLE,
366 .active_low = 1,
367 }, {
368 .name = "balloon3:green:nand",
369 .default_trigger = "nand-disk",
370 .gpio = BALLOON3_GPIO_LED_NAND,
371 .active_low = 1,
372 },
373};
374
375static struct gpio_led_platform_data balloon3_gpio_led_info = {
376 .leds = balloon3_gpio_leds,
377 .num_leds = ARRAY_SIZE(balloon3_gpio_leds),
378};
379
380static struct platform_device balloon3_leds = {
381 .name = "leds-gpio",
Marek Vasut02a453e2010-07-27 23:11:03 +0200382 .id = 0,
Marek Vasut12a24492010-07-27 01:37:44 +0200383 .dev = {
384 .platform_data = &balloon3_gpio_led_info,
385 }
386};
387
Marek Vasut02a453e2010-07-27 23:11:03 +0200388struct gpio_led balloon3_pcf_gpio_leds[] = {
389 {
390 .name = "balloon3:green:led0",
391 .gpio = BALLOON3_PCF_GPIO_LED0,
392 .active_low = 1,
393 }, {
394 .name = "balloon3:green:led1",
395 .gpio = BALLOON3_PCF_GPIO_LED1,
396 .active_low = 1,
397 }, {
398 .name = "balloon3:orange:led2",
399 .gpio = BALLOON3_PCF_GPIO_LED2,
400 .active_low = 1,
401 }, {
402 .name = "balloon3:orange:led3",
403 .gpio = BALLOON3_PCF_GPIO_LED3,
404 .active_low = 1,
405 }, {
406 .name = "balloon3:orange:led4",
407 .gpio = BALLOON3_PCF_GPIO_LED4,
408 .active_low = 1,
409 }, {
410 .name = "balloon3:orange:led5",
411 .gpio = BALLOON3_PCF_GPIO_LED5,
412 .active_low = 1,
413 }, {
414 .name = "balloon3:red:led6",
415 .gpio = BALLOON3_PCF_GPIO_LED6,
416 .active_low = 1,
417 }, {
418 .name = "balloon3:red:led7",
419 .gpio = BALLOON3_PCF_GPIO_LED7,
420 .active_low = 1,
421 },
422};
423
424static struct gpio_led_platform_data balloon3_pcf_gpio_led_info = {
425 .leds = balloon3_pcf_gpio_leds,
426 .num_leds = ARRAY_SIZE(balloon3_pcf_gpio_leds),
427};
428
429static struct platform_device balloon3_pcf_leds = {
430 .name = "leds-gpio",
431 .id = 1,
432 .dev = {
433 .platform_data = &balloon3_pcf_gpio_led_info,
434 }
435};
436
Marek Vasut12a24492010-07-27 01:37:44 +0200437static void __init balloon3_leds_init(void)
438{
439 platform_device_register(&balloon3_leds);
Marek Vasut02a453e2010-07-27 23:11:03 +0200440 platform_device_register(&balloon3_pcf_leds);
Marek Vasut12a24492010-07-27 01:37:44 +0200441}
442#else
443static inline void balloon3_leds_init(void) {}
444#endif
445
446/******************************************************************************
Marek Vasutb0240bf2010-07-26 23:24:44 +0200447 * FPGA IRQ
448 ******************************************************************************/
Jonathan McDowell2a23ec32009-07-04 14:43:56 +0100449static void balloon3_mask_irq(unsigned int irq)
450{
451 int balloon3_irq = (irq - BALLOON3_IRQ(0));
452 balloon3_irq_enabled &= ~(1 << balloon3_irq);
453 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
454}
455
456static void balloon3_unmask_irq(unsigned int irq)
457{
458 int balloon3_irq = (irq - BALLOON3_IRQ(0));
459 balloon3_irq_enabled |= (1 << balloon3_irq);
460 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
461}
462
463static struct irq_chip balloon3_irq_chip = {
464 .name = "FPGA",
465 .ack = balloon3_mask_irq,
466 .mask = balloon3_mask_irq,
467 .unmask = balloon3_unmask_irq,
468};
469
470static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
471{
472 unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
473 balloon3_irq_enabled;
Jonathan McDowell2a23ec32009-07-04 14:43:56 +0100474 do {
475 /* clear useless edge notification */
476 if (desc->chip->ack)
477 desc->chip->ack(BALLOON3_AUX_NIRQ);
478 while (pending) {
479 irq = BALLOON3_IRQ(0) + __ffs(pending);
480 generic_handle_irq(irq);
481 pending &= pending - 1;
482 }
483 pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
484 balloon3_irq_enabled;
485 } while (pending);
486}
487
488static void __init balloon3_init_irq(void)
489{
490 int irq;
491
492 pxa27x_init_irq();
493 /* setup extra Balloon3 irqs */
494 for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) {
495 set_irq_chip(irq, &balloon3_irq_chip);
496 set_irq_handler(irq, handle_level_irq);
497 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
498 }
499
500 set_irq_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler);
501 set_irq_type(BALLOON3_AUX_NIRQ, IRQ_TYPE_EDGE_FALLING);
502
503 pr_debug("%s: chained handler installed - irq %d automatically "
504 "enabled\n", __func__, BALLOON3_AUX_NIRQ);
505}
506
Marek Vasutb0240bf2010-07-26 23:24:44 +0200507/******************************************************************************
Marek Vasut02a453e2010-07-27 23:11:03 +0200508 * GPIO expander
509 ******************************************************************************/
510#if defined(CONFIG_GPIO_PCF857X) || defined(CONFIG_GPIO_PCF857X_MODULE)
511static struct pcf857x_platform_data balloon3_pcf857x_pdata = {
512 .gpio_base = BALLOON3_PCF_GPIO_BASE,
513 .n_latch = 0,
514 .setup = NULL,
515 .teardown = NULL,
516 .context = NULL,
517};
518
519static struct i2c_board_info __initdata balloon3_i2c_devs[] = {
520 {
521 I2C_BOARD_INFO("pcf8574a", 0x38),
522 .platform_data = &balloon3_pcf857x_pdata,
523 },
524};
525
526static void __init balloon3_i2c_init(void)
527{
528 pxa_set_i2c_info(NULL);
529 i2c_register_board_info(0, ARRAY_AND_SIZE(balloon3_i2c_devs));
530}
531#else
532static inline void balloon3_i2c_init(void) {}
533#endif
534
535/******************************************************************************
Marek Vasute6a8ef52010-07-28 03:32:05 +0200536 * NAND
537 ******************************************************************************/
538#if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
539static uint16_t balloon3_ctl =
540 BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 |
541 BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3 |
542 BALLOON3_NAND_CONTROL_FLWP;
543
544static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
545{
546 struct nand_chip *this = mtd->priv;
547
548 if (ctrl & NAND_CTRL_CHANGE) {
549 if (ctrl & NAND_CLE)
550 balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCLE;
551 else
552 balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLCLE;
553
554 if (ctrl & NAND_ALE)
555 balloon3_ctl |= BALLOON3_NAND_CONTROL_FLALE;
556 else
557 balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLALE;
558
559 __raw_writel(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
560 }
561
562 if (cmd != NAND_CMD_NONE)
563 writeb(cmd, this->IO_ADDR_W);
564}
565
566static void balloon3_nand_select_chip(struct mtd_info *mtd, int chip)
567{
568 if (chip < 0 || chip > 3)
569 return;
570
571 balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCE0 |
572 BALLOON3_NAND_CONTROL_FLCE1 |
573 BALLOON3_NAND_CONTROL_FLCE2 |
574 BALLOON3_NAND_CONTROL_FLCE3;
575
576 /* Deassert correct nCE line */
577 balloon3_ctl &= ~(BALLOON3_NAND_CONTROL_FLCE0 << chip);
578
579 __raw_writew(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
580}
581
582static int balloon3_nand_probe(struct platform_device *pdev)
583{
584 void __iomem *temp_map;
585 uint16_t ver;
586 int ret;
587
588 __raw_writew(BALLOON3_NAND_CONTROL2_16BIT, BALLOON3_NAND_CONTROL2_REG);
589
590 ver = __raw_readw(BALLOON3_FPGA_VER);
591 if (ver > 0x0201)
592 pr_warn("The FPGA code, version 0x%04x, is newer than rel-0.3. "
593 "NAND support might be broken in this version!", ver);
594
595 /* Power up the NAND chips */
596 ret = gpio_request(BALLOON3_GPIO_RUN_NAND, "NAND");
597 if (ret)
598 goto err1;
599
600 ret = gpio_direction_output(BALLOON3_GPIO_RUN_NAND, 1);
601 if (ret)
602 goto err2;
603
604 gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1);
605
606 /* Deassert all nCE lines and write protect line */
607 __raw_writel(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
608 return 0;
609
610err2:
611 gpio_free(BALLOON3_GPIO_RUN_NAND);
612err1:
613 return ret;
614}
615
616static void balloon3_nand_remove(struct platform_device *pdev)
617{
618 /* Power down the NAND chips */
619 gpio_set_value(BALLOON3_GPIO_RUN_NAND, 0);
620 gpio_free(BALLOON3_GPIO_RUN_NAND);
621}
622
623static struct mtd_partition balloon3_partition_info[] = {
624 [0] = {
625 .name = "Boot",
626 .offset = 0,
627 .size = SZ_4M,
628 },
629 [1] = {
630 .name = "RootFS",
631 .offset = MTDPART_OFS_APPEND,
632 .size = MTDPART_SIZ_FULL
633 },
634};
635
636static const char *balloon3_part_probes[] = { "cmdlinepart", NULL };
637
638struct platform_nand_data balloon3_nand_pdata = {
639 .chip = {
640 .nr_chips = 4,
641 .chip_offset = 0,
642 .nr_partitions = ARRAY_SIZE(balloon3_partition_info),
643 .partitions = balloon3_partition_info,
644 .chip_delay = 50,
645 .part_probe_types = balloon3_part_probes,
646 },
647 .ctrl = {
648 .hwcontrol = 0,
649 .dev_ready = 0,
650 .select_chip = balloon3_nand_select_chip,
651 .cmd_ctrl = balloon3_nand_cmd_ctl,
652 .probe = balloon3_nand_probe,
653 .remove = balloon3_nand_remove,
654 },
655};
656
657static struct resource balloon3_nand_resource[] = {
658 [0] = {
659 .start = BALLOON3_NAND_BASE,
660 .end = BALLOON3_NAND_BASE + 0x4,
661 .flags = IORESOURCE_MEM,
662 },
663};
664
665static struct platform_device balloon3_nand = {
666 .name = "gen_nand",
667 .num_resources = ARRAY_SIZE(balloon3_nand_resource),
668 .resource = balloon3_nand_resource,
669 .id = -1,
670 .dev = {
671 .platform_data = &balloon3_nand_pdata,
672 }
673};
674
675static void __init balloon3_nand_init(void)
676{
677 platform_device_register(&balloon3_nand);
678}
679#else
680static inline void balloon3_nand_init(void) {}
681#endif
682
683/******************************************************************************
Marek Vasut3a27f6e2010-07-28 08:27:49 +0200684 * Core power regulator
685 ******************************************************************************/
686#if defined(CONFIG_REGULATOR_MAX1586) || \
687 defined(CONFIG_REGULATOR_MAX1586_MODULE)
688static struct regulator_consumer_supply balloon3_max1587a_consumers[] = {
689 {
690 .supply = "vcc_core",
691 }
692};
693
694static struct regulator_init_data balloon3_max1587a_v3_info = {
695 .constraints = {
696 .name = "vcc_core range",
697 .min_uV = 900000,
698 .max_uV = 1705000,
699 .always_on = 1,
700 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
701 },
702 .consumer_supplies = balloon3_max1587a_consumers,
703 .num_consumer_supplies = ARRAY_SIZE(balloon3_max1587a_consumers),
704};
705
706static struct max1586_subdev_data balloon3_max1587a_subdevs[] = {
707 {
708 .name = "vcc_core",
709 .id = MAX1586_V3,
710 .platform_data = &balloon3_max1587a_v3_info,
711 }
712};
713
714static struct max1586_platform_data balloon3_max1587a_info = {
715 .subdevs = balloon3_max1587a_subdevs,
716 .num_subdevs = ARRAY_SIZE(balloon3_max1587a_subdevs),
717 .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
718};
719
720static struct i2c_board_info __initdata balloon3_pi2c_board_info[] = {
721 {
722 I2C_BOARD_INFO("max1586", 0x14),
723 .platform_data = &balloon3_max1587a_info,
724 },
725};
726
727static void __init balloon3_pmic_init(void)
728{
729 pxa27x_set_i2c_power_info(NULL);
730 i2c_register_board_info(1, ARRAY_AND_SIZE(balloon3_pi2c_board_info));
731}
732#else
733static inline void balloon3_pmic_init(void) {}
734#endif
735
736/******************************************************************************
Marek Vasutb0240bf2010-07-26 23:24:44 +0200737 * Machine init
738 ******************************************************************************/
Jonathan McDowell2a23ec32009-07-04 14:43:56 +0100739static void __init balloon3_init(void)
740{
Jonathan McDowell2a23ec32009-07-04 14:43:56 +0100741 ARB_CNTRL = ARB_CORE_PARK | 0x234;
742
Marek Vasut12a24492010-07-27 01:37:44 +0200743 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config));
744
Russell Kingcc155c62009-11-09 13:34:08 +0800745 pxa_set_ffuart_info(NULL);
746 pxa_set_btuart_info(NULL);
747 pxa_set_stuart_info(NULL);
748
Marek Vasut02a453e2010-07-27 23:11:03 +0200749 balloon3_i2c_init();
Marek Vasut12a24492010-07-27 01:37:44 +0200750 balloon3_irda_init();
751 balloon3_lcd_init();
752 balloon3_leds_init();
753 balloon3_mmc_init();
Marek Vasute6a8ef52010-07-28 03:32:05 +0200754 balloon3_nand_init();
Marek Vasut12a24492010-07-27 01:37:44 +0200755 balloon3_nor_init();
Marek Vasut3a27f6e2010-07-28 08:27:49 +0200756 balloon3_pmic_init();
Marek Vasut12a24492010-07-27 01:37:44 +0200757 balloon3_ts_init();
758 balloon3_udc_init();
759 balloon3_uhc_init();
Jonathan McDowell2a23ec32009-07-04 14:43:56 +0100760}
761
762static struct map_desc balloon3_io_desc[] __initdata = {
763 { /* CPLD/FPGA */
764 .virtual = BALLOON3_FPGA_VIRT,
765 .pfn = __phys_to_pfn(BALLOON3_FPGA_PHYS),
766 .length = BALLOON3_FPGA_LENGTH,
767 .type = MT_DEVICE,
768 },
769};
770
771static void __init balloon3_map_io(void)
772{
773 pxa_map_io();
774 iotable_init(balloon3_io_desc, ARRAY_SIZE(balloon3_io_desc));
775}
776
777MACHINE_START(BALLOON3, "Balloon3")
778 /* Maintainer: Nick Bane. */
779 .phys_io = 0x40000000,
780 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
781 .map_io = balloon3_map_io,
782 .init_irq = balloon3_init_irq,
783 .timer = &pxa_timer,
784 .init_machine = balloon3_init,
785 .boot_params = PHYS_OFFSET + 0x100,
786MACHINE_END