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 <nbd@nbd.name>
This commit is contained in:
parent
e0bd225269
commit
e0d58157d8
1 changed files with 11 additions and 5 deletions
|
@ -10,10 +10,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ath79_spi_disable(struct ath79_spi *sp)
|
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);
|
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,
|
+static int ath79_spi_read_flash_data(struct spi_device *spi,
|
||||||
+ struct spi_flash_read_message *msg)
|
+ struct spi_flash_read_message *msg)
|
||||||
+{
|
+{
|
||||||
|
@ -22,9 +30,6 @@
|
||||||
+ if (msg->addr_width > 3)
|
+ if (msg->addr_width > 3)
|
||||||
+ return -EOPNOTSUPP;
|
+ return -EOPNOTSUPP;
|
||||||
+
|
+
|
||||||
+ if (spi->chip_select || gpio_is_valid(spi->cs_gpio))
|
|
||||||
+ return -EOPNOTSUPP;
|
|
||||||
+
|
|
||||||
+ /* disable GPIO mode */
|
+ /* disable GPIO mode */
|
||||||
+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0);
|
+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0);
|
||||||
+
|
+
|
||||||
|
@ -44,11 +49,12 @@
|
||||||
static int ath79_spi_probe(struct platform_device *pdev)
|
static int ath79_spi_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct spi_master *master;
|
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->num_chipselect = pdata->num_chipselect;
|
||||||
master->cs_gpios = pdata->cs_gpios;
|
master->cs_gpios = pdata->cs_gpios;
|
||||||
}
|
}
|
||||||
+ master->spi_flash_read = ath79_spi_read_flash_data;
|
+ master->spi_flash_read = ath79_spi_read_flash_data;
|
||||||
|
+ master->flash_read_supported = ath79_spi_flash_read_supported;
|
||||||
|
|
||||||
sp->bitbang.master = master;
|
sp->bitbang.master = master;
|
||||||
sp->bitbang.chipselect = ath79_spi_chipselect;
|
sp->bitbang.chipselect = ath79_spi_chipselect;
|
||||||
|
|
Loading…
Reference in a new issue