diff options
Diffstat (limited to 'drivers/spi/mpc52xx_psc_spi.c')
-rw-r--r-- | drivers/spi/mpc52xx_psc_spi.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 604e5f0a2d95..25eda71f4bf4 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c | |||
@@ -148,7 +148,6 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi, | |||
148 | unsigned rfalarm; | 148 | unsigned rfalarm; |
149 | unsigned send_at_once = MPC52xx_PSC_BUFSIZE; | 149 | unsigned send_at_once = MPC52xx_PSC_BUFSIZE; |
150 | unsigned recv_at_once; | 150 | unsigned recv_at_once; |
151 | unsigned bpw = mps->bits_per_word / 8; | ||
152 | 151 | ||
153 | if (!t->tx_buf && !t->rx_buf && t->len) | 152 | if (!t->tx_buf && !t->rx_buf && t->len) |
154 | return -EINVAL; | 153 | return -EINVAL; |
@@ -164,22 +163,15 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi, | |||
164 | } | 163 | } |
165 | 164 | ||
166 | dev_dbg(&spi->dev, "send %d bytes...\n", send_at_once); | 165 | dev_dbg(&spi->dev, "send %d bytes...\n", send_at_once); |
167 | if (tx_buf) { | 166 | for (; send_at_once; sb++, send_at_once--) { |
168 | for (; send_at_once; sb++, send_at_once--) { | 167 | /* set EOF flag before the last word is sent */ |
169 | /* set EOF flag */ | 168 | if (send_at_once == 1) |
170 | if (mps->bits_per_word | 169 | out_8(&psc->ircr2, 0x01); |
171 | && (sb + 1) % bpw == 0) | 170 | |
172 | out_8(&psc->ircr2, 0x01); | 171 | if (tx_buf) |
173 | out_8(&psc->mpc52xx_psc_buffer_8, tx_buf[sb]); | 172 | out_8(&psc->mpc52xx_psc_buffer_8, tx_buf[sb]); |
174 | } | 173 | else |
175 | } else { | ||
176 | for (; send_at_once; sb++, send_at_once--) { | ||
177 | /* set EOF flag */ | ||
178 | if (mps->bits_per_word | ||
179 | && ((sb + 1) % bpw) == 0) | ||
180 | out_8(&psc->ircr2, 0x01); | ||
181 | out_8(&psc->mpc52xx_psc_buffer_8, 0); | 174 | out_8(&psc->mpc52xx_psc_buffer_8, 0); |
182 | } | ||
183 | } | 175 | } |
184 | 176 | ||
185 | 177 | ||