14 #include <linux/kernel.h>
17 #include <linux/i2c.h>
20 #include <linux/input.h>
51 #define DA850_EVM_PHY_ID "davinci_mdio-0:00"
52 #define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)
53 #define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)
55 #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
56 #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
58 #define DA850_WLAN_EN GPIO_TO_PIN(6, 9)
59 #define DA850_WLAN_IRQ GPIO_TO_PIN(6, 10)
61 #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
95 .name =
"MAC-Address",
104 .parts = da850evm_spiflash_part,
105 .nr_parts =
ARRAY_SIZE(da850evm_spiflash_part),
117 .modalias =
"m25p80",
118 .platform_data = &da850evm_spiflash_data,
119 .controller_data = &da850evm_spiflash_cfg,
121 .max_speed_hz = 30000000,
128 static void da850_evm_m25p80_notify_add(
struct mtd_info *mtd)
136 pr_info(
"Read MAC addr from SPI Flash: %pM\n",
142 .
add = da850_evm_m25p80_notify_add,
145 static void da850_evm_setup_mac_addr(
void)
150 static void da850_evm_setup_mac_addr(
void) { }
153 static struct mtd_partition da850_evm_norflash_partition[] = {
155 .name =
"bootloaders + env",
167 .name =
"filesystem",
176 .parts = da850_evm_norflash_partition,
177 .nr_parts =
ARRAY_SIZE(da850_evm_norflash_partition),
180 static struct resource da850_evm_norflash_resource[] = {
189 .name =
"physmap-flash",
192 .platform_data = &da850_evm_norflash_data,
195 .resource = da850_evm_norflash_resource,
203 .name =
"pm-davinci",
205 .platform_data = &da850_pm_pdata,
215 static struct mtd_partition da850_evm_nandflash_partition[] = {
217 .name =
"u-boot env",
241 .name =
"filesystem",
259 .parts = da850_evm_nandflash_partition,
260 .nr_parts =
ARRAY_SIZE(da850_evm_nandflash_partition),
264 .timing = &da850_evm_nandflash_timing,
267 static struct resource da850_evm_nandflash_resource[] = {
281 .name =
"davinci_nand",
284 .platform_data = &da850_evm_nandflash_data,
286 .num_resources =
ARRAY_SIZE(da850_evm_nandflash_resource),
287 .resource = da850_evm_nandflash_resource,
291 &da850_evm_nandflash_device,
292 &da850_evm_norflash_device,
295 #define DA8XX_AEMIF_CE2CFG_OFFSET 0x10
296 #define DA8XX_AEMIF_ASIZE_16BIT 0x1
298 static void __init da850_evm_init_nor(
void)
312 static const short da850_evm_nand_pins[] = {
320 static const short da850_evm_nor_pins[] = {
336 #if defined(CONFIG_MMC_DAVINCI) || \
337 defined(CONFIG_MMC_DAVINCI_MODULE)
343 static inline void da850_evm_setup_nor_nand(
void)
350 pr_warning(
"da850_evm_init: nand mux setup failed: "
355 pr_warning(
"da850_evm_init: nor mux setup failed: %d\n",
358 da850_evm_init_nor();
365 #ifdef CONFIG_DA850_UI_RMII
366 static inline void da850_evm_setup_emac_rmii(
int rmii_sel)
374 static inline void da850_evm_setup_emac_rmii(
int rmii_sel) { }
378 #define DA850_KEYS_DEBOUNCE_MS 10
386 #define DA850_GPIO_KEYS_POLL_MS 200
402 static const char const *da850_evm_ui_exp[] = {
416 #define DA850_N_UI_PB 8
431 .buttons = da850_evm_ui_keys,
437 .name =
"gpio-keys-polled",
440 .platform_data = &da850_evm_ui_keys_pdata
444 static void da850_evm_ui_keys_init(
unsigned gpio)
450 button = &da850_evm_ui_keys[
i];
452 button->
desc = (
char *)
458 #ifdef CONFIG_DA850_UI_SD_VIDEO_PORT
459 static inline void da850_evm_setup_video_port(
int video_sel)
464 static inline void da850_evm_setup_video_port(
int video_sel) { }
467 static int da850_evm_ui_expander_setup(
struct i2c_client *
client,
unsigned gpio,
468 unsigned ngpio,
void *
c)
470 int sel_a, sel_b, sel_c,
ret;
476 ret =
gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
478 pr_warning(
"Cannot open UI expander pin %d\n", sel_a);
479 goto exp_setup_sela_fail;
482 ret =
gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
484 pr_warning(
"Cannot open UI expander pin %d\n", sel_b);
485 goto exp_setup_selb_fail;
488 ret =
gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
490 pr_warning(
"Cannot open UI expander pin %d\n", sel_c);
491 goto exp_setup_selc_fail;
499 da850_evm_ui_keys_init(gpio);
502 pr_warning(
"Could not register UI GPIO expander push-buttons");
503 goto exp_setup_keys_fail;
506 pr_info(
"DA850/OMAP-L138 EVM UI card detected\n");
508 da850_evm_setup_nor_nand();
510 da850_evm_setup_emac_rmii(sel_a);
512 da850_evm_setup_video_port(sel_c);
526 static int da850_evm_ui_expander_teardown(
struct i2c_client *client,
527 unsigned gpio,
unsigned ngpio,
void *c)
536 gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
537 gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
538 gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
544 #define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
545 #define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
566 static const char const *da850_evm_bb_exp[] = {
585 #define DA850_N_BB_USER_SW 8
609 .buttons = da850_evm_bb_keys,
615 .name =
"gpio-keys-polled",
618 .platform_data = &da850_evm_bb_keys_pdata
622 static void da850_evm_bb_keys_init(
unsigned gpio)
627 button = &da850_evm_bb_keys[0];
628 button->
desc = (
char *)
633 button = &da850_evm_bb_keys[i + 1];
635 button->
desc = (
char *)
641 #define DA850_N_BB_USER_LED 2
643 static struct gpio_led da850_evm_bb_leds[] = {
652 .leds = da850_evm_bb_leds,
660 .platform_data = &da850_evm_bb_leds_pdata
664 static void da850_evm_bb_leds_init(
unsigned gpio)
670 led = &da850_evm_bb_leds[
i];
678 static int da850_evm_bb_expander_setup(
struct i2c_client *client,
679 unsigned gpio,
unsigned ngpio,
688 da850_evm_bb_keys_init(gpio);
691 pr_warning(
"Could not register baseboard GPIO expander keys");
692 goto io_exp_setup_sw_fail;
695 da850_evm_bb_leds_init(gpio);
698 pr_warning(
"Could not register baseboard GPIO expander LEDS");
699 goto io_exp_setup_leds_fail;
704 io_exp_setup_leds_fail:
706 io_exp_setup_sw_fail:
710 static int da850_evm_bb_expander_teardown(
struct i2c_client *client,
711 unsigned gpio,
unsigned ngpio,
void *c)
721 .setup = da850_evm_ui_expander_setup,
722 .teardown = da850_evm_ui_expander_teardown,
723 .names = da850_evm_ui_exp,
728 .setup = da850_evm_bb_expander_setup,
729 .teardown = da850_evm_bb_expander_teardown,
730 .names = da850_evm_bb_exp,
739 .platform_data = &da850_evm_ui_expander_info,
743 .platform_data = &da850_evm_bb_expander_info,
753 .enabled_uarts = 0x7,
757 static u8 da850_iis_serializer_direction[] = {
765 .tx_dma_offset = 0x2000,
766 .rx_dma_offset = 0x2000,
768 .num_serializer =
ARRAY_SIZE(da850_iis_serializer_direction),
770 .serial_dir = da850_iis_serializer_direction,
777 static const short da850_evm_mcasp_pins[]
__initconst = {
784 static int da850_evm_mmc_get_ro(
int index)
789 static int da850_evm_mmc_get_cd(
int index)
795 .get_ro = da850_evm_mmc_get_ro,
796 .get_cd = da850_evm_mmc_get_cd,
798 .max_freq = 50000000,
803 static const short da850_evm_mmcsd0_pins[] __initconst = {
810 static void da850_panel_power_ctrl(
int val)
819 static int da850_lcd_hw_init(
void)
837 da850_panel_power_ctrl(0);
840 da850_panel_power_ctrl(1);
850 .supply =
"usb0_vdda33",
853 .supply =
"usb1_vdda33",
860 .supply =
"dvdd3318_a",
863 .supply =
"dvdd3318_b",
866 .supply =
"dvdd3318_c",
880 .supply =
"sata_vddr",
883 .supply =
"usb0_vdda18",
886 .supply =
"usb1_vdda18",
889 .supply =
"ddr_dvdd18",
896 .supply =
"sata_vdd",
899 .supply =
"pll0_vdda",
902 .supply =
"pll1_vdda",
905 .supply =
"usbs_cvdd",
908 .supply =
"vddarnwa1",
914 .defdcdc_default =
true,
928 .consumer_supplies = tps65070_dcdc1_consumers,
941 .consumer_supplies = tps65070_dcdc2_consumers,
942 .driver_data = &tps6507x_platform_data,
955 .consumer_supplies = tps65070_dcdc3_consumers,
956 .driver_data = &tps6507x_platform_data,
969 .consumer_supplies = tps65070_ldo1_consumers,
982 .consumer_supplies = tps65070_ldo2_consumers,
988 .min_pressure = 0x30,
996 .tps6507x_pmic_init_data = &tps65070_regulator_data[0],
997 .tps6507x_ts_init_data = &tps6507x_touchscreen_data,
1000 static struct i2c_board_info __initdata da850_evm_tps65070_info[] = {
1003 .platform_data = &tps_board,
1007 static int __init pmic_tps65070_init(
void)
1013 static const short da850_evm_lcdc_pins[] = {
1018 static const short da850_evm_mii_pins[] = {
1027 static const short da850_evm_rmii_pins[] = {
1035 static int __init da850_evm_config_emac(
void)
1043 if (!machine_is_davinci_da850_evm())
1053 pr_info(
"EMAC: RMII PHY configured, MII PHY will not be"
1058 pr_info(
"EMAC: MII PHY configured, RMII PHY will not be"
1063 pr_warning(
"da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
1071 pr_warning(
"da850_evm_init:GPIO(2,6) mux setup "
1088 pr_warning(
"da850_evm_init: emac registration failed: %d\n",
1100 static const s16 da850_dma0_rsv_chans[][2] = {
1108 static const s16 da850_dma0_rsv_slots[][2] = {
1116 static const s16 da850_dma1_rsv_chans[][2] = {
1123 static const s16 da850_dma1_rsv_slots[][2] = {
1131 .rsv_chans = da850_dma0_rsv_chans,
1132 .rsv_slots = da850_dma0_rsv_slots,
1136 .rsv_chans = da850_dma1_rsv_chans,
1137 .rsv_slots = da850_dma1_rsv_slots,
1141 &da850_edma_cc0_rsv,
1142 &da850_edma_cc1_rsv,
1145 #ifdef CONFIG_CPU_FREQ
1146 static __init int da850_evm_init_cpufreq(
void)
1163 static __init int da850_evm_init_cpufreq(
void) {
return 0; }
1166 #if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
1168 #define TVP5147_CH0 "tvp514x-0"
1169 #define TVP5147_CH1 "tvp514x-1"
1178 #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
1180 static const struct vpif_input da850_ch0_inputs[] = {
1184 .name =
"Composite",
1195 static const struct vpif_input da850_ch1_inputs[] = {
1215 .platform_data = &tvp5146_pdata,
1222 .platform_data = &tvp5146_pdata,
1229 .subdev_count =
ARRAY_SIZE(da850_vpif_capture_sdev_info),
1231 .inputs = da850_ch0_inputs,
1241 .inputs = da850_ch1_inputs,
1250 .card_name =
"DA850/OMAP-L138 Video Capture",
1263 static const struct vpif_output da850_ch0_outputs[] = {
1267 .name =
"Composite",
1272 .subdev_name =
"adv7343",
1283 .subdev_name =
"adv7343",
1290 .subdev_count =
ARRAY_SIZE(da850_vpif_subdev),
1292 .outputs = da850_ch0_outputs,
1293 .output_count =
ARRAY_SIZE(da850_ch0_outputs),
1295 .card_name =
"DA850/OMAP-L138 Video Display",
1298 static __init void da850_vpif_init(
void)
1304 pr_warn(
"da850_evm_init: VPIF setup failed: %d\n", ret);
1308 pr_warn(
"da850_evm_init: VPIF capture mux setup failed: %d\n",
1313 pr_warn(
"da850_evm_init: VPIF capture setup failed: %d\n", ret);
1317 pr_warn(
"da850_evm_init: VPIF display mux setup failed: %d\n",
1322 pr_warn(
"da850_evm_init: VPIF display setup failed: %d\n", ret);
1326 static __init void da850_vpif_init(
void) {}
1329 #ifdef CONFIG_DA850_WL12XX
1331 static void wl12xx_set_power(
int index,
bool power_on)
1335 pr_debug(
"Powering %s wl12xx", power_on ?
"on" :
"off");
1337 if (power_on == power_state)
1339 power_state = power_on;
1357 .max_freq = 25000000,
1363 static const short da850_wl12xx_pins[] __initconst = {
1376 static __init int da850_wl12xx_init(
void)
1382 pr_err(
"wl12xx/mmc mux setup failed: %d\n", ret);
1388 pr_err(
"wl12xx/mmc registration failed: %d\n", ret);
1394 pr_err(
"Could not request wl12xx enable gpio: %d\n", ret);
1400 pr_err(
"Could not request wl12xx irq gpio: %d\n", ret);
1408 pr_err(
"Could not set wl12xx data: %d\n", ret);
1426 static __init int da850_wl12xx_init(
void)
1433 #define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000)
1435 static __init void da850_evm_init(
void)
1439 ret = pmic_tps65070_init();
1441 pr_warning(
"da850_evm_init: TPS65070 PMIC init failed: %d\n",
1446 pr_warning(
"da850_evm_init: edma registration failed: %d\n",
1451 pr_warning(
"da850_evm_init: i2c0 mux setup failed: %d\n",
1456 pr_warning(
"da850_evm_init: i2c0 registration failed: %d\n",
1462 pr_warning(
"da830_evm_init: watchdog registration failed: %d\n",
1468 pr_warning(
"da850_evm_init: mmcsd0 mux setup failed:"
1473 pr_warning(
"da850_evm_init: can not open GPIO %d\n",
1479 pr_warning(
"da850_evm_init: can not open GPIO %d\n",
1485 pr_warning(
"da850_evm_init: mmcsd0 registration failed:"
1488 ret = da850_wl12xx_init();
1490 pr_warning(
"da850_evm_init: wl12xx initialization"
1491 " failed: %d\n", ret);
1509 pr_warning(
"da850_evm_init: mcasp mux setup failed: %d\n",
1516 pr_warning(
"da850_evm_init: lcdcntl mux setup failed: %d\n",
1522 pr_warning(
"da850_evm_init: evm specific lcd mux setup "
1523 "failed: %d\n", ret);
1525 ret = da850_lcd_hw_init();
1527 pr_warning(
"da850_evm_init: lcd initialization failed: %d\n",
1533 pr_warning(
"da850_evm_init: lcdc registration failed: %d\n",
1538 pr_warning(
"da850_evm_init: rtc setup failed: %d\n", ret);
1540 ret = da850_evm_init_cpufreq();
1542 pr_warning(
"da850_evm_init: cpufreq registration failed: %d\n",
1547 pr_warning(
"da850_evm_init: cpuidle registration failed: %d\n",
1552 pr_warning(
"da850_evm_init: suspend registration failed: %d\n",
1560 pr_warning(
"da850_evm_init: spi 1 registration failed: %d\n",
1565 pr_warning(
"da850_evm_init: sata registration failed: %d\n",
1568 da850_evm_setup_mac_addr();
1571 #ifdef CONFIG_SERIAL_8250_CONSOLE
1572 static int __init da850_evm_console_init(
void)
1574 if (!machine_is_davinci_da850_evm())
1582 static void __init da850_evm_map_io(
void)
1587 MACHINE_START(DAVINCI_DA850_EVM,
"DaVinci DA850/OMAP-L138/AM18x EVM")
1588 .atag_offset = 0x100,
1589 .map_io = da850_evm_map_io,
1592 .init_machine = da850_evm_init,