Skip to content

Commit

Permalink
Merge branch 'fix/dw' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/broonie/spi into spi-dw
  • Loading branch information
Mark Brown committed Mar 9, 2015
2 parents c22c62d + 854d2f2 commit 0365fbd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
12 changes: 10 additions & 2 deletions drivers/spi/spi-dw-mid.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ static void dw_spi_dma_tx_done(void *arg)
{
struct dw_spi *dws = arg;

if (test_and_clear_bit(TX_BUSY, &dws->dma_chan_busy) & BIT(RX_BUSY))
clear_bit(TX_BUSY, &dws->dma_chan_busy);
if (test_bit(RX_BUSY, &dws->dma_chan_busy))
return;
spi_finalize_current_transfer(dws->master);
}
Expand Down Expand Up @@ -139,6 +140,9 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws)
1,
DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!txdesc)
return NULL;

txdesc->callback = dw_spi_dma_tx_done;
txdesc->callback_param = dws;

Expand All @@ -153,7 +157,8 @@ static void dw_spi_dma_rx_done(void *arg)
{
struct dw_spi *dws = arg;

if (test_and_clear_bit(RX_BUSY, &dws->dma_chan_busy) & BIT(TX_BUSY))
clear_bit(RX_BUSY, &dws->dma_chan_busy);
if (test_bit(TX_BUSY, &dws->dma_chan_busy))
return;
spi_finalize_current_transfer(dws->master);
}
Expand Down Expand Up @@ -184,6 +189,9 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws)
1,
DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!rxdesc)
return NULL;

rxdesc->callback = dw_spi_dma_rx_done;
rxdesc->callback_param = dws;

Expand Down
4 changes: 2 additions & 2 deletions drivers/spi/spi-dw-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ struct spi_pci_desc {

static struct spi_pci_desc spi_pci_mid_desc_1 = {
.setup = dw_spi_mid_init,
.num_cs = 32,
.num_cs = 5,
.bus_num = 0,
};

static struct spi_pci_desc spi_pci_mid_desc_2 = {
.setup = dw_spi_mid_init,
.num_cs = 4,
.num_cs = 2,
.bus_num = 1,
};

Expand Down
4 changes: 2 additions & 2 deletions drivers/spi/spi-dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,14 +517,14 @@ static void spi_hw_init(struct device *dev, struct dw_spi *dws)
if (!dws->fifo_len) {
u32 fifo;

for (fifo = 2; fifo <= 256; fifo++) {
for (fifo = 1; fifo < 256; fifo++) {
dw_writew(dws, DW_SPI_TXFLTR, fifo);
if (fifo != dw_readw(dws, DW_SPI_TXFLTR))
break;
}
dw_writew(dws, DW_SPI_TXFLTR, 0);

dws->fifo_len = (fifo == 2) ? 0 : fifo - 1;
dws->fifo_len = (fifo == 1) ? 0 : fifo;
dev_dbg(dev, "Detected FIFO size: %u bytes\n", dws->fifo_len);
}
}
Expand Down

0 comments on commit 0365fbd

Please sign in to comment.