From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 03/10] mfd: stpmic1: use register define from header
Date: Tue, 12 Nov 2019 10:19:49 +0100 [thread overview]
Message-ID: <20191112091956.26628-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20191112091956.26628-1-a.fatoum@pengutronix.de>
A previous commit has copied over the upstream <linux/mfd/stpmic1.h>
header. Use it instead of replicating register definitions in the
MFD and watchdog cell driver. No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mfd/stpmic1.c | 3 +--
drivers/watchdog/stpmic1_wdt.c | 28 ++++++++++++----------------
2 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c
index eae6fe3a4e05..ab13ded0ecfe 100644
--- a/drivers/mfd/stpmic1.c
+++ b/drivers/mfd/stpmic1.c
@@ -12,8 +12,7 @@
#include <of.h>
#include <regmap.h>
#include <xfuncs.h>
-
-#define VERSION_SR 0x6
+#include <linux/mfd/stpmic1.h>
struct stpmic1 {
struct device_d *dev;
diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c
index 9b7a586387db..40273ffc4c85 100644
--- a/drivers/watchdog/stpmic1_wdt.c
+++ b/drivers/watchdog/stpmic1_wdt.c
@@ -14,22 +14,15 @@
#include <restart.h>
#include <reset_source.h>
-#define RESTART_SR 0x05
-#define MAIN_CR 0x10
-#define WCHDG_CR 0x1B
-#define WCHDG_TIMER_CR 0x1C
+#include <linux/mfd/stpmic1.h>
-/* Restart Status Register (RESTART_SR) */
+/* Restart Status Register (RREQ_STATE_SR) */
#define R_RST BIT(0)
#define R_SWOFF BIT(1)
#define R_WDG BIT(2)
#define R_PKEYLKP BIT(3)
#define R_VINOK_FA BIT(4)
-/* Main PMIC Control Register (MAIN_CR) */
-#define SWOFF BIT(0)
-#define RREQ_EN BIT(1)
-
/* Watchdog Control Register (WCHDG_CR) */
#define WDT_START BIT(0)
#define WDT_PING BIT(1)
@@ -106,8 +99,9 @@ static void __noreturn stpmic1_restart_handler(struct restart_handler *rst)
{
struct stpmic1_wdt *wdt = container_of(rst, struct stpmic1_wdt, restart);
- regmap_write_bits(wdt->regmap, MAIN_CR,
- SWOFF | RREQ_EN, SWOFF | RREQ_EN);
+ regmap_write_bits(wdt->regmap, SWOFF_PWRCTRL_CR,
+ SOFTWARE_SWITCH_OFF_ENABLED | RESTART_REQUEST_ENABLED,
+ SOFTWARE_SWITCH_OFF_ENABLED | RESTART_REQUEST_ENABLED);
mdelay(1000);
hang();
@@ -119,8 +113,9 @@ static void __noreturn stpmic1_poweroff(struct poweroff_handler *handler)
shutdown_barebox();
- regmap_write_bits(wdt->regmap, MAIN_CR,
- SWOFF | RREQ_EN, SWOFF);
+ regmap_write_bits(wdt->regmap, SWOFF_PWRCTRL_CR,
+ SOFTWARE_SWITCH_OFF_ENABLED | RESTART_REQUEST_ENABLED,
+ SOFTWARE_SWITCH_OFF_ENABLED);
mdelay(1000);
hang();
@@ -142,7 +137,7 @@ static int stpmic1_set_reset_reason(struct regmap *map)
int ret;
int i, instance = 0;
- ret = regmap_read(map, RESTART_SR, ®);
+ ret = regmap_read(map, RREQ_STATE_SR, ®);
if (ret)
return ret;
@@ -156,7 +151,7 @@ static int stpmic1_set_reset_reason(struct regmap *map)
reset_source_set_prinst(type, 400, instance);
- pr_info("STPMIC1 reset reason %s (RESTART_SR: 0x%08x)\n",
+ pr_info("STPMIC1 reset reason %s (RREQ_STATE_SR: 0x%08x)\n",
reset_source_name(), reg);
return 0;
@@ -180,7 +175,8 @@ static int stpmic1_wdt_probe(struct device_d *dev)
wdd->timeout_max = PMIC_WDT_MAX_TIMEOUT;
/* have the watchdog reset, not power-off the system */
- regmap_write_bits(wdt->regmap, MAIN_CR, RREQ_EN, RREQ_EN);
+ regmap_write_bits(wdt->regmap, SWOFF_PWRCTRL_CR,
+ RESTART_REQUEST_ENABLED, RESTART_REQUEST_ENABLED);
ret = watchdog_register(wdd);
if (ret) {
--
2.24.0.rc1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-11-12 9:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 9:19 [PATCH 01/10] ARM: dts: stm32mp: move alias to SoC device tree Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 02/10] ARM: stm32mp157c-dk2: add optional DEBUG_LL print to entry point Ahmad Fatoum
2019-11-12 9:19 ` Ahmad Fatoum [this message]
2019-11-12 9:19 ` [PATCH 04/10] watchdog: stm32_iwdg: return -ENOSYS on attempt to disable Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 05/10] i2c: stm32: use device_reset_us helper instead of open-coding Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 06/10] Documentation: boards: stm32mp: document boot error LED Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 07/10] ARM: stm32mp: add helper for querying ram size Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 08/10] ARM: stm32mp: add basic DDR controller driver Ahmad Fatoum
2019-11-13 9:28 ` [PATCH] fixup! " Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 09/10] ARM: stm32mp: add stm32mp_cpu_lowlevel_init with stack set up Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 10/10] ARM: stm32mp: dk2: don't hard-code memory size Ahmad Fatoum
2019-11-13 9:29 ` [PATCH] fixup! " Ahmad Fatoum
2019-11-13 14:25 ` [PATCH 01/10] ARM: dts: stm32mp: move alias to SoC device tree 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=20191112091956.26628-3-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--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