diff options
author | Jonas Gorski <jogo@openwrt.org> | 2014-01-13 12:11:58 +0000 |
---|---|---|
committer | Jonas Gorski <jogo@openwrt.org> | 2014-01-13 12:11:58 +0000 |
commit | 02c8d6aa273b56ea0991e4c7340468dcab1bf66c (patch) | |
tree | f9a8e1380aaebb7030ab0b81f65604f6c6f776f4 /target/linux | |
parent | 7bcc344cf4c8437df39e3e0cdc5bacb5d0cbd9cb (diff) | |
download | upstream-02c8d6aa273b56ea0991e4c7340468dcab1bf66c.tar.gz upstream-02c8d6aa273b56ea0991e4c7340468dcab1bf66c.tar.bz2 upstream-02c8d6aa273b56ea0991e4c7340468dcab1bf66c.zip |
brcm63xx: fix legacy spi tranfers >= 256 bytes
Fixes e.g. SPI flash access on BCM6358/BCM6368. Transfers < 256 bytes
are not affected.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39265 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
2 files changed, 57 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-3.10/054-spi-bcm63xx-don-t-substract-prepend-length-from-tota.patch b/target/linux/brcm63xx/patches-3.10/054-spi-bcm63xx-don-t-substract-prepend-length-from-tota.patch new file mode 100644 index 0000000000..422474546f --- /dev/null +++ b/target/linux/brcm63xx/patches-3.10/054-spi-bcm63xx-don-t-substract-prepend-length-from-tota.patch @@ -0,0 +1,26 @@ +From e85583b12b023773b488cf8406f11719a4037461 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jogo@openwrt.org> +Date: Sun, 1 Dec 2013 16:16:44 +0100 +Subject: [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. + +Signed-off-by: Jonas Gorski <jogo@openwrt.org> +--- + drivers/spi/spi-bcm63xx.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/spi/spi-bcm63xx.c ++++ b/drivers/spi/spi-bcm63xx.c +@@ -180,8 +180,6 @@ static int bcm63xx_txrx_bufs(struct spi_ + transfer_list); + } + +- len -= prepend_len; +- + init_completion(&bs->done); + + /* Fill in the Message control register */ diff --git a/target/linux/brcm63xx/patches-3.10/055-spi-bcm63xx-don-t-reject-reads-256-bytes.patch b/target/linux/brcm63xx/patches-3.10/055-spi-bcm63xx-don-t-reject-reads-256-bytes.patch new file mode 100644 index 0000000000..cf83c7b7b7 --- /dev/null +++ b/target/linux/brcm63xx/patches-3.10/055-spi-bcm63xx-don-t-reject-reads-256-bytes.patch @@ -0,0 +1,31 @@ +From 4d8fa9d3d1fe1d70fe7d59537acf49797f6010a1 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jogo@openwrt.org> +Date: Sun, 1 Dec 2013 16:19:46 +0100 +Subject: [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. + +Signed-off-by: Jonas Gorski <jogo@openwrt.org> +--- + drivers/spi/spi-bcm63xx.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +--- a/drivers/spi/spi-bcm63xx.c ++++ b/drivers/spi/spi-bcm63xx.c +@@ -214,13 +214,7 @@ static int bcm63xx_txrx_bufs(struct spi_ + 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; |