[PATCH 03/10] mfd: stpmic1: use register define from header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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, &reg);
+	ret = regmap_read(map, RREQ_STATE_SR, &reg);
 	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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux