]> git.karo-electronics.de Git - linux-beck.git/commit
spi: fsl-espi: set spi_master members min_speed_hz and max_speed_hz
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 15 Nov 2016 20:56:33 +0000 (21:56 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 16 Nov 2016 14:59:39 +0000 (14:59 +0000)
commitf254e65ce20fda3c442ebc50ae1502281963a79b
tree5621457a2e6e86564aa8f0e53eb7ce731d31ed29
parenta9a813ddc505279efd94b2b8ff9ead0f7e005b63
spi: fsl-espi: set spi_master members min_speed_hz and max_speed_hz

ESPI has a max and min supported SPI frequency, determined by the
clock divider range. Set master->min_speed_hz/max_speed_hz to inform
the SPI core about these limits.
Then the SPI core handles cases where a transfer requests a frequency
outside the supported range.

So far the driver simply set the lowest supported frequency if the
requested frequency was below the supported range. This is not
necessarily an appropriate action as the device might not support
frequencies greater than the requested one.
With this patch the SPI core will reject transfers requesting a
too low frequency.

The check in fsl_espi_setup can be removed because the SPI core sets
spi->max_speed_hz to master->max_speed_hz if it's not set already.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-espi.c