diff options
author | Maxime Ripard <maxime@cerno.tech> | 2020-03-17 09:29:11 +0100 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2020-03-17 09:29:11 +0100 |
commit | 51b8479ab20ba3804348824c63abdb3f35b0aaeb (patch) | |
tree | f3ecae09fc31773c9da185de167bf2034f1aaa2e /drivers/spi/atmel-quadspi.c | |
parent | 6afe6929964bca6847986d0507a555a041f07753 (diff) | |
parent | 69ddce0970d9d1de63bed9c24eefa0814db29a5a (diff) |
Merge drm/drm-next into drm-misc-next
Jernej needs some patches that got merged in -rc5.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'drivers/spi/atmel-quadspi.c')
-rw-r--r-- | drivers/spi/atmel-quadspi.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index fd8007ebb145..13def7f78b9e 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -149,6 +149,7 @@ struct atmel_qspi { struct clk *qspick; struct platform_device *pdev; const struct atmel_qspi_caps *caps; + resource_size_t mmap_size; u32 pending; u32 mr; u32 scr; @@ -329,6 +330,14 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) u32 sr, offset; int err; + /* + * Check if the address exceeds the MMIO window size. An improvement + * would be to add support for regular SPI mode and fall back to it + * when the flash memories overrun the controller's memory space. + */ + if (op->addr.val + op->data.nbytes > aq->mmap_size) + return -ENOTSUPP; + err = atmel_qspi_set_cfg(aq, op, &offset); if (err) return err; @@ -480,6 +489,8 @@ static int atmel_qspi_probe(struct platform_device *pdev) goto exit; } + aq->mmap_size = resource_size(res); + /* Get the peripheral clock */ aq->pclk = devm_clk_get(&pdev->dev, "pclk"); if (IS_ERR(aq->pclk)) |