diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-11-09 04:06:45 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-09 11:42:17 -0500 |
commit | e6811d1d7a6a38ee637fe219c3b67dbfe17e8b3f (patch) | |
tree | c85ec0d0bd6f8475ffb6e7134d038fcc00eb4d0b /drivers | |
parent | dc4dc36056392c0b0b1ca9e81bebff964b9297e0 (diff) |
spi: make sure all transfer has bits_per_word set
When spi client does the spi transfer and does not sets
the bits_per_word for each transfer then set it as default
of spi device in spi core before calling low level transfer.
Removing the similar code from spi-tegra20-slink driver as
it is not required.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-tegra20-slink.c | 3 | ||||
-rw-r--r-- | drivers/spi/spi.c | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index b8985be81d96..07dc7359fb12 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c | |||
@@ -727,8 +727,7 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi, | |||
727 | unsigned long command; | 727 | unsigned long command; |
728 | unsigned long command2; | 728 | unsigned long command2; |
729 | 729 | ||
730 | bits_per_word = t->bits_per_word ? t->bits_per_word : | 730 | bits_per_word = t->bits_per_word; |
731 | spi->bits_per_word; | ||
732 | speed = t->speed_hz ? t->speed_hz : spi->max_speed_hz; | 731 | speed = t->speed_hz ? t->speed_hz : spi->max_speed_hz; |
733 | if (!speed) | 732 | if (!speed) |
734 | speed = tspi->spi_max_frequency; | 733 | speed = tspi->spi_max_frequency; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 84c2861d6f4d..518e5955664c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -1190,6 +1190,7 @@ EXPORT_SYMBOL_GPL(spi_setup); | |||
1190 | static int __spi_async(struct spi_device *spi, struct spi_message *message) | 1190 | static int __spi_async(struct spi_device *spi, struct spi_message *message) |
1191 | { | 1191 | { |
1192 | struct spi_master *master = spi->master; | 1192 | struct spi_master *master = spi->master; |
1193 | struct spi_transfer *xfer; | ||
1193 | 1194 | ||
1194 | /* Half-duplex links include original MicroWire, and ones with | 1195 | /* Half-duplex links include original MicroWire, and ones with |
1195 | * only one data pin like SPI_3WIRE (switches direction) or where | 1196 | * only one data pin like SPI_3WIRE (switches direction) or where |
@@ -1198,7 +1199,6 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message) | |||
1198 | */ | 1199 | */ |
1199 | if ((master->flags & SPI_MASTER_HALF_DUPLEX) | 1200 | if ((master->flags & SPI_MASTER_HALF_DUPLEX) |
1200 | || (spi->mode & SPI_3WIRE)) { | 1201 | || (spi->mode & SPI_3WIRE)) { |
1201 | struct spi_transfer *xfer; | ||
1202 | unsigned flags = master->flags; | 1202 | unsigned flags = master->flags; |
1203 | 1203 | ||
1204 | list_for_each_entry(xfer, &message->transfers, transfer_list) { | 1204 | list_for_each_entry(xfer, &message->transfers, transfer_list) { |
@@ -1211,6 +1211,15 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message) | |||
1211 | } | 1211 | } |
1212 | } | 1212 | } |
1213 | 1213 | ||
1214 | /** | ||
1215 | * Set transfer bits_per_word as spi device default if it is not | ||
1216 | * set for this transfer. | ||
1217 | */ | ||
1218 | list_for_each_entry(xfer, &message->transfers, transfer_list) { | ||
1219 | if (!xfer->bits_per_word) | ||
1220 | xfer->bits_per_word = spi->bits_per_word; | ||
1221 | } | ||
1222 | |||
1214 | message->spi = spi; | 1223 | message->spi = spi; |
1215 | message->status = -EINPROGRESS; | 1224 | message->status = -EINPROGRESS; |
1216 | return master->transfer(spi, message); | 1225 | return master->transfer(spi, message); |