spi_bfin: wait for tx to complete on full duplex paths
Full duplex SPI operation should not read a dummy byte at the first transfer. Bug and fix by Jean-Christian de Rivaz <jc@eclis.ch>: http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3678 Signed-off-by: Jean-Christian de Rivaz <jc@eclis.ch> Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Родитель
e26aa015dd
Коммит
4fd432d9c7
|
@ -358,14 +358,10 @@ static void u8_cs_chg_reader(struct driver_data *drv_data)
|
||||||
|
|
||||||
static void u8_duplex(struct driver_data *drv_data)
|
static void u8_duplex(struct driver_data *drv_data)
|
||||||
{
|
{
|
||||||
/* poll for SPI completion before start */
|
|
||||||
while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
|
|
||||||
cpu_relax();
|
|
||||||
|
|
||||||
/* in duplex mode, clk is triggered by writing of TDBR */
|
/* in duplex mode, clk is triggered by writing of TDBR */
|
||||||
while (drv_data->rx < drv_data->rx_end) {
|
while (drv_data->rx < drv_data->rx_end) {
|
||||||
write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
|
write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
|
||||||
while (read_STAT(drv_data) & BIT_STAT_TXS)
|
while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
|
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
|
@ -495,14 +491,10 @@ static void u16_cs_chg_reader(struct driver_data *drv_data)
|
||||||
|
|
||||||
static void u16_duplex(struct driver_data *drv_data)
|
static void u16_duplex(struct driver_data *drv_data)
|
||||||
{
|
{
|
||||||
/* poll for SPI completion before start */
|
|
||||||
while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
|
|
||||||
cpu_relax();
|
|
||||||
|
|
||||||
/* in duplex mode, clk is triggered by writing of TDBR */
|
/* in duplex mode, clk is triggered by writing of TDBR */
|
||||||
while (drv_data->tx < drv_data->tx_end) {
|
while (drv_data->tx < drv_data->tx_end) {
|
||||||
write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
|
write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
|
||||||
while (read_STAT(drv_data) & BIT_STAT_TXS)
|
while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
|
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
|
@ -516,15 +508,11 @@ static void u16_cs_chg_duplex(struct driver_data *drv_data)
|
||||||
{
|
{
|
||||||
struct chip_data *chip = drv_data->cur_chip;
|
struct chip_data *chip = drv_data->cur_chip;
|
||||||
|
|
||||||
/* poll for SPI completion before start */
|
|
||||||
while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
|
|
||||||
cpu_relax();
|
|
||||||
|
|
||||||
while (drv_data->tx < drv_data->tx_end) {
|
while (drv_data->tx < drv_data->tx_end) {
|
||||||
cs_active(drv_data, chip);
|
cs_active(drv_data, chip);
|
||||||
|
|
||||||
write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
|
write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
|
||||||
while (read_STAT(drv_data) & BIT_STAT_TXS)
|
while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
|
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче