int board_late_init(void) { char *idk_lcd; setup_board_eeprom_env(); /* * DEV_CTRL.DEV_ON = 1 please - else palmas switches off in 8 seconds * This is the POWERHOLD-in-Low behavior. */ palmas_i2c_write_u8(TPS65903X_CHIP_P1, 0xA0, 0x1); /* TBD: Add LCD panel detection once information is available */ if (am571x_idk_needs_lcd()) idk_lcd = "osd101t2045"; /* Default to legacy LCD */ else idk_lcd = "no"; setenv("idk_lcd", idk_lcd); #if !defined(CONFIG_SPL_BUILD) board_set_ethaddr(); #endif return 0; }
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 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); }