Hello Florian,

I've refreshed the patch with miguel updates.

Regards,
Tanguy Bouzéloc.

Le 28/12/2010 23:37, Florian Fainelli a écrit :
Hello Tanguy,

On Tuesday 28 December 2010 10:17:37 Tanguy Bouzéloc wrote:
Hello Florian,

I've refreshed the patches, Miguel GAIO have sent you a patch also a few
weeks ago (warning fixes, move spi registers functions inside the
driver), you have to apply this one after mines.
Even if I revert Miguel's patch locally and try to apply your patches, they
fail, can you check if you have not applied a patch locally that you did not
send me?

I can attach the *.rej files if that helps.

Thanks,
Tanguy.

Le 28/12/2010 00:26, Florian Fainelli a écrit :
Hello Tanguy,

On Thursday 25 November 2010 10:37:04 Tanguy Bouzéloc wrote:
Hi Florian,

Il joined you a bcm63xx-spi fix for multibytes reads/writes.
I tried to apply all the patches that you submitted so far:

0001-fix-platform-device-registration.patch
0001-fix-chipselect-command-register-defines-add-missing-.patch
0002-make-slave-select-proper.patch
0003-fix-multibytes-transferts.patch

but they no longer apply cleanly. Can you refresh them and resubmit them?
I will be quicker in applying them this time ;)

Thanks a lot!
--
Florian

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 09ae58539656c6a9a6d722263e6e1e54eb7eab88 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tanguy=20Bouz=C3=A9loc?= <tanguy.bouze...@efixo.com>
Date: Wed, 29 Dec 2010 11:50:02 +0100
Subject: [PATCH] refresh patch

---
 target/linux/brcm63xx/patches-2.6.35/240-spi.patch |   65 +++++++++-----------
 1 files changed, 29 insertions(+), 36 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 ab12a6f..adc4c22 100644
--- a/target/linux/brcm63xx/patches-2.6.35/240-spi.patch
+++ b/target/linux/brcm63xx/patches-2.6.35/240-spi.patch
@@ -318,7 +318,7 @@
  #endif /* BCM63XX_REGS_H_ */
 --- /dev/null
 +++ b/drivers/spi/bcm63xx_spi.c
-@@ -0,0 +1,501 @@
+@@ -0,0 +1,494 @@
 +/*
 + * Broadcom BCM63xx SPI controller support
 + *
@@ -370,38 +370,43 @@
 +	/* Data buffers */
 +	const unsigned char	*tx_ptr;
 +	unsigned char		*rx_ptr;
++
++	/* data iomem */
++	u8 __iomem		*tx_io;
++	const u8 __iomem	*rx_io;
++
 +	int			remaining_bytes;
 +
 +	struct clk		*clk;
 +	struct platform_device	*pdev;
 +};
 +
