[glsdk/meta-ti-glsdk.git] / recipes-bsp / linux / linux-omap-psp-2.6.32 / 0005-board-omap3-beagle-add-DSS2-support.patch
1 From 818b8bbfb472de23b10aec58acd55eb31fafe0b9 Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Wed, 10 Feb 2010 15:07:36 +0100
4 Subject: [PATCH 05/45] board-omap3-beagle: add DSS2 support
6 ---
7 arch/arm/mach-omap2/board-omap3beagle.c | 130 ++++++++++++++++++++++++-------
8 1 files changed, 103 insertions(+), 27 deletions(-)
10 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
11 index 9f72c7a..3b7f6ec 100644
12 --- a/arch/arm/mach-omap2/board-omap3beagle.c
13 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
14 @@ -40,6 +40,7 @@
16 #include <plat/board.h>
17 #include <plat/common.h>
18 +#include <plat/display.h>
19 #include <plat/gpmc.h>
20 #include <plat/nand.h>
21 #include <plat/usb.h>
22 @@ -153,6 +154,105 @@ static struct platform_device omap3beagle_nand_device = {
23 .resource = &omap3beagle_nand_resource,
24 };
26 +/* DSS */
27 +
28 +static int beagle_enable_dvi(struct omap_dss_device *dssdev)
29 +{
30 + if (dssdev->reset_gpio != -1)
31 + gpio_set_value(dssdev->reset_gpio, 1);
32 +
33 + return 0;
34 +}
35 +
36 +static void beagle_disable_dvi(struct omap_dss_device *dssdev)
37 +{
38 + if (dssdev->reset_gpio != -1)
39 + gpio_set_value(dssdev->reset_gpio, 0);
40 +}
41 +
42 +static struct omap_dss_device beagle_dvi_device = {
43 + .type = OMAP_DISPLAY_TYPE_DPI,
44 + .name = "dvi",
45 + .driver_name = "generic_panel",
46 + .phy.dpi.data_lines = 24,
47 + .reset_gpio = 170,
48 + .platform_enable = beagle_enable_dvi,
49 + .platform_disable = beagle_disable_dvi,
50 +};
51 +
52 +static int beagle_panel_enable_tv(struct omap_dss_device *dssdev)
53 +{
54 +#define ENABLE_VDAC_DEDICATED 0x03
55 +#define ENABLE_VDAC_DEV_GRP 0x20
56 +
57 + twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
58 + ENABLE_VDAC_DEDICATED,
59 + TWL4030_VDAC_DEDICATED);
60 + twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
61 + ENABLE_VDAC_DEV_GRP, TWL4030_VDAC_DEV_GRP);
62 +
63 + return 0;
64 +}
65 +
66 +static void beagle_panel_disable_tv(struct omap_dss_device *dssdev)
67 +{
68 + twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00,
69 + TWL4030_VDAC_DEDICATED);
70 + twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00,
71 + TWL4030_VDAC_DEV_GRP);
72 +}
73 +
74 +static struct omap_dss_device beagle_tv_device = {
75 + .name = "tv",
76 + .driver_name = "venc",
77 + .type = OMAP_DISPLAY_TYPE_VENC,
78 + .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
79 + .platform_enable = beagle_panel_enable_tv,
80 + .platform_disable = beagle_panel_disable_tv,
81 +};
82 +
83 +static struct omap_dss_device *beagle_dss_devices[] = {
84 + &beagle_dvi_device,
85 + &beagle_tv_device,
86 +};
87 +
88 +static struct omap_dss_board_info beagle_dss_data = {
89 + .num_devices = ARRAY_SIZE(beagle_dss_devices),
90 + .devices = beagle_dss_devices,
91 + .default_device = &beagle_dvi_device,
92 +};
93 +
94 +static struct platform_device beagle_dss_device = {
95 + .name = "omapdss",
96 + .id = -1,
97 + .dev = {
98 + .platform_data = &beagle_dss_data,
99 + },
100 +};
101 +
102 +static struct regulator_consumer_supply beagle_vdac_supply = {
103 + .supply = "vdda_dac",
104 + .dev = &beagle_dss_device.dev,
105 +};
106 +
107 +static struct regulator_consumer_supply beagle_vdvi_supply = {
108 + .supply = "vdds_dsi",
109 + .dev = &beagle_dss_device.dev,
110 +};
111 +
112 +static void __init beagle_display_init(void)
113 +{
114 + int r;
115 +
116 + r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset");
117 + if (r < 0) {
118 + printk(KERN_ERR "Unable to get DVI reset GPIO\n");
119 + return;
120 + }
121 +
122 + gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
123 +}
124 +
125 #include "sdram-micron-mt46h32m32lf-6.h"
127 static struct twl4030_hsmmc_info mmc[] = {
128 @@ -172,15 +272,6 @@ static struct twl4030_hsmmc_info mmc[] = {
129 {} /* Terminator */
130 };
132 -static struct platform_device omap3_beagle_lcd_device = {
133 - .name = "omap3beagle_lcd",
134 - .id = -1,
135 -};
136 -
137 -static struct omap_lcd_config omap3_beagle_lcd_config __initdata = {
138 - .ctrl_name = "internal",
139 -};
140 -
141 static struct regulator_consumer_supply beagle_vmmc1_supply = {
142 .supply = "vmmc",
143 };
144 @@ -236,16 +327,6 @@ static struct twl4030_gpio_platform_data beagle_gpio_data = {
145 .setup = beagle_twl_gpio_setup,
146 };
148 -static struct regulator_consumer_supply beagle_vdac_supply = {
149 - .supply = "vdac",
150 - .dev = &omap3_beagle_lcd_device.dev,
151 -};
152 -
153 -static struct regulator_consumer_supply beagle_vdvi_supply = {
154 - .supply = "vdvi",
155 - .dev = &omap3_beagle_lcd_device.dev,
156 -};
157 -
158 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
159 static struct regulator_init_data beagle_vmmc1 = {
160 .constraints = {
161 @@ -418,14 +499,8 @@ static struct platform_device keys_gpio = {
162 },
163 };
165 -static struct omap_board_config_kernel omap3_beagle_config[] __initdata = {
166 - { OMAP_TAG_LCD, &omap3_beagle_lcd_config },
167 -};
168 -
169 static void __init omap3_beagle_init_irq(void)
170 {
171 - omap_board_config = omap3_beagle_config;
172 - omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
173 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
174 mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
175 omap3_dsp_rate_table, omap3_l3_rate_table);
176 @@ -437,9 +512,9 @@ static void __init omap3_beagle_init_irq(void)
177 }
179 static struct platform_device *omap3_beagle_devices[] __initdata = {
180 - &omap3_beagle_lcd_device,
181 &leds_gpio,
182 &keys_gpio,
183 + &beagle_dss_device,
184 };
186 static void __init omap3beagle_flash_init(void)
187 @@ -522,8 +597,9 @@ static void __init omap3_beagle_init(void)
188 /* Ensure SDRC pins are mux'd for self-refresh */
189 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
190 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
191 -}
193 + beagle_display_init();
194 +}
195 static void __init omap3_beagle_map_io(void)
196 {
197 omap2_set_globals_343x();
198 --
199 1.6.6.1