Skip to contentSkip to conversation

watchdog: imx: use clk_get to acquire the watchdog clock

PATCH Superseded Fabio Estevam 5 participants 9 messages Dec 7, 2010 – Dec 14, 2010

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

PATCH v2 1/1 watchdog: imx: use clk_get to acquire the watchdog clock

Use clk_get to acquire the watchdog clock and also avoid hardcoding the clock name.

---
Changes since v1:
- adapted the watchdog name in arch/arm/plat-mxc/system.c

 arch/arm/mach-imx/clock-imx21.c |    2 +-
 arch/arm/mach-imx/clock-imx25.c |    2 +-
 arch/arm/mach-imx/clock-imx27.c |    2 +-
 arch/arm/mach-mx3/clock-imx31.c |    2 +-
 arch/arm/mach-mx3/clock-imx35.c |    2 +-
 arch/arm/plat-mxc/system.c      |    2 +-
 drivers/watchdog/imx2_wdt.c     |    2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-imx/clock-imx21.c +1 -1
index cf15ea5..c63a4f5 100644
@@ -1185,7 +1185,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "brom", brom_clk)
 	_REGISTER_CLOCK(NULL, "emma", emma_clk[0])
 	_REGISTER_CLOCK(NULL, "slcdc", slcdc_clk[0])
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
 	_REGISTER_CLOCK("mxc-keypad", NULL, kpp_clk)
arch/arm/mach-imx/clock-imx25.c +1 -1
index 9e4a557..2c98be8 100644
@@ -296,7 +296,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdt_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
 	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
arch/arm/mach-imx/clock-imx27.c +1 -1
index 2202b88..f32f3b8 100644
@@ -667,7 +667,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
 	_REGISTER_CLOCK(NULL, "mstick", mstick_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
arch/arm/mach-mx3/clock-imx31.c +1 -1
index 7cf6d29..4193cf5 100644
@@ -530,7 +530,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx31-cspi.2", NULL, cspi3_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
 	_REGISTER_CLOCK(NULL, "pwm", pwm_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "rtc", rtc_clk)
 	_REGISTER_CLOCK(NULL, "epit", epit1_clk)
 	_REGISTER_CLOCK(NULL, "epit", epit2_clk)
arch/arm/mach-mx3/clock-imx35.c +1 -1
index 61e4a31..22259d9 100644
@@ -495,7 +495,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
 	_REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk)
 	_REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usbahb_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "max", max_clk)
 	_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
 	_REGISTER_CLOCK(NULL, "csi", csi_clk)
arch/arm/plat-mxc/system.c +1 -1
index c3972c5..3455fc0 100644
@@ -55,7 +55,7 @@ void arch_reset(char mode, const char *cmd)
 	} else {
 		struct clk *clk;
 
-		clk = clk_get_sys("imx-wdt.0", NULL);
+		clk = clk_get_sys("imx2-wdt.0", NULL);
 		if (!IS_ERR(clk))
 			clk_enable(clk);
 		wcr_enable = (1 << 2);
drivers/watchdog/imx2_wdt.c +1 -1
index 2ee7dac..86f7cac 100644
@@ -270,7 +270,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);
+	imx2_wdt.clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(imx2_wdt.clk)) {
 		dev_err(&pdev->dev, "can't get Watchdog clock\n");
 		return PTR_ERR(imx2_wdt.clk);
Signature · 1 line
1.6.0.4
maintainer
#1 lore raw

PATCH v2 1/1 watchdog: imx: use clk_get to acquire the watchdog clock

Quoted 86 lines · Fabio Estevam

Use clk_get to acquire the watchdog clock and also avoid hardcoding the clock name.

---
Changes since v1:
- adapted the watchdog name in arch/arm/plat-mxc/system.c

 arch/arm/mach-imx/clock-imx21.c |    2 +-
 arch/arm/mach-imx/clock-imx25.c |    2 +-
 arch/arm/mach-imx/clock-imx27.c |    2 +-
 arch/arm/mach-mx3/clock-imx31.c |    2 +-
 arch/arm/mach-mx3/clock-imx35.c |    2 +-
 arch/arm/plat-mxc/system.c      |    2 +-
 drivers/watchdog/imx2_wdt.c     |    2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-imx/clock-imx21.c +1 -1
index cf15ea5..c63a4f5 100644
@@ -1185,7 +1185,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "brom", brom_clk)
 	_REGISTER_CLOCK(NULL, "emma", emma_clk[0])
 	_REGISTER_CLOCK(NULL, "slcdc", slcdc_clk[0])
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
 	_REGISTER_CLOCK("mxc-keypad", NULL, kpp_clk)
