[U-Boot] [PATCH V9 7/9] MMC: APIs to support resize of EMMC boot partition

Michael Pratt mpratt at chromium.org
Thu May 23 18:51:16 CEST 2013


Hi Amar,

On Apr 27, 2013 at 6:12 AM, Amar <amarendra.xt at samsung.com> wrote:
> +#ifdef CONFIG_SUPPORT_EMMC_BOOT
> +/*
> + * This function changes the size of boot partition and the size of rpmb
> + * partition present on EMMC devices.
> + *
> + * Input Parameters:
> + * struct *mmc: pointer for the mmc device strcuture
> + * bootsize: size of boot partition
> + * rpmbsize: size of rpmb partition
> + *
> + * Returns 0 on success.
> + */
> +
> +int mmc_boot_partition_size_change(struct mmc *mmc, unsigned long bootsize,
> + unsigned long rpmbsize)
> +{
> + int err;
> + struct mmc_cmd cmd;
> +
> + /* Only use this command for raw EMMC moviNAND. Enter backdoor mode */
> + cmd.cmdidx = MMC_CMD_RES_MAN;
> + cmd.resp_type = MMC_RSP_R1b;
> + cmd.cmdarg = MMC_CMD62_ARG1;
> +
> + err = mmc_send_cmd(mmc, &cmd, NULL);
> + if (err) {
> + debug("mmc_boot_partition_size_change: Error1 = %d\n", err);
> + return err;
> + }
> +
> + /* Boot partition changing mode */
> + cmd.cmdidx = MMC_CMD_RES_MAN;
> + cmd.resp_type = MMC_RSP_R1b;
> + cmd.cmdarg = MMC_CMD62_ARG2;

The function description above implies that this function will work on all EMMC
devices, but you are using vendor commands here and have the comment "Only use
this command for raw EMMC moviNAND".

This was brought up in the V4 patch by Jaehoon Chung, but never addressed.
Vendor specific code should probably be broken off to a vendor specific area,
or there should at least be some conditional check that the EMMC is compatible.

> +
> + err = mmc_send_cmd(mmc, &cmd, NULL);
> + if (err) {
> + debug("mmc_boot_partition_size_change: Error2 = %d\n", err);
> + return err;
> + }
> + /* boot partition size is multiple of 128KB */
> + bootsize = (bootsize * 1024) / 128;
> +
> + /* Arg: boot partition size */
> + cmd.cmdidx = MMC_CMD_RES_MAN;
> + cmd.resp_type = MMC_RSP_R1b;
> + cmd.cmdarg = bootsize;
> +
> + err = mmc_send_cmd(mmc, &cmd, NULL);
> + if (err) {
> + debug("mmc_boot_partition_size_change: Error3 = %d\n", err);
> + return err;
> + }
> + /* RPMB partition size is multiple of 128KB */
> + rpmbsize = (rpmbsize * 1024) / 128;
> + /* Arg: RPMB partition size */
> + cmd.cmdidx = MMC_CMD_RES_MAN;
> + cmd.resp_type = MMC_RSP_R1b;
> + cmd.cmdarg = rpmbsize;
> +
> + err = mmc_send_cmd(mmc, &cmd, NULL);
> + if (err) {
> + debug("mmc_boot_partition_size_change: Error4 = %d\n", err);
> + return err;
> + }
> + return 0;
> +}

Thanks,
Michael Pratt


More information about the U-Boot mailing list