On 03/29/2017 03:35 PM, Ludovic BARRE wrote:yes it's needed before scan (fix a "stm32 qspi controller" issue)
[...]
Errr, now I am totally lost :) Is that some internal SPI NOR ? Shouldn'toops, fsize field defined the size of "flash memory" in stm32 qspiWhat external memory ? Unclearfsize field defines the size of external memory.+ writel_relaxed(CR_PRESC(presc) | CR_FTHRES(3) | CR_TCEN |I don't understand why this is needed and the comment doesn't make
CR_SSHIFT
+ | CR_EN, qspi->io_base + QUADSPI_CR);
+
+ /* a minimum fsize must be set to sent the command id */
+ flash->fsize = 25;
sense. Please fix.
controller.
the size be coming from DT or something ?
Number of bytes in Flash memory = 2 ^[FSIZE+1].Is it needed before the scan ?
To sent a nor cmd this field must be set (hardware issue),
but before "spi_nor_scan" the size of flash nor is not know.
So I set a temporary value (workaround).
After "spi_nor_scan" the fsize is overwritten by the right value
flash->fsize = __fls(mtd->size) - 1;
Normaly, this field is used only for memory map mode,Please do, also please consider that I'm reading the comment and I
but in fact is check in indirect mode.
So while flash scan "spi_nor_scan":
-I can't let 0.
-I not know yet the size of flash.
So I fix a temporary value
I will update my comment
barely have any clue about this hardware , so make sure I can
understand it.
+ ret = spi_nor_scan(&flash->nor, NULL, flash_read);[...]
+ if (ret) {
+ dev_err(qspi->dev, "device scan failed\n");
+ return ret;
+ }
+
+ flash->fsize = __fls(mtd->size) - 1;
+
+ writel_relaxed(DCR_CSHT(1), qspi->io_base + QUADSPI_DCR);
+
+ ret = mtd_device_register(mtd, NULL, 0);
+ if (ret) {
+ dev_err(qspi->dev, "mtd device parse failed\n");
+ return ret;
+ }
+
+ dev_dbg(qspi->dev, "read mm:%s cs:%d bus:%d\n",
+ qspi->read_mode == CCR_FMODE_MM ? "yes" : "no", cs_num,
width);
+
+ return 0;
+}