From e0d58157d8e2ec3da0a1fe62a65aa756c5514871 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 5 Nov 2017 18:34:01 +0100 Subject: [PATCH] ar71xx: fix flash fast read on devices using multiple flash chips Add a callback to allow the SPI driver to indicate which devices fast flash read works on. Signed-off-by: Felix Fietkau --- .../461-spi-ath79-add-fast-flash-read.patch | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/target/linux/ar71xx/patches-4.9/461-spi-ath79-add-fast-flash-read.patch b/target/linux/ar71xx/patches-4.9/461-spi-ath79-add-fast-flash-read.patch index 0dc73a8b5b..5c3583f758 100644 --- a/target/linux/ar71xx/patches-4.9/461-spi-ath79-add-fast-flash-read.patch +++ b/target/linux/ar71xx/patches-4.9/461-spi-ath79-add-fast-flash-read.patch @@ -10,10 +10,18 @@ } static void ath79_spi_disable(struct ath79_spi *sp) -@@ -205,6 +202,33 @@ static u32 ath79_spi_txrx_mode0(struct s +@@ -205,6 +202,38 @@ static u32 ath79_spi_txrx_mode0(struct s return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); } ++static bool ath79_spi_flash_read_supported(struct spi_device *spi) ++{ ++ if (spi->chip_select || gpio_is_valid(spi->cs_gpio)) ++ return false; ++ ++ return true; ++} ++ +static int ath79_spi_read_flash_data(struct spi_device *spi, + struct spi_flash_read_message *msg) +{ @@ -22,9 +30,6 @@ + if (msg->addr_width > 3) + return -EOPNOTSUPP; + -+ if (spi->chip_select || gpio_is_valid(spi->cs_gpio)) -+ return -EOPNOTSUPP; -+ + /* disable GPIO mode */ + ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0); + @@ -44,11 +49,12 @@ static int ath79_spi_probe(struct platform_device *pdev) { struct spi_master *master; -@@ -234,6 +258,7 @@ static int ath79_spi_probe(struct platfo +@@ -234,6 +263,8 @@ static int ath79_spi_probe(struct platfo master->num_chipselect = pdata->num_chipselect; master->cs_gpios = pdata->cs_gpios; } + master->spi_flash_read = ath79_spi_read_flash_data; ++ master->flash_read_supported = ath79_spi_flash_read_supported; sp->bitbang.master = master; sp->bitbang.chipselect = ath79_spi_chipselect; -- 2.25.1