diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-02-19 04:34:47 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-02 22:59:45 -0500 |
commit | 7984b5ca5c6245e332adcb8a8c2aefb2732b40bf (patch) | |
tree | 294574391f274f4dd8f2fefb8f7cf77301ccacd6 /drivers/spi/spi-octeon.c | |
parent | 85fe414d3228bdecc52366692c6f70c750f687aa (diff) |
spi: octeon: Convert to let spi core validate transfer speed
Set master->max_speed_hz then spi core will handle checking transfer speed.
The behavior is different from current code when the speed_hz is greater than
the maximum transfer speed supported by the controller.
Unless there is other good reason, I think we had better make the behavior
consistent with what spi core does.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-octeon.c')
-rw-r--r-- | drivers/spi/spi-octeon.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/spi/spi-octeon.c b/drivers/spi/spi-octeon.c index a51458985ccf..1ed259449c7f 100644 --- a/drivers/spi/spi-octeon.c +++ b/drivers/spi/spi-octeon.c | |||
@@ -67,8 +67,6 @@ static int octeon_spi_do_transfer(struct octeon_spi *p, | |||
67 | cpol = mode & SPI_CPOL; | 67 | cpol = mode & SPI_CPOL; |
68 | 68 | ||
69 | speed_hz = xfer->speed_hz ? : spi->max_speed_hz; | 69 | speed_hz = xfer->speed_hz ? : spi->max_speed_hz; |
70 | if (speed_hz > OCTEON_SPI_MAX_CLOCK_HZ) | ||
71 | speed_hz = OCTEON_SPI_MAX_CLOCK_HZ; | ||
72 | 70 | ||
73 | clkdiv = octeon_get_io_clock_rate() / (2 * speed_hz); | 71 | clkdiv = octeon_get_io_clock_rate() / (2 * speed_hz); |
74 | 72 | ||
@@ -214,6 +212,7 @@ static int octeon_spi_probe(struct platform_device *pdev) | |||
214 | 212 | ||
215 | master->transfer_one_message = octeon_spi_transfer_one_message; | 213 | master->transfer_one_message = octeon_spi_transfer_one_message; |
216 | master->bits_per_word_mask = SPI_BPW_MASK(8); | 214 | master->bits_per_word_mask = SPI_BPW_MASK(8); |
215 | master->max_speed_hz = OCTEON_SPI_MAX_CLOCK_HZ; | ||
217 | 216 | ||
218 | master->dev.of_node = pdev->dev.of_node; | 217 | master->dev.of_node = pdev->dev.of_node; |
219 | err = devm_spi_register_master(&pdev->dev, master); | 218 | err = devm_spi_register_master(&pdev->dev, master); |