Skip to content

Commit

Permalink
spi: octeon: Convert to let spi core validate transfer speed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Mark Brown committed Mar 3, 2014
1 parent 85fe414 commit 7984b5c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/spi/spi-octeon.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
cpol = mode & SPI_CPOL;

speed_hz = xfer->speed_hz ? : spi->max_speed_hz;
if (speed_hz > OCTEON_SPI_MAX_CLOCK_HZ)
speed_hz = OCTEON_SPI_MAX_CLOCK_HZ;

clkdiv = octeon_get_io_clock_rate() / (2 * speed_hz);

Expand Down Expand Up @@ -214,6 +212,7 @@ static int octeon_spi_probe(struct platform_device *pdev)

master->transfer_one_message = octeon_spi_transfer_one_message;
master->bits_per_word_mask = SPI_BPW_MASK(8);
master->max_speed_hz = OCTEON_SPI_MAX_CLOCK_HZ;

master->dev.of_node = pdev->dev.of_node;
err = devm_spi_register_master(&pdev->dev, master);
Expand Down

0 comments on commit 7984b5c

Please sign in to comment.