diff options
-rw-r--r-- | arch/arm/mach-davinci/board-da850-evm.c | 50 | ||||
-rw-r--r-- | arch/arm/mach-davinci/da850.c | 42 | ||||
-rw-r--r-- | arch/arm/mach-davinci/devices-da8xx.c | 59 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/da8xx.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/mux.h | 26 |
5 files changed, 180 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 52bfe4cba25c..b1df784ed702 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/console.h> | 17 | #include <linux/console.h> |
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/i2c/at24.h> | 19 | #include <linux/i2c/at24.h> |
20 | #include <linux/gpio.h> | ||
20 | 21 | ||
21 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
22 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
@@ -29,6 +30,9 @@ | |||
29 | #define DA850_EVM_PHY_MASK 0x1 | 30 | #define DA850_EVM_PHY_MASK 0x1 |
30 | #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ | 31 | #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ |
31 | 32 | ||
33 | #define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15) | ||
34 | #define DA850_LCD_PWR_PIN GPIO_TO_PIN(8, 10) | ||
35 | |||
32 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { | 36 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { |
33 | .bus_freq = 100, /* kHz */ | 37 | .bus_freq = 100, /* kHz */ |
34 | .bus_delay = 0, /* usec */ | 38 | .bus_delay = 0, /* usec */ |
@@ -59,6 +63,37 @@ static struct snd_platform_data da850_evm_snd_data = { | |||
59 | .rxnumevt = 1, | 63 | .rxnumevt = 1, |
60 | }; | 64 | }; |
61 | 65 | ||
66 | static int da850_lcd_hw_init(void) | ||
67 | { | ||
68 | int status; | ||
69 | |||
70 | status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n"); | ||
71 | if (status < 0) | ||
72 | return status; | ||
73 | |||
74 | status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n"); | ||
75 | if (status < 0) { | ||
76 | gpio_free(DA850_LCD_BL_PIN); | ||
77 | return status; | ||
78 | } | ||
79 | |||
80 | gpio_direction_output(DA850_LCD_BL_PIN, 0); | ||
81 | gpio_direction_output(DA850_LCD_PWR_PIN, 0); | ||
82 | |||
83 | /* disable lcd backlight */ | ||
84 | gpio_set_value(DA850_LCD_BL_PIN, 0); | ||
85 | |||
86 | /* disable lcd power */ | ||
87 | gpio_set_value(DA850_LCD_PWR_PIN, 0); | ||
88 | |||
89 | /* enable lcd power */ | ||
90 | gpio_set_value(DA850_LCD_PWR_PIN, 1); | ||
91 | |||
92 | /* enable lcd backlight */ | ||
93 | gpio_set_value(DA850_LCD_BL_PIN, 1); | ||
94 | |||
95 | return 0; | ||
96 | } | ||
62 | 97 | ||
63 | static __init void da850_evm_init(void) | 98 | static __init void da850_evm_init(void) |
64 | { | 99 | { |
@@ -115,6 +150,21 @@ static __init void da850_evm_init(void) | |||
115 | ret); | 150 | ret); |
116 | 151 | ||
117 | da8xx_init_mcasp(0, &da850_evm_snd_data); | 152 | da8xx_init_mcasp(0, &da850_evm_snd_data); |
153 | |||
154 | ret = da8xx_pinmux_setup(da850_lcdcntl_pins); | ||
155 | if (ret) | ||
156 | pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n", | ||
157 | ret); | ||
158 | |||
159 | ret = da850_lcd_hw_init(); | ||
160 | if (ret) | ||
161 | pr_warning("da850_evm_init: lcd initialization failed: %d\n", | ||
162 | ret); | ||
163 | |||
164 | ret = da8xx_register_lcdc(); | ||
165 | if (ret) | ||
166 | pr_warning("da850_evm_init: lcdc registration failed: %d\n", | ||
167 | ret); | ||
118 | } | 168 | } |
119 | 169 | ||
120 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 170 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index e440c09c5576..e6e605bf1516 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c | |||
@@ -297,6 +297,13 @@ static struct clk mcasp_clk = { | |||
297 | .psc_ctlr = 1, | 297 | .psc_ctlr = 1, |
298 | }; | 298 | }; |
299 | 299 | ||
300 | static struct clk lcdc_clk = { | ||
301 | .name = "lcdc", | ||
302 | .parent = &pll0_sysclk2, | ||
303 | .lpsc = DA8XX_LPSC1_LCDC, | ||
304 | .psc_ctlr = 1, | ||
305 | }; | ||
306 | |||
300 | static struct davinci_clk da850_clks[] = { | 307 | static struct davinci_clk da850_clks[] = { |
301 | CLK(NULL, "ref", &ref_clk), | 308 | CLK(NULL, "ref", &ref_clk), |
302 | CLK(NULL, "pll0", &pll0_clk), | 309 | CLK(NULL, "pll0", &pll0_clk), |
@@ -335,6 +342,7 @@ static struct davinci_clk da850_clks[] = { | |||
335 | CLK(NULL, "rmii", &rmii_clk), | 342 | CLK(NULL, "rmii", &rmii_clk), |
336 | CLK("davinci_emac.1", NULL, &emac_clk), | 343 | CLK("davinci_emac.1", NULL, &emac_clk), |
337 | CLK("davinci-mcasp.0", NULL, &mcasp_clk), | 344 | CLK("davinci-mcasp.0", NULL, &mcasp_clk), |
345 | CLK("da8xx_lcdc.0", NULL, &lcdc_clk), | ||
338 | CLK(NULL, NULL, NULL), | 346 | CLK(NULL, NULL, NULL), |
339 | }; | 347 | }; |
340 | 348 | ||
@@ -405,6 +413,30 @@ static const struct mux_config da850_pins[] = { | |||
405 | MUX_CFG(DA850, AXR_2, 2, 20, 15, 1, false) | 413 | MUX_CFG(DA850, AXR_2, 2, 20, 15, 1, false) |
406 | MUX_CFG(DA850, AXR_1, 2, 24, 15, 1, false) | 414 | MUX_CFG(DA850, AXR_1, 2, 24, 15, 1, false) |
407 | MUX_CFG(DA850, AXR_0, 2, 28, 15, 1, false) | 415 | MUX_CFG(DA850, AXR_0, 2, 28, 15, 1, false) |
416 | /* LCD function */ | ||
417 | MUX_CFG(DA850, LCD_D_7, 16, 8, 15, 2, false) | ||
418 | MUX_CFG(DA850, LCD_D_6, 16, 12, 15, 2, false) | ||
419 | MUX_CFG(DA850, LCD_D_5, 16, 16, 15, 2, false) | ||
420 | MUX_CFG(DA850, LCD_D_4, 16, 20, 15, 2, false) | ||
421 | MUX_CFG(DA850, LCD_D_3, 16, 24, 15, 2, false) | ||
422 | MUX_CFG(DA850, LCD_D_2, 16, 28, 15, 2, false) | ||
423 | MUX_CFG(DA850, LCD_D_1, 17, 0, 15, 2, false) | ||
424 | MUX_CFG(DA850, LCD_D_0, 17, 4, 15, 2, false) | ||
425 | MUX_CFG(DA850, LCD_D_15, 17, 8, 15, 2, false) | ||
426 | MUX_CFG(DA850, LCD_D_14, 17, 12, 15, 2, false) | ||
427 | MUX_CFG(DA850, LCD_D_13, 17, 16, 15, 2, false) | ||
428 | MUX_CFG(DA850, LCD_D_12, 17, 20, 15, 2, false) | ||
429 | MUX_CFG(DA850, LCD_D_11, 17, 24, 15, 2, false) | ||
430 | MUX_CFG(DA850, LCD_D_10, 17, 28, 15, 2, false) | ||
431 | MUX_CFG(DA850, LCD_D_9, 18, 0, 15, 2, false) | ||
432 | MUX_CFG(DA850, LCD_D_8, 18, 4, 15, 2, false) | ||
433 | MUX_CFG(DA850, LCD_PCLK, 18, 24, 15, 2, false) | ||
434 | MUX_CFG(DA850, LCD_HSYNC, 19, 0, 15, 2, false) | ||
435 | MUX_CFG(DA850, LCD_VSYNC, 19, 4, 15, 2, false) | ||
436 | MUX_CFG(DA850, NLCD_AC_ENB_CS, 19, 24, 15, 2, false) | ||
437 | /* GPIO function */ | ||
438 | MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) | ||
439 | MUX_CFG(DA850, GPIO8_10, 18, 28, 15, 8, false) | ||
408 | #endif | 440 | #endif |
409 | }; | 441 | }; |
410 | 442 | ||
@@ -449,6 +481,16 @@ const short da850_mcasp_pins[] __initdata = { | |||
449 | -1 | 481 | -1 |
450 | }; | 482 | }; |
451 | 483 | ||
484 | const short da850_lcdcntl_pins[] __initdata = { | ||
485 | DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3, DA850_LCD_D_4, | ||
486 | DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7, DA850_LCD_D_8, | ||
487 | DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11, DA850_LCD_D_12, | ||
488 | DA850_LCD_D_13, DA850_LCD_D_14, DA850_LCD_D_15, DA850_LCD_PCLK, | ||
489 | DA850_LCD_HSYNC, DA850_LCD_VSYNC, DA850_NLCD_AC_ENB_CS, DA850_GPIO2_15, | ||
490 | DA850_GPIO8_10, | ||
491 | -1 | ||
492 | }; | ||
493 | |||
452 | /* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ | 494 | /* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ |
453 | static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = { | 495 | static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = { |
454 | [IRQ_DA8XX_COMMTX] = 7, | 496 | [IRQ_DA8XX_COMMTX] = 7, |
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 1882eef3aead..094eb8ed8e76 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <mach/common.h> | 21 | #include <mach/common.h> |
22 | #include <mach/time.h> | 22 | #include <mach/time.h> |
23 | #include <mach/da8xx.h> | 23 | #include <mach/da8xx.h> |
24 | #include <video/da8xx-fb.h> | ||
24 | 25 | ||
25 | #include "clock.h" | 26 | #include "clock.h" |
26 | 27 | ||
@@ -353,3 +354,61 @@ void __init da8xx_init_mcasp(int id, struct snd_platform_data *pdata) | |||
353 | platform_device_register(&da850_mcasp_device); | 354 | platform_device_register(&da850_mcasp_device); |
354 | } | 355 | } |
355 | } | 356 | } |
357 | |||
358 | static const struct display_panel disp_panel = { | ||
359 | QVGA, | ||
360 | 16, | ||
361 | 16, | ||
362 | COLOR_ACTIVE, | ||
363 | }; | ||
364 | |||
365 | static struct lcd_ctrl_config lcd_cfg = { | ||
366 | &disp_panel, | ||
367 | .ac_bias = 255, | ||
368 | .ac_bias_intrpt = 0, | ||
369 | .dma_burst_sz = 16, | ||
370 | .bpp = 16, | ||
371 | .fdd = 255, | ||
372 | .tft_alt_mode = 0, | ||
373 | .stn_565_mode = 0, | ||
374 | .mono_8bit_mode = 0, | ||
375 | .invert_line_clock = 1, | ||
376 | .invert_frm_clock = 1, | ||
377 | .sync_edge = 0, | ||
378 | .sync_ctrl = 1, | ||
379 | .raster_order = 0, | ||
380 | }; | ||
381 | |||
382 | static struct da8xx_lcdc_platform_data da850_evm_lcdc_pdata = { | ||
383 | .manu_name = "sharp", | ||
384 | .controller_data = &lcd_cfg, | ||
385 | .type = "Sharp_LK043T1DG01", | ||
386 | }; | ||
387 | |||
388 | static struct resource da8xx_lcdc_resources[] = { | ||
389 | [0] = { /* registers */ | ||
390 | .start = DA8XX_LCD_CNTRL_BASE, | ||
391 | .end = DA8XX_LCD_CNTRL_BASE + SZ_4K - 1, | ||
392 | .flags = IORESOURCE_MEM, | ||
393 | }, | ||
394 | [1] = { /* interrupt */ | ||
395 | .start = IRQ_DA8XX_LCDINT, | ||
396 | .end = IRQ_DA8XX_LCDINT, | ||
397 | .flags = IORESOURCE_IRQ, | ||
398 | }, | ||
399 | }; | ||
400 | |||
401 | static struct platform_device da850_lcdc_device = { | ||
402 | .name = "da8xx_lcdc", | ||
403 | .id = 0, | ||
404 | .num_resources = ARRAY_SIZE(da8xx_lcdc_resources), | ||
405 | .resource = da8xx_lcdc_resources, | ||
406 | .dev = { | ||
407 | .platform_data = &da850_evm_lcdc_pdata, | ||
408 | } | ||
409 | }; | ||
410 | |||
411 | int __init da8xx_register_lcdc(void) | ||
412 | { | ||
413 | return platform_device_register(&da850_lcdc_device); | ||
414 | } | ||
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 30c5c407ea85..0af3fb6077a3 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #define DA8XX_TIMER64P1_BASE 0x01c21000 | 37 | #define DA8XX_TIMER64P1_BASE 0x01c21000 |
38 | #define DA8XX_GPIO_BASE 0x01e26000 | 38 | #define DA8XX_GPIO_BASE 0x01e26000 |
39 | #define DA8XX_PSC1_BASE 0x01e27000 | 39 | #define DA8XX_PSC1_BASE 0x01e27000 |
40 | #define DA8XX_LCD_CNTRL_BASE 0x01e13000 | ||
40 | 41 | ||
41 | #define PINMUX0 0x00 | 42 | #define PINMUX0 0x00 |
42 | #define PINMUX1 0x04 | 43 | #define PINMUX1 0x04 |
@@ -66,6 +67,7 @@ int da8xx_register_edma(void); | |||
66 | int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); | 67 | int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); |
67 | int da8xx_register_watchdog(void); | 68 | int da8xx_register_watchdog(void); |
68 | int da8xx_register_emac(void); | 69 | int da8xx_register_emac(void); |
70 | int da8xx_register_lcdc(void); | ||
69 | void __init da8xx_init_mcasp(int id, struct snd_platform_data *pdata); | 71 | void __init da8xx_init_mcasp(int id, struct snd_platform_data *pdata); |
70 | 72 | ||
71 | extern struct platform_device da8xx_serial_device; | 73 | extern struct platform_device da8xx_serial_device; |
@@ -103,6 +105,7 @@ extern const short da850_i2c0_pins[]; | |||
103 | extern const short da850_i2c1_pins[]; | 105 | extern const short da850_i2c1_pins[]; |
104 | extern const short da850_cpgmac_pins[]; | 106 | extern const short da850_cpgmac_pins[]; |
105 | extern const short da850_mcasp_pins[]; | 107 | extern const short da850_mcasp_pins[]; |
108 | extern const short da850_lcdcntl_pins[]; | ||
106 | 109 | ||
107 | int da8xx_pinmux_setup(const short pins[]); | 110 | int da8xx_pinmux_setup(const short pins[]); |
108 | 111 | ||
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h index 82d751461856..30bf329d5373 100644 --- a/arch/arm/mach-davinci/include/mach/mux.h +++ b/arch/arm/mach-davinci/include/mach/mux.h | |||
@@ -775,6 +775,32 @@ enum davinci_da850_index { | |||
775 | DA850_AXR_2, | 775 | DA850_AXR_2, |
776 | DA850_AXR_1, | 776 | DA850_AXR_1, |
777 | DA850_AXR_0, | 777 | DA850_AXR_0, |
778 | |||
779 | /* LCD function */ | ||
780 | DA850_LCD_D_7, | ||
781 | DA850_LCD_D_6, | ||
782 | DA850_LCD_D_5, | ||
783 | DA850_LCD_D_4, | ||
784 | DA850_LCD_D_3, | ||
785 | DA850_LCD_D_2, | ||
786 | DA850_LCD_D_1, | ||
787 | DA850_LCD_D_0, | ||
788 | DA850_LCD_D_15, | ||
789 | DA850_LCD_D_14, | ||
790 | DA850_LCD_D_13, | ||
791 | DA850_LCD_D_12, | ||
792 | DA850_LCD_D_11, | ||
793 | DA850_LCD_D_10, | ||
794 | DA850_LCD_D_9, | ||
795 | DA850_LCD_D_8, | ||
796 | DA850_LCD_PCLK, | ||
797 | DA850_LCD_HSYNC, | ||
798 | DA850_LCD_VSYNC, | ||
799 | DA850_NLCD_AC_ENB_CS, | ||
800 | |||
801 | /* GPIO function */ | ||
802 | DA850_GPIO2_15, | ||
803 | DA850_GPIO8_10, | ||
778 | }; | 804 | }; |
779 | 805 | ||
780 | #ifdef CONFIG_DAVINCI_MUX | 806 | #ifdef CONFIG_DAVINCI_MUX |