Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rpi 4.14.y mcp2517fd v6.11 for hubert denkmair #4

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions drivers/spi/spi-bcm2835aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,6 @@ static void bcm2835aux_spi_transfer_helper(struct bcm2835aux_spi *bs)
BCM2835_AUX_SPI_STAT_TX_FULL))) {
bcm2835aux_wr_fifo(bs);
}

/* and check if we have reached "done" */
while (bs->rx_len && (!bs->tx_len) && (!bs->pending) &&
(!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) &
BCM2835_AUX_SPI_STAT_BUSY))) {
bcm2835aux_rd_fifo(bs);
}
}

static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id)
Expand All @@ -274,8 +267,10 @@ static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id)
BCM2835_AUX_SPI_CNTL1_IDLE);
}

/* and if rx_len is 0 then disable interrupts and wake up completion */
if (!bs->rx_len) {

if ((!bs->rx_len) &&
(!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) & BCM2835_AUX_SPI_STAT_BUSY))) {
/* when transfer is complete then disable interrupts and wake up completion */
bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL1, bs->cntl[1]);
complete(&master->xfer_completion);
}
Expand Down Expand Up @@ -342,8 +337,7 @@ static int bcm2835aux_spi_transfer_one_poll(struct spi_master *master,
timeout = jiffies + 2 + HZ * polling_limit_us / 1000000;

/* loop until finished the transfer */
while (bs->rx_len) {

while ((bs->rx_len) || (bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) & BCM2835_AUX_SPI_STAT_BUSY)) {
/* do common fifo handling */
bcm2835aux_spi_transfer_helper(bs);

Expand Down