* [PATCH 1/4] [POWERPC][SPI] spi_mpc83xx.c: should turn off SPI unit while switching any mode.
[not found] ` <20070726131134.GA3309-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2007-07-26 13:13 ` Anton Vorontsov
[not found] ` <20070726131346.GA3417-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-26 13:14 ` [PATCH 2/4] [POWERPC][SPI] spi_mpc83xx: get rid of magic numbers Anton Vorontsov
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Anton Vorontsov @ 2007-07-26 13:13 UTC (permalink / raw)
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A
Documentation clearly states, that mode should not be changed
till SPMODE_ENABLE bit set. I've seen hangs w/o this patch.
Signed-off-by: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
---
drivers/spi/spi_mpc83xx.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 3295cfc..0b99fd9 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -176,6 +176,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
regval |= SPMODE_PM(pm);
}
+ /* Turn off SPI unit prior changing mode */
+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
if (mpc83xx_spi->activate_cs)
mpc83xx_spi->activate_cs(spi->chip_select, pol);
@@ -249,6 +251,8 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
regval &= 0xff0fffff;
regval |= SPMODE_LEN(bits_per_word);
+ /* Turn off SPI unit prior changing mode */
+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
return 0;
--
1.5.0.6
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] [POWERPC][SPI] spi_mpc83xx: get rid of magic numbers
[not found] ` <20070726131134.GA3309-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-26 13:13 ` [PATCH 1/4] [POWERPC][SPI] spi_mpc83xx.c: should turn off SPI unit while switching any mode Anton Vorontsov
@ 2007-07-26 13:14 ` Anton Vorontsov
2007-07-26 13:14 ` [PATCH 3/4] [POWERPC][SPI] spi_mpc83xx: support for lsb mode switching Anton Vorontsov
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Anton Vorontsov @ 2007-07-26 13:14 UTC (permalink / raw)
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A
Signed-off-by: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
---
drivers/spi/spi_mpc83xx.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 0b99fd9..e2d8dbc 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -153,7 +153,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
len = len - 1;
/* mask out bits we are going to set */
- regval &= ~0x38ff0000;
+ regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH |
+ SPMODE_LEN(0xF) | SPMODE_DIV16 | SPMODE_PM(0xF));
if (spi->mode & SPI_CPHA)
regval |= SPMODE_CP_BEGIN_EDGECLK;
@@ -248,7 +249,7 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
/* Mask out bits_per_wordgth */
- regval &= 0xff0fffff;
+ regval &= ~SPMODE_LEN(0xF);
regval |= SPMODE_LEN(bits_per_word);
/* Turn off SPI unit prior changing mode */
--
1.5.0.6
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] [POWERPC][SPI] spi_mpc83xx: support for lsb mode switching
[not found] ` <20070726131134.GA3309-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-26 13:13 ` [PATCH 1/4] [POWERPC][SPI] spi_mpc83xx.c: should turn off SPI unit while switching any mode Anton Vorontsov
2007-07-26 13:14 ` [PATCH 2/4] [POWERPC][SPI] spi_mpc83xx: get rid of magic numbers Anton Vorontsov
@ 2007-07-26 13:14 ` Anton Vorontsov
2007-07-26 13:14 ` [PATCH 4/4] [POWERPC][SPI] spi_mpc83xx: fix LSB mode shifts Anton Vorontsov
2007-07-27 2:58 ` [PATCH 0/4] Few spi_mpc83xx.c fixes and improvements David Brownell
4 siblings, 0 replies; 9+ messages in thread
From: Anton Vorontsov @ 2007-07-26 13:14 UTC (permalink / raw)
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A
Signed-off-by: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
---
drivers/spi/spi_mpc83xx.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index e2d8dbc..7e17c8b 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -154,12 +154,15 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
/* mask out bits we are going to set */
regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH |
- SPMODE_LEN(0xF) | SPMODE_DIV16 | SPMODE_PM(0xF));
+ SPMODE_LEN(0xF) | SPMODE_DIV16 | SPMODE_PM(0xF) | \
+ SPMODE_REV);
if (spi->mode & SPI_CPHA)
regval |= SPMODE_CP_BEGIN_EDGECLK;
if (spi->mode & SPI_CPOL)
regval |= SPMODE_CI_INACTIVEHIGH;
+ if (!(spi->mode & SPI_LSB_FIRST))
+ regval |= SPMODE_REV;
regval |= SPMODE_LEN(len);
@@ -248,9 +251,11 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
- /* Mask out bits_per_wordgth */
- regval &= ~SPMODE_LEN(0xF);
+ /* mask out bits we are going to set */
+ regval &= ~(SPMODE_LEN(0xF) | SPMODE_REV);
regval |= SPMODE_LEN(bits_per_word);
+ if (!(spi->mode & SPI_LSB_FIRST))
+ regval |= SPMODE_REV;
/* Turn off SPI unit prior changing mode */
mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
@@ -260,7 +265,7 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
}
/* the spi->mode bits understood by this driver: */
-#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH)
+#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST)
static int mpc83xx_spi_setup(struct spi_device *spi)
{
--
1.5.0.6
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] [POWERPC][SPI] spi_mpc83xx: fix LSB mode shifts
[not found] ` <20070726131134.GA3309-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
` (2 preceding siblings ...)
2007-07-26 13:14 ` [PATCH 3/4] [POWERPC][SPI] spi_mpc83xx: support for lsb mode switching Anton Vorontsov
@ 2007-07-26 13:14 ` Anton Vorontsov
2007-07-27 2:58 ` [PATCH 0/4] Few spi_mpc83xx.c fixes and improvements David Brownell
4 siblings, 0 replies; 9+ messages in thread
From: Anton Vorontsov @ 2007-07-26 13:14 UTC (permalink / raw)
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A
spi_mpc83xx should use other shifts when running in QE+LSB mode.
Signed-off-by: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
---
drivers/spi/spi_mpc83xx.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 7e17c8b..458075a 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -237,6 +237,14 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
} else
return -EINVAL;
+ if (mpc83xx_spi->qe_mode && spi->mode & SPI_LSB_FIRST) {
+ mpc83xx_spi->tx_shift = 0;
+ if (bits_per_word <= 8)
+ mpc83xx_spi->rx_shift = 8;
+ else
+ mpc83xx_spi->rx_shift = 0;
+ }
+
/* nsecs = (clock period)/2 */
if (!hz)
hz = spi->max_speed_hz;
--
1.5.0.6
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] Few spi_mpc83xx.c fixes and improvements
[not found] ` <20070726131134.GA3309-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
` (3 preceding siblings ...)
2007-07-26 13:14 ` [PATCH 4/4] [POWERPC][SPI] spi_mpc83xx: fix LSB mode shifts Anton Vorontsov
@ 2007-07-27 2:58 ` David Brownell
[not found] ` <200707261958.09127.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
4 siblings, 1 reply; 9+ messages in thread
From: David Brownell @ 2007-07-27 2:58 UTC (permalink / raw)
To: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Thursday 26 July 2007, Anton Vorontsov wrote:
> Hi all,
>
> These patches based on Linus' tree, as of today.
I don't know mpc83xx ... are there any PPC folk who can see
any reason not to just merge these patches? They look OK
to me, but in this case that doesn't mean much. :)
If I don't hear otherwise, I'll forward all four of these
patches upstream on Monday.
(Anton, thanks for these updates!)
- Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 9+ messages in thread