Skip to content

Commit ab02963

Browse files
committed
Merge tag 'spi-v3.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A few nasty issues, particularly a race with the interrupt controller in the xilinx driver, together with a couple of more minor fixes and a much needed move of the mailing list away from sourceforge." * tag 'spi-v3.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: hspi: fixup long delay time spi: spi-xilinx: Remove ISR race condition spi: topcliff-pch: fix error return code in pch_spi_probe() spi: topcliff-pch: Pass correct pointer to free_irq() spi: Move mailing list to vger
2 parents 50e6f85 + c1d926a commit ab02963

File tree

4 files changed

+39
-42
lines changed

4 files changed

+39
-42
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7624,7 +7624,7 @@ F: drivers/clk/spear/
76247624
SPI SUBSYSTEM
76257625
M: Mark Brown <[email protected]>
76267626
M: Grant Likely <[email protected]>
7627-
7627+
76287628
T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
76297629
Q: http://patchwork.kernel.org/project/spi-devel-general/list/
76307630
S: Maintained

drivers/spi/spi-sh-hspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static int hspi_status_check_timeout(struct hspi_priv *hspi, u32 mask, u32 val)
8989
if ((mask & hspi_read(hspi, SPSR)) == val)
9090
return 0;
9191

92-
msleep(20);
92+
udelay(10);
9393
}
9494

9595
dev_err(hspi->dev, "timeout\n");

drivers/spi/spi-topcliff-pch.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)
14871487
return 0;
14881488

14891489
err_spi_register_master:
1490-
free_irq(board_dat->pdev->irq, board_dat);
1490+
free_irq(board_dat->pdev->irq, data);
14911491
err_request_irq:
14921492
pch_spi_free_resources(board_dat, data);
14931493
err_spi_get_resources:
@@ -1667,6 +1667,7 @@ static int pch_spi_probe(struct pci_dev *pdev,
16671667
pd_dev = platform_device_alloc("pch-spi", i);
16681668
if (!pd_dev) {
16691669
dev_err(&pdev->dev, "platform_device_alloc failed\n");
1670+
retval = -ENOMEM;
16701671
goto err_platform_device;
16711672
}
16721673
pd_dev_save->pd_save[i] = pd_dev;

drivers/spi/spi-xilinx.c

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
267267
{
268268
struct xilinx_spi *xspi = spi_master_get_devdata(spi->master);
269269
u32 ipif_ier;
270-
u16 cr;
271270

272271
/* We get here with transmitter inhibited */
273272

@@ -276,7 +275,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
276275
xspi->remaining_bytes = t->len;
277276
INIT_COMPLETION(xspi->done);
278277

279-
xilinx_spi_fill_tx_fifo(xspi);
280278

281279
/* Enable the transmit empty interrupt, which we use to determine
282280
* progress on the transmission.
@@ -285,12 +283,41 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
285283
xspi->write_fn(ipif_ier | XSPI_INTR_TX_EMPTY,
286284
xspi->regs + XIPIF_V123B_IIER_OFFSET);
287285

288-
/* Start the transfer by not inhibiting the transmitter any longer */
289-
cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET) &
290-
~XSPI_CR_TRANS_INHIBIT;
291-
xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET);
286+
for (;;) {
287+
u16 cr;
288+
u8 sr;
289+
290+
xilinx_spi_fill_tx_fifo(xspi);
291+
292+
/* Start the transfer by not inhibiting the transmitter any
293+
* longer
294+
*/
295+
cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET) &
296+
~XSPI_CR_TRANS_INHIBIT;
297+
xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET);
298+
299+
wait_for_completion(&xspi->done);
300+
301+
/* A transmit has just completed. Process received data and
302+
* check for more data to transmit. Always inhibit the
303+
* transmitter while the Isr refills the transmit register/FIFO,
304+
* or make sure it is stopped if we're done.
305+
*/
306+
cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET);
307+
xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT,
308+
xspi->regs + XSPI_CR_OFFSET);
309+
310+
/* Read out all the data from the Rx FIFO */
311+
sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET);
312+
while ((sr & XSPI_SR_RX_EMPTY_MASK) == 0) {
313+
xspi->rx_fn(xspi);
314+
sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET);
315+
}
292316

293-
wait_for_completion(&xspi->done);
317+
/* See if there is more data to send */
318+
if (!xspi->remaining_bytes > 0)
319+
break;
320+
}
294321

295322
/* Disable the transmit empty interrupt */
296323
xspi->write_fn(ipif_ier, xspi->regs + XIPIF_V123B_IIER_OFFSET);
@@ -314,38 +341,7 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
314341
xspi->write_fn(ipif_isr, xspi->regs + XIPIF_V123B_IISR_OFFSET);
315342

316343
if (ipif_isr & XSPI_INTR_TX_EMPTY) { /* Transmission completed */
317-
u16 cr;
318-
u8 sr;
319-
320-
/* A transmit has just completed. Process received data and
321-
* check for more data to transmit. Always inhibit the
322-
* transmitter while the Isr refills the transmit register/FIFO,
323-
* or make sure it is stopped if we're done.
324-
*/
325-
cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET);
326-
xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT,
327-
xspi->regs + XSPI_CR_OFFSET);
328-
329-
/* Read out all the data from the Rx FIFO */
330-
sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET);
331-
while ((sr & XSPI_SR_RX_EMPTY_MASK) == 0) {
332-
xspi->rx_fn(xspi);
333-
sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET);
334-
}
335-
336-
/* See if there is more data to send */
337-
if (xspi->remaining_bytes > 0) {
338-
xilinx_spi_fill_tx_fifo(xspi);
339-
/* Start the transfer by not inhibiting the
340-
* transmitter any longer
341-
*/
342-
xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET);
343-
} else {
344-
/* No more data to send.
345-
* Indicate the transfer is completed.
346-
*/
347-
complete(&xspi->done);
348-
}
344+
complete(&xspi->done);
349345
}
350346

351347
return IRQ_HANDLED;

0 commit comments

Comments
 (0)