Skip to contentSkip to conversation

mfd: mc13xxx: Configure WDI reset

PATCH New Markus Pargmann 3 participants 6 messages Sep 8, 2014 – Sep 9, 2014 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: mc13xxx: Configure WDI reset

Setup the PMIC to make a restart when a watchdog interrupt occures. If this is not configured, the PMIC will shut down the power supply without a restart.

---
 drivers/mfd/mc13xxx-core.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/mfd/mc13xxx-core.c +8 -0
index 2b6bc868cd3d..64dde5d24b32 100644
@@ -36,6 +36,9 @@
 #define MC34708_REVISION_FIN		(0x07 <<  6)
 #define MC34708_REVISION_FAB		(0x07 <<  9)
 
+#define MC13XXX_PWRCTRL		15
+#define MC13XXX_PWRCTRL_WDIRESET	(1 << 12)
+
 #define MC13XXX_ADC1		44
 #define MC13XXX_ADC1_ADEN		(1 << 0)
 #define MC13XXX_ADC1_RAND		(1 << 1)
@@ -416,6 +419,11 @@ int mc13xxx_common_init(struct device *dev)
 
 	mc13xxx->variant->print_revision(mc13xxx, revision);
 
+	ret = mc13xxx_reg_rmw(mc13xxx, MC13XXX_PWRCTRL,
+			MC13XXX_PWRCTRL_WDIRESET, MC13XXX_PWRCTRL_WDIRESET);
+	if (ret)
+		return ret;
+
 	for (i = 0; i < ARRAY_SIZE(mc13xxx->irqs); i++) {
 		mc13xxx->irqs[i].reg_offset = i / MC13XXX_IRQ_PER_REG;
 		mc13xxx->irqs[i].mask = BIT(i % MC13XXX_IRQ_PER_REG);
Signature · 1 line
2.1.0
Applied
#1 lore raw

PATCH 1/1 mfd: mc13xxx: Configure WDI reset

Quoted 8 lines · Markus Pargmann

Setup the PMIC to make a restart when a watchdog interrupt occures. If this is not configured, the PMIC will shut down the power supply without a restart.

---
 drivers/mfd/mc13xxx-core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied, thanks.

Quoted 26 lines
drivers/mfd/mc13xxx-core.c +8 -0
index 2b6bc868cd3d..64dde5d24b32 100644
@@ -36,6 +36,9 @@
 #define MC34708_REVISION_FIN		(0x07 <<  6)
 #define MC34708_REVISION_FAB		(0x07 <<  9)
 
+#define MC13XXX_PWRCTRL		15
+#define MC13XXX_PWRCTRL_WDIRESET	(1 << 12)
+
 #define MC13XXX_ADC1		44
 #define MC13XXX_ADC1_ADEN		(1 << 0)
 #define MC13XXX_ADC1_RAND		(1 << 1)
@@ -416,6 +419,11 @@ int mc13xxx_common_init(struct device *dev)
 
 	mc13xxx->variant->print_revision(mc13xxx, revision);
 
+	ret = mc13xxx_reg_rmw(mc13xxx, MC13XXX_PWRCTRL,
+			MC13XXX_PWRCTRL_WDIRESET, MC13XXX_PWRCTRL_WDIRESET);
+	if (ret)
+		return ret;
+
 	for (i = 0; i < ARRAY_SIZE(mc13xxx->irqs); i++) {
 		mc13xxx->irqs[i].reg_offset = i / MC13XXX_IRQ_PER_REG;
 		mc13xxx->irqs[i].mask = BIT(i % MC13XXX_IRQ_PER_REG);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw

PATCH 1/1 mfd: mc13xxx: Configure WDI reset

In reply to Markus Pargmann

Hello

Le 08/09/2014 09:01, Markus Pargmann a ?crit :

Quoted 3 lines

Setup the PMIC to make a restart when a watchdog interrupt occures. If this is not configured, the PMIC will shut down the power supply without a restart.

Well, this was used to poweroff the mx31moboard board. So we need to be able to configure the functionality.

#3 lore raw

PATCH 1/1 mfd: mc13xxx: Configure WDI reset

Hi,

Quoted 10 lines · Philippe R?tornaz

Hello

Le 08/09/2014 09:01, Markus Pargmann a ?crit :

Quoted 3 lines

Setup the PMIC to make a restart when a watchdog interrupt occures. If this is not configured, the PMIC will shut down the power supply without a restart.

Well, this was used to poweroff the mx31moboard board. So we need to be able to configure the functionality.

So on mx31moboard the watchdog interrupt always leads to a poweroff instead of a reset? Perhaps it would be better to switch back to poweroff on watchdog interrupt right before the shutdown watchdog interrupt is triggered.

Best regards

Markus

Signature · 11 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140908/fbdf2974/attachment.sig>
#4 lore raw

PATCH 1/1 mfd: mc13xxx: Configure WDI reset

Le 08/09/2014 11:25, Markus Pargmann a ?crit :

Quoted 11 lines

Hi,

Quoted 8 lines · Philippe R?tornaz

Hello

Le 08/09/2014 09:01, Markus Pargmann a ?crit :

Quoted 3 lines

Setup the PMIC to make a restart when a watchdog interrupt occures. If this is not configured, the PMIC will shut down the power supply without a restart.

Quoted 5 lines
Quoted 2 lines

Well, this was used to poweroff the mx31moboard board. So we need to be able to configure the functionality.

So on mx31moboard the watchdog interrupt always leads to a poweroff instead of a reset?

Well, no, it simply doesn't work since the output pin is not enabled :) We enable the watchdog output only in pm_power_off().

Quoted 3 lines

Perhaps it would be better to switch back to poweroff on watchdog interrupt right before the shutdown watchdog interrupt is triggered.

Yes, we definitely should be doing this.
The only point is that we don't have currently access to the PMIC from pm_power_off().
Is there a clean/recommended way to do it ?

Thanks !

Philippe

#5 lore raw

PATCH 1/1 mfd: mc13xxx: Configure WDI reset

Hi,

Quoted 21 lines · Philippe R?tornaz

Le 08/09/2014 11:25, Markus Pargmann a ?crit :

Quoted 11 lines

Hi,

Quoted 8 lines · Philippe R?tornaz

Hello

Le 08/09/2014 09:01, Markus Pargmann a ?crit :

Quoted 3 lines

Setup the PMIC to make a restart when a watchdog interrupt occures. If this is not configured, the PMIC will shut down the power supply without a restart.

Quoted 5 lines
Quoted 2 lines

Well, this was used to poweroff the mx31moboard board. So we need to be able to configure the functionality.

So on mx31moboard the watchdog interrupt always leads to a poweroff instead of a reset?

Well, no, it simply doesn't work since the output pin is not enabled :) We enable the watchdog output only in pm_power_off().

Quoted 8 lines
Quoted 3 lines

Perhaps it would be better to switch back to poweroff on watchdog interrupt right before the shutdown watchdog interrupt is triggered.

Yes, we definitely should be doing this.
The only point is that we don't have currently access to the PMIC from pm_power_off().
Is there a clean/recommended way to do it ?

An exported function in the pmic mfd driver that switches between poweroff/reset on watchdog interrupt may be ok for this. In the board pm_power_off routine you could then use of_find_device_by_node() or something similar to get the device struct and pass it to the function.

Best Regards,

Markus

Signature · 11 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140909/999413b8/attachment.sig>