diff options
Diffstat (limited to 'arch/arm/mach-pxa/pcm990-baseboard.c')
-rw-r--r-- | arch/arm/mach-pxa/pcm990-baseboard.c | 203 |
1 files changed, 139 insertions, 64 deletions
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index 49d951db0f3d..30023b00e476 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/ide.h> | 25 | #include <linux/ide.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/pwm_backlight.h> | ||
27 | 28 | ||
28 | #include <media/soc_camera.h> | 29 | #include <media/soc_camera.h> |
29 | 30 | ||
@@ -32,13 +33,120 @@ | |||
32 | #include <asm/arch/camera.h> | 33 | #include <asm/arch/camera.h> |
33 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
34 | #include <asm/arch/pxa-regs.h> | 35 | #include <asm/arch/pxa-regs.h> |
35 | #include <asm/arch/pxa2xx-gpio.h> | 36 | #include <asm/arch/audio.h> |
36 | #include <asm/arch/mmc.h> | 37 | #include <asm/arch/mmc.h> |
37 | #include <asm/arch/ohci.h> | 38 | #include <asm/arch/ohci.h> |
38 | #include <asm/arch/pcm990_baseboard.h> | 39 | #include <asm/arch/pcm990_baseboard.h> |
40 | #include <asm/arch/pxafb.h> | ||
41 | #include <asm/arch/mfp-pxa27x.h> | ||
42 | |||
43 | #include "devices.h" | ||
44 | #include "generic.h" | ||
45 | |||
46 | static unsigned long pcm990_pin_config[] __initdata = { | ||
47 | /* MMC */ | ||
48 | GPIO32_MMC_CLK, | ||
49 | GPIO112_MMC_CMD, | ||
50 | GPIO92_MMC_DAT_0, | ||
51 | GPIO109_MMC_DAT_1, | ||
52 | GPIO110_MMC_DAT_2, | ||
53 | GPIO111_MMC_DAT_3, | ||
54 | /* USB */ | ||
55 | GPIO88_USBH1_PWR, | ||
56 | GPIO89_USBH1_PEN, | ||
57 | /* PWM0 */ | ||
58 | GPIO16_PWM0_OUT, | ||
59 | }; | ||
39 | 60 | ||
40 | /* | 61 | /* |
41 | * The PCM-990 development baseboard uses PCM-027's hardeware in the | 62 | * pcm990_lcd_power - control power supply to the LCD |
63 | * @on: 0 = switch off, 1 = switch on | ||
64 | * | ||
65 | * Called by the pxafb driver | ||
66 | */ | ||
67 | #ifndef CONFIG_PCM990_DISPLAY_NONE | ||
68 | static void pcm990_lcd_power(int on, struct fb_var_screeninfo *var) | ||
69 | { | ||
70 | if (on) { | ||
71 | /* enable LCD-Latches | ||
72 | * power on LCD | ||
73 | */ | ||
74 | __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = | ||
75 | PCM990_CTRL_LCDPWR + PCM990_CTRL_LCDON; | ||
76 | } else { | ||
77 | /* disable LCD-Latches | ||
78 | * power off LCD | ||
79 | */ | ||
80 | __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = 0x00; | ||
81 | } | ||
82 | } | ||
83 | #endif | ||
84 | |||
85 | #if defined(CONFIG_PCM990_DISPLAY_SHARP) | ||
86 | static struct pxafb_mode_info fb_info_sharp_lq084v1dg21 = { | ||
87 | .pixclock = 28000, | ||
88 | .xres = 640, | ||
89 | .yres = 480, | ||
90 | .bpp = 16, | ||
91 | .hsync_len = 20, | ||
92 | .left_margin = 103, | ||
93 | .right_margin = 47, | ||
94 | .vsync_len = 6, | ||
95 | .upper_margin = 28, | ||
96 | .lower_margin = 5, | ||
97 | .sync = 0, | ||
98 | .cmap_greyscale = 0, | ||
99 | }; | ||
100 | |||
101 | static struct pxafb_mach_info pcm990_fbinfo __initdata = { | ||
102 | .modes = &fb_info_sharp_lq084v1dg21, | ||
103 | .num_modes = 1, | ||
104 | .lccr0 = LCCR0_PAS, | ||
105 | .lccr3 = LCCR3_PCP, | ||
106 | .pxafb_lcd_power = pcm990_lcd_power, | ||
107 | }; | ||
108 | #elif defined(CONFIG_PCM990_DISPLAY_NEC) | ||
109 | struct pxafb_mode_info fb_info_nec_nl6448bc20_18d = { | ||
110 | .pixclock = 39720, | ||
111 | .xres = 640, | ||
112 | .yres = 480, | ||
113 | .bpp = 16, | ||
114 | .hsync_len = 32, | ||
115 | .left_margin = 16, | ||
116 | .right_margin = 48, | ||
117 | .vsync_len = 2, | ||
118 | .upper_margin = 12, | ||
119 | .lower_margin = 17, | ||
120 | .sync = 0, | ||
121 | .cmap_greyscale = 0, | ||
122 | }; | ||
123 | |||
124 | static struct pxafb_mach_info pcm990_fbinfo __initdata = { | ||
125 | .modes = &fb_info_nec_nl6448bc20_18d, | ||
126 | .num_modes = 1, | ||
127 | .lccr0 = LCCR0_Act, | ||
128 | .lccr3 = LCCR3_PixFlEdg, | ||
129 | .pxafb_lcd_power = pcm990_lcd_power, | ||
130 | }; | ||
131 | #endif | ||
132 | |||
133 | static struct platform_pwm_backlight_data pcm990_backlight_data = { | ||
134 | .pwm_id = 0, | ||
135 | .max_brightness = 1023, | ||
136 | .dft_brightness = 1023, | ||
137 | .pwm_period_ns = 78770, | ||
138 | }; | ||
139 | |||
140 | static struct platform_device pcm990_backlight_device = { | ||
141 | .name = "pwm-backlight", | ||
142 | .dev = { | ||
143 | .parent = &pxa27x_device_pwm0.dev, | ||
144 | .platform_data = &pcm990_backlight_data, | ||
145 | }, | ||
146 | }; | ||
147 | |||
148 | /* | ||
149 | * The PCM-990 development baseboard uses PCM-027's hardware in the | ||
42 | * following way: | 150 | * following way: |
43 | * | 151 | * |
44 | * - LCD support is in use | 152 | * - LCD support is in use |
@@ -185,16 +293,6 @@ static int pcm990_mci_init(struct device *dev, irq_handler_t mci_detect_int, | |||
185 | { | 293 | { |
186 | int err; | 294 | int err; |
187 | 295 | ||
188 | /* | ||
189 | * enable GPIO for PXA27x MMC controller | ||
190 | */ | ||
191 | pxa_gpio_mode(GPIO32_MMCCLK_MD); | ||
192 | pxa_gpio_mode(GPIO112_MMCCMD_MD); | ||
193 | pxa_gpio_mode(GPIO92_MMCDAT0_MD); | ||
194 | pxa_gpio_mode(GPIO109_MMCDAT1_MD); | ||
195 | pxa_gpio_mode(GPIO110_MMCDAT2_MD); | ||
196 | pxa_gpio_mode(GPIO111_MMCDAT3_MD); | ||
197 | |||
198 | err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, IRQF_DISABLED, | 296 | err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, IRQF_DISABLED, |
199 | "MMC card detect", data); | 297 | "MMC card detect", data); |
200 | if (err) | 298 | if (err) |
@@ -241,8 +339,6 @@ static struct pxamci_platform_data pcm990_mci_platform_data = { | |||
241 | */ | 339 | */ |
242 | static int pcm990_ohci_init(struct device *dev) | 340 | static int pcm990_ohci_init(struct device *dev) |
243 | { | 341 | { |
244 | pxa_gpio_mode(PCM990_USB_OVERCURRENT); | ||
245 | pxa_gpio_mode(PCM990_USB_PWR_EN); | ||
246 | /* | 342 | /* |
247 | * disable USB port 2 and 3 | 343 | * disable USB port 2 and 3 |
248 | * power sense is active low | 344 | * power sense is active low |
@@ -269,23 +365,27 @@ static struct pxaohci_platform_data pcm990_ohci_platform_data = { | |||
269 | * PXA27x Camera specific stuff | 365 | * PXA27x Camera specific stuff |
270 | */ | 366 | */ |
271 | #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) | 367 | #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) |
368 | static unsigned long pcm990_camera_pin_config[] = { | ||
369 | /* CIF */ | ||
370 | GPIO98_CIF_DD_0, | ||
371 | GPIO105_CIF_DD_1, | ||
372 | GPIO104_CIF_DD_2, | ||
373 | GPIO103_CIF_DD_3, | ||
374 | GPIO95_CIF_DD_4, | ||
375 | GPIO94_CIF_DD_5, | ||
376 | GPIO93_CIF_DD_6, | ||
377 | GPIO108_CIF_DD_7, | ||
378 | GPIO107_CIF_DD_8, | ||
379 | GPIO106_CIF_DD_9, | ||
380 | GPIO42_CIF_MCLK, | ||
381 | GPIO45_CIF_PCLK, | ||
382 | GPIO43_CIF_FV, | ||
383 | GPIO44_CIF_LV, | ||
384 | }; | ||
385 | |||
272 | static int pcm990_pxacamera_init(struct device *dev) | 386 | static int pcm990_pxacamera_init(struct device *dev) |
273 | { | 387 | { |
274 | pxa_gpio_mode(GPIO98_CIF_DD_0_MD); | 388 | pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_camera_pin_config)); |
275 | pxa_gpio_mode(GPIO105_CIF_DD_1_MD); | ||
276 | pxa_gpio_mode(GPIO104_CIF_DD_2_MD); | ||
277 | pxa_gpio_mode(GPIO103_CIF_DD_3_MD); | ||
278 | pxa_gpio_mode(GPIO95_CIF_DD_4_MD); | ||
279 | pxa_gpio_mode(GPIO94_CIF_DD_5_MD); | ||
280 | pxa_gpio_mode(GPIO93_CIF_DD_6_MD); | ||
281 | pxa_gpio_mode(GPIO108_CIF_DD_7_MD); | ||
282 | pxa_gpio_mode(GPIO107_CIF_DD_8_MD); | ||
283 | pxa_gpio_mode(GPIO106_CIF_DD_9_MD); | ||
284 | pxa_gpio_mode(GPIO42_CIF_MCLK_MD); | ||
285 | pxa_gpio_mode(GPIO45_CIF_PCLK_MD); | ||
286 | pxa_gpio_mode(GPIO43_CIF_FV_MD); | ||
287 | pxa_gpio_mode(GPIO44_CIF_LV_MD); | ||
288 | |||
289 | return 0; | 389 | return 0; |
290 | } | 390 | } |
291 | 391 | ||
@@ -333,36 +433,6 @@ static struct i2c_board_info __initdata pcm990_i2c_devices[] = { | |||
333 | #endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ | 433 | #endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ |
334 | 434 | ||
335 | /* | 435 | /* |
336 | * AC97 support | ||
337 | * Note: The connected AC97 mixer also reports interrupts at PCM990_AC97_IRQ | ||
338 | */ | ||
339 | static struct resource pxa27x_ac97_resources[] = { | ||
340 | [0] = { | ||
341 | .start = 0x40500000, | ||
342 | .end = 0x40500000 + 0xfff, | ||
343 | .flags = IORESOURCE_MEM, | ||
344 | }, | ||
345 | [1] = { | ||
346 | .start = IRQ_AC97, | ||
347 | .end = IRQ_AC97, | ||
348 | .flags = IORESOURCE_IRQ, | ||
349 | }, | ||
350 | }; | ||
351 | |||
352 | static u64 pxa_ac97_dmamask = 0xffffffffUL; | ||
353 | |||
354 | static struct platform_device pxa27x_device_ac97 = { | ||
355 | .name = "pxa2xx-ac97", | ||
356 | .id = -1, | ||
357 | .dev = { | ||
358 | .dma_mask = &pxa_ac97_dmamask, | ||
359 | .coherent_dma_mask = 0xffffffff, | ||
360 | }, | ||
361 | .num_resources = ARRAY_SIZE(pxa27x_ac97_resources), | ||
362 | .resource = pxa27x_ac97_resources, | ||
363 | }; | ||
364 | |||
365 | /* | ||
366 | * enable generic access to the base board control CPLDs U6 and U7 | 436 | * enable generic access to the base board control CPLDs U6 and U7 |
367 | */ | 437 | */ |
368 | static struct map_desc pcm990_io_desc[] __initdata = { | 438 | static struct map_desc pcm990_io_desc[] __initdata = { |
@@ -387,13 +457,18 @@ static struct map_desc pcm990_io_desc[] __initdata = { | |||
387 | */ | 457 | */ |
388 | void __init pcm990_baseboard_init(void) | 458 | void __init pcm990_baseboard_init(void) |
389 | { | 459 | { |
460 | pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_pin_config)); | ||
461 | |||
390 | /* register CPLD access */ | 462 | /* register CPLD access */ |
391 | iotable_init(pcm990_io_desc, ARRAY_SIZE(pcm990_io_desc)); | 463 | iotable_init(ARRAY_AND_SIZE(pcm990_io_desc)); |
392 | 464 | ||
393 | /* register CPLD's IRQ controller */ | 465 | /* register CPLD's IRQ controller */ |
394 | pcm990_init_irq(); | 466 | pcm990_init_irq(); |
395 | 467 | ||
396 | platform_device_register(&pxa27x_device_ac97); | 468 | #ifndef CONFIG_PCM990_DISPLAY_NONE |
469 | set_pxa_fb_info(&pcm990_fbinfo); | ||
470 | #endif | ||
471 | platform_device_register(&pcm990_backlight_device); | ||
397 | 472 | ||
398 | /* MMC */ | 473 | /* MMC */ |
399 | pxa_set_mci_info(&pcm990_mci_platform_data); | 474 | pxa_set_mci_info(&pcm990_mci_platform_data); |
@@ -402,13 +477,13 @@ void __init pcm990_baseboard_init(void) | |||
402 | pxa_set_ohci_info(&pcm990_ohci_platform_data); | 477 | pxa_set_ohci_info(&pcm990_ohci_platform_data); |
403 | 478 | ||
404 | pxa_set_i2c_info(NULL); | 479 | pxa_set_i2c_info(NULL); |
480 | pxa_set_ac97_info(NULL); | ||
405 | 481 | ||
406 | #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) | 482 | #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) |
407 | pxa_set_camera_info(&pcm990_pxacamera_platform_data); | 483 | pxa_set_camera_info(&pcm990_pxacamera_platform_data); |
408 | 484 | ||
409 | i2c_register_board_info(0, pcm990_i2c_devices, | 485 | i2c_register_board_info(0, ARRAY_AND_SIZE(pcm990_i2c_devices)); |
410 | ARRAY_SIZE(pcm990_i2c_devices)); | ||
411 | #endif | 486 | #endif |
412 | 487 | ||
413 | printk(KERN_INFO"PCM-990 Evaluation baseboard initialized\n"); | 488 | printk(KERN_INFO "PCM-990 Evaluation baseboard initialized\n"); |
414 | } | 489 | } |