diff options
author | Thor Thayer <tthayer@opensource.altera.com> | 2014-11-06 13:54:27 -0600 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2014-12-14 16:23:55 +0000 |
commit | 656378a5094c1fe3e4291345d3f0cf3aadbde8db (patch) | |
tree | 3f6fd9610968e6dd89eabfe574587e7d134b74c0 /drivers/spi/spi-txx9.c | |
parent | 2e0f55eaf9b604eb3ae84802b668003ecd7946bc (diff) | |
download | kernel_samsung_smdk4412-656378a5094c1fe3e4291345d3f0cf3aadbde8db.zip kernel_samsung_smdk4412-656378a5094c1fe3e4291345d3f0cf3aadbde8db.tar.gz kernel_samsung_smdk4412-656378a5094c1fe3e4291345d3f0cf3aadbde8db.tar.bz2 |
spi: dw: Fix dynamic speed change.
commit 0a8727e69778683495058852f783eeda141a754e upstream.
An IOCTL call that calls spi_setup() and then dw_spi_setup() will
overwrite the persisted last transfer speed. On each transfer, the
SPI speed is compared to the last transfer speed to determine if the
clock divider registers need to be updated (did the speed change?).
This bug was observed with the spidev driver using spi-config to
update the max transfer speed.
This fix: Don't overwrite the persisted last transaction clock speed
when updating the SPI parameters in dw_spi_setup(). On the next
transaction, the new speed won't match the persisted last speed
and the hardware registers will be updated.
On initialization, the persisted last transaction clock
speed will be 0 but will be updated after the first SPI
transaction.
Move zeroed clock divider check into clock change test because
chip->clk_div is zero on startup and would cause a divide-by-zero
error. The calculation was wrong as well (can't support odd #).
Reported-by: Vlastimil Setka <setka@vsis.cz>
Signed-off-by: Vlastimil Setka <setka@vsis.cz>
Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/spi/spi-txx9.c')
0 files changed, 0 insertions, 0 deletions