* [PATCH] mfd: mc13xxx: Configure WDI reset
@ 2014-09-08 7:01 Markus Pargmann
2014-09-08 7:27 ` Lee Jones
2014-09-08 7:42 ` Philippe Rétornaz
0 siblings, 2 replies; 6+ messages in thread
From: Markus Pargmann @ 2014-09-08 7:01 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
drivers/mfd/mc13xxx-core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 2b6bc868cd3d..64dde5d24b32 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -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);
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mfd: mc13xxx: Configure WDI reset
2014-09-08 7:01 [PATCH] mfd: mc13xxx: Configure WDI reset Markus Pargmann
@ 2014-09-08 7:27 ` Lee Jones
2014-09-08 7:42 ` Philippe Rétornaz
1 sibling, 0 replies; 6+ messages in thread
From: Lee Jones @ 2014-09-08 7:27 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 08 Sep 2014, Markus Pargmann wrote:
> 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.
>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
> drivers/mfd/mc13xxx-core.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
Applied, thanks.
> diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
> index 2b6bc868cd3d..64dde5d24b32 100644
> --- a/drivers/mfd/mc13xxx-core.c
> +++ b/drivers/mfd/mc13xxx-core.c
> @@ -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);
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] mfd: mc13xxx: Configure WDI reset
2014-09-08 7:01 [PATCH] mfd: mc13xxx: Configure WDI reset Markus Pargmann
2014-09-08 7:27 ` Lee Jones
@ 2014-09-08 7:42 ` Philippe Rétornaz
2014-09-08 9:25 ` Markus Pargmann
1 sibling, 1 reply; 6+ messages in thread
From: Philippe Rétornaz @ 2014-09-08 7:42 UTC (permalink / raw)
To: linux-arm-kernel
Hello
Le 08/09/2014 09:01, Markus Pargmann a ?crit :
> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] mfd: mc13xxx: Configure WDI reset
2014-09-08 7:42 ` Philippe Rétornaz
@ 2014-09-08 9:25 ` Markus Pargmann
2014-09-08 12:06 ` Philippe Rétornaz
0 siblings, 1 reply; 6+ messages in thread
From: Markus Pargmann @ 2014-09-08 9:25 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Mon, Sep 08, 2014 at 09:42:35AM +0200, Philippe R?tornaz wrote:
> Hello
>
> Le 08/09/2014 09:01, Markus Pargmann a ?crit :
> >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
--
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] mfd: mc13xxx: Configure WDI reset
2014-09-08 9:25 ` Markus Pargmann
@ 2014-09-08 12:06 ` Philippe Rétornaz
2014-09-09 5:51 ` Markus Pargmann
0 siblings, 1 reply; 6+ messages in thread
From: Philippe Rétornaz @ 2014-09-08 12:06 UTC (permalink / raw)
To: linux-arm-kernel
Le 08/09/2014 11:25, Markus Pargmann a ?crit :
> Hi,
>
> On Mon, Sep 08, 2014 at 09:42:35AM +0200, Philippe R?tornaz wrote:
>> Hello
>>
>> Le 08/09/2014 09:01, Markus Pargmann a ?crit :
>>> 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?
Well, no, it simply doesn't work since the output pin is not enabled :)
We enable the watchdog output only in pm_power_off().
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] mfd: mc13xxx: Configure WDI reset
2014-09-08 12:06 ` Philippe Rétornaz
@ 2014-09-09 5:51 ` Markus Pargmann
0 siblings, 0 replies; 6+ messages in thread
From: Markus Pargmann @ 2014-09-09 5:51 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Mon, Sep 08, 2014 at 02:06:36PM +0200, Philippe R?tornaz wrote:
> Le 08/09/2014 11:25, Markus Pargmann a ?crit :
> >Hi,
> >
> >On Mon, Sep 08, 2014 at 09:42:35AM +0200, Philippe R?tornaz wrote:
> >>Hello
> >>
> >>Le 08/09/2014 09:01, Markus Pargmann a ?crit :
> >>>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?
>
> Well, no, it simply doesn't work since the output pin is not enabled :)
> We enable the watchdog output only in pm_power_off().
>
> >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
--
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-09-09 5:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08 7:01 [PATCH] mfd: mc13xxx: Configure WDI reset Markus Pargmann
2014-09-08 7:27 ` Lee Jones
2014-09-08 7:42 ` Philippe Rétornaz
2014-09-08 9:25 ` Markus Pargmann
2014-09-08 12:06 ` Philippe Rétornaz
2014-09-09 5:51 ` Markus Pargmann
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.