This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSIDK574: uboot board detect ti_emmc_boardid_get

Part Number: TMDSIDK574

Dear TI,

From the follwing patch,the am57xx supports that read board id information from the emmc boot1 partition,

I'm curious how to put the information in emmc, is it convenient to tell, because our customer's board does not have eeprom on it,thanks

commit d6eaaae3d3066efadab3899e3f66ee8db85368b2
Author: Caleb Robey <c-robey@ti.com>
Date: Thu Jan 2 08:17:25 2020 -0600

board: ti: beagleboneai: emmc read changes

BeagleBoard.org BeagleBone AI rev A1 does not include a board
identifier I2C EEPROM due to a design oversight. These boards have
been put into production and are generally available now.

The board identifier information, however, has been included in the
second eMMC linear boot partition (/dev/mmcblk1boot1).

+int __maybe_unused ti_emmc_boardid_get(void)
+{
+ int rc;
+ struct udevice *dev;
+ struct mmc *mmc;
+ struct ti_common_eeprom *ep;
+ struct ti_am_eeprom brdid;
+ struct blk_desc *bdesc;
+ uchar *buffer;
+
+ ep = TI_EEPROM_DATA;
+ if (ep->header == TI_EEPROM_HEADER_MAGIC)
+ return 0; /* EEPROM has already been read */
+
+ /* Initialize with a known bad marker for emmc fails.. */
+ ep->header = TI_DEAD_EEPROM_MAGIC;
+ ep->name[0] = 0x0;
+ ep->version[0] = 0x0;
+ ep->serial[0] = 0x0;
+ ep->config[0] = 0x0;
+
+ /* uclass object initialization */
+ rc = mmc_initialize(NULL);
+ if (rc)
+ return rc;
+
+ /* Set device to /dev/mmcblk1 */
+ rc = uclass_get_device(UCLASS_MMC, 1, &dev);
+ if (rc)
+ return rc;
+
+ /* Grab the mmc device */
+ mmc = mmc_get_mmc_dev(dev);
+ if (!mmc)
+ return -ENODEV;
+
+ /* mmc hardware initialization routine */
+ mmc_init(mmc);
+
+ /* Set partition to /dev/mmcblk1boot1 */
+ rc = mmc_switch_part(mmc, 2);
+ if (rc)
+ return rc;
+
+ buffer = malloc(mmc->read_bl_len);
+ if (!buffer)
+ return -ENOMEM;
+
+ bdesc = mmc_get_blk_desc(mmc);
+
+ /* blk_dread returns the number of blocks read*/
+ if (blk_dread(bdesc, 0L, 1, buffer) != 1) {
+ rc = -EIO;