FAILED: patch "[PATCH] spi: cadence-quadspi: Flush posted register writes before DAC" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y
git checkout FETCH_HEAD
git cherry-pick -x 1ad55767e77a853c98752ed1e33b68049a243bd7
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025101635-laurel-crawling-2104@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 1ad55767e77a853c98752ed1e33b68049a243bd7 Mon Sep 17 00:00:00 2001
From: Pratyush Yadav <[email protected]>
Date: Sat, 6 Sep 2025 00:29:56 +0530
Subject: [PATCH] spi: cadence-quadspi: Flush posted register writes before DAC
access
cqspi_read_setup() and cqspi_write_setup() program the address width as the last step in the setup. This is likely to be immediately followed by a DAC region read/write. On TI K3 SoCs the DAC region is on a different endpoint from the register region. This means that the order of the two operations is not guaranteed, and they might be reordered at the interconnect level. It is possible that the DAC read/write goes through before the address width update goes through. In this situation if the previous command used a different address width the OSPI command is sent with the wrong number of address bytes, resulting in an invalid command and undefined behavior.
Read back the size register to make sure the write gets flushed before accessing the DAC region.
Message-ID: <[email protected]>
drivers/spi/spi-cadence-quadspi.c +2 -0
@@ -719,6 +719,7 @@ static int cqspi_read_setup(struct cqspi_flash_pdata *f_pdata, reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK ; reg |= (op->addr.nbytes -1 );writel (reg, reg_base +CQSPI_REG_SIZE ); +readl (reg_base +CQSPI_REG_SIZE );/* Flush posted write. */ return 0 ; }
@@ -1063,6 +1064,7 @@ static int cqspi_write_setup(struct cqspi_flash_pdata *f_pdata, reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK ; reg |= (op->addr.nbytes -1 );writel (reg, reg_base +CQSPI_REG_SIZE ); +readl (reg_base +CQSPI_REG_SIZE );/* Flush posted write. */ return 0 ; }
Sasha Levin
maintainerPATCH 1/1 spi: cadence-quadspi: Flush posted register writes before DAC access
From: Pratyush Yadav <[email protected]>
[ Upstream commit 1ad55767e77a853c98752ed1e33b68049a243bd7 ]
cqspi_read_setup() and cqspi_write_setup() program the address width as the last step in the setup. This is likely to be immediately followed by a DAC region read/write. On TI K3 SoCs the DAC region is on a different endpoint from the register region. This means that the order of the two operations is not guaranteed, and they might be reordered at the interconnect level. It is possible that the DAC read/write goes through before the address width update goes through. In this situation if the previous command used a different address width the OSPI command is sent with the wrong number of address bytes, resulting in an invalid command and undefined behavior.
Read back the size register to make sure the write gets flushed before accessing the DAC region.
Message-ID: <[email protected]>
--- drivers/mtd/spi-nor/cadence-quadspi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/spi-nor/cadence-quadspi.c +2 -0
@@ -496,6 +496,7 @@ static int cqspi_read_setup(struct spi_nor *nor) reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK ; reg |= (nor->addr_width -1 );writel (reg, reg_base +CQSPI_REG_SIZE ); +readl (reg_base +CQSPI_REG_SIZE );/* Flush posted write. */ return 0 ; }
@@ -608,6 +609,7 @@ static int cqspi_write_setup(struct spi_nor *nor) reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK ; reg |= (nor->addr_width -1 );writel (reg, reg_base +CQSPI_REG_SIZE ); +readl (reg_base +CQSPI_REG_SIZE );/* Flush posted write. */ return 0 ; }
Signature · 1 line
2.51.0