]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
spi: sunxi: set maximum and minimum speed of SPI master
authorMichal Suchanek <hramrach@gmail.com>
Tue, 14 Jun 2016 12:10:04 +0000 (12:10 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 27 Jun 2016 18:18:35 +0000 (19:18 +0100)
The speed limits are unset in the sun4i and sun6i SPI drivers.

The maximum speed of SPI master is used when maximum speed of SPI slave
is not specified. Also the __spi_validate function should check that
transfer speeds do not exceed the master limits.

The user manual for A10 and A31 specifies maximum
speed of the SPI clock as 100MHz and minimum as 3kHz.

Setting the SPI clock to out-of-spec values can lock up the SoC.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
--
v2:
new patch
v3:
fix constant style
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sun4i.c
drivers/spi/spi-sun6i.c

index 07ce7c97750e7be41d5e107e194270c32412a175..d02cf9829f1aae5e3de6f60004867b7339b982fd 100644 (file)
@@ -392,6 +392,8 @@ static int sun4i_spi_probe(struct platform_device *pdev)
        }
 
        sspi->master = master;
+       master->max_speed_hz = 100 * 1000 * 1000;
+       master->min_speed_hz = 3 * 1000;
        master->set_cs = sun4i_spi_set_cs;
        master->transfer_one = sun4i_spi_transfer_one;
        master->num_chipselect = 4;
index 6fa6ff12ae61b9377c1bf2b9110df6c23b4236ac..d5a6a2e5f54aa8cfe4440287071b7d3f6b58e3e2 100644 (file)
@@ -390,6 +390,8 @@ static int sun6i_spi_probe(struct platform_device *pdev)
        }
 
        sspi->master = master;
+       master->max_speed_hz = 100 * 1000 * 1000;
+       master->min_speed_hz = 3 * 1000;
        master->set_cs = sun6i_spi_set_cs;
        master->transfer_one = sun6i_spi_transfer_one;
        master->num_chipselect = 4;