> -----Original Message-----
> From: Vignesh Raghavendra <vigne...@ti.com>
> Sent: Tuesday, April 2, 2019 10:04 AM
> To: Marek Vasut <marek.va...@gmail.com>; u-boot@lists.denx.de
> Cc: Marek Vasut <marek.vasut+rene...@gmail.com>; Horatiu Vultur
> <horatiu.vul...@microchip.com>; Jagan Teki <ja...@openedev.com>; Simon
> Goldschmidt <simon.k.r.goldschm...@gmail.com>; Stefan Roese <s...@denx.de>;
> Ashish Kumar <ashish.ku...@nxp.com>
> Subject: Re: [PATCH] mtd: spi: Replace ad-hoc default implementation with
> spi_mem_op
> 
> + Ashish,
> 
> On 02/04/19 6:22 AM, Marek Vasut wrote:
> > Replace the ad-hoc erase operation implementation with a simple
> > spi_mem_op implementation of the same functionality. This is a minor
> > optimization and removal of the ad-hoc code.
> >
> > This however also changes the behavior of the execution of the erase
> > opcode from two separate transfer requests to the SPI NOR driver to
> > one transfer request to the SPI NOR driver. The former was how U-Boot
> > behaved before the SPI NOR framework was imported and the later was
> > introduced by the SPI NOR framework. The former is more optimal, so
> > keep that.
> >
> > Signed-off-by: Marek Vasut <marek.vasut+rene...@gmail.com>
> > Cc: Horatiu Vultur <horatiu.vul...@microchip.com>
> > Cc: Jagan Teki <ja...@openedev.com>
> > Cc: Simon Goldschmidt <simon.k.r.goldschm...@gmail.com>
> > Cc: Stefan Roese <s...@denx.de>
> > Cc: Vignesh R <vigne...@ti.com>
> > ---
> 
> Marek, thanks for the fix!
> 
> Jagan,
> 
> Could we get this merged before v2019.04 release as this should fix regression
> wrt erase reported by Ashish.


Yes, follow patch reverts back to old method of erase implementation.
Tested-by: Ashish Kumar <ashish.ku...@nxp.com>

Regards
Ashish
> 
> >  drivers/mtd/spi/spi-nor-core.c | 14 ++++++--------
> >  1 file changed, 6 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/mtd/spi/spi-nor-core.c
> > b/drivers/mtd/spi/spi-nor-core.c index b7f0733877..c4e2f6a08f 100644
> > --- a/drivers/mtd/spi/spi-nor-core.c
> > +++ b/drivers/mtd/spi/spi-nor-core.c
> > @@ -524,8 +524,11 @@ static int read_bar(struct spi_nor *nor, const struct
> flash_info *info)
> >   */
> >  static int spi_nor_erase_sector(struct spi_nor *nor, u32 addr)  {
> > -   u8 buf[SPI_NOR_MAX_ADDR_WIDTH];
> > -   int i;
> > +   struct spi_mem_op op =
> > +           SPI_MEM_OP(SPI_MEM_OP_CMD(nor->erase_opcode, 1),
> > +                      SPI_MEM_OP_ADDR(nor->addr_width, addr, 1),
> > +                      SPI_MEM_OP_NO_DUMMY,
> > +                      SPI_MEM_OP_NO_DATA);
> >
> >     if (nor->erase)
> >             return nor->erase(nor, addr);
> > @@ -534,12 +537,7 @@ static int spi_nor_erase_sector(struct spi_nor *nor,
> u32 addr)
> >      * Default implementation, if driver doesn't have a specialized HW
> >      * control
> >      */
> > -   for (i = nor->addr_width - 1; i >= 0; i--) {
> > -           buf[i] = addr & 0xff;
> > -           addr >>= 8;
> > -   }
> > -
> > -   return nor->write_reg(nor, nor->erase_opcode, buf, nor->addr_width);
> > +   return spi_mem_exec_op(nor->spi, &op);
> >  }
> >
> >  /*
> >
> 
> --
> Regards
> Vignesh
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to