linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update()
@ 2021-07-19  7:48 Andy Shevchenko
  2021-07-19  7:48 ` [PATCH v1 2/3] spi: pxa2xx: Reset DMA bits in CR1 in reset_sccr1() Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-07-19  7:48 UTC (permalink / raw)
  To: Mark Brown, Andy Shevchenko, linux-arm-kernel, linux-spi, linux-kernel
  Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik

Convert reset_sccr1() to use pxa2xx_spi_update().
It will help for further improvements.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-pxa2xx.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 974e30744b83..7c4c8179a329 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -594,24 +594,22 @@ static int u32_reader(struct driver_data *drv_data)
 
 static void reset_sccr1(struct driver_data *drv_data)
 {
-	struct chip_data *chip =
-		spi_get_ctldata(drv_data->controller->cur_msg->spi);
-	u32 sccr1_reg;
+	struct chip_data *chip = spi_get_ctldata(drv_data->controller->cur_msg->spi);
+	u32 mask = drv_data->int_cr1;
 
-	sccr1_reg = pxa2xx_spi_read(drv_data, SSCR1) & ~drv_data->int_cr1;
 	switch (drv_data->ssp_type) {
 	case QUARK_X1000_SSP:
-		sccr1_reg &= ~QUARK_X1000_SSCR1_RFT;
+		mask |= QUARK_X1000_SSCR1_RFT;
 		break;
 	case CE4100_SSP:
-		sccr1_reg &= ~CE4100_SSCR1_RFT;
+		mask |= CE4100_SSCR1_RFT;
 		break;
 	default:
-		sccr1_reg &= ~SSCR1_RFT;
+		mask |= SSCR1_RFT;
 		break;
 	}
-	sccr1_reg |= chip->threshold;
-	pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg);
+
+	pxa2xx_spi_update(drv_data, SSCR1, mask, chip->threshold);
 }
 
 static void int_stop_and_reset(struct driver_data *drv_data)
-- 
2.30.2


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

* [PATCH v1 2/3] spi: pxa2xx: Reset DMA bits in CR1 in reset_sccr1()
  2021-07-19  7:48 [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update() Andy Shevchenko
@ 2021-07-19  7:48 ` Andy Shevchenko
  2021-07-19  7:48 ` [PATCH v1 3/3] spi: pxa2xx: Reuse int_stop_and_reset() in couple of places Andy Shevchenko
  2021-07-19 14:37 ` [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update() Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-07-19  7:48 UTC (permalink / raw)
  To: Mark Brown, Andy Shevchenko, linux-arm-kernel, linux-spi, linux-kernel
  Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik

In order to allow reset_sccr1() to be reused in DMA paths,
reset DMA bits in CR1 in this function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-pxa2xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 7c4c8179a329..833eb52ed305 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -595,7 +595,7 @@ static int u32_reader(struct driver_data *drv_data)
 static void reset_sccr1(struct driver_data *drv_data)
 {
 	struct chip_data *chip = spi_get_ctldata(drv_data->controller->cur_msg->spi);
-	u32 mask = drv_data->int_cr1;
+	u32 mask = drv_data->int_cr1 | drv_data->dma_cr1;
 
 	switch (drv_data->ssp_type) {
 	case QUARK_X1000_SSP:
-- 
2.30.2


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

* [PATCH v1 3/3] spi: pxa2xx: Reuse int_stop_and_reset() in couple of places
  2021-07-19  7:48 [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update() Andy Shevchenko
  2021-07-19  7:48 ` [PATCH v1 2/3] spi: pxa2xx: Reset DMA bits in CR1 in reset_sccr1() Andy Shevchenko
@ 2021-07-19  7:48 ` Andy Shevchenko
  2021-07-19 14:37 ` [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update() Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-07-19  7:48 UTC (permalink / raw)
  To: Mark Brown, Andy Shevchenko, linux-arm-kernel, linux-spi, linux-kernel
  Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik

Reuse int_stop_and_reset() in couple of places.

While at it, change the order of the int_stop_and_reset() and pxa2xx_spi_off()
to be in align with the similar flow in int_error_stop().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-pxa2xx.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 833eb52ed305..19a2d1ea7d42 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -722,11 +722,8 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
 
 static void handle_bad_msg(struct driver_data *drv_data)
 {
+	int_stop_and_reset(drv_data);
 	pxa2xx_spi_off(drv_data);
-	clear_SSCR1_bits(drv_data, drv_data->int_cr1);
-	if (!pxa25x_ssp_comp(drv_data))
-		pxa2xx_spi_write(drv_data, SSTO, 0);
-	write_SSSR_CS(drv_data, drv_data->clear_sr);
 
 	dev_err(drv_data->ssp->dev, "bad message state in interrupt handler\n");
 }
@@ -1154,13 +1151,10 @@ static void pxa2xx_spi_handle_err(struct spi_controller *controller,
 {
 	struct driver_data *drv_data = spi_controller_get_devdata(controller);
 
+	int_stop_and_reset(drv_data);
+
 	/* Disable the SSP */
 	pxa2xx_spi_off(drv_data);
-	/* Clear and disable interrupts and service requests */
-	write_SSSR_CS(drv_data, drv_data->clear_sr);
-	clear_SSCR1_bits(drv_data, drv_data->int_cr1 | drv_data->dma_cr1);
-	if (!pxa25x_ssp_comp(drv_data))
-		pxa2xx_spi_write(drv_data, SSTO, 0);
 
 	/*
 	 * Stop the DMA if running. Note DMA callback handler may have unset
-- 
2.30.2


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

* Re: [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update()
  2021-07-19  7:48 [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update() Andy Shevchenko
  2021-07-19  7:48 ` [PATCH v1 2/3] spi: pxa2xx: Reset DMA bits in CR1 in reset_sccr1() Andy Shevchenko
  2021-07-19  7:48 ` [PATCH v1 3/3] spi: pxa2xx: Reuse int_stop_and_reset() in couple of places Andy Shevchenko
@ 2021-07-19 14:37 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-07-19 14:37 UTC (permalink / raw)
  To: linux-spi, Andy Shevchenko, linux-arm-kernel, linux-kernel
  Cc: Mark Brown, Daniel Mack, Robert Jarzmik, Haojian Zhuang

On Mon, 19 Jul 2021 10:48:40 +0300, Andy Shevchenko wrote:
> Convert reset_sccr1() to use pxa2xx_spi_update().
> It will help for further improvements.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update()
      commit: e0a6512d29126901dd16dfede314616b57ec8210
[2/3] spi: pxa2xx: Reset DMA bits in CR1 in reset_sccr1()
      commit: cdcb26ce747a5ec665a98fd6c303248a12418140
[3/3] spi: pxa2xx: Reuse int_stop_and_reset() in couple of places
      commit: 3bbdc083262dc082e5c8e7b0646faf8f4ef894dd

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2021-07-19 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19  7:48 [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update() Andy Shevchenko
2021-07-19  7:48 ` [PATCH v1 2/3] spi: pxa2xx: Reset DMA bits in CR1 in reset_sccr1() Andy Shevchenko
2021-07-19  7:48 ` [PATCH v1 3/3] spi: pxa2xx: Reuse int_stop_and_reset() in couple of places Andy Shevchenko
2021-07-19 14:37 ` [PATCH v1 1/3] spi: pxa2xx: Convert reset_sccr1() to use pxa2xx_spi_update() Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).