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.

Linux/AM4378: Creating custom board. what changes to u-boot do i need if i don't include the EEPROM?

Part Number: AM4378

Tool/software: Linux

developing on Ubuntu 16.04

linux SDK 4..03.0.05

using am4378

So we are about to start making some custom boards. when i went to make a custom board in the <u-boot dir>/boards/ti/my_custom_board (copied from the 437x evm board) i see there is a lot of dependence on this EEPROM that contains the MAC, the board, name, DDR size, etc. our design doesn't have this extra chip and we think it doesn't need it.

what do i have to change in my board files (and u-boot) so that i can hard code this stuff instead of making code decisions on EEPROM data.  i have been trying to figure it all out on my own but i've never done this and i would like to know ALL the spots that need to change up-front.

Thank you

  • Hello cobsonchael,

    You can hardcode the am_ep.name to AM43__GP in ti_i2c_eeprom_am_get function in <Processor SDK>/board-support/u-boot-<version>/board/ti/common/board_detect.c file. In this way all the board, name, DDR size, etc. configurations will be selected as for AM437X GP EVM board. You can do the same for the MAC address. Please, also refer to this and this patch I've made before. The second method falls back to defined board name if the EEPROM probe fails and it is suitable for SD cards if you are planing to run it on different boards. 

    Best regards,
    Kemal

  • so as u-boot exists, without modification to the code that isn't my custom board, u-boot will only function if this eeprom exists, correct? based on your answer i would say it is impossible to make it work changing only my board.c file

    there was a change that was made to another file to add our custom dtb:
    in Kconfig at [u-boot]/arch/arm/mach-omap2/am33xx/

    in the block starting with TARGET_AM43XX_EVM we added
    config TARGET_CUSTOM_BOARD
    bool "Support Custom board"
    select TI_I2C_BOARD_DETECT
    help
    custom U-boot board configuration.


    in this instance do i remove "select TI_I2C_BOARD_DETECT"?
  • cobsonchael said:
    so as u-boot exists, without modification to the code that isn't my custom board, u-boot will only function if this eeprom exists, correct? based on your answer i would say it is impossible to make it work changing only my board.c file


    It depends which board.c file you mean but correct.


    cobsonchael said:

    in this instance do i remove "select TI_I2C_BOARD_DETECT"?

    Yes, if you remove TI_I2C_BOARD_DETECT it will NOT work. But you can always change the logic and remove all the other board detection configs and stuff which you do not need or exclude them by using conditional compilation directives.

    You can also refer to the patch in this post where I've harcoded the board name in board.c for old SDK releases and this thread where I've added AM335x SK based custom board to U-Boot.

  • in addition there is mention in the "board_eth_init" routine of an efuse which is where the MAC address is stored. what is this efuse? does the board get the MAC from the EEPROM or this efuse?
  • It is up to you to decide where to save and from where to get the MAC. Please, also see the AM437x and AM572x board files, you can find more MAC related code in there.
  • "Yes, if you remove TI_I2C_BOARD_DETECT it will NOT work."

    so i NEED that line of code? or can i exclude that line of code and just comment out some function calls in board.c? does board detect happen no matter what?

    i see your "patches" but what i am hearing is that if i base my board off of a ti board (evm, like everyone says to around here) i either need to modify the core code of u-boot/boards/ti/common.c or include an EEPROM.

    also, since you keep pointing me to posts where you directed people to use your patches that means there is no wiki for how to take u-boot and modify it completely for a custom board.

    i looked at your patch in board_detect.c, do you see anything wrong with the following change to your patch:

    rc = ti_i2c_eeprom_get(bus_addr, dev_addr, TI_EEPROM_HEADER_MAGIC,
    sizeof(am_ep), (uint8_t *)&am_ep);
    if (rc)
    {
    char tempMAC[TI_EEPROM_HDR_NO_OF_MAC_ADDR][TI_EEPROM_HDR_ETH_ALEN] = { {0, 0x1B, 0xC4, 0x03, 0xD0, 0x8F},
    {0, 0x1B, 0xC4, 0x03, 0xD0, 0x8F},
    {0, 0x1B, 0xC4, 0x03, 0xD0, 0x8F} } ;


    strlcpy(ep->name, "am437x_UTI", TI_EEPROM_HDR_NAME_LEN + 1);
    strlcpy(ep->version, "v1.0", TI_EEPROM_HDR_REV_LEN + 1);
    strlcpy(ep->serial, "434ENG00002", TI_EEPROM_HDR_SERIAL_LEN + 1);
    //strlcpy(ep->config, config stuff here, TI_EEPROM_HDR_CONFIG_LEN + 1);
    memcpy(ep->mac_addr, tempMAC,
    TI_EEPROM_HDR_NO_OF_MAC_ADDR * TI_EEPROM_HDR_ETH_ALEN); //TI_EEPROM_HDR_NO_OF_MAC_ADDR = 3, TI_EEPROM_HDR_ETH_ALEN = 6
    }
    else
    {
    strlcpy(ep->name, am_ep.name, TI_EEPROM_HDR_NAME_LEN + 1);
    /* BeagleBone Green '1' eeprom, board_rev: 0x1a 0x00 0x00 0x00 */
    if (am_ep.version[0] == 0x1a && am_ep.version[1] == 0x00 &&
    am_ep.version[2] == 0x00 && am_ep.version[3] == 0x00)
    strlcpy(ep->version, "BBG1", TI_EEPROM_HDR_REV_LEN + 1);
    else
    strlcpy(ep->version, am_ep.version, TI_EEPROM_HDR_REV_LEN + 1);

    strlcpy(ep->serial, am_ep.serial, TI_EEPROM_HDR_SERIAL_LEN + 1);
    strlcpy(ep->config, am_ep.config, TI_EEPROM_HDR_CONFIG_LEN + 1);
    memcpy(ep->mac_addr, am_ep.mac_addr,
    TI_EEPROM_HDR_NO_OF_MAC_ADDR * TI_EEPROM_HDR_ETH_ALEN);
    }

    ep->header = am_ep.header;

    ti_eeprom_string_cleanup(ep->name);
    ti_eeprom_string_cleanup(ep->version);
    ti_eeprom_string_cleanup(ep->serial);
    ti_eeprom_string_cleanup(ep->config);

    in fact, since i am completely new to this whole process (first linux board for us) is there someone i can send all my code changes to for u-boot to determine if it will likely work/made mistakes/forgot something?

  • so it seems, based on what i've found, that you guys (TI) provides a unique MAC address for the unit and we only need to load our own MAC if we want to. is that accurate?
  • in my board.c file there is this portion of code:

    #ifdef CONFIG_TI_I2C_BOARD_DETECT
    void do_board_detect(void)
    {
    if (ti_i2c_eeprom_am_get(-1, CONFIG_SYS_I2C_EEPROM_ADDR))
    printf("ti_i2c_eeprom_init failed\n");
    }
    #endif

    so if i do not include CONFIG_TI_I2C_BOARD_DETECT in that Kconfig file it looks like it won't try to do a board detect, right? so that would fix my issue and i could just modify board.c to not use any "board detected" variables/routine calls to set up my hardware, right?
  • Yes. Later wherever your see the board_is_evm() function in <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/board.c and <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/mux.c file you should make that part of the code taken into account.

  • so last question (i think):  is there someone i can send all my code changes to for u-boot to determine if it will likely work/made mistakes/forgot something?

  • You will probably need to do the code review and testing in your company or by yourself. We do not provide continuous integration services. If you are done with this thread please mark it as resolved by clicking on "This resolved my issue" button and create a new thread if you have more MAC related doubts I will assign it to network engineer.

  • ok so this seems contradictory

    i asked: so as u-boot exists, without modification to the code that isn't my custom board, u-boot will only function if this eeprom exists, correct? based on your answer i would say it is impossible to make it work changing only my board.c file

    you answered: It depends which board.c file you mean but correct.

    then i asked: so if i do not include CONFIG_TI_I2C_BOARD_DETECT in that Kconfig file it looks like it won't try to do a board detect, right? so that would fix my issue and i could just modify board.c to not use any "board detected" variables/routine calls to set up my hardware, right?

    you answered: Yes. Later wherever your see the board_is_evm() function in <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/board.c and <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/mux.c file you should make that part of the code taken into account


    so which is it, do i need to change board_detect.c to account for board detect because just changing board.c isn't enough OR changing my board files is enough and i just need to cut out enough conditional code to make it happen?

    you also did not answer this: so it seems, based on what i've found, that you guys (TI) provides a unique MAC address for the unit and we only need to load our own MAC if we want to. is that accurate?
  • cobsonchael said:
    i asked: so as u-boot exists, without modification to the code that isn't my custom board, u-boot will only function if this eeprom exists, correct? based on your answer i would say it is impossible to make it work changing only my board.c file

    you answered: It depends which board.c file you mean but correct.


    If you are asking about <Processor SDK>/board-support/u-boot-<version>/arch/arm/mach-omap2/am33xx/board.c it is less possible. If you are asking about <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/board.c it is possible. I send you the old SDK patch to check it. In the old SDK versions all the EEPROM detection was done in <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/board.c file. You can move all the logic from <Processor SDK>/board-support/u-boot-<version>/board/ti/common/board_detect.c back to your <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/board.c and make it work. I told you also to use the conditional compilation directives to implement the logic without breaking the currently implemented one. You can do this, nothing is impossible, just do it.


    cobsonchael said:
    then i asked: so if i do not include CONFIG_TI_I2C_BOARD_DETECT in that Kconfig file it looks like it won't try to do a board detect, right? so that would fix my issue and i could just modify board.c to not use any "board detected" variables/routine calls to set up my hardware, right?

    you answered: Yes. Later wherever your see the board_is_evm() function in <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/board.c and <Processor SDK>/board-support/u-boot-<version>/board/ti/am43xx/mux.c file you should make that part of the code taken into account

    You can always use the empirical method and check does it works or not.


    cobsonchael said:
    so which is it, do i need to change board_detect.c to account for board detect because just changing board.c isn't enough OR changing my board files is enough and i just need to cut out enough conditional code to make it happen?

    Just apply my fist patch I gave you. You are too new in this field to implement the other changes.


    cobsonchael said:
    you also did not answer this: so it seems, based on what i've found, that you guys (TI) provides a unique MAC address for the unit and we only need to load our own MAC if we want to. is that accurate?

    I told you to create a new thread, and I will assign it to network engineer.

  • i'm new to linux and looking for answers. that is precisely what this forum is meant for. i get the feeling you are trying to close this thread because you feel like you gave good enough answers but i am trying to learn how things work and how to best modify the code to match what i need. given the lack of documentation for this process i'm surprised a wiki doesn't exist explaining this process better. we can't be the only company that is coming from a non-linux environment to a linux environment with no previous linux experience and making a custom board.

    first off: i was unaware there was another board.c file at arch/arm/mach-omap2/am33xx/board.c so i apologize that i wasn't looking at the right files when looking at the patches. u-boot is pretty complex compared to how our last processor functioned. however i wanted to look at the patch before i apply it since i didn't know what it would do or if i even need it. it would appear that i do not need it and instead i can just omit CONFIG_TI_I2C_BOARD_DETECT from the Kconfig and remove any calls in board.c and mux.c that would ask for details from the eeprom data. this is the ultimate question i wanted answered.

    second: i didn't appreciate " You are too new in this field to implement the other changes". i would rather not apply a patch that hardcodes anything (which, if i understand it correctly would disable my ability to use the EVM board without changing it back and recompiling) and if i don't need to i would rather not have it attempt to read an i2c chip that doesn't exist and delay booting by however long the timeout value is (or spouting off error messages of attempting to access part that isn't described in DTS file). this isn't a school project. my boss won't settle for "eh, good enough. it works but i don't know why" and he won't appreciate the answer of "i don't know" when he asks why i made these changes to the files needed to make this thing boot.
  • I got your point, but once you gain more experience in this field, you will get my point too. Could you now close this thread by clicking on "This resolved my Issue" button. Your MAC address question will be answered by the network engineer. You can also create a new thread with the same subject from this thread, and I will escalate it to the highest responsible person as I can. Thank you in advance.
  • i am continuing my questions here:

    e2e.ti.com/.../772835

    issue resolved here

  • Hello cobsonchael,

    Since you are continuing the question in new thread, please close this one by clicking on "This resolved my issue" button.

    Thanks,
    Kemal