Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
Axel Lin | 61cbaa9 | 2011-12-10 10:08:08 +0800 | [diff] [blame] | 16 | #include <linux/export.h> |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 17 | #include <linux/init.h> |
| 18 | #include <linux/platform_device.h> |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 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 Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 25 | #include <linux/ucb1400.h> |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 26 | #include <linux/mtd/mtd.h> |
| 27 | #include <linux/mtd/partitions.h> |
| 28 | #include <linux/types.h> |
Marek Vasut | 02a453e | 2010-07-27 23:11:03 +0200 | [diff] [blame] | 29 | #include <linux/i2c/pcf857x.h> |
Sebastian Andrzej Siewior | b459396 | 2011-02-23 12:38:16 +0100 | [diff] [blame] | 30 | #include <linux/i2c/pxa-i2c.h> |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 31 | #include <linux/mtd/nand.h> |
| 32 | #include <linux/mtd/physmap.h> |
Marek Vasut | 3a27f6e | 2010-07-28 08:27:49 +0200 | [diff] [blame] | 33 | #include <linux/regulator/max1586.h> |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 34 | |
| 35 | #include <asm/setup.h> |
| 36 | #include <asm/mach-types.h> |
| 37 | #include <asm/irq.h> |
| 38 | #include <asm/sizes.h> |
| 39 | |
| 40 | #include <asm/mach/arch.h> |
| 41 | #include <asm/mach/map.h> |
| 42 | #include <asm/mach/irq.h> |
| 43 | #include <asm/mach/flash.h> |
| 44 | |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 45 | #include "pxa27x.h" |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 46 | #include <mach/balloon3.h> |
| 47 | #include <mach/audio.h> |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 48 | #include <linux/platform_data/video-pxafb.h> |
| 49 | #include <linux/platform_data/mmc-pxamci.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 50 | #include "udc.h" |
| 51 | #include "pxa27x-udc.h" |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 52 | #include <linux/platform_data/irda-pxaficp.h> |
| 53 | #include <linux/platform_data/usb-ohci-pxa27x.h> |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 54 | |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 55 | #include "generic.h" |
| 56 | #include "devices.h" |
| 57 | |
Marek Vasut | b0240bf | 2010-07-26 23:24:44 +0200 | [diff] [blame] | 58 | /****************************************************************************** |
| 59 | * Pin configuration |
| 60 | ******************************************************************************/ |
| 61 | static unsigned long balloon3_pin_config[] __initdata = { |
| 62 | /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */ |
| 63 | GPIO42_BTUART_RXD, |
| 64 | GPIO43_BTUART_TXD, |
| 65 | GPIO44_BTUART_CTS, |
| 66 | GPIO45_BTUART_RTS, |
| 67 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 68 | /* Reset, configured as GPIO wakeup source */ |
Marek Vasut | b0240bf | 2010-07-26 23:24:44 +0200 | [diff] [blame] | 69 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, |
Marek Vasut | b0240bf | 2010-07-26 23:24:44 +0200 | [diff] [blame] | 70 | }; |
| 71 | |
Marek Vasut | b0240bf | 2010-07-26 23:24:44 +0200 | [diff] [blame] | 72 | /****************************************************************************** |
| 73 | * Compatibility: Parameter parsing |
| 74 | ******************************************************************************/ |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 75 | static unsigned long balloon3_irq_enabled; |
| 76 | |
| 77 | static unsigned long balloon3_features_present = |
| 78 | (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) | |
| 79 | (1 << BALLOON3_FEATURE_AUDIO) | |
| 80 | (1 << BALLOON3_FEATURE_TOPPOLY); |
| 81 | |
| 82 | int balloon3_has(enum balloon3_features feature) |
| 83 | { |
| 84 | return (balloon3_features_present & (1 << feature)) ? 1 : 0; |
| 85 | } |
| 86 | EXPORT_SYMBOL_GPL(balloon3_has); |
| 87 | |
| 88 | int __init parse_balloon3_features(char *arg) |
| 89 | { |
| 90 | if (!arg) |
| 91 | return 0; |
| 92 | |
Daniel Walter | 4fce45b | 2014-08-08 14:23:54 -0700 | [diff] [blame] | 93 | return kstrtoul(arg, 0, &balloon3_features_present); |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 94 | } |
| 95 | early_param("balloon3_features", parse_balloon3_features); |
| 96 | |
Marek Vasut | b0240bf | 2010-07-26 23:24:44 +0200 | [diff] [blame] | 97 | /****************************************************************************** |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 98 | * Compact Flash slot |
| 99 | ******************************************************************************/ |
| 100 | #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE) |
| 101 | static unsigned long balloon3_cf_pin_config[] __initdata = { |
| 102 | GPIO48_nPOE, |
| 103 | GPIO49_nPWE, |
| 104 | GPIO50_nPIOR, |
| 105 | GPIO51_nPIOW, |
| 106 | GPIO85_nPCE_1, |
| 107 | GPIO54_nPCE_2, |
| 108 | GPIO79_PSKTSEL, |
| 109 | GPIO55_nPREG, |
| 110 | GPIO56_nPWAIT, |
| 111 | GPIO57_nIOIS16, |
| 112 | }; |
| 113 | |
| 114 | static void __init balloon3_cf_init(void) |
| 115 | { |
| 116 | if (!balloon3_has(BALLOON3_FEATURE_CF)) |
| 117 | return; |
| 118 | |
| 119 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_cf_pin_config)); |
| 120 | } |
| 121 | #else |
| 122 | static inline void balloon3_cf_init(void) {} |
| 123 | #endif |
| 124 | |
| 125 | /****************************************************************************** |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 126 | * NOR Flash |
| 127 | ******************************************************************************/ |
| 128 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 129 | static struct mtd_partition balloon3_nor_partitions[] = { |
| 130 | { |
| 131 | .name = "Flash", |
| 132 | .offset = 0x00000000, |
| 133 | .size = MTDPART_SIZ_FULL, |
| 134 | } |
| 135 | }; |
| 136 | |
| 137 | static struct physmap_flash_data balloon3_flash_data[] = { |
| 138 | { |
| 139 | .width = 2, /* bankwidth in bytes */ |
| 140 | .parts = balloon3_nor_partitions, |
| 141 | .nr_parts = ARRAY_SIZE(balloon3_nor_partitions) |
| 142 | } |
| 143 | }; |
| 144 | |
| 145 | static struct resource balloon3_flash_resource = { |
| 146 | .start = PXA_CS0_PHYS, |
| 147 | .end = PXA_CS0_PHYS + SZ_64M - 1, |
| 148 | .flags = IORESOURCE_MEM, |
| 149 | }; |
| 150 | |
| 151 | static struct platform_device balloon3_flash = { |
| 152 | .name = "physmap-flash", |
| 153 | .id = 0, |
| 154 | .resource = &balloon3_flash_resource, |
| 155 | .num_resources = 1, |
| 156 | .dev = { |
| 157 | .platform_data = balloon3_flash_data, |
| 158 | }, |
| 159 | }; |
| 160 | static void __init balloon3_nor_init(void) |
| 161 | { |
| 162 | platform_device_register(&balloon3_flash); |
| 163 | } |
| 164 | #else |
| 165 | static inline void balloon3_nor_init(void) {} |
| 166 | #endif |
| 167 | |
| 168 | /****************************************************************************** |
| 169 | * Audio and Touchscreen |
| 170 | ******************************************************************************/ |
| 171 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ |
| 172 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 173 | static unsigned long balloon3_ac97_pin_config[] __initdata = { |
| 174 | GPIO28_AC97_BITCLK, |
| 175 | GPIO29_AC97_SDATA_IN_0, |
| 176 | GPIO30_AC97_SDATA_OUT, |
| 177 | GPIO31_AC97_SYNC, |
| 178 | GPIO113_AC97_nRESET, |
| 179 | GPIO95_GPIO, |
| 180 | }; |
| 181 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 182 | static struct ucb1400_pdata vpac270_ucb1400_pdata = { |
Haojian Zhuang | 6384fda | 2011-10-10 14:21:08 +0800 | [diff] [blame] | 183 | .irq = PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ), |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 184 | }; |
| 185 | |
| 186 | |
| 187 | static struct platform_device balloon3_ucb1400_device = { |
| 188 | .name = "ucb1400_core", |
| 189 | .id = -1, |
| 190 | .dev = { |
| 191 | .platform_data = &vpac270_ucb1400_pdata, |
| 192 | }, |
| 193 | }; |
| 194 | |
| 195 | static void __init balloon3_ts_init(void) |
| 196 | { |
| 197 | if (!balloon3_has(BALLOON3_FEATURE_AUDIO)) |
| 198 | return; |
| 199 | |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 200 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config)); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 201 | pxa_set_ac97_info(NULL); |
| 202 | platform_device_register(&balloon3_ucb1400_device); |
| 203 | } |
| 204 | #else |
| 205 | static inline void balloon3_ts_init(void) {} |
| 206 | #endif |
| 207 | |
| 208 | /****************************************************************************** |
| 209 | * Framebuffer |
| 210 | ******************************************************************************/ |
| 211 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 212 | static unsigned long balloon3_lcd_pin_config[] __initdata = { |
| 213 | GPIOxx_LCD_TFT_16BPP, |
| 214 | GPIO99_GPIO, |
| 215 | }; |
| 216 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 217 | static struct pxafb_mode_info balloon3_lcd_modes[] = { |
| 218 | { |
| 219 | .pixclock = 38000, |
| 220 | .xres = 480, |
| 221 | .yres = 640, |
| 222 | .bpp = 16, |
| 223 | .hsync_len = 8, |
| 224 | .left_margin = 8, |
| 225 | .right_margin = 8, |
| 226 | .vsync_len = 2, |
| 227 | .upper_margin = 4, |
| 228 | .lower_margin = 5, |
| 229 | .sync = 0, |
| 230 | }, |
| 231 | }; |
| 232 | |
| 233 | static struct pxafb_mach_info balloon3_lcd_screen = { |
| 234 | .modes = balloon3_lcd_modes, |
| 235 | .num_modes = ARRAY_SIZE(balloon3_lcd_modes), |
| 236 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
| 237 | }; |
| 238 | |
| 239 | static void balloon3_backlight_power(int on) |
| 240 | { |
| 241 | gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on); |
| 242 | } |
| 243 | |
| 244 | static void __init balloon3_lcd_init(void) |
| 245 | { |
| 246 | int ret; |
| 247 | |
| 248 | if (!balloon3_has(BALLOON3_FEATURE_TOPPOLY)) |
| 249 | return; |
| 250 | |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 251 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_lcd_pin_config)); |
| 252 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 253 | ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON"); |
| 254 | if (ret) { |
| 255 | pr_err("Requesting BKL-ON GPIO failed!\n"); |
| 256 | goto err; |
| 257 | } |
| 258 | |
| 259 | ret = gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1); |
| 260 | if (ret) { |
| 261 | pr_err("Setting BKL-ON GPIO direction failed!\n"); |
| 262 | goto err2; |
| 263 | } |
| 264 | |
| 265 | balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power; |
Russell King - ARM Linux | 4321e1a | 2011-02-15 15:37:30 +0800 | [diff] [blame] | 266 | pxa_set_fb_info(NULL, &balloon3_lcd_screen); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 267 | return; |
| 268 | |
| 269 | err2: |
| 270 | gpio_free(BALLOON3_GPIO_RUN_BACKLIGHT); |
| 271 | err: |
| 272 | return; |
| 273 | } |
| 274 | #else |
| 275 | static inline void balloon3_lcd_init(void) {} |
| 276 | #endif |
| 277 | |
| 278 | /****************************************************************************** |
| 279 | * SD/MMC card controller |
| 280 | ******************************************************************************/ |
| 281 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 282 | static unsigned long balloon3_mmc_pin_config[] __initdata = { |
| 283 | GPIO32_MMC_CLK, |
| 284 | GPIO92_MMC_DAT_0, |
| 285 | GPIO109_MMC_DAT_1, |
| 286 | GPIO110_MMC_DAT_2, |
| 287 | GPIO111_MMC_DAT_3, |
| 288 | GPIO112_MMC_CMD, |
| 289 | }; |
| 290 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 291 | static struct pxamci_platform_data balloon3_mci_platform_data = { |
| 292 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 293 | .gpio_card_detect = -1, |
| 294 | .gpio_card_ro = -1, |
| 295 | .gpio_power = -1, |
| 296 | .detect_delay_ms = 200, |
| 297 | }; |
| 298 | |
| 299 | static void __init balloon3_mmc_init(void) |
| 300 | { |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 301 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_mmc_pin_config)); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 302 | pxa_set_mci_info(&balloon3_mci_platform_data); |
| 303 | } |
| 304 | #else |
| 305 | static inline void balloon3_mmc_init(void) {} |
| 306 | #endif |
| 307 | |
| 308 | /****************************************************************************** |
| 309 | * USB Gadget |
| 310 | ******************************************************************************/ |
Haojian Zhuang | c0a3915 | 2011-11-10 07:13:07 +0800 | [diff] [blame] | 311 | #if defined(CONFIG_USB_PXA27X)||defined(CONFIG_USB_PXA27X_MODULE) |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 312 | static void balloon3_udc_command(int cmd) |
| 313 | { |
| 314 | if (cmd == PXA2XX_UDC_CMD_CONNECT) |
| 315 | UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE; |
| 316 | else if (cmd == PXA2XX_UDC_CMD_DISCONNECT) |
| 317 | UP2OCR &= ~UP2OCR_DPPUE; |
| 318 | } |
| 319 | |
| 320 | static int balloon3_udc_is_connected(void) |
| 321 | { |
| 322 | return 1; |
| 323 | } |
| 324 | |
| 325 | static struct pxa2xx_udc_mach_info balloon3_udc_info __initdata = { |
| 326 | .udc_command = balloon3_udc_command, |
| 327 | .udc_is_connected = balloon3_udc_is_connected, |
| 328 | .gpio_pullup = -1, |
| 329 | }; |
| 330 | |
| 331 | static void __init balloon3_udc_init(void) |
| 332 | { |
| 333 | pxa_set_udc_info(&balloon3_udc_info); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 334 | } |
| 335 | #else |
| 336 | static inline void balloon3_udc_init(void) {} |
| 337 | #endif |
| 338 | |
| 339 | /****************************************************************************** |
| 340 | * IrDA |
| 341 | ******************************************************************************/ |
| 342 | #if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE) |
| 343 | static struct pxaficp_platform_data balloon3_ficp_platform_data = { |
| 344 | .transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF, |
| 345 | }; |
| 346 | |
| 347 | static void __init balloon3_irda_init(void) |
| 348 | { |
| 349 | pxa_set_ficp_info(&balloon3_ficp_platform_data); |
| 350 | } |
| 351 | #else |
| 352 | static inline void balloon3_irda_init(void) {} |
| 353 | #endif |
| 354 | |
| 355 | /****************************************************************************** |
| 356 | * USB Host |
| 357 | ******************************************************************************/ |
| 358 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 359 | static unsigned long balloon3_uhc_pin_config[] __initdata = { |
| 360 | GPIO88_USBH1_PWR, |
| 361 | GPIO89_USBH1_PEN, |
| 362 | }; |
| 363 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 364 | static struct pxaohci_platform_data balloon3_ohci_info = { |
| 365 | .port_mode = PMM_PERPORT_MODE, |
| 366 | .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
| 367 | }; |
| 368 | |
| 369 | static void __init balloon3_uhc_init(void) |
| 370 | { |
| 371 | if (!balloon3_has(BALLOON3_FEATURE_OHCI)) |
| 372 | return; |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 373 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_uhc_pin_config)); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 374 | pxa_set_ohci_info(&balloon3_ohci_info); |
| 375 | } |
| 376 | #else |
| 377 | static inline void balloon3_uhc_init(void) {} |
| 378 | #endif |
| 379 | |
| 380 | /****************************************************************************** |
| 381 | * LEDs |
| 382 | ******************************************************************************/ |
| 383 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 384 | static unsigned long balloon3_led_pin_config[] __initdata = { |
| 385 | GPIO9_GPIO, /* NAND activity LED */ |
| 386 | GPIO10_GPIO, /* Heartbeat LED */ |
| 387 | }; |
| 388 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 389 | struct gpio_led balloon3_gpio_leds[] = { |
| 390 | { |
| 391 | .name = "balloon3:green:idle", |
| 392 | .default_trigger = "heartbeat", |
| 393 | .gpio = BALLOON3_GPIO_LED_IDLE, |
| 394 | .active_low = 1, |
| 395 | }, { |
| 396 | .name = "balloon3:green:nand", |
| 397 | .default_trigger = "nand-disk", |
| 398 | .gpio = BALLOON3_GPIO_LED_NAND, |
| 399 | .active_low = 1, |
| 400 | }, |
| 401 | }; |
| 402 | |
| 403 | static struct gpio_led_platform_data balloon3_gpio_led_info = { |
| 404 | .leds = balloon3_gpio_leds, |
| 405 | .num_leds = ARRAY_SIZE(balloon3_gpio_leds), |
| 406 | }; |
| 407 | |
| 408 | static struct platform_device balloon3_leds = { |
| 409 | .name = "leds-gpio", |
Marek Vasut | 02a453e | 2010-07-27 23:11:03 +0200 | [diff] [blame] | 410 | .id = 0, |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 411 | .dev = { |
| 412 | .platform_data = &balloon3_gpio_led_info, |
| 413 | } |
| 414 | }; |
| 415 | |
Marek Vasut | 02a453e | 2010-07-27 23:11:03 +0200 | [diff] [blame] | 416 | struct gpio_led balloon3_pcf_gpio_leds[] = { |
| 417 | { |
| 418 | .name = "balloon3:green:led0", |
| 419 | .gpio = BALLOON3_PCF_GPIO_LED0, |
| 420 | .active_low = 1, |
| 421 | }, { |
| 422 | .name = "balloon3:green:led1", |
| 423 | .gpio = BALLOON3_PCF_GPIO_LED1, |
| 424 | .active_low = 1, |
| 425 | }, { |
| 426 | .name = "balloon3:orange:led2", |
| 427 | .gpio = BALLOON3_PCF_GPIO_LED2, |
| 428 | .active_low = 1, |
| 429 | }, { |
| 430 | .name = "balloon3:orange:led3", |
| 431 | .gpio = BALLOON3_PCF_GPIO_LED3, |
| 432 | .active_low = 1, |
| 433 | }, { |
| 434 | .name = "balloon3:orange:led4", |
| 435 | .gpio = BALLOON3_PCF_GPIO_LED4, |
| 436 | .active_low = 1, |
| 437 | }, { |
| 438 | .name = "balloon3:orange:led5", |
| 439 | .gpio = BALLOON3_PCF_GPIO_LED5, |
| 440 | .active_low = 1, |
| 441 | }, { |
| 442 | .name = "balloon3:red:led6", |
| 443 | .gpio = BALLOON3_PCF_GPIO_LED6, |
| 444 | .active_low = 1, |
| 445 | }, { |
| 446 | .name = "balloon3:red:led7", |
| 447 | .gpio = BALLOON3_PCF_GPIO_LED7, |
| 448 | .active_low = 1, |
| 449 | }, |
| 450 | }; |
| 451 | |
| 452 | static struct gpio_led_platform_data balloon3_pcf_gpio_led_info = { |
| 453 | .leds = balloon3_pcf_gpio_leds, |
| 454 | .num_leds = ARRAY_SIZE(balloon3_pcf_gpio_leds), |
| 455 | }; |
| 456 | |
| 457 | static struct platform_device balloon3_pcf_leds = { |
| 458 | .name = "leds-gpio", |
| 459 | .id = 1, |
| 460 | .dev = { |
| 461 | .platform_data = &balloon3_pcf_gpio_led_info, |
| 462 | } |
| 463 | }; |
| 464 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 465 | static void __init balloon3_leds_init(void) |
| 466 | { |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 467 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_led_pin_config)); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 468 | platform_device_register(&balloon3_leds); |
Marek Vasut | 02a453e | 2010-07-27 23:11:03 +0200 | [diff] [blame] | 469 | platform_device_register(&balloon3_pcf_leds); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 470 | } |
| 471 | #else |
| 472 | static inline void balloon3_leds_init(void) {} |
| 473 | #endif |
| 474 | |
| 475 | /****************************************************************************** |
Marek Vasut | b0240bf | 2010-07-26 23:24:44 +0200 | [diff] [blame] | 476 | * FPGA IRQ |
| 477 | ******************************************************************************/ |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 478 | static void balloon3_mask_irq(struct irq_data *d) |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 479 | { |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 480 | int balloon3_irq = (d->irq - BALLOON3_IRQ(0)); |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 481 | balloon3_irq_enabled &= ~(1 << balloon3_irq); |
| 482 | __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG); |
| 483 | } |
| 484 | |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 485 | static void balloon3_unmask_irq(struct irq_data *d) |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 486 | { |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 487 | int balloon3_irq = (d->irq - BALLOON3_IRQ(0)); |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 488 | balloon3_irq_enabled |= (1 << balloon3_irq); |
| 489 | __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG); |
| 490 | } |
| 491 | |
| 492 | static struct irq_chip balloon3_irq_chip = { |
| 493 | .name = "FPGA", |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 494 | .irq_ack = balloon3_mask_irq, |
| 495 | .irq_mask = balloon3_mask_irq, |
| 496 | .irq_unmask = balloon3_unmask_irq, |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 497 | }; |
| 498 | |
Thomas Gleixner | bd0b9ac | 2015-09-14 10:42:37 +0200 | [diff] [blame] | 499 | static void balloon3_irq_handler(struct irq_desc *desc) |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 500 | { |
| 501 | unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) & |
| 502 | balloon3_irq_enabled; |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 503 | do { |
Thomas Gleixner | 9ec9756 | 2015-07-13 10:58:22 +0200 | [diff] [blame] | 504 | struct irq_data *d = irq_desc_get_irq_data(desc); |
Axel Lin | 385877c | 2015-09-01 09:52:21 +0800 | [diff] [blame] | 505 | struct irq_chip *chip = irq_desc_get_chip(desc); |
Thomas Gleixner | 9ec9756 | 2015-07-13 10:58:22 +0200 | [diff] [blame] | 506 | unsigned int irq; |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 507 | |
Thomas Gleixner | 9ec9756 | 2015-07-13 10:58:22 +0200 | [diff] [blame] | 508 | /* clear useless edge notification */ |
| 509 | if (chip->irq_ack) |
| 510 | chip->irq_ack(d); |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 511 | |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 512 | while (pending) { |
| 513 | irq = BALLOON3_IRQ(0) + __ffs(pending); |
| 514 | generic_handle_irq(irq); |
| 515 | pending &= pending - 1; |
| 516 | } |
| 517 | pending = __raw_readl(BALLOON3_INT_CONTROL_REG) & |
| 518 | balloon3_irq_enabled; |
| 519 | } while (pending); |
| 520 | } |
| 521 | |
| 522 | static void __init balloon3_init_irq(void) |
| 523 | { |
| 524 | int irq; |
| 525 | |
| 526 | pxa27x_init_irq(); |
| 527 | /* setup extra Balloon3 irqs */ |
| 528 | for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) { |
Thomas Gleixner | f38c02f | 2011-03-24 13:35:09 +0100 | [diff] [blame] | 529 | irq_set_chip_and_handler(irq, &balloon3_irq_chip, |
| 530 | handle_level_irq); |
Rob Herring | e8d36d5 | 2015-07-27 15:55:13 -0500 | [diff] [blame] | 531 | irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE); |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 532 | } |
| 533 | |
Thomas Gleixner | 6845664a | 2011-03-24 13:25:22 +0100 | [diff] [blame] | 534 | irq_set_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler); |
| 535 | irq_set_irq_type(BALLOON3_AUX_NIRQ, IRQ_TYPE_EDGE_FALLING); |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 536 | |
| 537 | pr_debug("%s: chained handler installed - irq %d automatically " |
| 538 | "enabled\n", __func__, BALLOON3_AUX_NIRQ); |
| 539 | } |
| 540 | |
Marek Vasut | b0240bf | 2010-07-26 23:24:44 +0200 | [diff] [blame] | 541 | /****************************************************************************** |
Marek Vasut | 02a453e | 2010-07-27 23:11:03 +0200 | [diff] [blame] | 542 | * GPIO expander |
| 543 | ******************************************************************************/ |
| 544 | #if defined(CONFIG_GPIO_PCF857X) || defined(CONFIG_GPIO_PCF857X_MODULE) |
| 545 | static struct pcf857x_platform_data balloon3_pcf857x_pdata = { |
| 546 | .gpio_base = BALLOON3_PCF_GPIO_BASE, |
| 547 | .n_latch = 0, |
| 548 | .setup = NULL, |
| 549 | .teardown = NULL, |
| 550 | .context = NULL, |
| 551 | }; |
| 552 | |
| 553 | static struct i2c_board_info __initdata balloon3_i2c_devs[] = { |
| 554 | { |
| 555 | I2C_BOARD_INFO("pcf8574a", 0x38), |
| 556 | .platform_data = &balloon3_pcf857x_pdata, |
| 557 | }, |
| 558 | }; |
| 559 | |
| 560 | static void __init balloon3_i2c_init(void) |
| 561 | { |
| 562 | pxa_set_i2c_info(NULL); |
| 563 | i2c_register_board_info(0, ARRAY_AND_SIZE(balloon3_i2c_devs)); |
| 564 | } |
| 565 | #else |
| 566 | static inline void balloon3_i2c_init(void) {} |
| 567 | #endif |
| 568 | |
| 569 | /****************************************************************************** |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 570 | * NAND |
| 571 | ******************************************************************************/ |
| 572 | #if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE) |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 573 | static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl) |
| 574 | { |
Boris BREZILLON | c993e09 | 2015-12-01 12:02:58 +0100 | [diff] [blame] | 575 | struct nand_chip *this = mtd_to_nand(mtd); |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 576 | uint8_t balloon3_ctl_set = 0, balloon3_ctl_clr = 0; |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 577 | |
| 578 | if (ctrl & NAND_CTRL_CHANGE) { |
| 579 | if (ctrl & NAND_CLE) |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 580 | balloon3_ctl_set |= BALLOON3_NAND_CONTROL_FLCLE; |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 581 | else |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 582 | balloon3_ctl_clr |= BALLOON3_NAND_CONTROL_FLCLE; |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 583 | |
| 584 | if (ctrl & NAND_ALE) |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 585 | balloon3_ctl_set |= BALLOON3_NAND_CONTROL_FLALE; |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 586 | else |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 587 | balloon3_ctl_clr |= BALLOON3_NAND_CONTROL_FLALE; |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 588 | |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 589 | if (balloon3_ctl_clr) |
| 590 | __raw_writel(balloon3_ctl_clr, |
| 591 | BALLOON3_NAND_CONTROL_REG); |
| 592 | if (balloon3_ctl_set) |
| 593 | __raw_writel(balloon3_ctl_set, |
Arnd Bergmann | 97b09da | 2011-10-01 22:03:45 +0200 | [diff] [blame] | 594 | BALLOON3_NAND_CONTROL_REG + |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 595 | BALLOON3_FPGA_SETnCLR); |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | if (cmd != NAND_CMD_NONE) |
| 599 | writeb(cmd, this->IO_ADDR_W); |
| 600 | } |
| 601 | |
| 602 | static void balloon3_nand_select_chip(struct mtd_info *mtd, int chip) |
| 603 | { |
| 604 | if (chip < 0 || chip > 3) |
| 605 | return; |
| 606 | |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 607 | /* Assert all nCE lines */ |
| 608 | __raw_writew( |
| 609 | BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 | |
| 610 | BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3, |
Arnd Bergmann | 97b09da | 2011-10-01 22:03:45 +0200 | [diff] [blame] | 611 | BALLOON3_NAND_CONTROL_REG + BALLOON3_FPGA_SETnCLR); |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 612 | |
| 613 | /* Deassert correct nCE line */ |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 614 | __raw_writew(BALLOON3_NAND_CONTROL_FLCE0 << chip, |
| 615 | BALLOON3_NAND_CONTROL_REG); |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 616 | } |
| 617 | |
Marek Vasut | 59bdd13 | 2010-10-19 17:06:49 +0200 | [diff] [blame] | 618 | static int balloon3_nand_dev_ready(struct mtd_info *mtd) |
| 619 | { |
| 620 | return __raw_readl(BALLOON3_NAND_STAT_REG) & BALLOON3_NAND_STAT_RNB; |
| 621 | } |
| 622 | |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 623 | static int balloon3_nand_probe(struct platform_device *pdev) |
| 624 | { |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 625 | uint16_t ver; |
| 626 | int ret; |
| 627 | |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 628 | __raw_writew(BALLOON3_NAND_CONTROL2_16BIT, |
Arnd Bergmann | 97b09da | 2011-10-01 22:03:45 +0200 | [diff] [blame] | 629 | BALLOON3_NAND_CONTROL2_REG + BALLOON3_FPGA_SETnCLR); |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 630 | |
| 631 | ver = __raw_readw(BALLOON3_FPGA_VER); |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 632 | if (ver < 0x4f08) |
| 633 | pr_warn("The FPGA code, version 0x%04x, is too old. " |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 634 | "NAND support might be broken in this version!", ver); |
| 635 | |
| 636 | /* Power up the NAND chips */ |
| 637 | ret = gpio_request(BALLOON3_GPIO_RUN_NAND, "NAND"); |
| 638 | if (ret) |
| 639 | goto err1; |
| 640 | |
| 641 | ret = gpio_direction_output(BALLOON3_GPIO_RUN_NAND, 1); |
| 642 | if (ret) |
| 643 | goto err2; |
| 644 | |
| 645 | gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1); |
| 646 | |
| 647 | /* Deassert all nCE lines and write protect line */ |
Marek Vasut | 1b9169d | 2010-10-19 16:19:32 +0200 | [diff] [blame] | 648 | __raw_writel( |
| 649 | BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 | |
| 650 | BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3 | |
| 651 | BALLOON3_NAND_CONTROL_FLWP, |
Arnd Bergmann | 97b09da | 2011-10-01 22:03:45 +0200 | [diff] [blame] | 652 | BALLOON3_NAND_CONTROL_REG + BALLOON3_FPGA_SETnCLR); |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 653 | return 0; |
| 654 | |
| 655 | err2: |
| 656 | gpio_free(BALLOON3_GPIO_RUN_NAND); |
| 657 | err1: |
| 658 | return ret; |
| 659 | } |
| 660 | |
| 661 | static void balloon3_nand_remove(struct platform_device *pdev) |
| 662 | { |
| 663 | /* Power down the NAND chips */ |
| 664 | gpio_set_value(BALLOON3_GPIO_RUN_NAND, 0); |
| 665 | gpio_free(BALLOON3_GPIO_RUN_NAND); |
| 666 | } |
| 667 | |
| 668 | static struct mtd_partition balloon3_partition_info[] = { |
| 669 | [0] = { |
| 670 | .name = "Boot", |
| 671 | .offset = 0, |
| 672 | .size = SZ_4M, |
| 673 | }, |
| 674 | [1] = { |
| 675 | .name = "RootFS", |
| 676 | .offset = MTDPART_OFS_APPEND, |
| 677 | .size = MTDPART_SIZ_FULL |
| 678 | }, |
| 679 | }; |
| 680 | |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 681 | struct platform_nand_data balloon3_nand_pdata = { |
| 682 | .chip = { |
| 683 | .nr_chips = 4, |
| 684 | .chip_offset = 0, |
| 685 | .nr_partitions = ARRAY_SIZE(balloon3_partition_info), |
| 686 | .partitions = balloon3_partition_info, |
| 687 | .chip_delay = 50, |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 688 | }, |
| 689 | .ctrl = { |
| 690 | .hwcontrol = 0, |
Marek Vasut | 59bdd13 | 2010-10-19 17:06:49 +0200 | [diff] [blame] | 691 | .dev_ready = balloon3_nand_dev_ready, |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 692 | .select_chip = balloon3_nand_select_chip, |
| 693 | .cmd_ctrl = balloon3_nand_cmd_ctl, |
| 694 | .probe = balloon3_nand_probe, |
| 695 | .remove = balloon3_nand_remove, |
| 696 | }, |
| 697 | }; |
| 698 | |
| 699 | static struct resource balloon3_nand_resource[] = { |
| 700 | [0] = { |
| 701 | .start = BALLOON3_NAND_BASE, |
| 702 | .end = BALLOON3_NAND_BASE + 0x4, |
| 703 | .flags = IORESOURCE_MEM, |
| 704 | }, |
| 705 | }; |
| 706 | |
| 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, |
| 714 | } |
| 715 | }; |
| 716 | |
| 717 | static void __init balloon3_nand_init(void) |
| 718 | { |
| 719 | platform_device_register(&balloon3_nand); |
| 720 | } |
| 721 | #else |
| 722 | static inline void balloon3_nand_init(void) {} |
| 723 | #endif |
| 724 | |
| 725 | /****************************************************************************** |
Marek Vasut | 3a27f6e | 2010-07-28 08:27:49 +0200 | [diff] [blame] | 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[] = { |
Axel Lin | 0bf189a | 2012-05-08 16:25:10 +0800 | [diff] [blame] | 731 | REGULATOR_SUPPLY("vcc_core", NULL), |
Marek Vasut | 3a27f6e | 2010-07-28 08:27:49 +0200 | [diff] [blame] | 732 | }; |
| 733 | |
| 734 | static struct regulator_init_data balloon3_max1587a_v3_info = { |
| 735 | .constraints = { |
| 736 | .name = "vcc_core range", |
| 737 | .min_uV = 900000, |
| 738 | .max_uV = 1705000, |
| 739 | .always_on = 1, |
| 740 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 741 | }, |
| 742 | .consumer_supplies = balloon3_max1587a_consumers, |
| 743 | .num_consumer_supplies = ARRAY_SIZE(balloon3_max1587a_consumers), |
| 744 | }; |
| 745 | |
| 746 | static struct max1586_subdev_data balloon3_max1587a_subdevs[] = { |
| 747 | { |
| 748 | .name = "vcc_core", |
| 749 | .id = MAX1586_V3, |
| 750 | .platform_data = &balloon3_max1587a_v3_info, |
| 751 | } |
| 752 | }; |
| 753 | |
| 754 | static struct max1586_platform_data balloon3_max1587a_info = { |
| 755 | .subdevs = balloon3_max1587a_subdevs, |
| 756 | .num_subdevs = ARRAY_SIZE(balloon3_max1587a_subdevs), |
| 757 | .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */ |
| 758 | }; |
| 759 | |
| 760 | static struct i2c_board_info __initdata balloon3_pi2c_board_info[] = { |
| 761 | { |
| 762 | I2C_BOARD_INFO("max1586", 0x14), |
| 763 | .platform_data = &balloon3_max1587a_info, |
| 764 | }, |
| 765 | }; |
| 766 | |
| 767 | static void __init balloon3_pmic_init(void) |
| 768 | { |
| 769 | pxa27x_set_i2c_power_info(NULL); |
| 770 | i2c_register_board_info(1, ARRAY_AND_SIZE(balloon3_pi2c_board_info)); |
| 771 | } |
| 772 | #else |
| 773 | static inline void balloon3_pmic_init(void) {} |
| 774 | #endif |
| 775 | |
| 776 | /****************************************************************************** |
Marek Vasut | b0240bf | 2010-07-26 23:24:44 +0200 | [diff] [blame] | 777 | * Machine init |
| 778 | ******************************************************************************/ |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 779 | static void __init balloon3_init(void) |
| 780 | { |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 781 | ARB_CNTRL = ARB_CORE_PARK | 0x234; |
| 782 | |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 783 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config)); |
| 784 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 785 | pxa_set_ffuart_info(NULL); |
| 786 | pxa_set_btuart_info(NULL); |
| 787 | pxa_set_stuart_info(NULL); |
| 788 | |
Marek Vasut | 02a453e | 2010-07-27 23:11:03 +0200 | [diff] [blame] | 789 | balloon3_i2c_init(); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 790 | balloon3_irda_init(); |
| 791 | balloon3_lcd_init(); |
| 792 | balloon3_leds_init(); |
| 793 | balloon3_mmc_init(); |
Marek Vasut | e6a8ef5 | 2010-07-28 03:32:05 +0200 | [diff] [blame] | 794 | balloon3_nand_init(); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 795 | balloon3_nor_init(); |
Marek Vasut | 3a27f6e | 2010-07-28 08:27:49 +0200 | [diff] [blame] | 796 | balloon3_pmic_init(); |
Marek Vasut | 12a2449 | 2010-07-27 01:37:44 +0200 | [diff] [blame] | 797 | balloon3_ts_init(); |
| 798 | balloon3_udc_init(); |
| 799 | balloon3_uhc_init(); |
Marek Vasut | b476ef0 | 2010-08-09 06:23:28 +0200 | [diff] [blame] | 800 | balloon3_cf_init(); |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 801 | } |
| 802 | |
| 803 | static struct map_desc balloon3_io_desc[] __initdata = { |
| 804 | { /* CPLD/FPGA */ |
Arnd Bergmann | 97b09da | 2011-10-01 22:03:45 +0200 | [diff] [blame] | 805 | .virtual = (unsigned long)BALLOON3_FPGA_VIRT, |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 806 | .pfn = __phys_to_pfn(BALLOON3_FPGA_PHYS), |
| 807 | .length = BALLOON3_FPGA_LENGTH, |
| 808 | .type = MT_DEVICE, |
| 809 | }, |
| 810 | }; |
| 811 | |
| 812 | static void __init balloon3_map_io(void) |
| 813 | { |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 814 | pxa27x_map_io(); |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 815 | iotable_init(balloon3_io_desc, ARRAY_SIZE(balloon3_io_desc)); |
| 816 | } |
| 817 | |
| 818 | MACHINE_START(BALLOON3, "Balloon3") |
| 819 | /* Maintainer: Nick Bane. */ |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 820 | .map_io = balloon3_map_io, |
Haojian Zhuang | 6ac6b81 | 2010-08-20 15:23:59 +0800 | [diff] [blame] | 821 | .nr_irqs = BALLOON3_NR_IRQS, |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 822 | .init_irq = balloon3_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 823 | .handle_irq = pxa27x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 824 | .init_time = pxa_timer_init, |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 825 | .init_machine = balloon3_init, |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 826 | .atag_offset = 0x100, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 827 | .restart = pxa_restart, |
Jonathan McDowell | 2a23ec3 | 2009-07-04 14:43:56 +0100 | [diff] [blame] | 828 | MACHINE_END |