Hello devs,
I’m working on a BMC system using ASPEED AST2600.
We got the u-boot 2019.04 code from BMC provider (AMI).
I’m trying to enable multidtb to support different SKUs of
our boards. The plan is to detect the board id via i2c so that
we can load the corresponding DTB.

I’ve read README.multi-dtb-fit and enabled these configs:
CONFIG_DTB_RESELECT=y
CONFIG_MULTI_DTB_FIT=y
CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_OF_LIST="ast2600-board1 ast2600-board2"

Then add board_fit_config_name_match like
#ifdef CONFIG_MULTI_DTB_FIT
int board_fit_config_name_match(const char *name)
{
    struct udevice *bus, *dev;
    int ret = uclass_get_device_by_seq(UCLASS_I2C, 2, &bus);
    if (ret) {
        printf("Can’t access I2C2: %d\n", ret);
        return ret;
    }

    ret = dm_i2c_probe(bus, 0xE8, 0, &dev);
    if (ret) {
        printf("Can’t detect id: %d\n", ret);
        return ret;
    }
   if (strcmp(name, "ast2600-board1")
        return -1;
   return 0;
}
#endif

However, it doesn’t work as expected.
uclass_get_device_by_seq failed with errno -19 (No such device).

After further study I guess I have to enable I2C in SPL.
So I added these configs:

CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_BOARD_INIT=y

Add spl_board_init like:
#ifdef CONFIG_SPL_BOARD_INIT
void spl_board_init(void)
{
    struct udevice *bus, *dev;
    int ret = uclass_get_device_by_seq(UCLASS_I2C, 2, &bus);
    if (ret) {
        printf("Can’t access I2C2: %d\n", ret);
    }

    ret = dm_i2c_probe(bus, 0xE8, 0, &dev);
    if (ret) {
        printf("Can’t detect id: %d\n", ret);
    }
}
#endif

I also added these to DTS:

&pinctrl_i2c3_default {
        u-boot,dm-spl;
};

&i2c2 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c3_default>;
        u-boot,dm-spl;
};

However, it still doesn’t work.
I have no idea how to go further.

Please give me some suggestions.
Or is it simply impossible to do that?

Best Regards,
Chih-Wei
===================================================================================================================================
This email and any attachments to it contain confidential information and are 
intended solely for the use of the individual to whom it is addressed. If you 
are not the intended recipient or receive it accidentally, please immediately 
notify the sender by e-mail and delete the message and any attachments from 
your computer system, and destroy all hard copies. Please be advised that any 
unauthorized disclosure, copying, distribution or any action taken or omitted 
in reliance on this, is illegal and prohibited. Any views or opinions expressed 
are solely those of the author and do not represent those of ASUSTeK.

For pricing information, ASUS is only entitled to set a recommendation resale 
price. All customers are free to set their own price as they wish.
===================================================================================================================================

Reply via email to