All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: openbmc@lists.ozlabs.org
Subject: [PATCH v2 linux dev-4.7 1/7] mtd: spi-nor: aspeed: fix setting of the register control value for writes
Date: Wed,  9 Nov 2016 09:15:37 +0100	[thread overview]
Message-ID: <1478679343-25354-2-git-send-email-clg@kaod.org> (raw)
In-Reply-To: <1478679343-25354-1-git-send-email-clg@kaod.org>

The setting of the register control value for writes depends on the
base value which was defined only if the mask applied to it changed
the register control value.

Fix that.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 I kept the info level because nothing wrong is happening. we are just
 possibly changing an optimized value for a non optimized value

 drivers/mtd/spi-nor/aspeed-smc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
index f65379bb2287..75ba73ef0660 100644
--- a/drivers/mtd/spi-nor/aspeed-smc.c
+++ b/drivers/mtd/spi-nor/aspeed-smc.c
@@ -756,7 +756,7 @@ static int aspeed_smc_chip_setup_init(struct aspeed_smc_chip *chip,
 {
 	struct aspeed_smc_controller *controller = chip->controller;
 	const struct aspeed_smc_info *info = controller->info;
-	u32 reg;
+	u32 reg, base_reg;
 
 	/*
 	 * Always turn on the write enable bit to allow opcodes to be
@@ -789,12 +789,13 @@ static int aspeed_smc_chip_setup_init(struct aspeed_smc_chip *chip,
 	reg = readl(chip->ctl);
 	dev_dbg(controller->dev, "control register: %08x\n", reg);
 
-	if ((reg & CONTROL_SPI_KEEP_MASK) != reg) {
-		chip->ctl_val[smc_base] = reg & CONTROL_SPI_KEEP_MASK;
+	base_reg = reg & CONTROL_SPI_KEEP_MASK;
+	if (base_reg != reg) {
 		dev_info(controller->dev,
 			 "control register changed to: %08x\n",
-			 chip->ctl_val[smc_base]);
+			 base_reg);
 	}
+	chip->ctl_val[smc_base] = base_reg;
 
 	/*
 	 * Retain the prior value of the control register as the
-- 
2.7.4

  reply	other threads:[~2016-11-09  8:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09  8:15 [PATCH v2 linux dev-4.7 0/7] Aspeed SMC improvements Cédric Le Goater
2016-11-09  8:15 ` Cédric Le Goater [this message]
2016-11-09 23:05   ` [PATCH v2 linux dev-4.7 1/7] mtd: spi-nor: aspeed: fix setting of the register control value for writes Joel Stanley
2016-11-09  8:15 ` [PATCH v2 linux dev-4.7 2/7] mtd: spi-nor: aspeed: improve 4 bytes mode Cédric Le Goater
2016-11-09 23:07   ` Joel Stanley
2016-11-09  8:15 ` [PATCH v2 linux dev-4.7 3/7] mtd: spi-nor: aspeed: extend the bits definitions Cédric Le Goater
2016-11-09  8:15 ` [PATCH v2 linux dev-4.7 4/7] mtd: spi-nor: aspeed: add some logging Cédric Le Goater
2016-11-09  8:15 ` [PATCH v2 linux dev-4.7 5/7] mtd: spi-nor: aspeed: use smc_read mode when doing DMAs Cédric Le Goater
2016-11-09  8:15 ` [PATCH v2 linux dev-4.7 6/7] mtd: spi-nor: aspeed: prepare for fast read Cédric Le Goater
2016-11-09  8:15 ` [PATCH v2 linux dev-4.7 7/7] mtd: spi-nor: aspeed: rework io routines Cédric Le Goater
2016-11-10  0:37 ` [PATCH v2 linux dev-4.7 0/7] Aspeed SMC improvements Joel Stanley

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=1478679343-25354-2-git-send-email-clg@kaod.org \
    --to=clg@kaod.org \
    --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.