This small series changes the dw_wdt driver, so that it is usable on
machines using the common clock framework (needs the clk to be prepared)
and devicetree (needs a binding).
Heiko Stuebner (3):
watchdog: dw_wdt: convert to SIMPLE_DEV_PM_OPS
watchdog: dw_wdt: use clk_prepare_enable and clk_disable_unprepare
watchdog: dw_wdt: add a devicetree binding
.../bindings/watchdog/snps-dw-apb-wdt.txt | 18 ++++++++++++
drivers/watchdog/dw_wdt.c | 31 ++++++++++++--------
2 files changed, 36 insertions(+), 13 deletions(-)
create mode 100644 Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
--
1.7.10.4
The dw_wdt only provides PM_SLEEP operations, so convert the driver
to use SIMPLE_DEV_PM_OPS instead of populating the struct manually.
This has the added effect of simplifying the CONFIG_PM ifdefs.
Signed-off-by: Heiko Stuebner <[email protected]>
---
drivers/watchdog/dw_wdt.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index e621098..4d3906d 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -252,7 +252,7 @@ static int dw_wdt_release(struct inode *inode, struct file *filp)
return 0;
}
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
static int dw_wdt_suspend(struct device *dev)
{
clk_disable(dw_wdt.clk);
@@ -271,12 +271,9 @@ static int dw_wdt_resume(struct device *dev)
return 0;
}
+#endif /* CONFIG_PM_SLEEP */
-static const struct dev_pm_ops dw_wdt_pm_ops = {
- .suspend = dw_wdt_suspend,
- .resume = dw_wdt_resume,
-};
-#endif /* CONFIG_PM */
+static SIMPLE_DEV_PM_OPS(dw_wdt_pm_ops, dw_wdt_suspend, dw_wdt_resume);
static const struct file_operations wdt_fops = {
.owner = THIS_MODULE,
@@ -346,9 +343,7 @@ static struct platform_driver dw_wdt_driver = {
.driver = {
.name = "dw_wdt",
.owner = THIS_MODULE,
-#ifdef CONFIG_PM
.pm = &dw_wdt_pm_ops,
-#endif /* CONFIG_PM */
},
};
--
1.7.10.4
This is necessary to make the driver work with platforms using the
common clock framework.
Signed-off-by: Heiko Stuebner <[email protected]>
---
drivers/watchdog/dw_wdt.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 4d3906d..b922bec 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -255,14 +255,14 @@ static int dw_wdt_release(struct inode *inode, struct file *filp)
#ifdef CONFIG_PM_SLEEP
static int dw_wdt_suspend(struct device *dev)
{
- clk_disable(dw_wdt.clk);
+ clk_disable_unprepare(dw_wdt.clk);
return 0;
}
static int dw_wdt_resume(struct device *dev)
{
- int err = clk_enable(dw_wdt.clk);
+ int err = clk_prepare_enable(dw_wdt.clk);
if (err)
return err;
@@ -306,7 +306,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
if (IS_ERR(dw_wdt.clk))
return PTR_ERR(dw_wdt.clk);
- ret = clk_enable(dw_wdt.clk);
+ ret = clk_prepare_enable(dw_wdt.clk);
if (ret)
return ret;
@@ -323,7 +323,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
return 0;
out_disable_clk:
- clk_disable(dw_wdt.clk);
+ clk_disable_unprepare(dw_wdt.clk);
return ret;
}
@@ -332,7 +332,7 @@ static int dw_wdt_drv_remove(struct platform_device *pdev)
{
misc_deregister(&dw_wdt_miscdev);
- clk_disable(dw_wdt.clk);
+ clk_disable_unprepare(dw_wdt.clk);
return 0;
}
--
1.7.10.4
The dw_wdt does not use any platform-specific data, so no new properties
need to be introduced. The dw-apb-wdt naming follows other designware
components in the kernel and is also written like this in documentation
describing the component.
Signed-off-by: Heiko Stuebner <[email protected]>
---
.../devicetree/bindings/watchdog/snps-dw-apb-wdt.txt | 18 ++++++++++++++++++
drivers/watchdog/dw_wdt.c | 10 ++++++++++
2 files changed, 28 insertions(+)
create mode 100644 Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
diff --git a/Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt b/Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
new file mode 100644
index 0000000..c20cdd1
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
@@ -0,0 +1,18 @@
+* Synosis DesignWare APB Watchdog
+
+The Watchdog controller is used for resuming system operation
+after a preset amount of time during which the WDT reset event has not
+occurred.
+
+Required properties:
+- compatible : "snps,dw-apb-wdt"
+- reg : offset and length of the register set for the device.
+- clocks : the periphal clock of the controller.
+
+Example:
+
+ watchdog@2004c000 {
+ compatible = "snps,dw-apb-wdt";
+ reg = <0x2004c000 0x100>;
+ clocks = <&wdt_clock>;
+ };
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index b922bec..829e148 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -35,6 +35,7 @@
#include <linux/timer.h>
#include <linux/uaccess.h>
#include <linux/watchdog.h>
+#include <linux/of.h>
#define WDOG_CONTROL_REG_OFFSET 0x00
#define WDOG_CONTROL_REG_WDT_EN_MASK 0x01
@@ -337,12 +338,21 @@ static int dw_wdt_drv_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_OF
+static const struct of_device_id dw_wdt_of_match[] = {
+ { .compatible = "snps,dw-apb-wdt", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, dw_i2c_of_match);
+#endif
+
static struct platform_driver dw_wdt_driver = {
.probe = dw_wdt_drv_probe,
.remove = dw_wdt_drv_remove,
.driver = {
.name = "dw_wdt",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(dw_wdt_of_match),
.pm = &dw_wdt_pm_ops,
},
};
--
1.7.10.4
On 26 June 2013 23:35, Heiko St?bner <[email protected]> wrote:
> The dw_wdt does not use any platform-specific data, so no new properties
> need to be introduced. The dw-apb-wdt naming follows other designware
> components in the kernel and is also written like this in documentation
> describing the component.
>
> Signed-off-by: Heiko Stuebner <[email protected]>
> ---
> .../devicetree/bindings/watchdog/snps-dw-apb-wdt.txt | 18 ++++++++++++++++++
> drivers/watchdog/dw_wdt.c | 10 ++++++++++
> 2 files changed, 28 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
>
> diff --git a/Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt b/Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
> new file mode 100644
> index 0000000..c20cdd1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
> @@ -0,0 +1,18 @@
> +* Synosis DesignWare APB Watchdog
Probably should be Synopsis?
--
With warm regards,
Sachin
On Thu, Jun 27, 2013 at 02:03:52AM -0000, =?utf-8?q?Heiko_St=C3=BCbner_=3Cheiko=40sntech=2Ede=3E?= wrote:
> The dw_wdt only provides PM_SLEEP operations, so convert the driver
> to use SIMPLE_DEV_PM_OPS instead of populating the struct manually.
> This has the added effect of simplifying the CONFIG_PM ifdefs.
>
> Signed-off-by: Heiko Stuebner <[email protected]>
>
Reviewed-by: Guenter Roeck <[email protected]>
On Thu, Jun 27, 2013 at 02:04:31AM -0000, =?utf-8?q?Heiko_St=C3=BCbner_=3Cheiko=40sntech=2Ede=3E?= wrote:
> This is necessary to make the driver work with platforms using the
> common clock framework.
>
> Signed-off-by: Heiko Stuebner <[email protected]>
>
Reviewed-by: Guenter Roeck <[email protected]>
Hi Heiko,
> This small series changes the dw_wdt driver, so that it is usable on
> machines using the common clock framework (needs the clk to be prepared)
> and devicetree (needs a binding).
>
> Heiko Stuebner (3):
> watchdog: dw_wdt: convert to SIMPLE_DEV_PM_OPS
> watchdog: dw_wdt: use clk_prepare_enable and clk_disable_unprepare
> watchdog: dw_wdt: add a devicetree binding
>
> .../bindings/watchdog/snps-dw-apb-wdt.txt | 18 ++++++++++++
> drivers/watchdog/dw_wdt.c | 31 ++++++++++++--------
> 2 files changed, 36 insertions(+), 13 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
patches 1 and 2 have been added to linux-watchdog-next.
Patch 3 has been replaced with Dinh Nguyen's patch (watchdog: dw: Enable OF support for DW watchdog timer).
Kind regards,
Wim.
Hi Wim,
Am Dienstag, 29. Oktober 2013, 08:32:55 schrieb Wim Van Sebroeck:
> > This small series changes the dw_wdt driver, so that it is usable on
> > machines using the common clock framework (needs the clk to be prepared)
> > and devicetree (needs a binding).
> >
> > Heiko Stuebner (3):
> > watchdog: dw_wdt: convert to SIMPLE_DEV_PM_OPS
> > watchdog: dw_wdt: use clk_prepare_enable and clk_disable_unprepare
> > watchdog: dw_wdt: add a devicetree binding
> >
> > .../bindings/watchdog/snps-dw-apb-wdt.txt | 18 ++++++++++++
> > drivers/watchdog/dw_wdt.c | 31
> > ++++++++++++-------- 2 files changed, 36 insertions(+), 13 deletions(-)
> > create mode 100644
> > Documentation/devicetree/bindings/watchdog/snps-dw-apb-wdt.txt
>
> patches 1 and 2 have been added to linux-watchdog-next.
> Patch 3 has been replaced with Dinh Nguyen's patch (watchdog: dw: Enable OF
> support for DW watchdog timer).
cool ... totally forgot about this series.
Shared IPs-blocks are a nice thing, making stuff not depend on individual lazy
developers [like me this time ;-) ]
Heiko