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