aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-3.10/0056-spi-bcm2708-add-9-bit-support-using-LoSSI-mode.patch
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2014-02-28 20:30:08 +0000
committerFlorian Fainelli <florian@openwrt.org>2014-02-28 20:30:08 +0000
commit800930b924c19a56b3a6e94ad351cd0715fb410d (patch)
tree70158d97f68604d69da8da779507469cf930bf07 /target/linux/brcm2708/patches-3.10/0056-spi-bcm2708-add-9-bit-support-using-LoSSI-mode.patch
parent68c939ba0b0a0dda84e7a2ae370155be9a5593bc (diff)
downloadmaster-187ad058-800930b924c19a56b3a6e94ad351cd0715fb410d.tar.gz
master-187ad058-800930b924c19a56b3a6e94ad351cd0715fb410d.tar.bz2
master-187ad058-800930b924c19a56b3a6e94ad351cd0715fb410d.zip
brcm2708: update against latest rpi-3.10.y branch
Update our copies of the brcm2708 patches to the latest rpi-3.10-y rebased against linux-3.10.y stable (3.10.32). This should hopefully make it easier for us in the future to leverage the raspberry/rpi-* branches. Signed-off-by: Florian Fainelli <florian@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39770 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm2708/patches-3.10/0056-spi-bcm2708-add-9-bit-support-using-LoSSI-mode.patch')
-rw-r--r--target/linux/brcm2708/patches-3.10/0056-spi-bcm2708-add-9-bit-support-using-LoSSI-mode.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-3.10/0056-spi-bcm2708-add-9-bit-support-using-LoSSI-mode.patch b/target/linux/brcm2708/patches-3.10/0056-spi-bcm2708-add-9-bit-support-using-LoSSI-mode.patch
new file mode 100644
index 0000000000..d7ad5a293c
--- /dev/null
+++ b/target/linux/brcm2708/patches-3.10/0056-spi-bcm2708-add-9-bit-support-using-LoSSI-mode.patch
@@ -0,0 +1,67 @@
+From 75c9b03f90ca974cb072d96f423884b773ca5425 Mon Sep 17 00:00:00 2001
+From: notro <notro@tronnes.org>
+Date: Sat, 26 Jan 2013 20:38:03 +0100
+Subject: [PATCH 056/174] spi-bcm2708: add 9-bit support using LoSSI mode
+
+---
+ drivers/spi/spi-bcm2708.c | 30 ++++++++++++++++++++++++++++--
+ 1 file changed, 28 insertions(+), 2 deletions(-)
+
+--- a/drivers/spi/spi-bcm2708.c
++++ b/drivers/spi/spi-bcm2708.c
+@@ -146,10 +146,31 @@ static inline void bcm2708_rd_fifo(struc
+ static inline void bcm2708_wr_fifo(struct bcm2708_spi *bs, int len)
+ {
+ u8 byte;
++ u16 val;
+
+ if (len > bs->len)
+ len = bs->len;
+
++ if (unlikely(bcm2708_rd(bs, SPI_CS) & SPI_CS_LEN)) {
++ /* LoSSI mode */
++ if (unlikely(len % 2)) {
++ printk(KERN_ERR"bcm2708_wr_fifo: length must be even, skipping.\n");
++ bs->len = 0;
++ return;
++ }
++ while (len) {
++ if (bs->tx_buf) {
++ val = *(const u16 *)bs->tx_buf;
++ bs->tx_buf += 2;
++ } else
++ val = 0;
++ bcm2708_wr(bs, SPI_FIFO, val);
++ bs->len -= 2;
++ len -= 2;
++ }
++ return;
++ }
++
+ while (len--) {
+ byte = bs->tx_buf ? *bs->tx_buf++ : 0;
+ bcm2708_wr(bs, SPI_FIFO, byte);
+@@ -234,8 +255,12 @@ static int bcm2708_setup_state(struct sp
+ switch (bpw) {
+ case 8:
+ break;
++ case 9:
++ /* Reading in LoSSI mode is a special case. See 'BCM2835 ARM Peripherals' datasheet */
++ cs |= SPI_CS_LEN;
++ break;
+ default:
+- dev_dbg(dev, "setup: invalid bits_per_word %u (must be 8)\n",
++ dev_dbg(dev, "setup: invalid bits_per_word %u (must be 8 or 9)\n",
+ bpw);
+ return -EINVAL;
+ }
+@@ -283,7 +308,8 @@ static int bcm2708_process_transfer(stru
+ ret = bcm2708_setup_state(spi->master, &spi->dev, &state,
+ xfer->speed_hz ? xfer->speed_hz : spi->max_speed_hz,
+ spi->chip_select, spi->mode,
+- spi->bits_per_word);
++ xfer->bits_per_word ? xfer->bits_per_word :
++ spi->bits_per_word);
+ if (ret)
+ return ret;
+