All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: openbmc@lists.ozlabs.org
Cc: "Joel Stanley" <joel@jms.id.au>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	"Cédric Le Goater" <clg@kaod.org>
Subject: [PATCH dev-5.0 1/4] mtd: spi-nor: aspeed: introduce a aspeed_smc_default_read() helper
Date: Wed, 17 Apr 2019 15:39:38 +0200	[thread overview]
Message-ID: <20190417133941.22962-2-clg@kaod.org> (raw)
In-Reply-To: <20190417133941.22962-1-clg@kaod.org>

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 drivers/mtd/spi-nor/aspeed-smc.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
index ddf7ae78aa0a..ee3059b27c07 100644
--- a/drivers/mtd/spi-nor/aspeed-smc.c
+++ b/drivers/mtd/spi-nor/aspeed-smc.c
@@ -882,6 +882,17 @@ static const uint32_t aspeed_smc_hclk_divs[] = {
 };
 #define ASPEED_SMC_HCLK_DIV(i) (aspeed_smc_hclk_divs[(i) - 1] << 8)
 
+static u32 aspeed_smc_default_read(struct aspeed_smc_chip *chip)
+{
+	return (chip->ctl_val[smc_read] & 0x2000) |
+		(0x00 << 28) | /* Single bit */
+		(0x00 << 24) | /* CE# max */
+		(0x03 << 16) | /* use normal reads */
+		(0x00 <<  8) | /* HCLK/16 */
+		(0x00 <<  6) | /* no dummy cycle */
+		(0x00);        /* normal mode */
+}
+
 static int aspeed_smc_optimize_read(struct aspeed_smc_chip *chip,
 				     u32 max_freq)
 {
@@ -898,13 +909,7 @@ static int aspeed_smc_optimize_read(struct aspeed_smc_chip *chip,
 	/* We start with the dumbest setting (keep 4Byte bit) and read
 	 * some data
 	 */
-	chip->ctl_val[smc_read] = (chip->ctl_val[smc_read] & 0x2000) |
-		(0x00 << 28) | /* Single bit */
-		(0x00 << 24) | /* CE# max */
-		(0x03 << 16) | /* use normal reads */
-		(0x00 <<  8) | /* HCLK/16 */
-		(0x00 <<  6) | /* no dummy cycle */
-		(0x00);        /* normal read */
+	chip->ctl_val[smc_read] = aspeed_smc_default_read(chip);
 
 	writel(chip->ctl_val[smc_read], chip->ctl);
 
-- 
2.20.1

  reply	other threads:[~2019-04-17 14:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 13:39 [PATCH dev-5.0 0/4] spi-nor: aspeed: add support for the 4B opcodes Cédric Le Goater
2019-04-17 13:39 ` Cédric Le Goater [this message]
2019-04-17 18:09   ` [PATCH dev-5.0 1/4] mtd: spi-nor: aspeed: introduce a aspeed_smc_default_read() helper Alexander Amelkin
2019-04-18  6:07     ` Andrew Jeffery
2019-04-18  6:23       ` Cédric Le Goater
2019-04-17 13:39 ` [PATCH dev-5.0 2/4] mtd: spi-nor: aspeed: clarify 4BYTE address mode mask Cédric Le Goater
2019-04-18  6:09   ` Andrew Jeffery
2019-04-17 13:39 ` [PATCH dev-5.0 3/4] mtd: spi-nor: aspeed: use memcpy_fromio() to capture the optimization buffer Cédric Le Goater
2019-04-18  6:10   ` Andrew Jeffery
2019-04-17 13:39 ` [PATCH dev-5.0 4/4] mtd: spi-nor: aspeed: add support for the 4B opcodes Cédric Le Goater
2019-04-18  6:10   ` Andrew Jeffery
2019-04-18 21:23 ` [PATCH dev-5.0 3/4] mtd: spi-nor: aspeed: use memcpy_fromio() to capture the optimization buffer Milton Miller II
2019-04-19  1:03   ` Andrew Jeffery
2019-04-19  6:02     ` Cédric Le Goater
2019-04-19  7:23       ` Andrew Jeffery
2019-04-19  8:09         ` Cédric Le Goater
2019-04-19  8:22           ` Andrew Jeffery
2019-05-02  3:53           ` Andrew Jeffery
2019-05-03 22:19           ` Milton Miller II
2019-04-18 22:27 ` [PATCH dev-5.0 2/4] mtd: spi-nor: aspeed: clarify 4BYTE address mode mask Milton Miller II
2019-04-19  6:09   ` Cédric Le Goater
2019-04-19  6:41     ` Andrew Jeffery
2019-04-18 22:41 ` [PATCH dev-5.0 0/4] spi-nor: aspeed: add support for the 4B opcodes Milton Miller II
2019-04-19  7:08   ` Cédric Le Goater

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=20190417133941.22962-2-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=andrew@aj.id.au \
    --cc=joel@jms.id.au \
    --cc=openbmc@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.