-+static inline u8 bcm_spi_readb(struct bcm63xx_hsspi *bs,
++static inline u8 bcm_spi_readb(struct bcm63xx_spi *bs,
 +				unsigned int offset)
 +{
-+        return bcm_readw(bs->regs + bcm63xx_spireg(offset));
++	return bcm_readw(bs->regs + bcm63xx_spireg(offset));
 +}
 +
-+static inline u16 bcm_spi_readw(struct bcm63xx_hsspi *bs,
++static inline u16 bcm_spi_readw(struct bcm63xx_spi *bs,
 +				unsigned int offset)
 +{
-+        return bcm_readw(bs->regs + bcm63xx_spireg(offset));
++	return bcm_readw(bs->regs + bcm63xx_spireg(offset));
 +}
 +
-+static inline void bcm_spi_writeb(struct bcm63xx_hsspi *bs,
++static inline void bcm_spi_writeb(struct bcm63xx_spi *bs,
 +				  u8 value, unsigned int offset)
 +{
-+        bcm_writeb(value, bs->regs + bcm63xx_spireg(offset));
++	bcm_writeb(value, bs->regs + bcm63xx_spireg(offset));
 +}
 +
-+static inline void bcm_spi_writew(struct bcm63xx_hsspi *bs,
++static inline void bcm_spi_writew(struct bcm63xx_spi *bs,
 +				  u16 value, unsigned int offset)
 +{
-+        bcm_writew(value, bs->regs + bcm63xx_spireg(offset));
++	bcm_writew(value, bs->regs + bcm63xx_spireg(offset));
 +}
 +
 +static int bcm63xx_spi_setup_transfer(struct spi_device *spi,
-+					struct spi_transfer *t)
++				      struct spi_transfer *t)
 +{
 +	u8 bits_per_word;
 +	u8 clk_cfg;
@@ -442,13 +447,13 @@
 +	case 32:
 +		clk_cfg = SPI_CLK_1_563MHZ;
 +		break;
-+	case 128:
++	case 64:
 +		clk_cfg = SPI_CLK_0_781MHZ;
 +		break;
-+	case 64:
++	case 128:
 +	default:
 +		/* Set to slowest mode for compatibility */
-+		clk_cfg = SPI_CLK_0_781MHZ;
++		clk_cfg = SPI_CLK_0_391MHZ;
 +		break;
 +	}
 +
@@ -497,20 +502,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(bs, SPI_MSG_TAIL);
-+
-+	while ((tail < bs->fifo_size) && (bs->remaining_bytes > 0)) {
-+		if (bs->tx_ptr)
-+			bcm_spi_writeb(bs, *bs->tx_ptr++, SPI_MSG_DATA);
-+		else
-+			bcm_spi_writeb(bs, 0, SPI_MSG_DATA);
-+
-+		bs->remaining_bytes--;
-+		tail = bcm_spi_readb(bs, SPI_MSG_TAIL);
-+	}
++	size = bs->remaining_bytes < bs->fifo_size ? bs->remaining_bytes :
++		bs->fifo_size;
++	memcpy_toio(bs->tx_io, bs->tx_ptr, size);
++	bs->remaining_bytes -= size;
 +}
 +
 +static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
@@ -551,6 +549,7 @@
 +	/* Issue the transfer */
 +	cmd = SPI_CMD_START_IMMEDIATE;
 +	cmd |= (0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT);
++	cmd |= (spi->chip_select << SPI_CMD_DEVICE_ID_SHIFT);
 +	bcm_spi_writew(bs, cmd, SPI_CMD);
 +	wait_for_completion(&bs->done);
 +
@@ -603,16 +602,8 @@
 +		rx_tail = bcm_spi_readb(bs, 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(bs, SPI_RX_DATA);
-+				if (bs->rx_ptr)
-+					*bs->rx_ptr++ = data;
-+			}
-+		}
++		if (rx_tail)
++			memcpy_fromio(bs->rx_ptr, bs->rx_io, rx_tail);
 +
 +		/* See if there is more data to send */
 +		if (bs->remaining_bytes > 0) {
@@ -708,6 +699,8 @@
 +	master->transfer = bcm63xx_transfer;
 +	bs->speed_hz = pdata->speed_hz;
 +	bs->stopping = 0;
++	bs->tx_io = (u8*)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA));
++	bs->rx_io = (const u8*)(bs->regs + bcm63xx_spireg(SPI_RX_DATA));
 +	spin_lock_init(&bs->lock);
 +
 +	/* Initialize hardware */
@@ -796,7 +789,7 @@
 +		.owner	= THIS_MODULE,
 +	},
 +	.probe		= bcm63xx_spi_probe,
-+	.remove		= bcm63xx_spi_remove,
++	.remove		= __exit_p(bcm63xx_spi_remove),
 +	.suspend	= bcm63xx_spi_suspend,
 +	.resume		= bcm63xx_spi_resume,
 +};
-- 
1.7.3.4

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

Reply via email to