[U-Boot] saveenv corrupts QSPI flash with latest commit U-Boot 2019.04-rc4-00047-gcfb3e102c4

Vignesh Raghavendra vigneshr at ti.com
Tue Apr 2 04:33:41 UTC 2019


Ashish,
> 
> Hi Vignesh,
> This is working now(READ, WRITE), after some change in fsl_qspi driver, where I check for 4byte op codes now.
> But now I see that erase is getting address as ZERO. Which in my opinion is  because 
> spi_nor_erase_sector() call write_reg which has SPI_MEM_OP_NO_ADDR?
> 
> /*
>  * Initiate the erasure of a single sector
>  */
> static int spi_nor_erase_sector(struct spi_nor *nor, u32 addr)
> {
>         u8 buf[SPI_NOR_MAX_ADDR_WIDTH];
>         int i;
> 
>         if (nor->erase)
>                 return nor->erase(nor, 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);
> }
> 
> 
> static int spi_nor_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
> {
>         struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(opcode, 1),
>                                           SPI_MEM_OP_NO_ADDR,
>                                           SPI_MEM_OP_NO_DUMMY,
>                                           SPI_MEM_OP_DATA_OUT(len, NULL, 1));
> 
>                 return spi_nor_read_write_reg(nor, &op, buf);
> }
> 

Marek has posted a patch[1] which should fix erase issue for you without
any driver changes. Could you test and provide a Tested-by for the
patch. I will ask Jagan to pull that in for v2019.04 if it works.

[1] http://patchwork.ozlabs.org/patch/1073563/

-- 
Regards
Vignesh


More information about the U-Boot mailing list