diff mbox series

spi: lpspi: Fix CLK pin becomes low before one transfer

Message ID 20181204062224.28844-1-xiaoning.wang@nxp.com (mailing list archive)
State Accepted
Commit a15dc3d657fa2df08d1adbed926050314b5f4ba7
Headers show
Series spi: lpspi: Fix CLK pin becomes low before one transfer | expand

Commit Message

Clark Wang Dec. 4, 2018, 6:23 a.m. UTC
Remove Reset operation in fsl_lpspi_config(). This RST may cause both CLK
and CS pins go from high to low level under cs-gpio mode.
Add fsl_lpspi_reset() function after one message transfer to clear all
flags in use.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
---
 drivers/spi/spi-fsl-lpspi.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

Comments

Mark Brown Dec. 11, 2018, 2:30 p.m. UTC | #1
On Tue, Dec 04, 2018 at 06:23:19AM +0000, Clark Wang wrote:
> Remove Reset operation in fsl_lpspi_config(). This RST may cause both CLK
> and CS pins go from high to low level under cs-gpio mode.
> Add fsl_lpspi_reset() function after one message transfer to clear all
> flags in use.

This doesn't apply against current code, please check and resend.
Clark Wang Dec. 12, 2018, 2:10 a.m. UTC | #2
Hi Mark,

These five patches are based on patch series spi: lpspi: Add Slave Mode support for LPSPI. For the patch series make a big change, should I hold these five patches until the patch series are applied in your git branch?

Thanks for your patience.

Regards,
Clark Wang

> -----Original Message-----
> From: Mark Brown <broonie@kernel.org>
> Sent: Tuesday, December 11, 2018 22:30
> To: Clark Wang <xiaoning.wang@nxp.com>
> Cc: linux-spi@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] spi: lpspi: Fix CLK pin becomes low before one transfer
> 
> On Tue, Dec 04, 2018 at 06:23:19AM +0000, Clark Wang wrote:
> > Remove Reset operation in fsl_lpspi_config(). This RST may cause both
> > CLK and CS pins go from high to low level under cs-gpio mode.
> > Add fsl_lpspi_reset() function after one message transfer to clear all
> > flags in use.
> 
> This doesn't apply against current code, please check and resend.
Mark Brown Dec. 12, 2018, 6:16 p.m. UTC | #3
On Wed, Dec 12, 2018 at 02:10:46AM +0000, Clark Wang wrote:

> These five patches are based on patch series spi: lpspi: Add Slave Mode support for LPSPI. For the patch series make a big change, should I hold these five patches until the patch series are applied in your git branch?

OK, if you're sending patches that depend on other things that are still
in review it's important to call that out in the cover letter for the
series or after the --- for single patches, that way it's clear what's
going on.  Please resend these as a series with a note pointing at the
other series.

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.
diff mbox series

Patch

diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index f32a2e0d7ae1..a7d01b79827b 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -279,10 +279,6 @@  static int fsl_lpspi_config(struct fsl_lpspi_data *fsl_lpspi)
 	u32 temp;
 	int ret;
 
-	temp = CR_RST;
-	writel(temp, fsl_lpspi->base + IMX7ULP_CR);
-	writel(0, fsl_lpspi->base + IMX7ULP_CR);
-
 	if (!fsl_lpspi->is_slave) {
 		ret = fsl_lpspi_set_bitrate(fsl_lpspi);
 		if (ret)
@@ -373,6 +369,24 @@  static int fsl_lpspi_wait_for_completion(struct spi_controller *controller)
 	return 0;
 }
 
+static int fsl_lpspi_reset(struct fsl_lpspi_data *fsl_lpspi)
+{
+	u32 temp;
+
+	/* Disable all interrupt */
+	fsl_lpspi_intctrl(fsl_lpspi, 0);
+
+	/* W1C for all flags in SR */
+	temp = 0x3F << 8;
+	writel(temp, fsl_lpspi->base + IMX7ULP_SR);
+
+	/* Clear FIFO and disable module */
+	temp = CR_RRF | CR_RTF;
+	writel(temp, fsl_lpspi->base + IMX7ULP_CR);
+
+	return 0;
+}
+
 static int fsl_lpspi_transfer_one(struct spi_controller *controller,
 				  struct spi_device *spi,
 				  struct spi_transfer *t)
@@ -394,6 +408,8 @@  static int fsl_lpspi_transfer_one(struct spi_controller *controller,
 	if (ret)
 		return ret;
 
+	fsl_lpspi_reset(fsl_lpspi);
+
 	return 0;
 }