arch/arm/mach-imx/clock-imx25.c +1 -1
index 9e4a557..2c98be8 100644
@@ -296,7 +296,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdt_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
 	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
arch/arm/mach-imx/clock-imx27.c +1 -1
index 2202b88..f32f3b8 100644
@@ -667,7 +667,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
 	_REGISTER_CLOCK(NULL, "mstick", mstick_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
arch/arm/mach-mx3/clock-imx31.c +1 -1
index 7cf6d29..4193cf5 100644
@@ -530,7 +530,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx31-cspi.2", NULL, cspi3_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
 	_REGISTER_CLOCK(NULL, "pwm", pwm_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "rtc", rtc_clk)
 	_REGISTER_CLOCK(NULL, "epit", epit1_clk)
 	_REGISTER_CLOCK(NULL, "epit", epit2_clk)
arch/arm/mach-mx3/clock-imx35.c +1 -1
index 61e4a31..22259d9 100644
@@ -495,7 +495,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
 	_REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk)
 	_REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usbahb_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "max", max_clk)
 	_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
 	_REGISTER_CLOCK(NULL, "csi", csi_clk)
arch/arm/plat-mxc/system.c +0 -0
index c3972c5..3455fc0 100644

arch/arm/plat-mxc/system.c void arch_reset(char mode, const char *cmd) · line 58

Quoted 5 lines
arch/arm/plat-mxc/system.c +1 -1
@@ -55,7 +55,7 @@ void arch_reset(char mode, const char *cmd)
 	} else {
 		struct clk *clk;
 
-		clk = clk_get_sys("imx-wdt.0", NULL);
+		clk = clk_get_sys("imx2-wdt.0", NULL);

I should have seen this happen. This breaks i.MX1 reset which uses imx-wdt.0.

The root cause of this problem is that we have two different watchdog drivers with two different names but only one reset code for all i.MX. We could register an additional watchdog clock for all i.MXs and use it for the reset code.

Sascha

Signature · 4 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 |
#2 lore raw

PATCH v2 1/1 watchdog: imx: use clk_get to acquire the watchdog clock

Quoted 7 lines · Sascha Hauer

I should have seen this happen. This breaks i.MX1 reset which uses imx-wdt.0.

The root cause of this problem is that we have two different watchdog drivers with two different names but only one reset code for all i.MX. We could register an additional watchdog clock for all i.MXs and use it for the reset code.

Actually, there is no wdt-driver for mx1 yet. They _could_ be merged, but the result will not be pretty.

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20101207/d1c4df50/attachment.sig>
#3 lore raw

PATCH v2 1/1 watchdog: imx: use clk_get to acquire the watchdogclock

In reply to Sascha Hauer

Hi Sascha,

On 12/7/2010 2:49 PM, Sascha Hauer wrote:
...

Quoted 2 lines

I should have seen this happen. This breaks i.MX1 reset which uses imx-wdt.0.

I think it doesn´t break current mx1 reset mechanism. Please see the code below (arcm/arm/plat-mxc/system.c):

	if (cpu_is_mx1()) {
		wcr_enable = (1 << 0);
	} else {
		struct clk *clk;

		clk = clk_get_sys("imx2-wdt.0", NULL);
		if (!IS_ERR(clk))
			clk_enable(clk);
		wcr_enable = (1 << 2);
	}

For mx1 the clk_get_sys function is not called.

Regards,

Fabio Estevam

maintainer
#4 lore raw

PATCH v2 1/1 watchdog: imx: use clk_get to acquire the watchdogclock

Quoted 21 lines · Fabio Estevam

Hi Sascha,

On 12/7/2010 2:49 PM, Sascha Hauer wrote:
...

Quoted 2 lines

I should have seen this happen. This breaks i.MX1 reset which uses imx-wdt.0.

I think it doesn?t break current mx1 reset mechanism. Please see the code below (arcm/arm/plat-mxc/system.c):

	if (cpu_is_mx1()) {
		wcr_enable = (1 << 0);
	} else {
		struct clk *clk;

		clk = clk_get_sys("imx2-wdt.0", NULL);
		if (!IS_ERR(clk))
			clk_enable(clk);
		wcr_enable = (1 << 2);
	}
Quoted 1 line

For mx1 the clk_get_sys function is not called.

Oh, you are right. In this case your patch is ok.

Sascha

Signature · 4 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 |
maintainer
#6 lore raw

PATCH v2 1/1 watchdog: imx: use clk_get to acquire the watchdog clock

Quoted 9 lines · Wim Van Sebroeck

Hi All,

Quoted 3 lines

Use clk_get to acquire the watchdog clock and also avoid hardcoding the clock name.

Since this looks more arch specific, can this go via the arm kernel tree?

Yes, please. I already scheduled this.

Sascha

Signature · 4 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 |
maintainer
#8 lore raw

PATCH v2 1/1 watchdog: imx: use clk_get to acquire the watchdog clock

In reply to Fabio Estevam

Hi Fabio,

Quoted 34 lines · Fabio Estevam

Use clk_get to acquire the watchdog clock and also avoid hardcoding the clock name.

---
Changes since v1:
- adapted the watchdog name in arch/arm/plat-mxc/system.c

 arch/arm/mach-imx/clock-imx21.c |    2 +-
 arch/arm/mach-imx/clock-imx25.c |    2 +-
 arch/arm/mach-imx/clock-imx27.c |    2 +-
 arch/arm/mach-mx3/clock-imx31.c |    2 +-
 arch/arm/mach-mx3/clock-imx35.c |    2 +-
 arch/arm/plat-mxc/system.c      |    2 +-
 drivers/watchdog/imx2_wdt.c     |    2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-imx/clock-imx21.c +1 -1
index cf15ea5..c63a4f5 100644
@@ -1185,7 +1185,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "brom", brom_clk)
 	_REGISTER_CLOCK(NULL, "emma", emma_clk[0])
 	_REGISTER_CLOCK(NULL, "slcdc", slcdc_clk[0])
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
 	_REGISTER_CLOCK("mxc-keypad", NULL, kpp_clk)
