aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-3430sdp.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /arch/arm/mach-omap2/board-3430sdp.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/arm/mach-omap2/board-3430sdp.c')
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c368
1 files changed, 335 insertions, 33 deletions
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 0acb5560229c..5822bcf7b15f 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -20,7 +20,7 @@
20#include <linux/input/matrix_keypad.h> 20#include <linux/input/matrix_keypad.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/spi/ads7846.h> 22#include <linux/spi/ads7846.h>
23#include <linux/i2c/twl4030.h> 23#include <linux/i2c/twl.h>
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/gpio.h> 26#include <linux/gpio.h>
@@ -30,19 +30,23 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32 32
33#include <mach/mcspi.h> 33#include <plat/mcspi.h>
34#include <mach/mux.h> 34#include <plat/board.h>
35#include <mach/board.h> 35#include <plat/usb.h>
36#include <mach/usb.h> 36#include <plat/common.h>
37#include <mach/common.h> 37#include <plat/dma.h>
38#include <mach/dma.h> 38#include <plat/gpmc.h>
39#include <mach/gpmc.h> 39#include <plat/display.h>
40 40
41#include <mach/control.h> 41#include <plat/control.h>
42#include <mach/gpmc-smc91x.h> 42#include <plat/gpmc-smc91x.h>
43 43
44#include <mach/board-sdp.h>
45
46#include "mux.h"
44#include "sdram-qimonda-hyb18m512160af-6.h" 47#include "sdram-qimonda-hyb18m512160af-6.h"
45#include "mmc-twl4030.h" 48#include "hsmmc.h"
49#include "pm.h"
46 50
47#define CONFIG_DISABLE_HFCLK 1 51#define CONFIG_DISABLE_HFCLK 1
48 52
@@ -54,6 +58,24 @@
54 58
55#define TWL4030_MSECURE_GPIO 22 59#define TWL4030_MSECURE_GPIO 22
56 60
61/* FIXME: These values need to be updated based on more profiling on 3430sdp*/
62static struct cpuidle_params omap3_cpuidle_params_table[] = {
63 /* C1 */
64 {1, 2, 2, 5},
65 /* C2 */
66 {1, 10, 10, 30},
67 /* C3 */
68 {1, 50, 50, 300},
69 /* C4 */
70 {1, 1500, 1800, 4000},
71 /* C5 */
72 {1, 2500, 7500, 12000},
73 /* C6 */
74 {1, 3000, 8500, 15000},
75 /* C7 */
76 {1, 10000, 30000, 300000},
77};
78
57static int board_keymap[] = { 79static int board_keymap[] = {
58 KEY(0, 0, KEY_LEFT), 80 KEY(0, 0, KEY_LEFT),
59 KEY(0, 1, KEY_RIGHT), 81 KEY(0, 1, KEY_RIGHT),
@@ -152,37 +174,159 @@ static struct spi_board_info sdp3430_spi_board_info[] __initdata = {
152 }, 174 },
153}; 175};
154 176
155static struct platform_device sdp3430_lcd_device = { 177
156 .name = "sdp2430_lcd", 178#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
157 .id = -1, 179#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
180
181static unsigned backlight_gpio;
182static unsigned enable_gpio;
183static int lcd_enabled;
184static int dvi_enabled;
185
186static void __init sdp3430_display_init(void)
187{
188 int r;
189
190 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO;
191 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
192
193 r = gpio_request(enable_gpio, "LCD reset");
194 if (r) {
195 printk(KERN_ERR "failed to get LCD reset GPIO\n");
196 goto err0;
197 }
198
199 r = gpio_request(backlight_gpio, "LCD Backlight");
200 if (r) {
201 printk(KERN_ERR "failed to get LCD backlight GPIO\n");
202 goto err1;
203 }
204
205 gpio_direction_output(enable_gpio, 0);
206 gpio_direction_output(backlight_gpio, 0);
207
208 return;
209err1:
210 gpio_free(enable_gpio);
211err0:
212 return;
213}
214
215static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
216{
217 if (dvi_enabled) {
218 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
219 return -EINVAL;
220 }
221
222 gpio_direction_output(enable_gpio, 1);
223 gpio_direction_output(backlight_gpio, 1);
224
225 lcd_enabled = 1;
226
227 return 0;
228}
229
230static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
231{
232 lcd_enabled = 0;
233
234 gpio_direction_output(enable_gpio, 0);
235 gpio_direction_output(backlight_gpio, 0);
236}
237
238static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
239{
240 if (lcd_enabled) {
241 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
242 return -EINVAL;
243 }
244
245 dvi_enabled = 1;
246
247 return 0;
248}
249
250static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
251{
252 dvi_enabled = 0;
253}
254
255static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
256{
257 return 0;
258}
259
260static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev)
261{
262}
263
264
265static struct omap_dss_device sdp3430_lcd_device = {
266 .name = "lcd",
267 .driver_name = "sharp_ls_panel",
268 .type = OMAP_DISPLAY_TYPE_DPI,
269 .phy.dpi.data_lines = 16,
270 .platform_enable = sdp3430_panel_enable_lcd,
271 .platform_disable = sdp3430_panel_disable_lcd,
158}; 272};
159 273
160static struct regulator_consumer_supply sdp3430_vdac_supply = { 274static struct omap_dss_device sdp3430_dvi_device = {
161 .supply = "vdac", 275 .name = "dvi",
162 .dev = &sdp3430_lcd_device.dev, 276 .driver_name = "generic_panel",
277 .type = OMAP_DISPLAY_TYPE_DPI,
278 .phy.dpi.data_lines = 24,
279 .platform_enable = sdp3430_panel_enable_dvi,
280 .platform_disable = sdp3430_panel_disable_dvi,
163}; 281};
164 282
165static struct regulator_consumer_supply sdp3430_vdvi_supply = { 283static struct omap_dss_device sdp3430_tv_device = {
166 .supply = "vdvi", 284 .name = "tv",
167 .dev = &sdp3430_lcd_device.dev, 285 .driver_name = "venc",
286 .type = OMAP_DISPLAY_TYPE_VENC,
287 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
288 .platform_enable = sdp3430_panel_enable_tv,
289 .platform_disable = sdp3430_panel_disable_tv,
168}; 290};
169 291
170static struct platform_device *sdp3430_devices[] __initdata = { 292
293static struct omap_dss_device *sdp3430_dss_devices[] = {
171 &sdp3430_lcd_device, 294 &sdp3430_lcd_device,
295 &sdp3430_dvi_device,
296 &sdp3430_tv_device,
297};
298
299static struct omap_dss_board_info sdp3430_dss_data = {
300 .num_devices = ARRAY_SIZE(sdp3430_dss_devices),
301 .devices = sdp3430_dss_devices,
302 .default_device = &sdp3430_lcd_device,
172}; 303};
173 304
174static struct omap_lcd_config sdp3430_lcd_config __initdata = { 305static struct platform_device sdp3430_dss_device = {
175 .ctrl_name = "internal", 306 .name = "omapdss",
307 .id = -1,
308 .dev = {
309 .platform_data = &sdp3430_dss_data,
310 },
311};
312
313static struct regulator_consumer_supply sdp3430_vdda_dac_supply = {
314 .supply = "vdda_dac",
315 .dev = &sdp3430_dss_device.dev,
316};
317
318static struct platform_device *sdp3430_devices[] __initdata = {
319 &sdp3430_dss_device,
176}; 320};
177 321
178static struct omap_board_config_kernel sdp3430_config[] __initdata = { 322static struct omap_board_config_kernel sdp3430_config[] __initdata = {
179 { OMAP_TAG_LCD, &sdp3430_lcd_config },
180}; 323};
181 324
182static void __init omap_3430sdp_init_irq(void) 325static void __init omap_3430sdp_init_irq(void)
183{ 326{
184 omap_board_config = sdp3430_config; 327 omap_board_config = sdp3430_config;
185 omap_board_config_size = ARRAY_SIZE(sdp3430_config); 328 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
329 omap3_pm_init_cpuidle(omap3_cpuidle_params_table);
186 omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL); 330 omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
187 omap_init_irq(); 331 omap_init_irq();
188 omap_gpio_init(); 332 omap_gpio_init();
@@ -204,7 +348,7 @@ static struct twl4030_bci_platform_data sdp3430_bci_data = {
204 .tblsize = ARRAY_SIZE(sdp3430_batt_table), 348 .tblsize = ARRAY_SIZE(sdp3430_batt_table),
205}; 349};
206 350
207static struct twl4030_hsmmc_info mmc[] = { 351static struct omap2_hsmmc_info mmc[] = {
208 { 352 {
209 .mmc = 1, 353 .mmc = 1,
210 /* 8 bits (default) requires S6.3 == ON, 354 /* 8 bits (default) requires S6.3 == ON,
@@ -241,7 +385,7 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
241 */ 385 */
242 mmc[0].gpio_cd = gpio + 0; 386 mmc[0].gpio_cd = gpio + 0;
243 mmc[1].gpio_cd = gpio + 1; 387 mmc[1].gpio_cd = gpio + 1;
244 twl4030_mmc_init(mmc); 388 omap2_hsmmc_init(mmc);
245 389
246 /* link regulators to MMC adapters ... we "know" the 390 /* link regulators to MMC adapters ... we "know" the
247 * regulators will be set up only *after* we return. 391 * regulators will be set up only *after* we return.
@@ -392,22 +536,39 @@ static struct regulator_init_data sdp3430_vdac = {
392 | REGULATOR_CHANGE_STATUS, 536 | REGULATOR_CHANGE_STATUS,
393 }, 537 },
394 .num_consumer_supplies = 1, 538 .num_consumer_supplies = 1,
395 .consumer_supplies = &sdp3430_vdac_supply, 539 .consumer_supplies = &sdp3430_vdda_dac_supply,
396}; 540};
397 541
398/* VPLL2 for digital video outputs */ 542/* VPLL2 for digital video outputs */
543static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
544 {
545 .supply = "vdds_dsi",
546 .dev = &sdp3430_dss_device.dev,
547 }
548};
549
399static struct regulator_init_data sdp3430_vpll2 = { 550static struct regulator_init_data sdp3430_vpll2 = {
400 .constraints = { 551 .constraints = {
401 .name = "VDVI", 552 .name = "VDVI",
402 .min_uV = 1800000, 553 .min_uV = 1800000,
403 .max_uV = 1800000, 554 .max_uV = 1800000,
555 .apply_uV = true,
404 .valid_modes_mask = REGULATOR_MODE_NORMAL 556 .valid_modes_mask = REGULATOR_MODE_NORMAL
405 | REGULATOR_MODE_STANDBY, 557 | REGULATOR_MODE_STANDBY,
406 .valid_ops_mask = REGULATOR_CHANGE_MODE 558 .valid_ops_mask = REGULATOR_CHANGE_MODE
407 | REGULATOR_CHANGE_STATUS, 559 | REGULATOR_CHANGE_STATUS,
408 }, 560 },
409 .num_consumer_supplies = 1, 561 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vpll2_supplies),
410 .consumer_supplies = &sdp3430_vdvi_supply, 562 .consumer_supplies = sdp3430_vpll2_supplies,
563};
564
565static struct twl4030_codec_audio_data sdp3430_audio = {
566 .audio_mclk = 26000000,
567};
568
569static struct twl4030_codec_data sdp3430_codec = {
570 .audio_mclk = 26000000,
571 .audio = &sdp3430_audio,
411}; 572};
412 573
413static struct twl4030_platform_data sdp3430_twldata = { 574static struct twl4030_platform_data sdp3430_twldata = {
@@ -420,6 +581,7 @@ static struct twl4030_platform_data sdp3430_twldata = {
420 .madc = &sdp3430_madc_data, 581 .madc = &sdp3430_madc_data,
421 .keypad = &sdp3430_kp_data, 582 .keypad = &sdp3430_kp_data,
422 .usb = &sdp3430_usb_data, 583 .usb = &sdp3430_usb_data,
584 .codec = &sdp3430_codec,
423 585
424 .vaux1 = &sdp3430_vaux1, 586 .vaux1 = &sdp3430_vaux1,
425 .vaux2 = &sdp3430_vaux2, 587 .vaux2 = &sdp3430_vaux2,
@@ -481,11 +643,148 @@ static inline void board_smc91x_init(void)
481 643
482static void enable_board_wakeup_source(void) 644static void enable_board_wakeup_source(void)
483{ 645{
484 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */ 646 /* T2 interrupt line (keypad) */
647 omap_mux_init_signal("sys_nirq",
648 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
485} 649}
486 650
651static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
652
653 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
654 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
655 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
656
657 .phy_reset = true,
658 .reset_gpio_port[0] = 57,
659 .reset_gpio_port[1] = 61,
660 .reset_gpio_port[2] = -EINVAL
661};
662
663#ifdef CONFIG_OMAP_MUX
664static struct omap_board_mux board_mux[] __initdata = {
665 { .reg_offset = OMAP_MUX_TERMINATOR },
666};
667#else
668#define board_mux NULL
669#endif
670
671static struct mtd_partition sdp_nor_partitions[] = {
672 /* bootloader (U-Boot, etc) in first sector */
673 {
674 .name = "Bootloader-NOR",
675 .offset = 0,
676 .size = SZ_256K,
677 .mask_flags = MTD_WRITEABLE, /* force read-only */
678 },
679 /* bootloader params in the next sector */
680 {
681 .name = "Params-NOR",
682 .offset = MTDPART_OFS_APPEND,
683 .size = SZ_256K,
684 .mask_flags = 0,
685 },
686 /* kernel */
687 {
688 .name = "Kernel-NOR",
689 .offset = MTDPART_OFS_APPEND,
690 .size = SZ_2M,
691 .mask_flags = 0
692 },
693 /* file system */
694 {
695 .name = "Filesystem-NOR",
696 .offset = MTDPART_OFS_APPEND,
697 .size = MTDPART_SIZ_FULL,
698 .mask_flags = 0
699 }
700};
701
702static struct mtd_partition sdp_onenand_partitions[] = {
703 {
704 .name = "X-Loader-OneNAND",
705 .offset = 0,
706 .size = 4 * (64 * 2048),
707 .mask_flags = MTD_WRITEABLE /* force read-only */
708 },
709 {
710 .name = "U-Boot-OneNAND",
711 .offset = MTDPART_OFS_APPEND,
712 .size = 2 * (64 * 2048),
713 .mask_flags = MTD_WRITEABLE /* force read-only */
714 },
715 {
716 .name = "U-Boot Environment-OneNAND",
717 .offset = MTDPART_OFS_APPEND,
718 .size = 1 * (64 * 2048),
719 },
720 {
721 .name = "Kernel-OneNAND",
722 .offset = MTDPART_OFS_APPEND,
723 .size = 16 * (64 * 2048),
724 },
725 {
726 .name = "File System-OneNAND",
727 .offset = MTDPART_OFS_APPEND,
728 .size = MTDPART_SIZ_FULL,
729 },
730};
731
732static struct mtd_partition sdp_nand_partitions[] = {
733 /* All the partition sizes are listed in terms of NAND block size */
734 {
735 .name = "X-Loader-NAND",
736 .offset = 0,
737 .size = 4 * (64 * 2048),
738 .mask_flags = MTD_WRITEABLE, /* force read-only */
739 },
740 {
741 .name = "U-Boot-NAND",
742 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
743 .size = 10 * (64 * 2048),
744 .mask_flags = MTD_WRITEABLE, /* force read-only */
745 },
746 {
747 .name = "Boot Env-NAND",
748
749 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
750 .size = 6 * (64 * 2048),
751 },
752 {
753 .name = "Kernel-NAND",
754 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
755 .size = 40 * (64 * 2048),
756 },
757 {
758 .name = "File System - NAND",
759 .size = MTDPART_SIZ_FULL,
760 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
761 },
762};
763
764static struct flash_partitions sdp_flash_partitions[] = {
765 {
766 .parts = sdp_nor_partitions,
767 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
768 },
769 {
770 .parts = sdp_onenand_partitions,
771 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
772 },
773 {
774 .parts = sdp_nand_partitions,
775 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
776 },
777};
778
779static struct omap_musb_board_data musb_board_data = {
780 .interface_type = MUSB_INTERFACE_ULPI,
781 .mode = MUSB_OTG,
782 .power = 100,
783};
784
487static void __init omap_3430sdp_init(void) 785static void __init omap_3430sdp_init(void)
488{ 786{
787 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
489 omap3430_i2c_init(); 788 omap3430_i2c_init();
490 platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices)); 789 platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
491 if (omap_rev() > OMAP3430_REV_ES1_0) 790 if (omap_rev() > OMAP3430_REV_ES1_0)
@@ -497,21 +796,24 @@ static void __init omap_3430sdp_init(void)
497 ARRAY_SIZE(sdp3430_spi_board_info)); 796 ARRAY_SIZE(sdp3430_spi_board_info));
498 ads7846_dev_init(); 797 ads7846_dev_init();
499 omap_serial_init(); 798 omap_serial_init();
500 usb_musb_init(); 799 usb_musb_init(&musb_board_data);
501 board_smc91x_init(); 800 board_smc91x_init();
801 sdp_flash_init(sdp_flash_partitions);
802 sdp3430_display_init();
502 enable_board_wakeup_source(); 803 enable_board_wakeup_source();
804 usb_ehci_init(&ehci_pdata);
503} 805}
504 806
505static void __init omap_3430sdp_map_io(void) 807static void __init omap_3430sdp_map_io(void)
506{ 808{
507 omap2_set_globals_343x(); 809 omap2_set_globals_343x();
508 omap2_map_common_io(); 810 omap34xx_map_common_io();
509} 811}
510 812
511MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board") 813MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
512 /* Maintainer: Syed Khasim - Texas Instruments Inc */ 814 /* Maintainer: Syed Khasim - Texas Instruments Inc */
513 .phys_io = 0x48000000, 815 .phys_io = 0x48000000,
514 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 816 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
515 .boot_params = 0x80000100, 817 .boot_params = 0x80000100,
516 .map_io = omap_3430sdp_map_io, 818 .map_io = omap_3430sdp_map_io,
517 .init_irq = omap_3430sdp_init_irq, 819 .init_irq = omap_3430sdp_init_irq,