diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-ldp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-ldp.c | 130 |
1 files changed, 113 insertions, 17 deletions
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 218764c9377e..e179da0c4da5 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | #include <linux/gpio.h> | |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/smsc911x.h> | 28 | #include <linux/smsc911x.h> |
29 | #include <linux/mmc/host.h> | 29 | #include <linux/mmc/host.h> |
30 | #include <linux/gpio.h> | ||
30 | 31 | ||
31 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
32 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
@@ -34,7 +35,6 @@ | |||
34 | #include <asm/mach/map.h> | 35 | #include <asm/mach/map.h> |
35 | 36 | ||
36 | #include <plat/mcspi.h> | 37 | #include <plat/mcspi.h> |
37 | #include <mach/gpio.h> | ||
38 | #include <plat/board.h> | 38 | #include <plat/board.h> |
39 | #include <plat/common.h> | 39 | #include <plat/common.h> |
40 | #include <plat/gpmc.h> | 40 | #include <plat/gpmc.h> |
@@ -44,6 +44,9 @@ | |||
44 | #include <plat/usb.h> | 44 | #include <plat/usb.h> |
45 | #include <plat/gpmc-smsc911x.h> | 45 | #include <plat/gpmc-smsc911x.h> |
46 | 46 | ||
47 | #include <video/omapdss.h> | ||
48 | #include <video/omap-panel-generic-dpi.h> | ||
49 | |||
47 | #include "board-flash.h" | 50 | #include "board-flash.h" |
48 | #include "mux.h" | 51 | #include "mux.h" |
49 | #include "hsmmc.h" | 52 | #include "hsmmc.h" |
@@ -180,29 +183,102 @@ static inline void __init ldp_init_smsc911x(void) | |||
180 | gpmc_smsc911x_init(&smsc911x_cfg); | 183 | gpmc_smsc911x_init(&smsc911x_cfg); |
181 | } | 184 | } |
182 | 185 | ||
183 | static struct platform_device ldp_lcd_device = { | 186 | /* LCD */ |
184 | .name = "ldp_lcd", | 187 | |
185 | .id = -1, | 188 | static int ldp_backlight_gpio; |
189 | static int ldp_lcd_enable_gpio; | ||
190 | |||
191 | #define LCD_PANEL_RESET_GPIO 55 | ||
192 | #define LCD_PANEL_QVGA_GPIO 56 | ||
193 | |||
194 | static int ldp_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
195 | { | ||
196 | if (gpio_is_valid(ldp_lcd_enable_gpio)) | ||
197 | gpio_direction_output(ldp_lcd_enable_gpio, 1); | ||
198 | if (gpio_is_valid(ldp_backlight_gpio)) | ||
199 | gpio_direction_output(ldp_backlight_gpio, 1); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static void ldp_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
205 | { | ||
206 | if (gpio_is_valid(ldp_lcd_enable_gpio)) | ||
207 | gpio_direction_output(ldp_lcd_enable_gpio, 0); | ||
208 | if (gpio_is_valid(ldp_backlight_gpio)) | ||
209 | gpio_direction_output(ldp_backlight_gpio, 0); | ||
210 | } | ||
211 | |||
212 | static struct panel_generic_dpi_data ldp_panel_data = { | ||
213 | .name = "nec_nl2432dr22-11b", | ||
214 | .platform_enable = ldp_panel_enable_lcd, | ||
215 | .platform_disable = ldp_panel_disable_lcd, | ||
216 | }; | ||
217 | |||
218 | static struct omap_dss_device ldp_lcd_device = { | ||
219 | .name = "lcd", | ||
220 | .driver_name = "generic_dpi_panel", | ||
221 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
222 | .phy.dpi.data_lines = 18, | ||
223 | .data = &ldp_panel_data, | ||
186 | }; | 224 | }; |
187 | 225 | ||
188 | static struct omap_lcd_config ldp_lcd_config __initdata = { | 226 | static struct omap_dss_device *ldp_dss_devices[] = { |
189 | .ctrl_name = "internal", | 227 | &ldp_lcd_device, |
190 | }; | 228 | }; |
191 | 229 | ||
192 | static struct omap_board_config_kernel ldp_config[] __initdata = { | 230 | static struct omap_dss_board_info ldp_dss_data = { |
193 | { OMAP_TAG_LCD, &ldp_lcd_config }, | 231 | .num_devices = ARRAY_SIZE(ldp_dss_devices), |
232 | .devices = ldp_dss_devices, | ||
233 | .default_device = &ldp_lcd_device, | ||
194 | }; | 234 | }; |
195 | 235 | ||
196 | static void __init omap_ldp_init_early(void) | 236 | static void __init ldp_display_init(void) |
237 | { | ||
238 | int r; | ||
239 | |||
240 | static struct gpio gpios[] __initdata = { | ||
241 | {LCD_PANEL_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "LCD RESET"}, | ||
242 | {LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "LCD QVGA"}, | ||
243 | }; | ||
244 | |||
245 | r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); | ||
246 | if (r) { | ||
247 | pr_err("Cannot request LCD GPIOs, error %d\n", r); | ||
248 | return; | ||
249 | } | ||
250 | |||
251 | omap_display_init(&ldp_dss_data); | ||
252 | } | ||
253 | |||
254 | static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) | ||
197 | { | 255 | { |
198 | omap2_init_common_infrastructure(); | 256 | int r; |
199 | omap2_init_common_devices(NULL, NULL); | 257 | |
258 | struct gpio gpios[] = { | ||
259 | {gpio + 7 , GPIOF_OUT_INIT_LOW, "LCD ENABLE"}, | ||
260 | {gpio + 15, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT"}, | ||
261 | }; | ||
262 | |||
263 | r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); | ||
264 | if (r) { | ||
265 | pr_err("Cannot request LCD GPIOs, error %d\n", r); | ||
266 | ldp_backlight_gpio = -EINVAL; | ||
267 | ldp_lcd_enable_gpio = -EINVAL; | ||
268 | return r; | ||
269 | } | ||
270 | |||
271 | ldp_backlight_gpio = gpio + 15; | ||
272 | ldp_lcd_enable_gpio = gpio + 7; | ||
273 | |||
274 | return 0; | ||
200 | } | 275 | } |
201 | 276 | ||
202 | static struct twl4030_gpio_platform_data ldp_gpio_data = { | 277 | static struct twl4030_gpio_platform_data ldp_gpio_data = { |
203 | .gpio_base = OMAP_MAX_GPIO_LINES, | 278 | .gpio_base = OMAP_MAX_GPIO_LINES, |
204 | .irq_base = TWL4030_GPIO_IRQ_BASE, | 279 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
205 | .irq_end = TWL4030_GPIO_IRQ_END, | 280 | .irq_end = TWL4030_GPIO_IRQ_END, |
281 | .setup = ldp_twl_gpio_setup, | ||
206 | }; | 282 | }; |
207 | 283 | ||
208 | static struct regulator_consumer_supply ldp_vmmc1_supply[] = { | 284 | static struct regulator_consumer_supply ldp_vmmc1_supply[] = { |
@@ -244,10 +320,31 @@ static struct regulator_init_data ldp_vaux1 = { | |||
244 | .consumer_supplies = ldp_vaux1_supplies, | 320 | .consumer_supplies = ldp_vaux1_supplies, |
245 | }; | 321 | }; |
246 | 322 | ||
323 | static struct regulator_consumer_supply ldp_vpll2_supplies[] = { | ||
324 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), | ||
325 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"), | ||
326 | }; | ||
327 | |||
328 | static struct regulator_init_data ldp_vpll2 = { | ||
329 | .constraints = { | ||
330 | .name = "VDVI", | ||
331 | .min_uV = 1800000, | ||
332 | .max_uV = 1800000, | ||
333 | .apply_uV = true, | ||
334 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
335 | | REGULATOR_MODE_STANDBY, | ||
336 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
337 | | REGULATOR_CHANGE_STATUS, | ||
338 | }, | ||
339 | .num_consumer_supplies = ARRAY_SIZE(ldp_vpll2_supplies), | ||
340 | .consumer_supplies = ldp_vpll2_supplies, | ||
341 | }; | ||
342 | |||
247 | static struct twl4030_platform_data ldp_twldata = { | 343 | static struct twl4030_platform_data ldp_twldata = { |
248 | /* platform_data for children goes here */ | 344 | /* platform_data for children goes here */ |
249 | .vmmc1 = &ldp_vmmc1, | 345 | .vmmc1 = &ldp_vmmc1, |
250 | .vaux1 = &ldp_vaux1, | 346 | .vaux1 = &ldp_vaux1, |
347 | .vpll2 = &ldp_vpll2, | ||
251 | .gpio = &ldp_gpio_data, | 348 | .gpio = &ldp_gpio_data, |
252 | .keypad = &ldp_kp_twl4030_data, | 349 | .keypad = &ldp_kp_twl4030_data, |
253 | }; | 350 | }; |
@@ -273,7 +370,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { | |||
273 | }; | 370 | }; |
274 | 371 | ||
275 | static struct platform_device *ldp_devices[] __initdata = { | 372 | static struct platform_device *ldp_devices[] __initdata = { |
276 | &ldp_lcd_device, | ||
277 | &ldp_gpio_keys_device, | 373 | &ldp_gpio_keys_device, |
278 | }; | 374 | }; |
279 | 375 | ||
@@ -318,25 +414,25 @@ static struct mtd_partition ldp_nand_partitions[] = { | |||
318 | static void __init omap_ldp_init(void) | 414 | static void __init omap_ldp_init(void) |
319 | { | 415 | { |
320 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 416 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
321 | omap_board_config = ldp_config; | ||
322 | omap_board_config_size = ARRAY_SIZE(ldp_config); | ||
323 | ldp_init_smsc911x(); | 417 | ldp_init_smsc911x(); |
324 | omap_i2c_init(); | 418 | omap_i2c_init(); |
325 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); | 419 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); |
326 | omap_ads7846_init(1, 54, 310, NULL); | 420 | omap_ads7846_init(1, 54, 310, NULL); |
327 | omap_serial_init(); | 421 | omap_serial_init(); |
422 | omap_sdrc_init(NULL, NULL); | ||
328 | usb_musb_init(NULL); | 423 | usb_musb_init(NULL); |
329 | board_nand_init(ldp_nand_partitions, | 424 | board_nand_init(ldp_nand_partitions, |
330 | ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); | 425 | ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); |
331 | 426 | ||
332 | omap2_hsmmc_init(mmc); | 427 | omap2_hsmmc_init(mmc); |
428 | ldp_display_init(); | ||
333 | } | 429 | } |
334 | 430 | ||
335 | MACHINE_START(OMAP_LDP, "OMAP LDP board") | 431 | MACHINE_START(OMAP_LDP, "OMAP LDP board") |
336 | .boot_params = 0x80000100, | 432 | .atag_offset = 0x100, |
337 | .reserve = omap_reserve, | 433 | .reserve = omap_reserve, |
338 | .map_io = omap3_map_io, | 434 | .map_io = omap3_map_io, |
339 | .init_early = omap_ldp_init_early, | 435 | .init_early = omap3430_init_early, |
340 | .init_irq = omap3_init_irq, | 436 | .init_irq = omap3_init_irq, |
341 | .init_machine = omap_ldp_init, | 437 | .init_machine = omap_ldp_init, |
342 | .timer = &omap3_timer, | 438 | .timer = &omap3_timer, |