diff options
author | Sudhakar Rajashekhara <sudhakar.raj@ti.com> | 2009-08-13 14:33:14 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-08-26 11:55:54 +0300 |
commit | 5cbdf276bd9d9cd3cb9616f8253390096c1a237f (patch) | |
tree | d351c6e24902e1b6600b1559fedb40c7a0edddbb /arch/arm/mach-davinci | |
parent | b1466376b22e1ec6395ccda7580deb72d3a809ad (diff) |
davinci: Add platform support for da850/omap-l138 GLCD
This patch adds platform support for the graphic display
(Sharp LK043T1DG01) found on DA850/OMAP-L138 based EVM.
Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-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 52bfe4cba25..b1df784ed70 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -17,6 +17,7 @@ #include <linux/console.h> #include <linux/i2c.h> #include <linux/i2c/at24.h> +#include <linux/gpio.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -29,6 +30,9 @@ #define DA850_EVM_PHY_MASK 0x1 #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ +#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15) +#define DA850_LCD_PWR_PIN GPIO_TO_PIN(8, 10) + static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { .bus_freq = 100, /* kHz */ .bus_delay = 0, /* usec */ @@ -59,6 +63,37 @@ static struct snd_platform_data da850_evm_snd_data = { .rxnumevt = 1, }; +static int da850_lcd_hw_init(void) +{ + int status; + + status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n"); + if (status < 0) + return status; + + status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n"); + if (status < 0) { + gpio_free(DA850_LCD_BL_PIN); + return status; + } + + gpio_direction_output(DA850_LCD_BL_PIN, 0); + gpio_direction_output(DA850_LCD_PWR_PIN, 0); + + /* disable lcd backlight */ + gpio_set_value(DA850_LCD_BL_PIN, 0); + + /* disable lcd power */ + gpio_set_value(DA850_LCD_PWR_PIN, 0); + + /* enable lcd power */ + gpio_set_value(DA850_LCD_PWR_PIN, 1); + + /* enable lcd backlight */ + gpio_set_value(DA850_LCD_BL_PIN, 1); + + return 0; +} static __init void da850_evm_init(void) { @@ -115,6 +150,21 @@ static __init void da850_evm_init(void) ret); da8xx_init_mcasp(0, &da850_evm_snd_data); + + ret = da8xx_pinmux_setup(da850_lcdcntl_pins); + if (ret) + pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n", + ret); + + ret = da850_lcd_hw_init(); + if (ret) + pr_warning("da850_evm_init: lcd initialization failed: %d\n", + ret); + + ret = da8xx_register_lcdc(); + if (ret) + pr_warning("da850_evm_init: lcdc registration failed: %d\n", + ret); } #ifdef CONFIG_SERIAL_8250_CONSOLE diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index e440c09c557..e6e605bf151 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -297,6 +297,13 @@ static struct clk mcasp_clk = { .psc_ctlr = 1, }; +static struct clk lcdc_clk = { + .name = "lcdc", + .parent = &pll0_sysclk2, + .lpsc = DA8XX_LPSC1_LCDC, + .psc_ctlr = 1, +}; + static struct davinci_clk da850_clks[] = { CLK(NULL, "ref", &ref_clk), CLK(NULL, "pll0", &pll0_clk), @@ -335,6 +342,7 @@ static struct davinci_clk da850_clks[] = { CLK(NULL, "rmii", &rmii_clk), CLK("davinci_emac.1", NULL, &emac_clk), CLK("davinci-mcasp.0", NULL, &mcasp_clk), + CLK("da8xx_lcdc.0", NULL, &lcdc_clk), CLK(NULL, NULL, NULL), }; @@ -405,6 +413,30 @@ static const struct mux_config da850_pins[] = { MUX_CFG(DA850, AXR_2, 2, 20, 15, 1, false) MUX_CFG(DA850, AXR_1, 2, 24, 15, 1, false) MUX_CFG(DA850, AXR_0, 2, 28, 15, 1, false) + /* LCD function */ + MUX_CFG(DA850, LCD_D_7, 16, 8, 15, 2, false) + MUX_CFG(DA850, LCD_D_6, 16, 12, 15, 2, false) + MUX_CFG(DA850, LCD_D_5, 16, 16, 15, 2, false) + MUX_CFG(DA850, LCD_D_4, 16, 20, 15, 2, false) + MUX_CFG(DA850, LCD_D_3, 16, 24, 15, 2, false) + MUX_CFG(DA850, LCD_D_2, 16, 28, 15, 2, false) + MUX_CFG(DA850, LCD_D_1, 17, 0, 15, 2, false) + MUX_CFG(DA850, LCD_D_0, 17, 4, 15, 2, false) + MUX_CFG(DA850, LCD_D_15, 17, 8, 15, 2, false) + MUX_CFG(DA850, LCD_D_14, 17, 12, 15, 2, false) + MUX_CFG(DA850, LCD_D_13, 17, 16, 15, 2, false) + MUX_CFG(DA850, LCD_D_12, 17, 20, 15, 2, false) + MUX_CFG(DA850, LCD_D_11, 17, 24, 15, 2, false) + MUX_CFG(DA850, LCD_D_10, 17, 28, 15, 2, false) + MUX_CFG(DA850, LCD_D_9, 18, 0, 15, 2, false) + MUX_CFG(DA850, LCD_D_8, 18, 4, 15, 2, false) + MUX_CFG(DA850, LCD_PCLK, 18, 24, 15, 2, false) + MUX_CFG(DA850, LCD_HSYNC, 19, 0, 15, 2, false) + MUX_CFG(DA850, LCD_VSYNC, 19, 4, 15, 2, false) + MUX_CFG(DA850, NLCD_AC_ENB_CS, 19, 24, 15, 2, false) + /* GPIO function */ + MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) + MUX_CFG(DA850, GPIO8_10, 18, 28, 15, 8, false) #endif }; @@ -449,6 +481,16 @@ const short da850_mcasp_pins[] __initdata = { -1 }; +const short da850_lcdcntl_pins[] __initdata = { + DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3, DA850_LCD_D_4, + DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7, DA850_LCD_D_8, + DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11, DA850_LCD_D_12, + DA850_LCD_D_13, DA850_LCD_D_14, DA850_LCD_D_15, DA850_LCD_PCLK, + DA850_LCD_HSYNC, DA850_LCD_VSYNC, DA850_NLCD_AC_ENB_CS, DA850_GPIO2_15, + DA850_GPIO8_10, + -1 +}; + /* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = { [IRQ_DA8XX_COMMTX] = 7, diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 1882eef3aea..094eb8ed8e7 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -21,6 +21,7 @@ #include <mach/common.h> #include <mach/time.h> #include <mach/da8xx.h> +#include <video/da8xx-fb.h> #include "clock.h" @@ -353,3 +354,61 @@ void __init da8xx_init_mcasp(int id, struct snd_platform_data *pdata) platform_device_register(&da850_mcasp_device); } } + +static const struct display_panel disp_panel = { + QVGA, + 16, + 16, + COLOR_ACTIVE, +}; + +static struct lcd_ctrl_config lcd_cfg = { + &disp_panel, + .ac_bias = 255, + .ac_bias_intrpt = 0, + .dma_burst_sz = 16, + .bpp = 16, + .fdd = 255, + .tft_alt_mode = 0, + .stn_565_mode = 0, + .mono_8bit_mode = 0, + .invert_line_clock = 1, + .invert_frm_clock = 1, + .sync_edge = 0, + .sync_ctrl = 1, + .raster_order = 0, +}; + +static struct da8xx_lcdc_platform_data da850_evm_lcdc_pdata = { + .manu_name = "sharp", + .controller_data = &lcd_cfg, + .type = "Sharp_LK043T1DG01", +}; + +static struct resource da8xx_lcdc_resources[] = { + [0] = { /* registers */ + .start = DA8XX_LCD_CNTRL_BASE, + .end = DA8XX_LCD_CNTRL_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { /* interrupt */ + .start = IRQ_DA8XX_LCDINT, + .end = IRQ_DA8XX_LCDINT, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device da850_lcdc_device = { + .name = "da8xx_lcdc", + .id = 0, + .num_resources = ARRAY_SIZE(da8xx_lcdc_resources), + .resource = da8xx_lcdc_resources, + .dev = { + .platform_data = &da850_evm_lcdc_pdata, + } +}; + +int __init da8xx_register_lcdc(void) +{ + return platform_device_register(&da850_lcdc_device); +} diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 30c5c407ea8..0af3fb6077a 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -37,6 +37,7 @@ #define DA8XX_TIMER64P1_BASE 0x01c21000 #define DA8XX_GPIO_BASE 0x01e26000 #define DA8XX_PSC1_BASE 0x01e27000 +#define DA8XX_LCD_CNTRL_BASE 0x01e13000 #define PINMUX0 0x00 #define PINMUX1 0x04 @@ -66,6 +67,7 @@ int da8xx_register_edma(void); int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); int da8xx_register_watchdog(void); int da8xx_register_emac(void); +int da8xx_register_lcdc(void); void __init da8xx_init_mcasp(int id, struct snd_platform_data *pdata); extern struct platform_device da8xx_serial_device; @@ -103,6 +105,7 @@ extern const short da850_i2c0_pins[]; extern const short da850_i2c1_pins[]; extern const short da850_cpgmac_pins[]; extern const short da850_mcasp_pins[]; +extern const short da850_lcdcntl_pins[]; int da8xx_pinmux_setup(const short pins[]); diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h index 82d75146185..30bf329d537 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 { DA850_AXR_2, DA850_AXR_1, DA850_AXR_0, + + /* LCD function */ + DA850_LCD_D_7, + DA850_LCD_D_6, + DA850_LCD_D_5, + DA850_LCD_D_4, + DA850_LCD_D_3, + DA850_LCD_D_2, + DA850_LCD_D_1, + DA850_LCD_D_0, + DA850_LCD_D_15, + DA850_LCD_D_14, + DA850_LCD_D_13, + DA850_LCD_D_12, + DA850_LCD_D_11, + DA850_LCD_D_10, + DA850_LCD_D_9, + DA850_LCD_D_8, + DA850_LCD_PCLK, + DA850_LCD_HSYNC, + DA850_LCD_VSYNC, + DA850_NLCD_AC_ENB_CS, + + /* GPIO function */ + DA850_GPIO2_15, + DA850_GPIO8_10, }; #ifdef CONFIG_DAVINCI_MUX |