Hi Florian,

Il joined you a bcm63xx-spi fix for multibytes reads/writes.

Regards,
Tanguy Bouzéloc.

Le 18/11/2010 16:46, Florian Fainelli a écrit :
Hello Tanguy,

On Thursday 18 November 2010 16:24:32 Tanguy Bouzéloc wrote:
Hi Florian,

I've updated the spi driver, it fixes the following issues :

- chipselect
- command register defines
- add missing clock
The patch looks good, however, you have put some BCM6358 specific code in the
generic driver, can you change the driver to add a platform_data callback
doning what you want for instance?
--
Florian

From ab66b05d6f5e01feedec2c4a918bc20eb08b34dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tanguy=20Bouz=C3=A9loc?= <tanguy.bouze...@efixo.com>
Date: Wed, 24 Nov 2010 17:47:01 +0100
Subject: [PATCH 22/22] fix multibytes transferts

---
 target/linux/brcm63xx/patches-2.6.35/240-spi.patch |   40 ++++++++------------
 1 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/target/linux/brcm63xx/patches-2.6.35/240-spi.patch 
b/target/linux/brcm63xx/patches-2.6.35/240-spi.patch
index 344b1b4..ff607cd 100644
--- a/target/linux/brcm63xx/patches-2.6.35/240-spi.patch
+++ b/target/linux/brcm63xx/patches-2.6.35/240-spi.patch
@@ -326,7 +326,7 @@
  #endif /* BCM63XX_REGS_H_ */
 --- /dev/null
 +++ b/drivers/spi/bcm63xx_spi.c
-@@ -0,0 +1,480 @@
+@@ -0,0 +1,472 @@
 +/*
 + * Broadcom BCM63xx SPI controller support
 + *
@@ -346,7 +346,7 @@
 + * along with this program; if not, write to the
 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 + */
-+
++#define DEBUG
 +#include <linux/kernel.h>
 +#include <linux/init.h>
 +#include <linux/clk.h>
@@ -378,6 +378,11 @@
 +      /* Data buffers */
 +      const unsigned char     *tx_ptr;
 +      unsigned char           *rx_ptr;
++
++      /* data iomem */
++      volatile unsigned char       *tx_io;
++      const volatile unsigned char *rx_io;
++
 +      int                     remaining_bytes;
 +
 +      struct clk              *clk;
@@ -481,20 +486,13 @@
 +/* Fill the TX FIFO with as many bytes as possible */
 +static void bcm63xx_spi_fill_tx_fifo(struct bcm63xx_spi *bs)
 +{
-+        u8 tail;
++      u8 size;
 +
 +        /* Fill the Tx FIFO with as many bytes as possible */
-+      tail = bcm_spi_readb(SPI_MSG_TAIL);
-+
-+        while ((tail < bs->fifo_size) && (bs->remaining_bytes > 0)) {
-+                if (bs->tx_ptr)
-+                        bcm_spi_writeb(*bs->tx_ptr++, SPI_MSG_DATA);
-+              else
-+                      bcm_spi_writeb(0, SPI_MSG_DATA);
-+
-+                bs->remaining_bytes--;
-+              tail = bcm_spi_readb(SPI_MSG_TAIL);
-+        }
++      size = bs->remaining_bytes < bs->fifo_size ? bs->remaining_bytes :
++              bs->fifo_size;
++      memcpy(bs->tx_io, bs->tx_ptr, size);
++      bs->remaining_bytes -= size;
 +}
 +
 +static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
@@ -588,16 +586,8 @@
 +              rx_tail = bcm_spi_readb(SPI_RX_TAIL);
 +
 +              /* Read out all the data */
-+              if (rx_tail) {
-+                      u8 data;
-+                      u8 i = 0;
-+
-+                      for(i = 0; i < rx_tail; i++) {
-+                              data = bcm_spi_readb(SPI_RX_DATA);
-+                              if (bs->rx_ptr)
-+                                      *bs->rx_ptr++ = data;
-+                      }
-+              }
++              if (rx_tail)
++                      memcpy(bs->rx_ptr, bs->rx_io, rx_tail);
 +
 +              /* See if there is more data to send */
 +              if (bs->remaining_bytes > 0) {
@@ -695,6 +685,8 @@
 +      master->transfer = bcm63xx_transfer;
 +      bs->speed_hz = pdata->speed_hz;
 +      bs->stopping = 0;
++      bs->tx_io = bcm63xx_regset_address(RSET_SPI) + 
bcm63xx_spireg(SPI_MSG_DATA);
++      bs->rx_io = bcm63xx_regset_address(RSET_SPI) + 
bcm63xx_spireg(SPI_RX_DATA);
 +      spin_lock_init(&bs->lock);
 +
 +      /* Initialize hardware */
-- 
1.7.3.2

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to