Thread (44 messages) 44 messages, 3 authors, 2019-10-25

Re: [PATCH v2 10/22] mtd: spi-nor: Rework write_sr()

From: John Garry <hidden>
Date: 2019-10-04 10:27:07
Also in: linux-aspeed, linux-mediatek, lkml

On 04/10/2019 11:03, Tudor.Ambarus@microchip.com wrote:
Hi, John,

On 10/04/2019 12:39 PM, John Garry wrote:
quoted
External E-Mail


On 24/09/2019 08:46, Tudor.Ambarus@microchip.com wrote:
quoted
+}
+
+/**
+ * spi_nor_write_sr() - Write the Status Register.
+ * @nor:    pointer to 'struct spi_nor'.
+ * @sr:        buffer to write to the Status Register.
+ * @len:    number of bytes to write to the Status Register.
+ *
+ * Return: 0 on success, -errno otherwise.
  */
-static int write_sr(struct spi_nor *nor, u8 val)
+static int spi_nor_write_sr(struct spi_nor *nor, const u8 *sr, size_t len)
 {
-    nor->bouncebuf[0] = val;
+    int ret;
+
+    ret = spi_nor_write_enable(nor);
+    if (ret)
+        return ret;
+
Hi Tudor,
quoted
     if (nor->spimem) {
         struct spi_mem_op op =
             SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_WRSR, 1),
                    SPI_MEM_OP_NO_ADDR,
                    SPI_MEM_OP_NO_DUMMY,
-                   SPI_MEM_OP_DATA_IN(1, nor->bouncebuf, 1));
This be SPI_MEM_OP_DATA_OUT() in the current mainline code also, right?
Hi Tudor,
In v5.4-rc1 this is defined as SPI_MEM_OP_DATA_IN, so the Mainline code should
fail. This looks like a bug. I didn't noticed it when doing the patch.
quoted
I'm testing my under development driver on top of v5.4-rc1, and flash_lock -u is broken.
It's not clear to me, does flash_lock fail with my patches on top of v5.4-rc1?
No, I haven't tested these patches. I'm just testing my out-of-tree 
driver on top of vanilla v5.4-rc1. I'm just mentioning the issue here as 
it seemed like a reasonably appropriate place.

However it looks like I will also need to test on top of these patches.
Or it fails when testing v5.4-rc1?

Can you test v5.4-rc1 and see if flash_lock works on you flash or not?
flash_lock -u errors for my driver on top of vanilla v5.4-rc1.

When I make the change, as above, flash_lock -u and -l succeed, but I 
can still write to the flash - I need to check that more - it may be my 
buggy driver.

IIRC, it did work for my driver based on v5.3
Please specify which flash do you use, and which controller.
The flash is n25q128a11:
[   14.917868] spi-nor spi-PRP0001:00: n25q128a11 (16384 Kbytes)

As for the driver, it's another HiSilicon SPI NOR controller driver 
which I'm developing - I eluded to it here already: 
https://lore.kernel.org/linux-mtd/c5e063e8-5025-8206-f819-6ce5228ef0fb@huawei.com/ (local)

Cheers,
John
Thanks for testing this!
ta


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help