
On Friday, May 15, 2015 at 10:47:46 AM, Pavel Machek wrote:
Seems like nothing much doing in micron side
switch (JEDEC_MFR(info)) { case CFI_MFR_ST: /* Micron, actually */ /* Some Micron need WREN command; all will accept it */ need_wren = true;
Umm. Take a closer look.
There's no break, so it continues below.
Ohh.. So Linux works for you.. then is it?
Well, yes, but this code patch is actually not tested in my case, because u-boot already resets it for Linux.
Anyway, is this what you'd like to see?
Was my idea of checking in which mode the SPI NOR is first discarded ?
[...]
@@ -233,6 +234,30 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode, flash->poll_cmd = CMD_FLAG_STATUS; #endif
- if (params->flags & MICRON_RESET) {
+#define CMD_RESET_ENABLE 0x66 +#define CMD_RESET_MEMORY 0x99
int ret;
The indent here seems funny.
I think it'd be better to pull this reset procedure into a separate function.
/*
* This is needed for the SoCFPGA booting from SPI NOR flash
* e.g. (N25Q256A), as U-Boot SPL 2013-socfpga (only version
* working on that board) sets 4-byte addressing mode.
*/
ret = spi_flash_cmd(spi, CMD_RESET_ENABLE, NULL, 0);
if (ret) {
printf("SF: Failed issue enable reset command\n");
return ret;
}
ret = spi_flash_cmd(spi, CMD_RESET_MEMORY, NULL, 0);
if (ret) {
printf("SF: Failed issue reset command\n");
return ret;
}
printf("SF: Device software reset\n");
- }
Otherwise I think it's OK.