mirror of
https://github.com/cjdelisle/openwrt.git
synced 2025-09-15 09:29:50 +00:00
The EN751221 SPI controller requires quiet time between operations otherwise NAND writes are often (almost always) not committed. udelay(100) works but does not account for the SPI clock speed which is configurable. This issue has been observed on two different SoCs with different brands of SPI NAND. The vendor code sets the CS state twice in order to add one SPI op worth of quiet time before and after each operation, this seems like a good strategy and is in any case well tested. Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
30 lines
725 B
Diff
30 lines
725 B
Diff
--- a/drivers/spi/Kconfig
|
|
+++ b/drivers/spi/Kconfig
|
|
@@ -355,7 +355,7 @@ config SPI_DLN2
|
|
|
|
config SPI_AIROHA_EN7523
|
|
bool "Airoha EN7523 SPI controller support"
|
|
- depends on ARCH_AIROHA
|
|
+ depends on ARCH_AIROHA || ECONET_EN75
|
|
help
|
|
This enables SPI controller support for the Airoha EN7523 SoC.
|
|
|
|
--- a/drivers/spi/spi-en7523.c
|
|
+++ b/drivers/spi/spi-en7523.c
|
|
@@ -82,10 +82,11 @@ static void opfifo_write(u32 cmd, u32 le
|
|
|
|
static void set_cs(int state)
|
|
{
|
|
- if (state)
|
|
- opfifo_write(OP_CSH, 1);
|
|
- else
|
|
- opfifo_write(OP_CSL, 1);
|
|
+ u32 cmd = state ? OP_CSH : OP_CSL;
|
|
+
|
|
+ /* EN751221 drops writes if we don't send this twice. */
|
|
+ opfifo_write(cmd, 1);
|
|
+ opfifo_write(cmd, 1);
|
|
}
|
|
|
|
static void manual_begin_cmd(void)
|