void am57x_idk_lcd_detect(void) { int r = -ENODEV; char *idk_lcd = "no"; uint8_t buf = 0; /* Only valid for IDKs */ if (board_is_x15() || board_is_am572x_evm()) return; /* Only AM571x IDK has gpio control detect.. so check that */ if (board_is_am571x_idk() && !am571x_idk_needs_lcd()) goto out; r = i2c_set_bus_num(OSD_TS_FT_BUS_ADDRESS); if (r) { printf("%s: Failed to set bus address to %d: %d\n", __func__, OSD_TS_FT_BUS_ADDRESS, r); goto out; } r = i2c_probe(OSD_TS_FT_CHIP_ADDRESS); if (r) { /* AM572x IDK has no explicit settings for optional LCD kit */ if (board_is_am571x_idk()) { printf("%s: Touch screen detect failed: %d!\n", __func__, r); } goto out; } /* Read FT ID */ r = i2c_read(OSD_TS_FT_CHIP_ADDRESS, OSD_TS_FT_REG_ID, 1, &buf, 1); if (r) { printf("%s: Touch screen ID read %d:0x%02x[0x%02x] failed:%d\n", __func__, OSD_TS_FT_BUS_ADDRESS, OSD_TS_FT_CHIP_ADDRESS, OSD_TS_FT_REG_ID, r); goto out; } switch (buf) { case OSD_TS_FT_ID_5606: idk_lcd = "osd101t2045"; break; case OSD_TS_FT_ID_5x46: idk_lcd = "osd101t2587"; break; default: printf("%s: Unidentifed Touch screen ID 0x%02x\n", __func__, buf); /* we will let default be "no lcd" */ } out: setenv("idk_lcd", idk_lcd); return; }
void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) { if (board_is_am571x_idk()) *dmm_lisa_regs = &am571x_idk_lisa_regs; else *dmm_lisa_regs = &beagle_x15_lisa_regs; }
void vcores_update(void) { if (board_is_am572x_idk()) *omap_vcores = &am572x_idk_volts; else if (board_is_am571x_idk()) *omap_vcores = &am571x_idk_volts; }
static void setup_board_eeprom_env(void) { char *name = "beagle_x15"; int rc; rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS); if (rc) goto invalid_eeprom; if (board_is_x15()) { if (board_is_x15_revb1()) name = "beagle_x15_revb1"; else name = "beagle_x15"; } else if (board_is_am572x_evm()) { if (board_is_am572x_evm_reva3()) name = "am57xx_evm_reva3"; else name = "am57xx_evm"; } else if (board_is_am572x_idk()) { name = "am572x_idk"; } else if (board_is_am571x_idk()) { name = "am571x_idk"; } else { printf("Unidentified board claims %s in eeprom header\n", board_ti_get_name()); } invalid_eeprom: set_board_info_env(name); }
/* Override function to read eeprom information: actual i2c read done by SPL*/ void do_board_detect(void) { char *bname = NULL; int rc; rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS); if (rc) printf("ti_i2c_eeprom_init failed %d\n", rc); if (board_is_x15()) bname = "BeagleBoard X15"; else if (board_is_am572x_evm()) bname = "AM572x EVM"; else if (board_is_am574x_idk()) bname = "AM574x IDK"; else if (board_is_am572x_idk()) bname = "AM572x IDK"; else if (board_is_am571x_idk()) bname = "AM571x IDK"; if (bname) snprintf(sysinfo.board_string, SYSINFO_BOARD_NAME_MAX_LEN, "Board: %s REV %s\n", bname, board_ti_get_rev()); }
int board_fit_config_name_match(const char *name) { if (board_is_x15()) { if (board_is_x15_revb1()) { if (!strcmp(name, "am57xx-beagle-x15-revb1")) return 0; } else if (board_is_x15_revc()) { if (!strcmp(name, "am57xx-beagle-x15-revc")) return 0; } else if (!strcmp(name, "am57xx-beagle-x15")) { return 0; } } else if (board_is_am572x_evm() && !strcmp(name, "am57xx-beagle-x15")) { return 0; } else if (board_is_am572x_idk() && !strcmp(name, "am572x-idk")) { return 0; } else if (board_is_am574x_idk() && !strcmp(name, "am574x-idk")) { return 0; } else if (board_is_am571x_idk() && !strcmp(name, "am571x-idk")) { return 0; } return -1; }
void vcores_init(void) { if (board_is_am572x_idk() || board_is_am574x_idk()) *omap_vcores = &am572x_idk_volts; else if (board_is_am571x_idk()) *omap_vcores = &am571x_idk_volts; else *omap_vcores = &beagle_x15_volts; }
int board_eth_init(bd_t *bis) { int ret; uint8_t mac_addr[6]; uint32_t mac_hi, mac_lo; uint32_t ctrl_val; /* try reading mac address from efuse */ mac_lo = readl((*ctrl)->control_core_mac_id_0_lo); mac_hi = readl((*ctrl)->control_core_mac_id_0_hi); mac_addr[0] = (mac_hi & 0xFF0000) >> 16; mac_addr[1] = (mac_hi & 0xFF00) >> 8; mac_addr[2] = mac_hi & 0xFF; mac_addr[3] = (mac_lo & 0xFF0000) >> 16; mac_addr[4] = (mac_lo & 0xFF00) >> 8; mac_addr[5] = mac_lo & 0xFF; if (!getenv("ethaddr")) { printf("<ethaddr> not set. Validating first E-fuse MAC\n"); if (is_valid_ethaddr(mac_addr)) eth_setenv_enetaddr("ethaddr", mac_addr); } mac_lo = readl((*ctrl)->control_core_mac_id_1_lo); mac_hi = readl((*ctrl)->control_core_mac_id_1_hi); mac_addr[0] = (mac_hi & 0xFF0000) >> 16; mac_addr[1] = (mac_hi & 0xFF00) >> 8; mac_addr[2] = mac_hi & 0xFF; mac_addr[3] = (mac_lo & 0xFF0000) >> 16; mac_addr[4] = (mac_lo & 0xFF00) >> 8; mac_addr[5] = mac_lo & 0xFF; if (!getenv("eth1addr")) { if (is_valid_ethaddr(mac_addr)) eth_setenv_enetaddr("eth1addr", mac_addr); } ctrl_val = readl((*ctrl)->control_core_control_io1) & (~0x33); ctrl_val |= 0x22; writel(ctrl_val, (*ctrl)->control_core_control_io1); /* The phy address for the AM57xx IDK are different than x15 */ if (board_is_am572x_idk() || board_is_am571x_idk()) { cpsw_data.slave_data[0].phy_addr = 0; cpsw_data.slave_data[1].phy_addr = 1; } ret = cpsw_register(&cpsw_data); if (ret < 0) printf("Error %d registering CPSW switch\n", ret); return ret; }
int board_fit_config_name_match(const char *name) { if (board_is_x15() && !strcmp(name, "am57xx-beagle-x15")) return 0; else if (board_is_am572x_evm() && !strcmp(name, "am57xx-beagle-x15")) return 0; else if (board_is_am572x_idk() && !strcmp(name, "am572x-idk")) return 0; else if (board_is_am571x_idk() && !strcmp(name, "am571x-idk")) return 0; else return -1; }
void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs) { switch (emif_nr) { case 1: if (board_is_am571x_idk()) *regs = &am571x_emif1_ddr3_666mhz_emif_regs; else if (board_is_am574x_idk()) *regs = &am574x_emif1_ddr3_666mhz_emif_ecc_regs; else *regs = &beagle_x15_emif1_ddr3_532mhz_emif_regs; break; case 2: if (board_is_am574x_idk()) *regs = &am571x_emif1_ddr3_666mhz_emif_regs; else *regs = &beagle_x15_emif2_ddr3_532mhz_emif_regs; break; } }
void recalibrate_iodelay(void) { const struct pad_conf_entry *pconf; const struct iodelay_cfg_entry *iod; int pconf_sz, iod_sz; int ret; if (board_is_am572x_idk()) { pconf = core_padconf_array_essential_am572x_idk; pconf_sz = ARRAY_SIZE(core_padconf_array_essential_am572x_idk); iod = iodelay_cfg_array_am572x_idk; iod_sz = ARRAY_SIZE(iodelay_cfg_array_am572x_idk); } else if (board_is_am571x_idk()) { pconf = core_padconf_array_essential_am571x_idk; pconf_sz = ARRAY_SIZE(core_padconf_array_essential_am571x_idk); iod = iodelay_cfg_array_am571x_idk; iod_sz = ARRAY_SIZE(iodelay_cfg_array_am571x_idk); } else { /* Common for X15/GPEVM */ pconf = core_padconf_array_essential_x15; pconf_sz = ARRAY_SIZE(core_padconf_array_essential_x15); /* There never was an SR1.0 X15.. So.. */ if (omap_revision() == DRA752_ES1_1) { iod = iodelay_cfg_array_x15_sr1_1; iod_sz = ARRAY_SIZE(iodelay_cfg_array_x15_sr1_1); } else { /* Since full production should switch to SR2.0 */ iod = iodelay_cfg_array_x15_sr2_0; iod_sz = ARRAY_SIZE(iodelay_cfg_array_x15_sr2_0); } } /* Setup I/O isolation */ ret = __recalibrate_iodelay_start(); if (ret) goto err; /* Do the muxing here */ do_set_mux32((*ctrl)->control_padconf_core_base, pconf, pconf_sz); /* Now do the weird minor deltas that should be safe */ if (board_is_x15() || board_is_am572x_evm()) { if (board_is_x15_revb1() || board_is_am572x_evm_reva3()) { pconf = core_padconf_array_delta_x15_sr2_0; pconf_sz = ARRAY_SIZE(core_padconf_array_delta_x15_sr2_0); } else { pconf = core_padconf_array_delta_x15_sr1_1; pconf_sz = ARRAY_SIZE(core_padconf_array_delta_x15_sr1_1); } do_set_mux32((*ctrl)->control_padconf_core_base, pconf, pconf_sz); } if (board_is_am571x_idk()) { if (am571x_idk_needs_lcd()) { pconf = core_padconf_array_vout_am571x_idk; pconf_sz = ARRAY_SIZE(core_padconf_array_vout_am571x_idk); } else { pconf = core_padconf_array_icss1eth_am571x_idk; pconf_sz = ARRAY_SIZE(core_padconf_array_icss1eth_am571x_idk); } do_set_mux32((*ctrl)->control_padconf_core_base, pconf, pconf_sz); } /* Setup IOdelay configuration */ ret = do_set_iodelay((*ctrl)->iodelay_config_base, iod, iod_sz); err: /* Closeup.. remove isolation */ __recalibrate_iodelay_end(ret); }
int board_eth_init(bd_t *bis) { int ret; uint8_t mac_addr[6]; uint32_t mac_hi, mac_lo; uint32_t ctrl_val; int i; u64 mac1, mac2; u8 mac_addr1[6], mac_addr2[6]; int num_macs; /* try reading mac address from efuse */ mac_lo = readl((*ctrl)->control_core_mac_id_0_lo); mac_hi = readl((*ctrl)->control_core_mac_id_0_hi); mac_addr[0] = (mac_hi & 0xFF0000) >> 16; mac_addr[1] = (mac_hi & 0xFF00) >> 8; mac_addr[2] = mac_hi & 0xFF; mac_addr[3] = (mac_lo & 0xFF0000) >> 16; mac_addr[4] = (mac_lo & 0xFF00) >> 8; mac_addr[5] = mac_lo & 0xFF; if (!getenv("ethaddr")) { printf("<ethaddr> not set. Validating first E-fuse MAC\n"); if (is_valid_ethaddr(mac_addr)) eth_setenv_enetaddr("ethaddr", mac_addr); } mac_lo = readl((*ctrl)->control_core_mac_id_1_lo); mac_hi = readl((*ctrl)->control_core_mac_id_1_hi); mac_addr[0] = (mac_hi & 0xFF0000) >> 16; mac_addr[1] = (mac_hi & 0xFF00) >> 8; mac_addr[2] = mac_hi & 0xFF; mac_addr[3] = (mac_lo & 0xFF0000) >> 16; mac_addr[4] = (mac_lo & 0xFF00) >> 8; mac_addr[5] = mac_lo & 0xFF; if (!getenv("eth1addr")) { if (is_valid_ethaddr(mac_addr)) eth_setenv_enetaddr("eth1addr", mac_addr); } ctrl_val = readl((*ctrl)->control_core_control_io1) & (~0x33); ctrl_val |= 0x22; writel(ctrl_val, (*ctrl)->control_core_control_io1); /* The phy address for the AM57xx IDK are different than x15 */ if (board_is_am572x_idk() || board_is_am571x_idk()) { cpsw_data.slave_data[0].phy_addr = 0; cpsw_data.slave_data[1].phy_addr = 1; } ret = cpsw_register(&cpsw_data); if (ret < 0) printf("Error %d registering CPSW switch\n", ret); /* * Export any Ethernet MAC addresses from EEPROM. * On AM57xx the 2 MAC addresses define the address range */ board_ti_get_eth_mac_addr(0, mac_addr1); board_ti_get_eth_mac_addr(1, mac_addr2); if (is_valid_ethaddr(mac_addr1) && is_valid_ethaddr(mac_addr2)) { mac1 = mac_to_u64(mac_addr1); mac2 = mac_to_u64(mac_addr2); /* must contain an address range */ num_macs = mac2 - mac1 + 1; /* <= 50 to protect against user programming error */ if (num_macs > 0 && num_macs <= 50) { for (i = 0; i < num_macs; i++) { u64_to_mac(mac1 + i, mac_addr); if (is_valid_ethaddr(mac_addr)) { eth_setenv_enetaddr_by_index("eth", i + 2, mac_addr); } } } } return ret; }