From: Christophe Leroy Date: Thu, 20 Nov 2014 16:24:17 +0000 (+0100) Subject: spi: fsl-spi: Don't use cpm_command on CPM1 X-Git-Tag: v5.15~16727^2~3^5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=194ed900cac2070175c6e6bf6d23e6bb7400a0f2;p=platform%2Fkernel%2Flinux-starfive.git spi: fsl-spi: Don't use cpm_command on CPM1 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 Signed-off-by: Christophe Leroy Tested-by: Patrick Vasseur Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c index c5dd20b..e85ab1c 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); } } }