bcm53xx: replace SPI revert with a fix sent upstream
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-4.14 / 180-spi-bcm-qspi-switch-back-to-reading-flash-using-smal.patch
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Date: Thu, 11 Oct 2018 09:07:31 +0200
3 Subject: [PATCH FIX] spi: bcm-qspi: switch back to reading flash using smaller
4 chunks
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Fixing/optimizing bcm_qspi_bspi_read() performance introduced two
10 changes:
11 1) It added a loop to read all requested data using multiple BSPI ops.
12 2) It bumped max size of a single BSPI block request from 256 to 512 B.
13
14 The later change resulted in occasional BSPI timeouts causing a
15 regression.
16
17 For some unknown reason hardware doesn't always handle reads as expected
18 when using 512 B chunks. In such cases it may happen that BSPI returns
19 amount of requested bytes without the last 1-3 ones. It provides the
20 remaining bytes later but doesn't raise an interrupt until another LR
21 start.
22
23 Switching back to 256 B reads fixes that problem and regression.
24
25 Fixes: 345309fa7c0c ("spi: bcm-qspi: Fix bcm_qspi_bspi_read() performance")
26 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
27 Cc: stable@vger.kernel.org # 4.11+
28 ---
29 drivers/spi/spi-bcm-qspi.c | 2 +-
30 1 file changed, 1 insertion(+), 1 deletion(-)
31
32 --- a/drivers/spi/spi-bcm-qspi.c
33 +++ b/drivers/spi/spi-bcm-qspi.c
34 @@ -88,7 +88,7 @@
35 #define BSPI_BPP_MODE_SELECT_MASK BIT(8)
36 #define BSPI_BPP_ADDR_SELECT_MASK BIT(16)
37
38 -#define BSPI_READ_LENGTH 512
39 +#define BSPI_READ_LENGTH 256
40
41 /* MSPI register offsets */
42 #define MSPI_SPCR0_LSB 0x000