mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] spi: i.MX: Simplify cspi_0_0_init()
Date: Thu, 10 Apr 2014 20:23:41 +0400	[thread overview]
Message-ID: <1397147022-20116-1-git-send-email-shc_work@mail.ru> (raw)

Use SPI module software reset to simplify cspi_0_0_init().

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/spi/imx_spi.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
index 45461bd..3c1ba61 100644
--- a/drivers/spi/imx_spi.c
+++ b/drivers/spi/imx_spi.c
@@ -67,6 +67,8 @@
 
 #define CSPI_0_0_TEST_LBC		(1 << 14)
 
+#define CSPI_0_0_RESET_START		(1 << 0)
+
 #define CSPI_0_7_RXDATA			0x00
 #define CSPI_0_7_TXDATA			0x04
 #define CSPI_0_7_CTRL			0x08
@@ -197,13 +199,9 @@ static void cspi_0_0_init(struct imx_spi *imx)
 {
 	void __iomem *base = imx->regs;
 
-	writel(CSPI_0_0_CTRL_ENABLE | CSPI_0_0_CTRL_MASTER,
-		     base + CSPI_0_0_CTRL);
-	writel(CSPI_0_0_PERIOD_32KHZ,
-		     base + CSPI_0_0_PERIOD);
-	while (readl(base + CSPI_0_0_INT) & CSPI_0_0_STAT_RR)
-		readl(base + CSPI_0_0_RXDATA);
-	writel(0, base + CSPI_0_0_INT);
+	writel(CSPI_0_0_RESET_START, base + CSPI_0_0_RESET);
+	do {
+	} while (readl(base + CSPI_0_0_RESET) & CSPI_0_0_RESET_START);
 }
 
 static unsigned int cspi_0_7_xchg_single(struct imx_spi *imx, unsigned int data)
-- 
1.8.3.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2014-04-10 16:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 16:23 Alexander Shiyan [this message]
2014-04-10 16:23 ` [PATCH 2/2] spi: i.MX: Optimise driver private structure Alexander Shiyan
2014-04-23 10:32 ` [PATCH 1/2] spi: i.MX: Simplify cspi_0_0_init() Sascha Hauer

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=1397147022-20116-1-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@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