Skip to contentSkip to conversation

mx35_3ds: Add watchdog support

PATCH New Fabio Estevam 3 participants 6 messages Nov 15, 2010 – Nov 16, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx35_3ds: Add watchdog support

mx35_3ds: Add watchdog support.

---
 arch/arm/mach-mx3/mach-mx35_3ds.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mach-mx35_3ds.c +1 -0
index 6b51fec..30e73bd 100644
@@ -79,6 +79,7 @@ static const struct mxc_nand_platform_data mx35pdk_nand_board_info __initconst =
 
 static struct platform_device *devices[] __initdata = {
 	&mx35pdk_flash,
+	&imx_wdt_device0,
 };
 
 static iomux_v3_cfg_t mx35pdk_pads[] = {
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH 1/1 mx35_3ds: Add watchdog support

Hi Fabio,

Quoted 1 line · Fabio Estevam

mx35_3ds: Add watchdog support.

I just converted the mx3 watchdog device to dynamic allocation. Will take care of mx35_3ds.

Best regards
Uwe

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

PATCH 1/1 mx35_3ds: Add watchdog support

Hi Uwe and Wolfram,

Quoted 7 lines · Uwe Kleine-K?nig

From: Uwe Kleine-K?nig <[email protected]>
Subject: Re: [PATCH] mx35_3ds: Add watchdog support
To: "Fabio Estevam" <[email protected]>
Cc: fabio.estevam at freescale.com, s.hauer at pengutronix.de, linux-arm-kernel at lists.infradead.org
Date: Monday, November 15, 2010, 1:52 PM
Hi Fabio,

Quoted 6 lines
Quoted 1 line · Fabio Estevam

mx35_3ds: Add watchdog support.

I just converted the mx3 watchdog device to dynamic allocation.? Will
take care of mx35_3ds.

Ok, understood.

I have also started testing watchdog on MX51.

As there is no watchdog clock entry in the CCM block on MX51 I thought on doing the following:

drivers/watchdog/imx2_wdt.c +0 -0
index 2ee7dac..63f600c 100644
@@ -270,10 +270,12 @@ static int __init imx2_wdt_probe(struct

platform_device *pdev)

        return -ENOMEM;
    }

- imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);
- if (IS_ERR(imx2_wdt.clk)) {
- dev_err(&pdev->dev, "can't get Watchdog clock\n");
- return PTR_ERR(imx2_wdt.clk);
+ if (!cpu_is_mx51()) {
+ imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);
+ if (IS_ERR(imx2_wdt.clk)) {
+ dev_err(&pdev->dev, "can't get Watchdog clock\n");
+ return PTR_ERR(imx2_wdt.clk);
+ }

    }

Does this look a correct approach?

Regards,

Fabio Estevam

#3 lore raw

PATCH 1/1 mx35_3ds: Add watchdog support

Quoted 10 lines · Fabio Estevam
drivers/watchdog/imx2_wdt.c +0 -1
index 2ee7dac..63f600c 100644
@@ -270,10 +270,12 @@ static int __init imx2_wdt_probe(struct
 platform_device *pdev)
        return -ENOMEM;
    }
 
-    imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);

drivers/watchdog/imx2_wdt.c static int __init imx2_wdt_probe(struct · line 280

Quoted 10 lines
drivers/watchdog/imx2_wdt.c +6 -3
-    if (IS_ERR(imx2_wdt.clk)) {
-        dev_err(&pdev->dev, "can't get Watchdog clock\n");
-        return PTR_ERR(imx2_wdt.clk);
+    if (!cpu_is_mx51()) {
+        imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);
+        if (IS_ERR(imx2_wdt.clk)) {
+            dev_err(&pdev->dev, "can't get Watchdog clock\n");
+            return PTR_ERR(imx2_wdt.clk);
+        }
    }

Why not do what we do on other platforms (such as omap) and provide a dummy imx-wdt.0 clock for non-MX51 CPUs? Then you don't need to code such stuff into drivers.

#4 lore raw

PATCH 1/1 mx35_3ds: Add watchdog support

In reply to Fabio Estevam

Hi Fabio,

Quoted 33 lines · Fabio Estevam

Hi Uwe and Wolfram,

Quoted 7 lines · Uwe Kleine-K?nig

From: Uwe Kleine-K?nig <[email protected]>
Subject: Re: [PATCH] mx35_3ds: Add watchdog support
To: "Fabio Estevam" <[email protected]>
Cc: fabio.estevam at freescale.com, s.hauer at pengutronix.de, linux-arm-kernel at lists.infradead.org
Date: Monday, November 15, 2010, 1:52 PM
Hi Fabio,

Quoted 6 lines
Quoted 1 line · Fabio Estevam

mx35_3ds: Add watchdog support.

I just converted the mx3 watchdog device to dynamic allocation.? Will
take care of mx35_3ds.

Ok, understood.

I have also started testing watchdog on MX51.

As there is no watchdog clock entry in the CCM block on MX51 I thought on doing the following:

drivers/watchdog/imx2_wdt.c +0 -0
index 2ee7dac..63f600c 100644
@@ -270,10 +270,12 @@ static int __init imx2_wdt_probe(struct
 platform_device *pdev)
        return -ENOMEM;
    }
 

drivers/watchdog/imx2_wdt.c static int __init imx2_wdt_probe(struct · line 279

Quoted 10 lines
drivers/watchdog/imx2_wdt.c +6 -4
-    imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);
-    if (IS_ERR(imx2_wdt.clk)) {
-        dev_err(&pdev->dev, "can't get Watchdog clock\n");
-        return PTR_ERR(imx2_wdt.clk);
+    if (!cpu_is_mx51()) {
+        imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);
+        if (IS_ERR(imx2_wdt.clk)) {
+            dev_err(&pdev->dev, "can't get Watchdog clock\n");
+            return PTR_ERR(imx2_wdt.clk);
+        }

(Minor note: after your patch the brackets don't balance anymore.)

I wonder why the driver uses clk_get_sys("imx-wdt.0", NULL). IMHO it should use clk_get(&pdev->dev, NULL). (For that to work we need to register the clock using "imx2-wdt.0". (Or even better "imx2-wdt".))

Best regards
Uwe

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

PATCH 1/1 mx35_3ds: Add watchdog support

Hi Uwe and Wolfram,

--- On Tue, 11/16/10, Uwe Kleine-K?nig <[email protected]> wrote:
...

Quoted 7 lines

I wonder why the driver uses clk_get_sys("imx-wdt.0", NULL).
IMHO it should use clk_get(&pdev->dev, NULL).? (For that to work we need
to register the clock using "imx2-wdt.0".? (Or even better "imx2-wdt".))

I sent a patch for registering a dummy watchdog clock: http://www.spinics.net/lists/arm-kernel/msg104087.html

This way we don?t need to change the watchdog driver.

Let me know what you think.

Regards,

Fabio Estevam