Commit Graph

9 Commits

Author SHA1 Message Date
Axel Lin 09e99bca83 spi: sc18is602: Convert to let spi core validate transfer speed
Set master->max_speed_hz and master->min_speed_hz then spi core will handle
checking transfer speed. So we can remove the same checking in this driver.

This patch also remove testing if hz is 0 because spi->max_speed_hz will be
default set to master->min_speed_hz if it was not set. So the transfer speed
will never set to 0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-13 09:47:05 +00:00
Axel Lin c5c67e31bc spi: sc18is602: Move checking chip_select for SC18IS602 to sc18is602_setup
So it will be checked when spi device is added onto the spi bus.
spi_add_device() calls spi_setup() which then calls spi->master->setup().
No need to check it every time sc18is602_transfer_one() is called.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-11 17:02:31 +00:00
Axel Lin 589f6a90e6 spi: sc18is602: Remove sc18is602_setup() because it is done by spi core
The checking for spi->mode is done in the implementation of spi_setup().
Calling sc18is602_check_transfer(spi, NULL, 0) is pointless because
the code is equivent to checking if spi->max_speed_hz is 0.
Note, sc18is602_check_transfer actually allows spi->max_speed_hz is 0
if t->speed_hz is set. So return error in sc18is602_setup() when
spi->max_speed_hz is 0 does not make sense.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:24:31 +00:00
Mark Brown 8b8b773e6b Merge commit 'spi/topic/sc18is602' into spi-linus 2014-01-23 13:14:15 +00:00
Axel Lin 463654cec2 spi: sc18is602: Convert to use bits_per_word_mask
Since commit 543bb25 "spi: add ability to validate xfer->bits_per_word in SPI
core", the driver can set bits_per_word_mask for the master then the SPI core
will reject transfers that attempt to use an unsupported bits_per_word value.
So we can remove the bits_per_word checking in sc18is602_check_transfer() and
let SPI core handle the checking.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-17 15:55:54 +00:00
Axel Lin 23061f1eb8 spi: Remove duplicate code to set default bits_per_word setting
The implementation in spi_setup() already set spi->bits_per_word = 8 when
spi->bits_per_word is 0 before calling spi->master->setup.
So we don't need to do it again in setup() callback.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Barry Song <Baohua.Song@csr.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-17 15:54:22 +00:00
Jingoo Han 15e0964dc2 spi: sc18is602: Use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 12:53:40 +00:00
Guenter Roeck 58ed90de3e spi/sc18is602: Return -EINVAL for probe failures due to I2C function mismatch
If the I2C bus master driver does not support the required functionality,
the driver returns -ENODEV. This causes a silent probe failure without error
message. Since the device has to be explicitly instantiated, and the user
should know the correct bus, this event really reflects an error condition.
Replace error return value with -EINVAL to trigger an error message showing
that the probe function failed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-23 12:13:54 +01:00
Guenter Roeck 3ce8859e2e spi: Master driver for NXP SC18IS602/603
This driver adds support for NXP SC18IS602/603 I2C to SPI bus bridge.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-22 19:34:51 +01:00