diff options
-rw-r--r-- | drivers/spi/mpc52xx_psc_spi.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 0debe11b67b4..3b97803e1d11 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c | |||
@@ -142,6 +142,7 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi, | |||
142 | unsigned rfalarm; | 142 | unsigned rfalarm; |
143 | unsigned send_at_once = MPC52xx_PSC_BUFSIZE; | 143 | unsigned send_at_once = MPC52xx_PSC_BUFSIZE; |
144 | unsigned recv_at_once; | 144 | unsigned recv_at_once; |
145 | int last_block = 0; | ||
145 | 146 | ||
146 | if (!t->tx_buf && !t->rx_buf && t->len) | 147 | if (!t->tx_buf && !t->rx_buf && t->len) |
147 | return -EINVAL; | 148 | return -EINVAL; |
@@ -151,15 +152,17 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi, | |||
151 | while (rb < t->len) { | 152 | while (rb < t->len) { |
152 | if (t->len - rb > MPC52xx_PSC_BUFSIZE) { | 153 | if (t->len - rb > MPC52xx_PSC_BUFSIZE) { |
153 | rfalarm = MPC52xx_PSC_RFALARM; | 154 | rfalarm = MPC52xx_PSC_RFALARM; |
155 | last_block = 0; | ||
154 | } else { | 156 | } else { |
155 | send_at_once = t->len - sb; | 157 | send_at_once = t->len - sb; |
156 | rfalarm = MPC52xx_PSC_BUFSIZE - (t->len - rb); | 158 | rfalarm = MPC52xx_PSC_BUFSIZE - (t->len - rb); |
159 | last_block = 1; | ||
157 | } | 160 | } |
158 | 161 | ||
159 | dev_dbg(&spi->dev, "send %d bytes...\n", send_at_once); | 162 | dev_dbg(&spi->dev, "send %d bytes...\n", send_at_once); |
160 | for (; send_at_once; sb++, send_at_once--) { | 163 | for (; send_at_once; sb++, send_at_once--) { |
161 | /* set EOF flag before the last word is sent */ | 164 | /* set EOF flag before the last word is sent */ |
162 | if (send_at_once == 1) | 165 | if (send_at_once == 1 && last_block) |
163 | out_8(&psc->ircr2, 0x01); | 166 | out_8(&psc->ircr2, 0x01); |
164 | 167 | ||
165 | if (tx_buf) | 168 | if (tx_buf) |