arch/arm/mach-imx/clock-imx25.c +0 -0
index 9e4a557..2c98be8 100644

arch/arm/mach-imx/clock-imx25.c static struct clk_lookup lookups[] = { · line 299

Quoted 5 lines
arch/arm/mach-imx/clock-imx25.c +1 -1
@@ -296,7 +296,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdt_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)

This breaks compilation on i.MX25. I updated the patch to fix this.

Sascha

Quoted 73 lines
arch/arm/mach-imx/clock-imx25.c +0 -0
 	_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
 	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
arch/arm/mach-imx/clock-imx27.c +1 -1
index 2202b88..f32f3b8 100644
@@ -667,7 +667,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
 	_REGISTER_CLOCK(NULL, "mstick", mstick_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
arch/arm/mach-mx3/clock-imx31.c +1 -1
index 7cf6d29..4193cf5 100644
@@ -530,7 +530,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx31-cspi.2", NULL, cspi3_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
 	_REGISTER_CLOCK(NULL, "pwm", pwm_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "rtc", rtc_clk)
 	_REGISTER_CLOCK(NULL, "epit", epit1_clk)
 	_REGISTER_CLOCK(NULL, "epit", epit2_clk)
arch/arm/mach-mx3/clock-imx35.c +1 -1
index 61e4a31..22259d9 100644
@@ -495,7 +495,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
 	_REGISTER_CLOCK("fsl-usb2-udc", "usb", usbotg_clk)
 	_REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usbahb_clk)
-	_REGISTER_CLOCK("imx-wdt.0", NULL, wdog_clk)
+	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
 	_REGISTER_CLOCK(NULL, "max", max_clk)
 	_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
 	_REGISTER_CLOCK(NULL, "csi", csi_clk)
arch/arm/plat-mxc/system.c +1 -1
index c3972c5..3455fc0 100644
@@ -55,7 +55,7 @@ void arch_reset(char mode, const char *cmd)
 	} else {
 		struct clk *clk;
 
-		clk = clk_get_sys("imx-wdt.0", NULL);
+		clk = clk_get_sys("imx2-wdt.0", NULL);
 		if (!IS_ERR(clk))
 			clk_enable(clk);
 		wcr_enable = (1 << 2);
drivers/watchdog/imx2_wdt.c +1 -1
index 2ee7dac..86f7cac 100644
@@ -270,7 +270,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);
+	imx2_wdt.clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(imx2_wdt.clk)) {
 		dev_err(&pdev->dev, "can't get Watchdog clock\n");
 		return PTR_ERR(imx2_wdt.clk);
Signature · 1 line
1.6.0.4
Signature · 4 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 |