diff options
Diffstat (limited to 'arch/arm/mach-pxa/balloon3.c')
-rw-r--r-- | arch/arm/mach-pxa/balloon3.c | 732 |
1 files changed, 581 insertions, 151 deletions
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c index f3b5ace815e5..9041340fee1d 100644 --- a/arch/arm/mach-pxa/balloon3.c +++ b/arch/arm/mach-pxa/balloon3.c | |||
@@ -22,9 +22,14 @@ | |||
22 | #include <linux/fb.h> | 22 | #include <linux/fb.h> |
23 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
24 | #include <linux/ioport.h> | 24 | #include <linux/ioport.h> |
25 | #include <linux/ucb1400.h> | ||
25 | #include <linux/mtd/mtd.h> | 26 | #include <linux/mtd/mtd.h> |
26 | #include <linux/mtd/partitions.h> | 27 | #include <linux/mtd/partitions.h> |
27 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/i2c/pcf857x.h> | ||
30 | #include <linux/mtd/nand.h> | ||
31 | #include <linux/mtd/physmap.h> | ||
32 | #include <linux/regulator/max1586.h> | ||
28 | 33 | ||
29 | #include <asm/setup.h> | 34 | #include <asm/setup.h> |
30 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
@@ -51,6 +56,59 @@ | |||
51 | #include "generic.h" | 56 | #include "generic.h" |
52 | #include "devices.h" | 57 | #include "devices.h" |
53 | 58 | ||
59 | /****************************************************************************** | ||
60 | * Pin configuration | ||
61 | ******************************************************************************/ | ||
62 | static unsigned long balloon3_pin_config[] __initdata = { | ||
63 | /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */ | ||
64 | GPIO42_BTUART_RXD, | ||
65 | GPIO43_BTUART_TXD, | ||
66 | GPIO44_BTUART_CTS, | ||
67 | GPIO45_BTUART_RTS, | ||
68 | |||
69 | /* Reset, configured as GPIO wakeup source */ | ||
70 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, | ||
71 | |||
72 | /* LEDs */ | ||
73 | GPIO9_GPIO, /* NAND activity LED */ | ||
74 | GPIO10_GPIO, /* Heartbeat LED */ | ||
75 | |||
76 | /* AC97 */ | ||
77 | GPIO28_AC97_BITCLK, | ||
78 | GPIO29_AC97_SDATA_IN_0, | ||
79 | GPIO30_AC97_SDATA_OUT, | ||
80 | GPIO31_AC97_SYNC, | ||
81 | GPIO113_AC97_nRESET, | ||
82 | GPIO95_GPIO, | ||
83 | |||
84 | /* MMC */ | ||
85 | 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, | ||
91 | |||
92 | /* USB Host */ | ||
93 | GPIO88_USBH1_PWR, | ||
94 | GPIO89_USBH1_PEN, | ||
95 | |||
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, | ||
107 | }; | ||
108 | |||
109 | /****************************************************************************** | ||
110 | * Compatibility: Parameter parsing | ||
111 | ******************************************************************************/ | ||
54 | static unsigned long balloon3_irq_enabled; | 112 | static unsigned long balloon3_irq_enabled; |
55 | 113 | ||
56 | static unsigned long balloon3_features_present = | 114 | static unsigned long balloon3_features_present = |
@@ -73,6 +131,321 @@ int __init parse_balloon3_features(char *arg) | |||
73 | } | 131 | } |
74 | early_param("balloon3_features", parse_balloon3_features); | 132 | early_param("balloon3_features", parse_balloon3_features); |
75 | 133 | ||
134 | /****************************************************************************** | ||
135 | * NOR Flash | ||
136 | ******************************************************************************/ | ||
137 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
138 | static struct mtd_partition balloon3_nor_partitions[] = { | ||
139 | { | ||
140 | .name = "Flash", | ||
141 | .offset = 0x00000000, | ||
142 | .size = MTDPART_SIZ_FULL, | ||
143 | } | ||
144 | }; | ||
145 | |||
146 | static 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 | |||
154 | static struct resource balloon3_flash_resource = { | ||
155 | .start = PXA_CS0_PHYS, | ||
156 | .end = PXA_CS0_PHYS + SZ_64M - 1, | ||
157 | .flags = IORESOURCE_MEM, | ||
158 | }; | ||
159 | |||
160 | static 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 | }; | ||
169 | static void __init balloon3_nor_init(void) | ||
170 | { | ||
171 | platform_device_register(&balloon3_flash); | ||
172 | } | ||
173 | #else | ||
174 | static 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) | ||
182 | static struct ucb1400_pdata vpac270_ucb1400_pdata = { | ||
183 | .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ), | ||
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 | |||
200 | pxa_set_ac97_info(NULL); | ||
201 | platform_device_register(&balloon3_ucb1400_device); | ||
202 | } | ||
203 | #else | ||
204 | static inline void balloon3_ts_init(void) {} | ||
205 | #endif | ||
206 | |||
207 | /****************************************************************************** | ||
208 | * Framebuffer | ||
209 | ******************************************************************************/ | ||
210 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
211 | static 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 | |||
227 | static 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 | |||
233 | static void balloon3_backlight_power(int on) | ||
234 | { | ||
235 | gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on); | ||
236 | } | ||
237 | |||
238 | static 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 | |||
261 | err2: | ||
262 | gpio_free(BALLOON3_GPIO_RUN_BACKLIGHT); | ||
263 | err: | ||
264 | return; | ||
265 | } | ||
266 | #else | ||
267 | static 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) | ||
274 | static 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 | |||
282 | static void __init balloon3_mmc_init(void) | ||
283 | { | ||
284 | pxa_set_mci_info(&balloon3_mci_platform_data); | ||
285 | } | ||
286 | #else | ||
287 | static 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) | ||
294 | static 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 | |||
302 | static int balloon3_udc_is_connected(void) | ||
303 | { | ||
304 | return 1; | ||
305 | } | ||
306 | |||
307 | static 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 | |||
313 | static 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 | ||
319 | static inline void balloon3_udc_init(void) {} | ||
320 | #endif | ||
321 | |||
322 | /****************************************************************************** | ||
323 | * IrDA | ||
324 | ******************************************************************************/ | ||
325 | #if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE) | ||
326 | static struct pxaficp_platform_data balloon3_ficp_platform_data = { | ||
327 | .transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF, | ||
328 | }; | ||
329 | |||
330 | static void __init balloon3_irda_init(void) | ||
331 | { | ||
332 | pxa_set_ficp_info(&balloon3_ficp_platform_data); | ||
333 | } | ||
334 | #else | ||
335 | static 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) | ||
342 | static 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 | |||
347 | static 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 | ||
354 | static inline void balloon3_uhc_init(void) {} | ||
355 | #endif | ||
356 | |||
357 | /****************************************************************************** | ||
358 | * LEDs | ||
359 | ******************************************************************************/ | ||
360 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | ||
361 | struct 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 | |||
375 | static struct gpio_led_platform_data balloon3_gpio_led_info = { | ||
376 | .leds = balloon3_gpio_leds, | ||
377 | .num_leds = ARRAY_SIZE(balloon3_gpio_leds), | ||
378 | }; | ||
379 | |||
380 | static struct platform_device balloon3_leds = { | ||
381 | .name = "leds-gpio", | ||
382 | .id = 0, | ||
383 | .dev = { | ||
384 | .platform_data = &balloon3_gpio_led_info, | ||
385 | } | ||
386 | }; | ||
387 | |||
388 | struct 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 | |||
424 | static 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 | |||
429 | static 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 | |||
437 | static void __init balloon3_leds_init(void) | ||
438 | { | ||
439 | platform_device_register(&balloon3_leds); | ||
440 | platform_device_register(&balloon3_pcf_leds); | ||
441 | } | ||
442 | #else | ||
443 | static inline void balloon3_leds_init(void) {} | ||
444 | #endif | ||
445 | |||
446 | /****************************************************************************** | ||
447 | * FPGA IRQ | ||
448 | ******************************************************************************/ | ||
76 | static void balloon3_mask_irq(unsigned int irq) | 449 | static void balloon3_mask_irq(unsigned int irq) |
77 | { | 450 | { |
78 | int balloon3_irq = (irq - BALLOON3_IRQ(0)); | 451 | int balloon3_irq = (irq - BALLOON3_IRQ(0)); |
@@ -98,7 +471,6 @@ static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
98 | { | 471 | { |
99 | unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) & | 472 | unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) & |
100 | balloon3_irq_enabled; | 473 | balloon3_irq_enabled; |
101 | |||
102 | do { | 474 | do { |
103 | /* clear useless edge notification */ | 475 | /* clear useless edge notification */ |
104 | if (desc->chip->ack) | 476 | if (desc->chip->ack) |
@@ -132,201 +504,259 @@ static void __init balloon3_init_irq(void) | |||
132 | "enabled\n", __func__, BALLOON3_AUX_NIRQ); | 504 | "enabled\n", __func__, BALLOON3_AUX_NIRQ); |
133 | } | 505 | } |
134 | 506 | ||
135 | static unsigned long balloon3_ac97_pin_config[] = { | 507 | /****************************************************************************** |
136 | GPIO28_AC97_BITCLK, | 508 | * GPIO expander |
137 | GPIO29_AC97_SDATA_IN_0, | 509 | ******************************************************************************/ |
138 | GPIO30_AC97_SDATA_OUT, | 510 | #if defined(CONFIG_GPIO_PCF857X) || defined(CONFIG_GPIO_PCF857X_MODULE) |
139 | GPIO31_AC97_SYNC, | 511 | static struct pcf857x_platform_data balloon3_pcf857x_pdata = { |
140 | GPIO113_AC97_nRESET, | 512 | .gpio_base = BALLOON3_PCF_GPIO_BASE, |
141 | }; | 513 | .n_latch = 0, |
142 | 514 | .setup = NULL, | |
143 | static void balloon3_backlight_power(int on) | 515 | .teardown = NULL, |
144 | { | 516 | .context = NULL, |
145 | pr_debug("%s: power is %s\n", __func__, on ? "on" : "off"); | ||
146 | gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on); | ||
147 | } | ||
148 | |||
149 | static unsigned long balloon3_lcd_pin_config[] = { | ||
150 | /* LCD - 16bpp Active TFT */ | ||
151 | GPIOxx_LCD_TFT_16BPP, | ||
152 | |||
153 | GPIO99_GPIO, /* Backlight */ | ||
154 | }; | 517 | }; |
155 | 518 | ||
156 | static struct pxafb_mode_info balloon3_lcd_modes[] = { | 519 | static struct i2c_board_info __initdata balloon3_i2c_devs[] = { |
157 | { | 520 | { |
158 | .pixclock = 38000, | 521 | I2C_BOARD_INFO("pcf8574a", 0x38), |
159 | .xres = 480, | 522 | .platform_data = &balloon3_pcf857x_pdata, |
160 | .yres = 640, | ||
161 | .bpp = 16, | ||
162 | .hsync_len = 8, | ||
163 | .left_margin = 8, | ||
164 | .right_margin = 8, | ||
165 | .vsync_len = 2, | ||
166 | .upper_margin = 4, | ||
167 | .lower_margin = 5, | ||
168 | .sync = 0, | ||
169 | }, | 523 | }, |
170 | }; | 524 | }; |
171 | 525 | ||
172 | static struct pxafb_mach_info balloon3_pxafb_info = { | 526 | static void __init balloon3_i2c_init(void) |
173 | .modes = balloon3_lcd_modes, | 527 | { |
174 | .num_modes = ARRAY_SIZE(balloon3_lcd_modes), | 528 | pxa_set_i2c_info(NULL); |
175 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | 529 | i2c_register_board_info(0, ARRAY_AND_SIZE(balloon3_i2c_devs)); |
176 | .pxafb_backlight_power = balloon3_backlight_power, | 530 | } |
177 | }; | 531 | #else |
532 | static inline void balloon3_i2c_init(void) {} | ||
533 | #endif | ||
534 | |||
535 | /****************************************************************************** | ||
536 | * NAND | ||
537 | ******************************************************************************/ | ||
538 | #if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE) | ||
539 | static 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 | |||
544 | static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl) | ||
545 | { | ||
546 | struct nand_chip *this = mtd->priv; | ||
178 | 547 | ||
179 | static unsigned long balloon3_mmc_pin_config[] = { | 548 | if (ctrl & NAND_CTRL_CHANGE) { |
180 | GPIO32_MMC_CLK, | 549 | if (ctrl & NAND_CLE) |
181 | GPIO92_MMC_DAT_0, | 550 | balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCLE; |
182 | GPIO109_MMC_DAT_1, | 551 | else |
183 | GPIO110_MMC_DAT_2, | 552 | balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLCLE; |
184 | GPIO111_MMC_DAT_3, | ||
185 | GPIO112_MMC_CMD, | ||
186 | }; | ||
187 | 553 | ||
188 | static void balloon3_mci_setpower(struct device *dev, unsigned int vdd) | 554 | if (ctrl & NAND_ALE) |
189 | { | 555 | balloon3_ctl |= BALLOON3_NAND_CONTROL_FLALE; |
190 | struct pxamci_platform_data *p_d = dev->platform_data; | 556 | else |
191 | 557 | balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLALE; | |
192 | if ((1 << vdd) & p_d->ocr_mask) { | 558 | |
193 | pr_debug("%s: on\n", __func__); | 559 | __raw_writel(balloon3_ctl, BALLOON3_NAND_CONTROL_REG); |
194 | /* FIXME something to prod here? */ | ||
195 | } else { | ||
196 | pr_debug("%s: off\n", __func__); | ||
197 | /* FIXME something to prod here? */ | ||
198 | } | 560 | } |
561 | |||
562 | if (cmd != NAND_CMD_NONE) | ||
563 | writeb(cmd, this->IO_ADDR_W); | ||
199 | } | 564 | } |
200 | 565 | ||
201 | static struct pxamci_platform_data balloon3_mci_platform_data = { | 566 | static void balloon3_nand_select_chip(struct mtd_info *mtd, int chip) |
202 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 567 | { |
203 | .setpower = balloon3_mci_setpower, | 568 | if (chip < 0 || chip > 3) |
204 | }; | 569 | return; |
205 | 570 | ||
206 | static int balloon3_udc_is_connected(void) | 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 | |||
582 | static int balloon3_nand_probe(struct platform_device *pdev) | ||
207 | { | 583 | { |
208 | pr_debug("%s: udc connected\n", __func__); | 584 | void __iomem *temp_map; |
209 | return 1; | 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 | |||
610 | err2: | ||
611 | gpio_free(BALLOON3_GPIO_RUN_NAND); | ||
612 | err1: | ||
613 | return ret; | ||
210 | } | 614 | } |
211 | 615 | ||
212 | static void balloon3_udc_command(int cmd) | 616 | static void balloon3_nand_remove(struct platform_device *pdev) |
213 | { | 617 | { |
214 | switch (cmd) { | 618 | /* Power down the NAND chips */ |
215 | case PXA2XX_UDC_CMD_CONNECT: | 619 | gpio_set_value(BALLOON3_GPIO_RUN_NAND, 0); |
216 | UP2OCR |= (UP2OCR_DPPUE + UP2OCR_DPPUBE); | 620 | gpio_free(BALLOON3_GPIO_RUN_NAND); |
217 | pr_debug("%s: connect\n", __func__); | ||
218 | break; | ||
219 | case PXA2XX_UDC_CMD_DISCONNECT: | ||
220 | UP2OCR &= ~UP2OCR_DPPUE; | ||
221 | pr_debug("%s: disconnect\n", __func__); | ||
222 | break; | ||
223 | } | ||
224 | } | 621 | } |
225 | 622 | ||
226 | static struct pxa2xx_udc_mach_info balloon3_udc_info = { | 623 | static struct mtd_partition balloon3_partition_info[] = { |
227 | .udc_is_connected = balloon3_udc_is_connected, | 624 | [0] = { |
228 | .udc_command = balloon3_udc_command, | 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 | }, | ||
229 | }; | 634 | }; |
230 | 635 | ||
231 | static struct pxaficp_platform_data balloon3_ficp_platform_data = { | 636 | static const char *balloon3_part_probes[] = { "cmdlinepart", NULL }; |
232 | .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, | ||
233 | }; | ||
234 | 637 | ||
235 | static unsigned long balloon3_ohci_pin_config[] = { | 638 | struct platform_nand_data balloon3_nand_pdata = { |
236 | GPIO88_USBH1_PWR, | 639 | .chip = { |
237 | GPIO89_USBH1_PEN, | 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 | }, | ||
238 | }; | 655 | }; |
239 | 656 | ||
240 | static struct pxaohci_platform_data balloon3_ohci_platform_data = { | 657 | static struct resource balloon3_nand_resource[] = { |
241 | .port_mode = PMM_PERPORT_MODE, | 658 | [0] = { |
242 | .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW, | 659 | .start = BALLOON3_NAND_BASE, |
660 | .end = BALLOON3_NAND_BASE + 0x4, | ||
661 | .flags = IORESOURCE_MEM, | ||
662 | }, | ||
243 | }; | 663 | }; |
244 | 664 | ||
245 | static unsigned long balloon3_pin_config[] __initdata = { | 665 | static struct platform_device balloon3_nand = { |
246 | /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */ | 666 | .name = "gen_nand", |
247 | GPIO42_BTUART_RXD, | 667 | .num_resources = ARRAY_SIZE(balloon3_nand_resource), |
248 | GPIO43_BTUART_TXD, | 668 | .resource = balloon3_nand_resource, |
249 | GPIO44_BTUART_CTS, | 669 | .id = -1, |
250 | GPIO45_BTUART_RTS, | 670 | .dev = { |
251 | 671 | .platform_data = &balloon3_nand_pdata, | |
252 | /* Wakeup GPIO */ | 672 | } |
253 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, | ||
254 | |||
255 | /* NAND & IDLE LED GPIOs */ | ||
256 | GPIO9_GPIO, | ||
257 | GPIO10_GPIO, | ||
258 | }; | 673 | }; |
259 | 674 | ||
260 | static struct gpio_led balloon3_gpio_leds[] = { | 675 | static void __init balloon3_nand_init(void) |
676 | { | ||
677 | platform_device_register(&balloon3_nand); | ||
678 | } | ||
679 | #else | ||
680 | static inline void balloon3_nand_init(void) {} | ||
681 | #endif | ||
682 | |||
683 | /****************************************************************************** | ||
684 | * Core power regulator | ||
685 | ******************************************************************************/ | ||
686 | #if defined(CONFIG_REGULATOR_MAX1586) || \ | ||
687 | defined(CONFIG_REGULATOR_MAX1586_MODULE) | ||
688 | static struct regulator_consumer_supply balloon3_max1587a_consumers[] = { | ||
261 | { | 689 | { |
262 | .name = "balloon3:green:idle", | 690 | .supply = "vcc_core", |
263 | .default_trigger = "heartbeat", | 691 | } |
264 | .gpio = BALLOON3_GPIO_LED_IDLE, | 692 | }; |
265 | .active_low = 1, | 693 | |
694 | static 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, | ||
266 | }, | 701 | }, |
702 | .consumer_supplies = balloon3_max1587a_consumers, | ||
703 | .num_consumer_supplies = ARRAY_SIZE(balloon3_max1587a_consumers), | ||
704 | }; | ||
705 | |||
706 | static struct max1586_subdev_data balloon3_max1587a_subdevs[] = { | ||
267 | { | 707 | { |
268 | .name = "balloon3:green:nand", | 708 | .name = "vcc_core", |
269 | .default_trigger = "nand-disk", | 709 | .id = MAX1586_V3, |
270 | .gpio = BALLOON3_GPIO_LED_NAND, | 710 | .platform_data = &balloon3_max1587a_v3_info, |
271 | .active_low = 1, | 711 | } |
272 | }, | ||
273 | }; | 712 | }; |
274 | 713 | ||
275 | static struct gpio_led_platform_data balloon3_gpio_leds_platform_data = { | 714 | static struct max1586_platform_data balloon3_max1587a_info = { |
276 | .leds = balloon3_gpio_leds, | 715 | .subdevs = balloon3_max1587a_subdevs, |
277 | .num_leds = ARRAY_SIZE(balloon3_gpio_leds), | 716 | .num_subdevs = ARRAY_SIZE(balloon3_max1587a_subdevs), |
717 | .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */ | ||
278 | }; | 718 | }; |
279 | 719 | ||
280 | static struct platform_device balloon3led_device = { | 720 | static struct i2c_board_info __initdata balloon3_pi2c_board_info[] = { |
281 | .name = "leds-gpio", | 721 | { |
282 | .id = -1, | 722 | I2C_BOARD_INFO("max1586", 0x14), |
283 | .dev = { | 723 | .platform_data = &balloon3_max1587a_info, |
284 | .platform_data = &balloon3_gpio_leds_platform_data, | ||
285 | }, | 724 | }, |
286 | }; | 725 | }; |
287 | 726 | ||
288 | static void __init balloon3_init(void) | 727 | static void __init balloon3_pmic_init(void) |
289 | { | 728 | { |
290 | pr_info("Initialising Balloon3\n"); | 729 | pxa27x_set_i2c_power_info(NULL); |
730 | i2c_register_board_info(1, ARRAY_AND_SIZE(balloon3_pi2c_board_info)); | ||
731 | } | ||
732 | #else | ||
733 | static inline void balloon3_pmic_init(void) {} | ||
734 | #endif | ||
291 | 735 | ||
292 | /* system bus arbiter setting | 736 | /****************************************************************************** |
293 | * - Core_Park | 737 | * Machine init |
294 | * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4 | 738 | ******************************************************************************/ |
295 | */ | 739 | static void __init balloon3_init(void) |
740 | { | ||
296 | ARB_CNTRL = ARB_CORE_PARK | 0x234; | 741 | ARB_CNTRL = ARB_CORE_PARK | 0x234; |
297 | 742 | ||
743 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config)); | ||
744 | |||
298 | pxa_set_ffuart_info(NULL); | 745 | pxa_set_ffuart_info(NULL); |
299 | pxa_set_btuart_info(NULL); | 746 | pxa_set_btuart_info(NULL); |
300 | pxa_set_stuart_info(NULL); | 747 | pxa_set_stuart_info(NULL); |
301 | 748 | ||
302 | pxa_set_i2c_info(NULL); | 749 | balloon3_i2c_init(); |
303 | if (balloon3_has(BALLOON3_FEATURE_AUDIO)) { | 750 | balloon3_irda_init(); |
304 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config)); | 751 | balloon3_lcd_init(); |
305 | pxa_set_ac97_info(NULL); | 752 | balloon3_leds_init(); |
306 | } | 753 | balloon3_mmc_init(); |
307 | 754 | balloon3_nand_init(); | |
308 | if (balloon3_has(BALLOON3_FEATURE_TOPPOLY)) { | 755 | balloon3_nor_init(); |
309 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_lcd_pin_config)); | 756 | balloon3_pmic_init(); |
310 | gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, | 757 | balloon3_ts_init(); |
311 | "LCD Backlight Power"); | 758 | balloon3_udc_init(); |
312 | gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1); | 759 | balloon3_uhc_init(); |
313 | set_pxa_fb_info(&balloon3_pxafb_info); | ||
314 | } | ||
315 | |||
316 | if (balloon3_has(BALLOON3_FEATURE_MMC)) { | ||
317 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_mmc_pin_config)); | ||
318 | pxa_set_mci_info(&balloon3_mci_platform_data); | ||
319 | } | ||
320 | pxa_set_ficp_info(&balloon3_ficp_platform_data); | ||
321 | if (balloon3_has(BALLOON3_FEATURE_OHCI)) { | ||
322 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ohci_pin_config)); | ||
323 | pxa_set_ohci_info(&balloon3_ohci_platform_data); | ||
324 | } | ||
325 | pxa_set_udc_info(&balloon3_udc_info); | ||
326 | |||
327 | pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config)); | ||
328 | |||
329 | platform_device_register(&balloon3led_device); | ||
330 | } | 760 | } |
331 | 761 | ||
332 | static struct map_desc balloon3_io_desc[] __initdata = { | 762 | static struct map_desc balloon3_io_desc[] __initdata = { |