diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-02-06 12:27:54 -0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-02-11 13:42:29 +0800 |
commit | b4e27545224e263d271a9d9aa8763357a7e40eaa (patch) | |
tree | 78e57380c0e68d535b05fc5d5548db986b6e608e /drivers/spi | |
parent | bfa76d49576599a4b9f9b7a71f23d73d6dcff735 (diff) | |
download | op-kernel-dev-b4e27545224e263d271a9d9aa8763357a7e40eaa.zip op-kernel-dev-b4e27545224e263d271a9d9aa8763357a7e40eaa.tar.gz |
spi: sc18is602: Support multiple devices on a single I2C bus if DT is configured
The driver currently only supports a single device per I2C bus since it uses
the I2C bus number to set the SPI bus number. This makes it impossible to
connect more than one chip to a single I2C bus.
We don't want to use dynamic bus numbers unconditionally since this would
result in every instantiation getting a different bus number starting with
65,535 counting down unless devicetree is configured. If devicetree is
configured, however, the SPI bus number is obtained from devicetree
data. So we can use dynamic SPI bus numbers in this case.
Reported-and-Tested-by: Marco Menchise <marco.menchise@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-sc18is602.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index 237f2e7..c04e601 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -290,7 +290,7 @@ static int sc18is602_probe(struct i2c_client *client, hw->freq = SC18IS602_CLOCK; break; } - master->bus_num = client->adapter->nr; + master->bus_num = np ? -1 : client->adapter->nr; master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST; master->bits_per_word_mask = SPI_BPW_MASK(8); master->setup = sc18is602_setup; |