[PATCH v2 2/3] mmc: erase: Use TRIM erase when available
Jaehoon Chung
jh80.chung at samsung.com
Wed Feb 8 10:03:10 CET 2023
Hi Loic,
> -----Original Message-----
> From: Loic Poulain <loic.poulain at linaro.org>
> Sent: Wednesday, February 8, 2023 5:09 PM
> To: Jaehoon Chung <jh80.chung at samsung.com>
> Cc: sjg at chromium.org; peng.fan at nxp.com; u-boot at lists.denx.de
> Subject: Re: [PATCH v2 2/3] mmc: erase: Use TRIM erase when available
>
> Hi Jaehoon,
>
> On Mon, 6 Feb 2023 at 06:05, Jaehoon Chung <jh80.chung at samsung.com> wrote:
> >
> > Hi,
> >
> > > -----Original Message-----
> > > From: Loic Poulain <loic.poulain at linaro.org>
> > > Sent: Thursday, January 26, 2023 6:24 PM
> > > To: sjg at chromium.org; peng.fan at nxp.com; jh80.chung at samsung.com
> > > Cc: u-boot at lists.denx.de; Loic Poulain <loic.poulain at linaro.org>
> > > Subject: [PATCH v2 2/3] mmc: erase: Use TRIM erase when available
> > >
> > > The default erase command applies on erase group unit, and
> > > simply round down to erase group size. When the start block
> > > is not aligned to erase group size (e.g. erasing partition)
> > > it causes unwanted erasing of the previous blocks, part of
> > > the same erase group (e.g. owned by other logical partition,
> > > or by the partition table itself).
> > >
> > > To prevent this issue, a simple solution is to use TRIM as
> > > argument of the Erase command, which is usually supported
> > > with eMMC > 4.0, and allow to apply erase operation to write
> > > blocks instead of erase group
> > >
> > > Signed-off-by: Loic Poulain <loic.poulain at linaro.org>
> > > ---
> > > v2: Add mmc unit test change to the series
> > >
> > > drivers/mmc/mmc_write.c | 34 +++++++++++++++++++++++-----------
> > > 1 file changed, 23 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c
> > > index 5b7aeeb012..a6f93380dd 100644
> > > --- a/drivers/mmc/mmc_write.c
> > > +++ b/drivers/mmc/mmc_write.c
> > > @@ -15,7 +15,7 @@
> > > #include <linux/math64.h>
> > > #include "mmc_private.h"
> > >
> > > -static ulong mmc_erase_t(struct mmc *mmc, ulong start, lbaint_t blkcnt)
> > > +static ulong mmc_erase_t(struct mmc *mmc, ulong start, lbaint_t blkcnt, u32 args)
> > > {
> > > struct mmc_cmd cmd;
> > > ulong end;
> > > @@ -52,7 +52,7 @@ static ulong mmc_erase_t(struct mmc *mmc, ulong start, lbaint_t blkcnt)
> > > goto err_out;
> > >
> > > cmd.cmdidx = MMC_CMD_ERASE;
> > > - cmd.cmdarg = MMC_ERASE_ARG;
> > > + cmd.cmdarg = args ? args : MMC_ERASE_ARG;
> >
> > It there any case to pass by other value?
>
> Not at the moment, but it can be used to support eMMC 'Secure Erase' arg.
I had mis-read. I had read the MMC_TRIM_ARG as MMC_ERASE_ARG. Thanks for kindly explanation. :)
Best Regards,
Jaehoon Chung
>
> Regards,
> Loic
More information about the U-Boot
mailing list