aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2010-07-26 19:37:44 -0400
committerEric Miao <eric.y.miao@gmail.com>2010-08-05 02:32:44 -0400
commit12a2449c79686964a36b17175970a8e1c19b4cf7 (patch)
tree548c20834af66350af0bd305e9510ca496b14187 /arch/arm/mach-pxa
parentb0240bf4d4fac099e067c206234aed4528d70ca9 (diff)
[ARM] pxa/balloon3: Machine file cleanup
Modularize components of the Balloon3 board. Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/balloon3.c354
1 files changed, 231 insertions, 123 deletions
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 8adb87a03674..572525c26cac 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -22,6 +22,7 @@
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>
@@ -61,35 +62,136 @@ static unsigned long balloon3_pin_config[] __initdata = {
61 GPIO44_BTUART_CTS, 62 GPIO44_BTUART_CTS,
62 GPIO45_BTUART_RTS, 63 GPIO45_BTUART_RTS,
63 64
64 /* Wakeup GPIO */ 65 /* Reset, configured as GPIO wakeup source */
65 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, 66 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
66 67
67 /* NAND & IDLE LED GPIOs */ 68 /* LEDs */
68 GPIO9_GPIO, 69 GPIO9_GPIO, /* NAND activity LED */
69 GPIO10_GPIO, 70 GPIO10_GPIO, /* Heartbeat LED */
70};
71 71
72/****************************************************************************** 72 /* AC97 */
73 * Audio and Touchscreen
74 ******************************************************************************/
75static unsigned long balloon3_ac97_pin_config[] = {
76 GPIO28_AC97_BITCLK, 73 GPIO28_AC97_BITCLK,
77 GPIO29_AC97_SDATA_IN_0, 74 GPIO29_AC97_SDATA_IN_0,
78 GPIO30_AC97_SDATA_OUT, 75 GPIO30_AC97_SDATA_OUT,
79 GPIO31_AC97_SYNC, 76 GPIO31_AC97_SYNC,
80 GPIO113_AC97_nRESET, 77 GPIO113_AC97_nRESET,
78 GPIO95_GPIO,
79
80 /* MMC */
81 GPIO32_MMC_CLK,
82 GPIO92_MMC_DAT_0,
83 GPIO109_MMC_DAT_1,
84 GPIO110_MMC_DAT_2,
85 GPIO111_MMC_DAT_3,
86 GPIO112_MMC_CMD,
87
88 /* USB Host */
89 GPIO88_USBH1_PWR,
90 GPIO89_USBH1_PEN,
81}; 91};
82 92
83/****************************************************************************** 93/******************************************************************************
84 * Framebuffer 94 * Compatibility: Parameter parsing
85 ******************************************************************************/ 95 ******************************************************************************/
96static unsigned long balloon3_irq_enabled;
86 97
87static void balloon3_backlight_power(int on) 98static unsigned long balloon3_features_present =
99 (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
100 (1 << BALLOON3_FEATURE_AUDIO) |
101 (1 << BALLOON3_FEATURE_TOPPOLY);
102
103int balloon3_has(enum balloon3_features feature)
88{ 104{
89 pr_debug("%s: power is %s\n", __func__, on ? "on" : "off"); 105 return (balloon3_features_present & (1 << feature)) ? 1 : 0;
90 gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on); 106}
107EXPORT_SYMBOL_GPL(balloon3_has);
108
109int __init parse_balloon3_features(char *arg)
110{
111 if (!arg)
112 return 0;
113
114 return strict_strtoul(arg, 0, &balloon3_features_present);
91} 115}
116early_param("balloon3_features", parse_balloon3_features);
92 117
118/******************************************************************************
119 * NOR Flash
120 ******************************************************************************/
121#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
122static struct mtd_partition balloon3_nor_partitions[] = {
123 {
124 .name = "Flash",
125 .offset = 0x00000000,
126 .size = MTDPART_SIZ_FULL,
127 }
128};
129
130static struct physmap_flash_data balloon3_flash_data[] = {
131 {
132 .width = 2, /* bankwidth in bytes */
133 .parts = balloon3_nor_partitions,
134 .nr_parts = ARRAY_SIZE(balloon3_nor_partitions)
135 }
136};
137
138static struct resource balloon3_flash_resource = {
139 .start = PXA_CS0_PHYS,
140 .end = PXA_CS0_PHYS + SZ_64M - 1,
141 .flags = IORESOURCE_MEM,
142};
143
144static struct platform_device balloon3_flash = {
145 .name = "physmap-flash",
146 .id = 0,
147 .resource = &balloon3_flash_resource,
148 .num_resources = 1,
149 .dev = {
150 .platform_data = balloon3_flash_data,
151 },
152};
153static void __init balloon3_nor_init(void)
154{
155 platform_device_register(&balloon3_flash);
156}
157#else
158static inline void balloon3_nor_init(void) {}
159#endif
160
161/******************************************************************************
162 * Audio and Touchscreen
163 ******************************************************************************/
164#if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
165 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
166static struct ucb1400_pdata vpac270_ucb1400_pdata = {
167 .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ),
168};
169
170
171static struct platform_device balloon3_ucb1400_device = {
172 .name = "ucb1400_core",
173 .id = -1,
174 .dev = {
175 .platform_data = &vpac270_ucb1400_pdata,
176 },
177};
178
179static void __init balloon3_ts_init(void)
180{
181 if (!balloon3_has(BALLOON3_FEATURE_AUDIO))
182 return;
183
184 pxa_set_ac97_info(NULL);
185 platform_device_register(&balloon3_ucb1400_device);
186}
187#else
188static inline void balloon3_ts_init(void) {}
189#endif
190
191/******************************************************************************
192 * Framebuffer
193 ******************************************************************************/
194#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
93static struct pxafb_mode_info balloon3_lcd_modes[] = { 195static struct pxafb_mode_info balloon3_lcd_modes[] = {
94 { 196 {
95 .pixclock = 38000, 197 .pixclock = 38000,
@@ -106,102 +208,147 @@ static struct pxafb_mode_info balloon3_lcd_modes[] = {
106 }, 208 },
107}; 209};
108 210
109static struct pxafb_mach_info balloon3_pxafb_info = { 211static struct pxafb_mach_info balloon3_lcd_screen = {
110 .modes = balloon3_lcd_modes, 212 .modes = balloon3_lcd_modes,
111 .num_modes = ARRAY_SIZE(balloon3_lcd_modes), 213 .num_modes = ARRAY_SIZE(balloon3_lcd_modes),
112 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 214 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
113 .pxafb_backlight_power = balloon3_backlight_power,
114}; 215};
115 216
116/****************************************************************************** 217static void balloon3_backlight_power(int on)
117 * SD/MMC card controller 218{
118 ******************************************************************************/ 219 gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
119static unsigned long balloon3_mmc_pin_config[] = { 220}
120 GPIO32_MMC_CLK,
121 GPIO92_MMC_DAT_0,
122 GPIO109_MMC_DAT_1,
123 GPIO110_MMC_DAT_2,
124 GPIO111_MMC_DAT_3,
125 GPIO112_MMC_CMD,
126};
127 221
128static void balloon3_mci_setpower(struct device *dev, unsigned int vdd) 222static void __init balloon3_lcd_init(void)
129{ 223{
130 struct pxamci_platform_data *p_d = dev->platform_data; 224 int ret;
131 225
132 if ((1 << vdd) & p_d->ocr_mask) { 226 if (!balloon3_has(BALLOON3_FEATURE_TOPPOLY))
133 pr_debug("%s: on\n", __func__); 227 return;
134 /* FIXME something to prod here? */ 228
135 } else { 229 ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON");
136 pr_debug("%s: off\n", __func__); 230 if (ret) {
137 /* FIXME something to prod here? */ 231 pr_err("Requesting BKL-ON GPIO failed!\n");
232 goto err;
233 }
234
235 ret = gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
236 if (ret) {
237 pr_err("Setting BKL-ON GPIO direction failed!\n");
238 goto err2;
138 } 239 }
240
241 balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power;
242 set_pxa_fb_info(&balloon3_lcd_screen);
243 return;
244
245err2:
246 gpio_free(BALLOON3_GPIO_RUN_BACKLIGHT);
247err:
248 return;
139} 249}
250#else
251static inline void balloon3_lcd_init(void) {}
252#endif
140 253
254/******************************************************************************
255 * SD/MMC card controller
256 ******************************************************************************/
257#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
141static struct pxamci_platform_data balloon3_mci_platform_data = { 258static struct pxamci_platform_data balloon3_mci_platform_data = {
142 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 259 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
143 .setpower = balloon3_mci_setpower, 260 .gpio_card_detect = -1,
261 .gpio_card_ro = -1,
262 .gpio_power = -1,
263 .detect_delay_ms = 200,
144}; 264};
145 265
266static void __init balloon3_mmc_init(void)
267{
268 pxa_set_mci_info(&balloon3_mci_platform_data);
269}
270#else
271static inline void balloon3_mmc_init(void) {}
272#endif
273
146/****************************************************************************** 274/******************************************************************************
147 * USB Gadget 275 * USB Gadget
148 ******************************************************************************/ 276 ******************************************************************************/
149static int balloon3_udc_is_connected(void) 277#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
278static void balloon3_udc_command(int cmd)
150{ 279{
151 pr_debug("%s: udc connected\n", __func__); 280 if (cmd == PXA2XX_UDC_CMD_CONNECT)
152 return 1; 281 UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
282 else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
283 UP2OCR &= ~UP2OCR_DPPUE;
153} 284}
154 285
155static void balloon3_udc_command(int cmd) 286static int balloon3_udc_is_connected(void)
156{ 287{
157 switch (cmd) { 288 return 1;
158 case PXA2XX_UDC_CMD_CONNECT:
159 UP2OCR |= (UP2OCR_DPPUE + UP2OCR_DPPUBE);
160 pr_debug("%s: connect\n", __func__);
161 break;
162 case PXA2XX_UDC_CMD_DISCONNECT:
163 UP2OCR &= ~UP2OCR_DPPUE;
164 pr_debug("%s: disconnect\n", __func__);
165 break;
166 }
167} 289}
168 290
169static struct pxa2xx_udc_mach_info balloon3_udc_info = { 291static struct pxa2xx_udc_mach_info balloon3_udc_info __initdata = {
170 .udc_is_connected = balloon3_udc_is_connected, 292 .udc_command = balloon3_udc_command,
171 .udc_command = balloon3_udc_command, 293 .udc_is_connected = balloon3_udc_is_connected,
294 .gpio_pullup = -1,
172}; 295};
173 296
297static void __init balloon3_udc_init(void)
298{
299 pxa_set_udc_info(&balloon3_udc_info);
300 platform_device_register(&balloon3_gpio_vbus);
301}
302#else
303static inline void balloon3_udc_init(void) {}
304#endif
305
174/****************************************************************************** 306/******************************************************************************
175 * IrDA 307 * IrDA
176 ******************************************************************************/ 308 ******************************************************************************/
309#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
177static struct pxaficp_platform_data balloon3_ficp_platform_data = { 310static struct pxaficp_platform_data balloon3_ficp_platform_data = {
178 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, 311 .transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF,
179}; 312};
180 313
314static void __init balloon3_irda_init(void)
315{
316 pxa_set_ficp_info(&balloon3_ficp_platform_data);
317}
318#else
319static inline void balloon3_irda_init(void) {}
320#endif
321
181/****************************************************************************** 322/******************************************************************************
182 * USB Host 323 * USB Host
183 ******************************************************************************/ 324 ******************************************************************************/
184static unsigned long balloon3_ohci_pin_config[] = { 325#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
185 GPIO88_USBH1_PWR, 326static struct pxaohci_platform_data balloon3_ohci_info = {
186 GPIO89_USBH1_PEN,
187};
188
189static struct pxaohci_platform_data balloon3_ohci_platform_data = {
190 .port_mode = PMM_PERPORT_MODE, 327 .port_mode = PMM_PERPORT_MODE,
191 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW, 328 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
192}; 329};
193 330
331static void __init balloon3_uhc_init(void)
332{
333 if (!balloon3_has(BALLOON3_FEATURE_OHCI))
334 return;
335 pxa_set_ohci_info(&balloon3_ohci_info);
336}
337#else
338static inline void balloon3_uhc_init(void) {}
339#endif
340
194/****************************************************************************** 341/******************************************************************************
195 * LED 342 * LEDs
196 ******************************************************************************/ 343 ******************************************************************************/
197static struct gpio_led balloon3_gpio_leds[] = { 344#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
345struct gpio_led balloon3_gpio_leds[] = {
198 { 346 {
199 .name = "balloon3:green:idle", 347 .name = "balloon3:green:idle",
200 .default_trigger = "heartbeat", 348 .default_trigger = "heartbeat",
201 .gpio = BALLOON3_GPIO_LED_IDLE, 349 .gpio = BALLOON3_GPIO_LED_IDLE,
202 .active_low = 1, 350 .active_low = 1,
203 }, 351 }, {
204 {
205 .name = "balloon3:green:nand", 352 .name = "balloon3:green:nand",
206 .default_trigger = "nand-disk", 353 .default_trigger = "nand-disk",
207 .gpio = BALLOON3_GPIO_LED_NAND, 354 .gpio = BALLOON3_GPIO_LED_NAND,
@@ -209,43 +356,26 @@ static struct gpio_led balloon3_gpio_leds[] = {
209 }, 356 },
210}; 357};
211 358
212static struct gpio_led_platform_data balloon3_gpio_leds_platform_data = { 359static struct gpio_led_platform_data balloon3_gpio_led_info = {
213 .leds = balloon3_gpio_leds, 360 .leds = balloon3_gpio_leds,
214 .num_leds = ARRAY_SIZE(balloon3_gpio_leds), 361 .num_leds = ARRAY_SIZE(balloon3_gpio_leds),
215}; 362};
216 363
217static struct platform_device balloon3led_device = { 364static struct platform_device balloon3_leds = {
218 .name = "leds-gpio", 365 .name = "leds-gpio",
219 .id = -1, 366 .id = -1,
220 .dev = { 367 .dev = {
221 .platform_data = &balloon3_gpio_leds_platform_data, 368 .platform_data = &balloon3_gpio_led_info,
222 }, 369 }
223}; 370};
224 371
225/****************************************************************************** 372static void __init balloon3_leds_init(void)
226 * Compatibility: Parameter parsing
227 ******************************************************************************/
228static unsigned long balloon3_irq_enabled;
229
230static unsigned long balloon3_features_present =
231 (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
232 (1 << BALLOON3_FEATURE_AUDIO) |
233 (1 << BALLOON3_FEATURE_TOPPOLY);
234
235int balloon3_has(enum balloon3_features feature)
236{ 373{
237 return (balloon3_features_present & (1 << feature)) ? 1 : 0; 374 platform_device_register(&balloon3_leds);
238} 375}
239EXPORT_SYMBOL_GPL(balloon3_has); 376#else
240 377static inline void balloon3_leds_init(void) {}
241int __init parse_balloon3_features(char *arg) 378#endif
242{
243 if (!arg)
244 return 0;
245
246 return strict_strtoul(arg, 0, &balloon3_features_present);
247}
248early_param("balloon3_features", parse_balloon3_features);
249 379
250/****************************************************************************** 380/******************************************************************************
251 * FPGA IRQ 381 * FPGA IRQ
@@ -314,46 +444,24 @@ static void __init balloon3_init_irq(void)
314 ******************************************************************************/ 444 ******************************************************************************/
315static void __init balloon3_init(void) 445static void __init balloon3_init(void)
316{ 446{
317 pr_info("Initialising Balloon3\n");
318
319 /* system bus arbiter setting
320 * - Core_Park
321 * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
322 */
323 ARB_CNTRL = ARB_CORE_PARK | 0x234; 447 ARB_CNTRL = ARB_CORE_PARK | 0x234;
324 448
449 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config));
450
325 pxa_set_ffuart_info(NULL); 451 pxa_set_ffuart_info(NULL);
326 pxa_set_btuart_info(NULL); 452 pxa_set_btuart_info(NULL);
327 pxa_set_stuart_info(NULL); 453 pxa_set_stuart_info(NULL);
328 454
329 pxa_set_i2c_info(NULL); 455 pxa_set_i2c_info(NULL);
330 if (balloon3_has(BALLOON3_FEATURE_AUDIO)) {
331 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config));
332 pxa_set_ac97_info(NULL);
333 }
334
335 if (balloon3_has(BALLOON3_FEATURE_TOPPOLY)) {
336 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_lcd_pin_config));
337 gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT,
338 "LCD Backlight Power");
339 gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
340 set_pxa_fb_info(&balloon3_pxafb_info);
341 }
342
343 if (balloon3_has(BALLOON3_FEATURE_MMC)) {
344 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_mmc_pin_config));
345 pxa_set_mci_info(&balloon3_mci_platform_data);
346 }
347 pxa_set_ficp_info(&balloon3_ficp_platform_data);
348 if (balloon3_has(BALLOON3_FEATURE_OHCI)) {
349 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ohci_pin_config));
350 pxa_set_ohci_info(&balloon3_ohci_platform_data);
351 }
352 pxa_set_udc_info(&balloon3_udc_info);
353
354 pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config));
355 456
356 platform_device_register(&balloon3led_device); 457 balloon3_irda_init();
458 balloon3_lcd_init();
459 balloon3_leds_init();
460 balloon3_mmc_init();
461 balloon3_nor_init();
462 balloon3_ts_init();
463 balloon3_udc_init();
464 balloon3_uhc_init();
357} 465}
358 466
359static struct map_desc balloon3_io_desc[] __initdata = { 467static struct map_desc balloon3_io_desc[] __initdata = {