public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: fsl-spi: Don't use cpm_command on CPM1
@ 2014-11-20 16:24 Christophe Leroy
  2014-11-21 18:12 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2014-11-20 16:24 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, linuxppc-dev, linux-spi

On CPM1, when the SPI parameter RAM is relocated to somewhere else than the
default location, in accordance with freescale documentation
(refer micropatch SPI application note EB662), init RX/TX params command shall
not be used because it doesn't take into account the new location, and
overwrites data that is in original location of SPI param ram at addresses 
SCC2 param base +  (u32*)0x88 (u16*)0x90 (u32*)0x98 (u16*)0xA0, hence breaking
activity on SCC2 if SCC2 is used in a mode like QMC for instance.

Therefore, the action shall be done manually as described by freescale and as
was already partly done by the driver.

Reported-by: Patrick Vasseur <patrick.vasseur@c-s.fr>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Tested-by: Patrick Vasseur <patrick.vasseur@c-s.fr>

---
 drivers/spi/spi-fsl-cpm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 54b0637..da97988 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -56,12 +56,15 @@ void fsl_spi_cpm_reinit_txrx(struct mpc8xxx_spi *mspi)
 		qe_issue_cmd(QE_INIT_TX_RX, mspi->subblock,
 			     QE_CR_PROTOCOL_UNSPECIFIED, 0);
 	} else {
-		cpm_command(CPM_SPI_CMD, CPM_CR_INIT_TRX);
 		if (mspi->flags & SPI_CPM1) {
+			out_be32(&mspi->pram->rstate, 0);
 			out_be16(&mspi->pram->rbptr,
 				 in_be16(&mspi->pram->rbase));
+			out_be32(&mspi->pram->tstate, 0);
 			out_be16(&mspi->pram->tbptr,
 				 in_be16(&mspi->pram->tbase));
+		} else {
+			cpm_command(CPM_SPI_CMD, CPM_CR_INIT_TRX);
 		}
 	}
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: fsl-spi: Don't use cpm_command on CPM1
  2014-11-20 16:24 [PATCH] spi: fsl-spi: Don't use cpm_command on CPM1 Christophe Leroy
@ 2014-11-21 18:12 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-11-21 18:12 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: linux-kernel, linuxppc-dev, linux-spi

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

On Thu, Nov 20, 2014 at 05:24:17PM +0100, Christophe Leroy wrote:
> On CPM1, when the SPI parameter RAM is relocated to somewhere else than the
> default location, in accordance with freescale documentation
> (refer micropatch SPI application note EB662), init RX/TX params command shall
> not be used because it doesn't take into account the new location, and
> overwrites data that is in original location of SPI param ram at addresses 
> SCC2 param base +  (u32*)0x88 (u16*)0x90 (u32*)0x98 (u16*)0xA0, hence breaking
> activity on SCC2 if SCC2 is used in a mode like QMC for instance.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-21 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 16:24 [PATCH] spi: fsl-spi: Don't use cpm_command on CPM1 Christophe Leroy
2014-11-21 18:12 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox