Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: linux@roeck-us.net
Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org,
	Anson.Huang@nxp.com, shawnguo@kernel.org, linux-imx@nxp.com,
	kernel@pengutronix.de, Fabio Estevam <festevam@gmail.com>
Subject: [PATCH 5/5] watchdog: imx7ulp: Use definitions instead of magic values
Date: Tue, 29 Oct 2019 14:40:37 -0300
Message-ID: <20191029174037.25381-5-festevam@gmail.com> (raw)
In-Reply-To: <20191029174037.25381-1-festevam@gmail.com>

Use definitions instead of magic values in order to improve readability.

Since the CLK field of the WDOG CS register is composed of two bits
to select the watchdog clock source, use a shift representation
instead of BIT().

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/watchdog/imx7ulp_wdt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c
index bcef3b6a9782..e3c1382dac52 100644
--- a/drivers/watchdog/imx7ulp_wdt.c
+++ b/drivers/watchdog/imx7ulp_wdt.c
@@ -17,6 +17,9 @@
 #define WDOG_CS_CMD32EN		BIT(13)
 #define WDOG_CS_ULK		BIT(11)
 #define WDOG_CS_RCS		BIT(10)
+#define LPO_CLK			0x1
+#define LPO_CLK_SHIFT		8
+#define WDOG_CS_CLK		(LPO_CLK << LPO_CLK_SHIFT)
 #define WDOG_CS_EN		BIT(7)
 #define WDOG_CS_UPDATE		BIT(5)
 
@@ -143,7 +146,7 @@ static void imx7ulp_wdt_init(void __iomem *base, unsigned int timeout)
 	/* set an initial timeout value in TOVAL */
 	writel(timeout, base + WDOG_TOVAL);
 	/* enable 32bit command sequence and reconfigure */
-	val = BIT(13) | BIT(8) | BIT(5);
+	val = WDOG_CS_CMD32EN | WDOG_CS_CLK | WDOG_CS_UPDATE;
 	writel(val, base + WDOG_CS);
 }
 
-- 
2.17.1


  parent reply index

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29 17:40 [PATCH 1/5] watchdog: imx7ulp: Fix reboot hang Fabio Estevam
2019-10-29 17:40 ` [PATCH 2/5] watchdog: imx7ulp: Pass the wdog instance inimx7ulp_wdt_enable() Fabio Estevam
2019-11-02 15:37   ` Guenter Roeck
2019-10-29 17:40 ` [PATCH 3/5] watchdog: imx7ulp: Remove unused structure member Fabio Estevam
2019-11-02 15:39   ` Guenter Roeck
2019-10-29 17:40 ` [PATCH 4/5] watchdog: imx7ulp: Remove inline annotations Fabio Estevam
2019-11-02 15:39   ` Guenter Roeck
2019-10-29 17:40 ` Fabio Estevam [this message]
2019-11-02 15:41   ` [PATCH 5/5] watchdog: imx7ulp: Use definitions instead of magic values Guenter Roeck
2019-11-02 15:36 ` [PATCH 1/5] watchdog: imx7ulp: Fix reboot hang Guenter Roeck
2019-11-04 13:45   ` Fabio Estevam
2019-11-04 14:06     ` Guenter Roeck
2019-11-07 17:46       ` Fabio Estevam
2019-11-08 14:39         ` Guenter Roeck

Reply instructions:

You may reply publically 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=20191029174037.25381-5-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=Anson.Huang@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=shawnguo@kernel.org \
    --cc=wim@linux-watchdog.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

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git