Skip to contentSkip to conversation

Get watchdog reboot working on efika smartbook

PATCH Superseded Arnaud Patard (Rtp) 4 participants 11 messages Feb 28, 2011 – Mar 1, 2011

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Get watchdog reboot working on efika smartbook

Hi,

With current patches in Sascha Hauer's tree, the efika smartbook is powering off when rebooting. The cause of this bug is the default behaviour of the mc13892 pmic. This patchset is configuring the pmic to reboot the system as expected by imx system.c (the reboot is done throught watchdog) and enables the watchdog on the efika mx/sb systems.

Arnaud

#2 lore raw

PATCH 1/2 mc13892: reboot on wdi event

Quoted 4 lines · Arnaud Patard

By default, on wdi (watchdog input) event the mc13892 is powering off. This patch is changing this to reboot on wdi event.

This strikes me as something that should be configurable by platforms.

#3 lore raw

PATCH 1/2 mc13892: reboot on wdi event

Quoted 7 lines · Mark Brown
Quoted 4 lines · Arnaud Patard

By default, on wdi (watchdog input) event the mc13892 is powering off. This patch is changing this to reboot on wdi event.

This strikes me as something that should be configurable by platforms.

afaik, mc13892 is used only on imx designs and the reset for imx is done only throught the watchdog. From this point of view, I don't see any valid reason for powering off instead of rebooting on watchdog event

Arnaud

#4 lore raw

PATCH 1/2 mc13892: reboot on wdi event

Quoted 3 lines · Arnaud Patard

afaik, mc13892 is used only on imx designs and the reset for imx is done only throught the watchdog. From this point of view, I don't see any valid reason for powering off instead of rebooting on watchdog event

Is there a separate way to do power off?

#5 lore raw

PATCH 1/2 mc13892: reboot on wdi event

Quoted 7 lines · Mark Brown
Quoted 3 lines · Arnaud Patard

afaik, mc13892 is used only on imx designs and the reset for imx is done only throught the watchdog. From this point of view, I don't see any valid reason for powering off instead of rebooting on watchdog event

Is there a separate way to do power off?

yeah. You can either disable pwgt1 and pwgt2 regulators or set the useroff bit of the power control 0 register.

Arnaud

#6 lore raw

PATCH 1/2 mc13892: reboot on wdi event

In reply to Arnaud Patard (Rtp)
Quoted 6 lines · Arnaud Patard
Quoted 4 lines · Mark Brown
Quoted 3 lines · Arnaud Patard

By default, on wdi (watchdog input) event the mc13892 is powering off. This patch is changing this to reboot on wdi event.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

This strikes me as something that should be configurable by platforms.

afaik, mc13892 is used only on imx designs and the reset for imx is done only throught the watchdog. From this point of view, I don't see any valid reason for powering off instead of rebooting on watchdog event

If this change is for i.MX only then it should be optional as Freescale probably will sell this PMIC to non i.MX users.

Thanks

Liam

#7 lore raw

PATCH 1/2 mc13892: reboot on wdi event

In reply to Arnaud Patard (Rtp)

Review

Quoted 8 lines · Arnaud Patard
(quoted diff) +8 -0
+
+	/* allows to reboot on wdi event */
+	ret = mc13xxx_reg_read(mc13892, MC13892_POWERCTL2, &val);
+	if (!ret) {
+		val |= MC13892_POWERCTL2_WDIRESET;
+		mc13xxx_reg_write(mc13892, MC13892_POWERCTL2, val);
+	}
+

Also, why is this in the regulator driver? The MFD core for the device might be a better choice - that'll ensure it gets done even if regulator support isn't enabled for some reason.

#8 lore raw

PATCH 1/2 mc13892: reboot on wdi event

Quoted 14 lines · Mark Brown

Review

Quoted 8 lines · Arnaud Patard
(quoted diff) +8 -0
+
+	/* allows to reboot on wdi event */
+	ret = mc13xxx_reg_read(mc13892, MC13892_POWERCTL2, &val);
+	if (!ret) {
+		val |= MC13892_POWERCTL2_WDIRESET;
+		mc13xxx_reg_write(mc13892, MC13892_POWERCTL2, val);
+	}
+

Also, why is this in the regulator driver? The MFD core for the device might be a better choice - that'll ensure it gets done even if regulator support isn't enabled for some reason.

I was not sure where to put it so I put it in the place where the power management is done. I can move it to the mfd driver. I'll only have to make sure it's done only for mc13892 (I don't know what would be the consequences to do it on mc13783 too and if there's a similar configuration setting).

Arnaud

#10 lore raw

PATCH 2/2 efika mx/sb: enable watchdog

Hi Arnaud,

just one nitpick below ...

Quoted 21 lines · Arnaud Patard

Register watchdog for efika mx and sb systems.

Index: linux-2.6-submit/arch/arm/mach-mx5/mx51_efika.c
===================================================================

arch/arm/mach-mx5/mx51_efika.c +1 -0
@@ -611,6 +611,7 @@
 					ARRAY_SIZE(mx51efika_pads));
 	imx51_add_imx_uart(0, &uart_pdata);
 	mx51_efika_usb();
+	imx51_add_imx2_wdt(0, NULL);
 	imx51_add_sdhci_esdhc_imx(0, NULL);
 
 	/* FIXME: comes from original code. check this. */

Index: linux-2.6-submit/arch/arm/mach-mx5/Kconfig
===================================================================

arch/arm/mach-mx5/Kconfig line 122

Quoted 6 lines
arch/arm/mach-mx5/Kconfig +1 -0
@@ -117,6 +117,7 @@
 	bool
 	select SOC_IMX51
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
 	select IMX_HAVE_PLATFORM_SPI_IMX

These IMX_HAVE_PLATFORM entries are sorted alphabetically and 2 sorts before _, so IMX_HAVE_PLATFORM_IMX2_WDT should be the first entry here.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |