[U-Boot] socfpga 2016.07-rc0: have to disable parts of flash probing and limit read size to get SPL to work

Pavel Machek pavel at denx.de
Wed Jun 1 23:24:35 CEST 2016


Hi!

There's one more "funny" thing I see with SPI: SPL fails to boot if I
let it do full probing, or if I allow it to do reads in big chunks
(that may be explained by watchdog, I'll investigate it some more).

This makes SPL work for me, but I guess I'd like to understand why.

Ideas welcome.

Best regards,
								Pavel

--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -515,6 +520,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 #endif
 		remain_len = ((SPI_FLASH_16MB_BOUN << flash->shift) *
 				(bank_sel + 1)) - offset;
+		remain_len = 32768;
 		if (len < remain_len)
 			read_len = len;
 		else
@@ -1176,23 +1178,28 @@ int spi_flash_scan(struct spi_flash *flash)
 	/* Now erase size becomes valid sector size */
 	flash->sector_size = flash->erase_size;
 
+#ifndef CONFIG_SPL_BUILD
 	/* Look for the fastest read cmd */
 	cmd = fls(params->e_rd_cmd & spi->mode_rx);
 	if (cmd) {
 		cmd = spi_read_cmds_array[cmd - 1];
 		flash->read_cmd = cmd;
 	} else {
+#endif
 		/* Go for default supported read cmd */
 		flash->read_cmd = CMD_READ_ARRAY_FAST;
+#ifndef CONFIG_SPL_BUILD		
 	}
-
 	/* Not require to look for fastest only two write cmds yet */
 	if (params->flags & WR_QPP && spi->mode & SPI_TX_QUAD)
 		flash->write_cmd = CMD_QUAD_PAGE_PROGRAM;
 	else
+#endif
 		/* Go for default supported write cmd */
 		flash->write_cmd = CMD_PAGE_PROGRAM;
 
+	/* Why are we even probing writes? SPL should not write anywhere... */
+
 	/* Set the quad enable bit - only for quad commands */
 	if ((flash->read_cmd == CMD_READ_QUAD_OUTPUT_FAST) ||
 	    (flash->read_cmd == CMD_READ_QUAD_IO_FAST) ||




-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


More information about the U-Boot mailing list