Message ID | 1410159671-25873-1-git-send-email-mpa@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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);
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.
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
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
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
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);
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(+)