spi: sunxi: expose maximum transfer size limit
authorMichal Suchanek <hramrach@gmail.com>
Mon, 13 Jun 2016 17:46:50 +0000 (17:46 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 14 Jun 2016 09:04:42 +0000 (10:04 +0100)
The sun4i spi hardware can trasfer at most 63 bytes of data without DMA
support so report the limitation. Same for sun6i.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sun4i.c
drivers/spi/spi-sun6i.c

index 1ddd9e2309b685576a8c63abc1770f731a7acd0c..07ce7c97750e7be41d5e107e194270c32412a175 100644 (file)
@@ -167,6 +167,11 @@ static void sun4i_spi_set_cs(struct spi_device *spi, bool enable)
        sun4i_spi_write(sspi, SUN4I_CTL_REG, reg);
 }
 
+static size_t sun4i_spi_max_transfer_size(struct spi_device *spi)
+{
+       return SUN4I_FIFO_DEPTH - 1;
+}
+
 static int sun4i_spi_transfer_one(struct spi_master *master,
                                  struct spi_device *spi,
                                  struct spi_transfer *tfr)
@@ -394,6 +399,7 @@ static int sun4i_spi_probe(struct platform_device *pdev)
        master->bits_per_word_mask = SPI_BPW_MASK(8);
        master->dev.of_node = pdev->dev.of_node;
        master->auto_runtime_pm = true;
+       master->max_transfer_size = sun4i_spi_max_transfer_size;
 
        sspi->hclk = devm_clk_get(&pdev->dev, "ahb");
        if (IS_ERR(sspi->hclk)) {
index 42e2c4bd690a253b423f42b0dfc6d1fc7c379ae9..6fa6ff12ae61b9377c1bf2b9110df6c23b4236ac 100644 (file)
@@ -153,6 +153,10 @@ static void sun6i_spi_set_cs(struct spi_device *spi, bool enable)
        sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg);
 }
 
+static size_t sun6i_spi_max_transfer_size(struct spi_device *spi)
+{
+       return SUN6I_FIFO_DEPTH - 1;
+}
 
 static int sun6i_spi_transfer_one(struct spi_master *master,
                                  struct spi_device *spi,
@@ -393,6 +397,7 @@ static int sun6i_spi_probe(struct platform_device *pdev)
        master->bits_per_word_mask = SPI_BPW_MASK(8);
        master->dev.of_node = pdev->dev.of_node;
        master->auto_runtime_pm = true;
+       master->max_transfer_size = sun6i_spi_max_transfer_size;
 
        sspi->hclk = devm_clk_get(&pdev->dev, "ahb");
        if (IS_ERR(sspi->hclk)) {