From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Date: Mon, 30 May 2016 10:52:39 +0200 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: <20160530085239.GB18126@amd> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi! > 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... Disabling flash locking like this seems to do the trick: diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 907067b..b75e66a 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -1131,14 +1131,16 @@ int spi_flash_scan(struct spi_flash *flash) /* lock hooks are flash specific - assign them based on idcode0 */ switch (idcode[0]) { +#if 0 #if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST) case SPI_FLASH_CFI_MFR_STMICRO: case SPI_FLASH_CFI_MFR_SST: flash->flash_lock = stm_lock; flash->flash_unlock = stm_unlock; flash->flash_is_locked = stm_is_locked; -#endif break; +#endif +#endif default: debug("SF: Lock ops not supported for %02x flash\n", idcode[0]); } and if someone is watching, the #endif should be moved. switch (...) { break; } is strange kind of C. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html