Skip to content

Commit

Permalink
spi: sunxi: set maximum and minimum speed of SPI master
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michal Suchanek authored and Mark Brown committed Jun 27, 2016
1 parent 794912c commit 0b06d8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/spi/spi-sun4i.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions drivers/spi/spi-sun6i.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0b06d8c

Please sign in to comment.