From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabio Estevam Date: Mon, 30 May 2016 10:43:39 -0300 Subject: [U-Boot] Between 2015.10 and 2016.01, SPI flash changed erase size, and saveenv stopped working In-Reply-To: <20160530083315.GA18126@amd> References: <20160529204041.GA8588@amd> <574BB1B8.8010400@denx.de> <20160530083315.GA18126@amd> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, May 30, 2016 at 5:33 AM, Pavel Machek wrote: > Commit c3c016cf75360c2a0d0a065b64b438aaf7720576 is a part of the problem: > > offset 0x40000 is protected and cannot be erased > => sf help > No SPI flash selected. Please run `sf probe' > => sf probe > ... > SF: Detected N25Q512 with page size 256 Bytes, erase size 4 KiB, total > 64 MiB > cadence_spi_set_speed: speed=1000000 > => sf protect unlock 0x40000 0x20000 > cadence_spi_xfer: len=1 [bytes] > cadence_spi_xfer: len=1 [bytes] > => saveenv > Saving Environment to SPI Flash... Does this quick hack help? I am wondering if yous SPI flash power up with the SR field protected: --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -1021,11 +1021,7 @@ int spi_flash_scan(struct spi_flash *flash) return -EPROTONOSUPPORT; } - /* Flash powers up read-only, so clear BP# bits */ - if (idcode[0] == SPI_FLASH_CFI_MFR_ATMEL || - idcode[0] == SPI_FLASH_CFI_MFR_MACRONIX || - idcode[0] == SPI_FLASH_CFI_MFR_SST) - write_sr(flash, 0); + write_sr(flash, 0); /* Assign spi data */ flash->name = params->name;