Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: andi.shyti@samsung.com (Andi Shyti)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/5] spi: s3c64xx: do not configure the device twice
Date: Tue, 28 Jun 2016 11:41:13 +0900	[thread overview]
Message-ID: <1467081676-8442-4-git-send-email-andi.shyti@samsung.com> (raw)
In-Reply-To: <1467081676-8442-1-git-send-email-andi.shyti@samsung.com>

At the start of the transfer, the spi_config function is called
twice, the first time when the 3c64xx_spi_prepare_message is
called and the second time with the s3c64xx_spi_transfer_one,
both called from the spi framework.

Remove the first call at the prepare message because in that
point we don't have the imformation about "bit per word" and
frequency.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/spi/spi-s3c64xx.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 14269b0..c65a9e6 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -676,16 +676,6 @@ static int s3c64xx_spi_prepare_message(struct spi_master *master,
 	struct spi_device *spi = msg->spi;
 	struct s3c64xx_spi_csinfo *cs = spi->controller_data;
 
-	/* If Master's(controller) state differs from that needed by Slave */
-	if (sdd->cur_speed != spi->max_speed_hz
-			|| sdd->cur_mode != spi->mode
-			|| sdd->cur_bpw != spi->bits_per_word) {
-		sdd->cur_bpw = spi->bits_per_word;
-		sdd->cur_speed = spi->max_speed_hz;
-		sdd->cur_mode = spi->mode;
-		s3c64xx_spi_config(sdd);
-	}
-
 	/* Configure feedback delay */
 	writel(cs->fb_delay & 0x3, sdd->regs + S3C64XX_SPI_FB_CLK);
 
@@ -712,6 +702,7 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master,
 	if (bpw != sdd->cur_bpw || speed != sdd->cur_speed) {
 		sdd->cur_bpw = bpw;
 		sdd->cur_speed = speed;
+		sdd->cur_mode = spi->mode;
 		s3c64xx_spi_config(sdd);
 	}
 
-- 
2.8.1

  parent reply	other threads:[~2016-06-28  2:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28  2:41 [PATCH v2 0/5] s3c64xx: consider the case of a disconnected CS line and some code rework Andi Shyti
2016-06-28  2:41 ` [PATCH v2 1/5] spi: s3c64xx: group the CS signalling writes in a single function Andi Shyti
2016-06-28  2:41 ` [PATCH v2 2/5] spi: s3c64xx: consider the case when the CS line is not connected Andi Shyti
2016-06-30 12:15   ` Applied "spi: s3c64xx: consider the case when the CS line is not connected" to the spi tree Mark Brown
2016-06-28  2:41 ` Andi Shyti [this message]
2016-06-28  2:41 ` [PATCH v2 4/5] spi: s3c64xx: simplify if statement in prepare_transfer function Andi Shyti
2016-06-28  2:41 ` [PATCH v2 5/5] spi: s3c64xx: use unsigned type for fifo handling variables Andi Shyti
2016-07-05 14:55   ` Mark Brown
2016-07-05 15:01     ` Andi Shyti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467081676-8442-4-git-send-email-andi.shyti@samsung.com \
    --to=andi.shyti@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox