Skip to contentSkip to conversation

spi/bcm63xx: don't substract prepend length from total length

PATCH In review Jonas Gorski 2 participants 4 messages Dec 1, 2013 – Dec 6, 2013 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 spi/bcm63xx: don't substract prepend length from total length

The spi command must include the full message length including any prepended writes, else transfers larger than 256 bytes will be incomplete.

---
 drivers/spi/spi-bcm63xx.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/spi-bcm63xx.c +0 -2
index 469ecd8..dceb7b2 100644
@@ -169,8 +169,6 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,
 			       transfer_list);
 	}
 
-	len -= prepend_len;
-
 	init_completion(&bs->done);
 
 	/* Fill in the Message control register */
Signature · 5 lines
1.8.4.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1385912662-8261-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org

#2 lore raw

PATCH 2/2 spi/bcm63xx: don't reject reads >= 256 bytes

The rx_tail register is only 8 bit wide, so it will wrap around after 256 read bytes. This makes it rather meaningless, so drop any usage of it to not treat reads over 256 as failed.

---
 drivers/spi/spi-bcm63xx.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/spi/spi-bcm63xx.c +1 -7
index dceb7b2..79750f0 100644
@@ -203,13 +203,7 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,
 	if (!timeout)
 		return -ETIMEDOUT;
 
-	/* read out all data */
-	rx_tail = bcm_spi_readb(bs, SPI_RX_TAIL);
-
-	if (do_rx && rx_tail != len)
-		return -EIO;
-
-	if (!rx_tail)
+	if (!do_rx)
 		return 0;
 
 	len = 0;
Signature · 5 lines
1.8.4.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1385912662-8261-2-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] spi/bcm63xx: don't reject reads >= 256 bytes

2013/12/1 Jonas Gorski <[email protected]>:

Quoted 5 lines

The rx_tail register is only 8 bit wide, so it will wrap around after 256 read bytes. This makes it rather meaningless, so drop any usage of it to not treat reads over 256 as failed.

Looks good:

Quoted 25 lines
---
 drivers/spi/spi-bcm63xx.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/spi/spi-bcm63xx.c +1 -8
index dceb7b2..79750f0 100644
@@ -203,13 +203,7 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,
        if (!timeout)
                return -ETIMEDOUT;
 
-       /* read out all data */
-       rx_tail = bcm_spi_readb(bs, SPI_RX_TAIL);
-
-       if (do_rx && rx_tail != len)
-               return -EIO;
-
-       if (!rx_tail)
+       if (!do_rx)
                return 0;
 
        len = 0;
--

1.8.4.rc3

Signature · 5 lines
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to a message not in the archive

2013/12/1 Jonas Gorski <[email protected]>:

Quoted 5 lines

The spi command must include the full message length including any prepended writes, else transfers larger than 256 bytes will be incomplete.

Looks good:

Quoted 19 lines
---
 drivers/spi/spi-bcm63xx.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/spi-bcm63xx.c +0 -3
index 469ecd8..dceb7b2 100644
@@ -169,8 +169,6 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,
                               transfer_list);
        }
 
-       len -= prepend_len;
-
        init_completion(&bs->done);
 
        /* Fill in the Message control register */
--

1.8.4.rc3

Signature · 5 lines
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html