X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=board%2Fti%2Fdra7xx%2Fevm.c;h=3fbbc9b23b0433bfc55e0384d8cc31be94c2522f;hb=09da87dafddef530e62ca1dc2655819dda1d28ee;hp=d142cccb939529f5fe87dbb87c840f142afb538a;hpb=c4a2736ca165167aa38228a60354c6a8950d42f8;p=u-boot diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index d142cccb93..3fbbc9b23b 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -27,13 +27,17 @@ #include #include #include +#include #include "mux_data.h" #include "../common/board_detect.h" #define board_is_dra74x_evm() board_ti_is("5777xCPU") +#define board_is_dra72x_evm() board_ti_is("DRA72x-T") #define board_is_dra74x_revh_or_later() board_is_dra74x_evm() && \ (strncmp("H", board_ti_get_rev(), 1) <= 0) +#define board_is_dra72x_revc_or_later() board_is_dra72x_evm() && \ + (strncmp("C", board_ti_get_rev(), 1) <= 0) #define board_ti_get_emif_size() board_ti_get_emif1_size() + \ board_ti_get_emif2_size() @@ -127,6 +131,31 @@ static const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra_es1 = { .emif_rd_wr_exec_thresh = 0x00000305 }; +const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra_es2 = { + .sdram_config_init = 0x61862BB2, + .sdram_config = 0x61862BB2, + .sdram_config2 = 0x00000000, + .ref_ctrl = 0x0000514D, + .ref_ctrl_final = 0x0000144A, + .sdram_tim1 = 0xD1137824, + .sdram_tim2 = 0x30B37FE3, + .sdram_tim3 = 0x409F8AD8, + .read_idle_ctrl = 0x00050000, + .zq_config = 0x5007190B, + .temp_alert_config = 0x00000000, + .emif_ddr_phy_ctlr_1_init = 0x0824400E, + .emif_ddr_phy_ctlr_1 = 0x0E24400E, + .emif_ddr_ext_phy_ctrl_1 = 0x04040100, + .emif_ddr_ext_phy_ctrl_2 = 0x006B009F, + .emif_ddr_ext_phy_ctrl_3 = 0x006B00A2, + .emif_ddr_ext_phy_ctrl_4 = 0x006B00A8, + .emif_ddr_ext_phy_ctrl_5 = 0x006B00A8, + .emif_rd_wr_lvl_rmp_win = 0x00000000, + .emif_rd_wr_lvl_rmp_ctl = 0x80000000, + .emif_rd_wr_lvl_ctl = 0x00000000, + .emif_rd_wr_exec_thresh = 0x00000305 +}; + const struct emif_regs emif1_ddr3_532_mhz_1cs_2G = { .sdram_config_init = 0x61851ab2, .sdram_config = 0x61851ab2, @@ -203,7 +232,11 @@ void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs) } break; case DRA722_ES1_0: - *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra_es1; + case DRA722_ES2_0: + if (ram_size < CONFIG_MAX_MEM_MAPPED) + *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra_es1; + else + *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra_es2; break; default: *regs = &emif1_ddr3_532_mhz_1cs; @@ -234,6 +267,18 @@ const struct dmm_lisa_map_regs lisa_map_dra7_2GB = { .is_ma_present = 0x1 }; +/* + * DRA722 EVM EMIF1 2GB CONFIGURATION + * EMIF1 4 devices of 512Mb x 8 Micron + */ +const struct dmm_lisa_map_regs lisa_map_2G_x_4 = { + .dmm_lisa_map_0 = 0x0, + .dmm_lisa_map_1 = 0x0, + .dmm_lisa_map_2 = 0x80700100, + .dmm_lisa_map_3 = 0xFF020100, + .is_ma_present = 0x1 +}; + void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) { u64 ram_size; @@ -250,8 +295,13 @@ void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) *dmm_lisa_regs = &lisa_map_dra7_1536MB; break; case DRA722_ES1_0: + case DRA722_ES2_0: default: - *dmm_lisa_regs = &lisa_map_2G_x_2; + if (ram_size < CONFIG_MAX_MEM_MAPPED) + *dmm_lisa_regs = &lisa_map_2G_x_2; + else + *dmm_lisa_regs = &lisa_map_2G_x_4; + break; } } @@ -268,6 +318,20 @@ int board_init(void) return 0; } +void dram_init_banksize(void) +{ + u64 ram_size; + + ram_size = board_ti_get_emif_size(); + + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = get_effective_memsize(); + if (ram_size > CONFIG_MAX_MEM_MAPPED) { + gd->bd->bi_dram[1].start = 0x200000000; + gd->bd->bi_dram[1].size = ram_size - CONFIG_MAX_MEM_MAPPED; + } +} + int board_late_init(void) { #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -310,8 +374,10 @@ void do_board_detect(void) if (board_is_dra74x_evm()) { bname = "DRA74x EVM"; - /* If EEPROM is not populated */ + } else if (board_is_dra72x_evm()) { + bname = "DRA72x EVM"; } else { + /* If EEPROM is not populated */ if (is_dra72x()) bname = "DRA72x EVM"; else @@ -324,7 +390,7 @@ void do_board_detect(void) } #endif /* CONFIG_SPL_BUILD */ -void set_muxconf_regs_essential(void) +void set_muxconf_regs(void) { do_set_mux32((*ctrl)->control_padconf_core_base, early_padconf, ARRAY_SIZE(early_padconf)); @@ -333,16 +399,29 @@ void set_muxconf_regs_essential(void) #ifdef CONFIG_IODELAY_RECALIBRATION void recalibrate_iodelay(void) { - struct pad_conf_entry const *pads; + struct pad_conf_entry const *pads, *delta_pads = NULL; struct iodelay_cfg_entry const *iodelay; - int npads, niodelays; + int npads, niodelays, delta_npads = 0; + int ret; switch (omap_revision()) { case DRA722_ES1_0: - pads = core_padconf_array_essential; - npads = ARRAY_SIZE(core_padconf_array_essential); - iodelay = iodelay_cfg_array; - niodelays = ARRAY_SIZE(iodelay_cfg_array); + case DRA722_ES2_0: + pads = dra72x_core_padconf_array_common; + npads = ARRAY_SIZE(dra72x_core_padconf_array_common); + if (board_is_dra72x_revc_or_later()) { + delta_pads = dra72x_rgmii_padconf_array_revc; + delta_npads = + ARRAY_SIZE(dra72x_rgmii_padconf_array_revc); + iodelay = dra72_iodelay_cfg_array_revc; + niodelays = ARRAY_SIZE(dra72_iodelay_cfg_array_revc); + } else { + delta_pads = dra72x_rgmii_padconf_array_revb; + delta_npads = + ARRAY_SIZE(dra72x_rgmii_padconf_array_revb); + iodelay = dra72_iodelay_cfg_array_revb; + niodelays = ARRAY_SIZE(dra72_iodelay_cfg_array_revb); + } break; case DRA752_ES1_0: case DRA752_ES1_1: @@ -362,7 +441,24 @@ void recalibrate_iodelay(void) RGMII1_ID_MODE_N_MASK); break; } - __recalibrate_iodelay(pads, npads, iodelay, niodelays); + /* Setup I/O isolation */ + ret = __recalibrate_iodelay_start(); + if (ret) + goto err; + + /* Do the muxing here */ + do_set_mux32((*ctrl)->control_padconf_core_base, pads, npads); + + /* Now do the weird minor deltas that should be safe */ + if (delta_npads) + do_set_mux32((*ctrl)->control_padconf_core_base, + delta_pads, delta_npads); + + /* Setup IOdelay configuration */ + ret = do_set_iodelay((*ctrl)->iodelay_config_base, iodelay, niodelays); +err: + /* Closeup.. remove isolation */ + __recalibrate_iodelay_end(ret); } #endif @@ -584,6 +680,11 @@ int board_eth_init(bd_t *bis) if (*omap_si_rev == DRA722_ES1_0) cpsw_data.active_slave = 1; + if (board_is_dra72x_revc_or_later()) { + cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RGMII_ID; + cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RGMII_ID; + } + ret = cpsw_register(&cpsw_data); if (ret < 0) printf("Error %d registering CPSW switch\n", ret); @@ -600,7 +701,7 @@ static inline void vtt_regulator_enable(void) return; /* Do not enable VTT for DRA722 */ - if (omap_revision() == DRA722_ES1_0) + if (is_dra72x()) return; /* @@ -617,3 +718,24 @@ int board_early_init_f(void) return 0; } #endif + +#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) +int ft_board_setup(void *blob, bd_t *bd) +{ + ft_cpu_setup(blob, bd); + + return 0; +} +#endif + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match(const char *name) +{ + if (is_dra72x() && !strcmp(name, "dra72-evm")) + return 0; + else if (!is_dra72x() && !strcmp(name, "dra7-evm")) + return 0; + else + return -1; +} +#endif