Other Parts Discussed in Thread: CSD
Hi TI engineers,
I want to modify the source code so that my board will always boot from eMMC boot partition #1 during initialization and before going into uboot. I understand which boot partition to boot is determined by the register EXT_CSD[179] which is set by using mmc partconf in uboot. Is there other way to hardcode the eMMC boot partition in uboot source code?
I found something in the /common/spl/Kconfig file.
config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION bool "MMC Raw mode: by partition" help Use a partition for loading U-Boot when using MMC/SD in raw mode. config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION hex "Partition to use to load U-Boot from" depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION default 1 help Partition on the MMC to load U-Boot from when the MMC is being used in raw mode config SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG bool "Override eMMC EXT_CSC_PART_CONFIG by user defined partition" depends on SUPPORT_EMMC_BOOT help eMMC boot partition is normally configured by the bits of the EXT_CSD register (EXT_CSC_PART_CONFIG), BOOT_PARTITION_ENABLE field. In some cases it might be required in SPL to load the image from different partition than the partition selected by EXT_CSC_PART_CONFIG register. Enable this option if you intend to use an eMMC boot partition other then selected via EXT_CSC_PART_CONFIG register and specify the custom partition number by the CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION option. config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION int "Number of the eMMC boot partition to use" depends on SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG default 1 help eMMC boot partition number to use when the eMMC in raw mode and the eMMC EXT_CSC_PART_CONFIG selection should be overridden in SPL by user defined partition number.
I have enable both by defining in the r5 and a53 deconfig file. But how do I use this to set to eMMC boot partition #1 during board initialization? Also, I have set the primary boot mode to eMMC for the boot configuration switches.
Or is it possible to modify the register EXT_CSD[179] in the board initialization source code, then build it and flash into the board?
By the way, I have found the source code for the command mmc partconf in /cmd/mmc.c
static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { int dev; struct mmc *mmc; u8 ack, part_num, access; if (argc != 2 && argc != 5) return CMD_RET_USAGE; dev = simple_strtoul(argv[1], NULL, 10); mmc = init_mmc_device(dev, false); if (!mmc) return CMD_RET_FAILURE; if (IS_SD(mmc)) { puts("PARTITION_CONFIG only exists on eMMC\n"); return CMD_RET_FAILURE; } if (argc == 2) return mmc_partconf_print(mmc); ack = simple_strtoul(argv[2], NULL, 10); part_num = simple_strtoul(argv[3], NULL, 10); access = simple_strtoul(argv[4], NULL, 10); /* acknowledge to be sent during boot operation */ return mmc_set_part_conf(mmc, ack, part_num, access); }
From the code, it will call another function to set part conf and this function is in /drivers/mmc/mmc_boot.c
/* * Modify EXT_CSD[179] which is PARTITION_CONFIG (formerly BOOT_CONFIG) * based on the passed in values for BOOT_ACK, BOOT_PARTITION_ENABLE and * PARTITION_ACCESS. * * Returns 0 on success. */ int mmc_set_part_conf(struct mmc *mmc, u8 ack, u8 part_num, u8 access) { int ret; u8 part_conf; part_conf = EXT_CSD_BOOT_ACK(ack) | EXT_CSD_BOOT_PART_NUM(part_num) | EXT_CSD_PARTITION_ACCESS(access); ret = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF, part_conf); if (!ret) mmc->part_config = part_conf; return ret; }
If I hardcode this, it will not take effect upon initialization, but will only take effect when you use the command in uboot.
In other words, is it possible to configure the register EXT_CSD[179] without configuring in u-boot or kernel?
Thanks.