omap3/omap4: add device tree support for wdt
Subsystems (5)
cover omap3/omap4: add device tree support for wdt
From: Xiao Jiang <[email protected]>
This series can be applied to dt branch of linux-omap tree.
Since omap24xx series has different wdt base addr (omap2420: 0x48022000 and
omap2430: 0x49016000) per commit 2817142f31bfbf26c216bf4f9192540c81b2d071, so I don't add wdt node in omap2.dtsi just like omap3 and omap4, maybe different dts files are needed for omap2420 and omap2430.
Tested with omap4430 blaze board.
Xiao Jiang (3):
arm/dts: add wdt node for omap3 and omap4
OMAP: wdt: add device tree support
watchdog: omap_wdt: add device tree support
arch/arm/boot/dts/omap3.dtsi | 5 +++++ arch/arm/boot/dts/omap4.dtsi | 5 +++++ arch/arm/mach-omap2/devices.c | 2 +- drivers/watchdog/omap_wdt.c | 8 ++++++++ 4 files changed, 19 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.3
PATCH 1/3 arm/dts: add wdt node for omap3 and omap4
From: Xiao Jiang <[email protected]>
Add wdt node to support dt.
--- arch/arm/boot/dts/omap3.dtsi | 5 +++++ arch/arm/boot/dts/omap4.dtsi | 5 +++++ 2 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap3.dtsi +5 -0
@@ -215,5 +215,10 @@ compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc3"; }; + + wdt: wdt@48314000{ + compatible = "ti,omap3-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };
arch/arm/boot/dts/omap4.dtsi +5 -0
@@ -272,5 +272,10 @@ ti,hwmods = "mmc5"; ti,needs-special-reset; }; + + wdt: wdt@4a314000{ + compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };
Signature · 1 line
1.7.3
Re: [PATCH 1/3] arm/dts: add wdt node for omap3 and omap4
Quoted 15 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang <[email protected]>
Add wdt node to support dt.
Signed-off-by Xiao Jiang <[email protected]>--- arch/arm/boot/dts/omap3.dtsi | 5 +++++ arch/arm/boot/dts/omap4.dtsi | 5 +++++ 2 files changed, 10 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap3.dtsi +0
-0
arch/arm/boot/dts/omap3.dtsi line 219
Quoted 5 lines
arch/arm/boot/dts/omap3.dtsi +2
-0@@ -215,5 +215,10 @@ compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc3"; }; + + wdt: wdt at 48314000{
Minor comment, may be call this wdt2 as this is watchdog timer 2. Also ass a space between the address and the "{".
Quoted 10 lines
arch/arm/boot/dts/omap3.dtsi +3
-0+ compatible = "ti,omap3-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };arch/arm/boot/dts/omap4.dtsi +0
-0
arch/arm/boot/dts/omap4.dtsi line 276
Quoted 5 lines
arch/arm/boot/dts/omap4.dtsi +2
-0@@ -272,5 +272,10 @@ ti,hwmods = "mmc5"; ti,needs-special-reset; }; + + wdt: wdt at 4a314000{
Same as above.
arch/arm/boot/dts/omap4.dtsi line 281
Quoted 5 lines
arch/arm/boot/dts/omap4.dtsi +3
-0+ compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };
Also we should add some documentation to describe the binding. Here it is very simple, but nonetheless we should have something as we have for gpio [1].
Cheers
Jon
Re: [PATCH 1/3] arm/dts: add wdt node for omap3 and omap4
Quoted 12 lines · Jon Hunter
Quoted 10 lines · On 05/25/2012 05:42 AM, [email protected] wrote:
From: Xiao Jiang <[email protected]>
Add wdt node to support dt.
Signed-off-by Xiao Jiang <[email protected]>--- arch/arm/boot/dts/omap3.dtsi | 5 +++++ arch/arm/boot/dts/omap4.dtsi | 5 +++++ 2 files changed, 10 insertions(+), 0 deletions(-)
Quoted 16 lines
arch/arm/boot/dts/omap3.dtsi line 220
Quoted 11 lines
arch/arm/boot/dts/omap3.dtsi +2
-0@@ -215,5 +215,10 @@ compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc3"; }; + + wdt: wdt@48314000{Minor comment, may be call this wdt2 as this is watchdog timer 2. Also ass a space between the address and the "{".
Ok, will change it to "wdt2: wdt@48314000 {".
Quoted 10 lines
Quoted 10 lines
arch/arm/boot/dts/omap3.dtsi +3
-0+ compatible = "ti,omap3-wdt"; + ti,hwmods = "wd_timer2"; + }; };};
arch/arm/boot/dts/omap4.dtsi +0
-0@@ -272,5 +272,10 @@
Quoted 10 lines
arch/arm/boot/dts/omap4.dtsi line 277
Quoted 6 lines
arch/arm/boot/dts/omap4.dtsi +2
-0ti,hwmods = "mmc5"; ti,needs-special-reset; }; + + wdt: wdt@4a314000{Same as above.
Ditto.
Quoted 12 lines
Quoted 6 lines
arch/arm/boot/dts/omap4.dtsi +3
-0+ compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; + }; };};
Also we should add some documentation to describe the binding. Here it is very simple, but nonetheless we should have something as we have for gpio [1].
Thanks for reminding, how about below patch?
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +15 -0
@@ -0,0 +1,15 @@ +TI Watchdog Timer (WDT) Controller for OMAP + +Required properties: +- compatible: + - "ti,omap2-wdt" for OMAP2 + - "ti,omap3-wdt" for OMAP3 + - "ti,omap4-wdt" for OMAP4 +- ti,hwmods: Name of the hwmod associated to the WDT + +Examples: + +wdt2: wdt@73f98000 { + compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; +};
Regards,
Xiao
Re: [PATCH 1/3] arm/dts: add wdt node for omap3 and omap4
Quoted 77 lines · Xiao Jiang
Quoted 12 lines · Jon Hunter
Quoted 10 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang <[email protected]>
Add wdt node to support dt.
Signed-off-by Xiao Jiang <[email protected]>--- arch/arm/boot/dts/omap3.dtsi | 5 +++++ arch/arm/boot/dts/omap4.dtsi | 5 +++++ 2 files changed, 10 insertions(+), 0 deletions(-)Quoted 16 lines
arch/arm/boot/dts/omap3.dtsi line 220
Quoted 11 lines
arch/arm/boot/dts/omap3.dtsi +2
-0@@ -215,5 +215,10 @@ compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc3"; }; + + wdt: wdt at 48314000{Minor comment, may be call this wdt2 as this is watchdog timer 2. Also ass a space between the address and the "{".
Ok, will change it to "wdt2: wdt at 48314000 {".
Quoted 10 lines
Quoted 10 lines
arch/arm/boot/dts/omap3.dtsi +3
-0+ compatible = "ti,omap3-wdt"; + ti,hwmods = "wd_timer2"; + }; };};
arch/arm/boot/dts/omap4.dtsi +0
-0@@ -272,5 +272,10 @@Quoted 10 lines
arch/arm/boot/dts/omap4.dtsi line 277
Quoted 6 lines
arch/arm/boot/dts/omap4.dtsi +2
-0ti,hwmods = "mmc5"; ti,needs-special-reset; }; + + wdt: wdt at 4a314000{Same as above.
Ditto.
Quoted 7 lines
Quoted 6 lines
arch/arm/boot/dts/omap4.dtsi +3
-0+ compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; + }; };};
Quoted 5 lines
Also we should add some documentation to describe the binding. Here it is very simple, but nonetheless we should have something as we have for gpio [1].
Thanks for reminding, how about below patch?
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +5
-0@@ -0,0 +1,15 @@ +TI Watchdog Timer (WDT) Controller for OMAP + +Required properties: +- compatible: + - "ti,omap2-wdt" for OMAP2
Documentation/devicetree/bindings/watchdog/omap-wdt.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +10
-0+ - "ti,omap3-wdt" for OMAP3 + - "ti,omap4-wdt" for OMAP4 +- ti,hwmods: Name of the hwmod associated to the WDT + +Examples: + +wdt2: wdt at 73f98000 { + compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; +};
Yes looks good. Thanks! Minor nit-pick in the example I would just copy the omap4 node completely with the actual omap4 address :-)
Cheers
Jon
Re: [PATCH 1/3] arm/dts: add wdt node for omap3 and omap4
Hi Jon and Benoit,
Quoted 20 lines
Quoted 20 lines
Thanks for reminding, how about below patch?
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +11
-0@@ -0,0 +1,15 @@ +TI Watchdog Timer (WDT) Controller for OMAP + +Required properties: +- compatible: + - "ti,omap2-wdt" for OMAP2 + - "ti,omap3-wdt" for OMAP3 + - "ti,omap4-wdt" for OMAP4 +- ti,hwmods: Name of the hwmod associated to the WDT + +Examples: +
Quoted 10 lines
Documentation/devicetree/bindings/watchdog/omap-wdt.txt line 15
Quoted 5 lines
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +4
-0+wdt2: wdt@73f98000 { + compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; +};Yes looks good. Thanks! Minor nit-pick in the example I would just copy the omap4 node completely with the actual omap4 address :-)
Oops, wrong addr, :). Perhaps we can drop address as you said, since the right addresses are defined in wd_timer2 hwmod (see [1]), and wdt also works without the address as follows.
arch/arm/boot/dts/omap2.dtsi +5 -0
@@ -63,5 +63,10 @@ ti,hwmods = "uart3"; clock-frequency = <48000000>; }; + + wdt2: wdt { + compatible = "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; };
};
arch/arm/boot/dts/omap3.dtsi +5 -0
@@ -215,5 +215,10 @@ compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc3"; }; + + wdt2: wdt { + compatible = "ti,omap3-wdt", "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; };
};
arch/arm/boot/dts/omap4.dtsi +5 -0
@@ -272,5 +272,10 @@ ti,hwmods = "mmc5"; ti,needs-special-reset; }; + + wdt2: wdt { + compatible = "ti,omap4-wdt", "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; };
};
Infos for omap3:
# dmesg|grep Machine
<6>[ 0.000000] Machine: Generic OMAP3 (Flattened Device Tree), model: TI OMAP3 EVM (OMAP3530, AM/DM37x) # dmesg|grep omap_wdt_probe <4>[ 2.552825] in omap_wdt_probe: 299, res->start = 0x48314000
Infos for omap4:
root@localhost:/root> dmesg|grep Machine
[ 0.000000] Machine: Generic OMAP4 (Flattened Device Tree), model: TI OMAP4 SDP board root@localhost:/root> dmesg|grep omap_wdt_probe [ 1.687896] in omap_wdt_probe: 299, res->start = 0x4a314000
So can I drop the wdt addr from dts file? otherwise it is not feasible to add omap2 wdt node in omap2.dtsi due to different addrs for omap2420 and omap2430.
Regards,
Xiao
[1] http://marc.info/?l=linux-omap&m=133836995026565&w=2
Quoted 3 lines
Cheers
Jon
Re: [PATCH 1/3] arm/dts: add wdt node for omap3 and omap4
Quoted 91 lines · Xiao Jiang
Hi Jon and Benoit,
Quoted 20 lines
Quoted 20 lines
Thanks for reminding, how about below patch?
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +11
-0@@ -0,0 +1,15 @@ +TI Watchdog Timer (WDT) Controller for OMAP + +Required properties: +- compatible: + - "ti,omap2-wdt" for OMAP2 + - "ti,omap3-wdt" for OMAP3 + - "ti,omap4-wdt" for OMAP4 +- ti,hwmods: Name of the hwmod associated to the WDT + +Examples: +Quoted 10 lines
Documentation/devicetree/bindings/watchdog/omap-wdt.txt line 15
Quoted 5 lines
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +4
-0+wdt2: wdt at 73f98000 { + compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; +};Yes looks good. Thanks! Minor nit-pick in the example I would just copy the omap4 node completely with the actual omap4 address :-)
Oops, wrong addr, :). Perhaps we can drop address as you said, since the right addresses are defined
inwd_timer2hwmod (see [1]), and wdt also works without the address as follows.arch/arm/boot/dts/omap2.dtsi +5
-0@@ -63,5 +63,10 @@ ti,hwmods = "uart3"; clock-frequency = <48000000>; }; + + wdt2: wdt { + compatible = "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };arch/arm/boot/dts/omap3.dtsi +5
-0@@ -215,5 +215,10 @@ compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc3"; }; + + wdt2: wdt { + compatible = "ti,omap3-wdt", "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };arch/arm/boot/dts/omap4.dtsi +5
-0@@ -272,5 +272,10 @@ ti,hwmods = "mmc5"; ti,needs-special-reset; }; + + wdt2: wdt { + compatible = "ti,omap4-wdt", "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };Infos for omap3:
# dmesg|grep Machine<6>[ 0.000000] Machine: Generic OMAP3 (Flattened Device Tree), model: TI OMAP3 EVM (OMAP3530, AM/DM37x) # dmesg|grep omap_wdt_probe <4>[ 2.552825] in omap_wdt_probe: 299, res->start = 0x48314000Infos for omap4:
root at localhost:/root> dmesg|grep Machine
Quoted 8 lines
[ 0.000000] Machine: Generic OMAP4 (Flattened Device Tree), model: TI OMAP4 SDP board root at localhost:/root> dmesg|grep omap_wdt_probe [ 1.687896] in omap_wdt_probe: 299, res->start = 0x4a314000So can I drop the wdt addr from dts file? otherwise it is not feasible to add omap2 wdt node in
omap2.dtsi
due to different addrs for omap2420 and omap2430.
Benoit, what is your preference here?
Cheers
Jon
Re: [PATCH 1/3] arm/dts: add wdt node for omap3 and omap4
Quoted 97 lines · Jon Hunter
Quoted 96 lines · Xiao Jiang
Hi Jon and Benoit,
Quoted 20 lines
Quoted 20 lines
Thanks for reminding, how about below patch?
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +11
-0@@ -0,0 +1,15 @@ +TI Watchdog Timer (WDT) Controller for OMAP + +Required properties: +- compatible: + - "ti,omap2-wdt" for OMAP2 + - "ti,omap3-wdt" for OMAP3 + - "ti,omap4-wdt" for OMAP4 +- ti,hwmods: Name of the hwmod associated to the WDT + +Examples: +Quoted 10 lines
Documentation/devicetree/bindings/watchdog/omap-wdt.txt line 15
Quoted 5 lines
Documentation/devicetree/bindings/watchdog/omap-wdt.txt new file +4
-0+wdt2: wdt at 73f98000 { + compatible = "ti,omap4-wdt"; + ti,hwmods = "wd_timer2"; +};Yes looks good. Thanks! Minor nit-pick in the example I would just copy the omap4 node completely with the actual omap4 address :-)
Oops, wrong addr, :). Perhaps we can drop address as you said, since the right addresses are defined
inwd_timer2hwmod (see [1]), and wdt also works without the address as follows.arch/arm/boot/dts/omap2.dtsi +5
-0@@ -63,5 +63,10 @@ ti,hwmods = "uart3"; clock-frequency =<48000000>; }; + + wdt2: wdt { + compatible = "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };arch/arm/boot/dts/omap3.dtsi +5
-0@@ -215,5 +215,10 @@ compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc3"; }; + + wdt2: wdt { + compatible = "ti,omap3-wdt", "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };arch/arm/boot/dts/omap4.dtsi +5
-0@@ -272,5 +272,10 @@ ti,hwmods = "mmc5"; ti,needs-special-reset; }; + + wdt2: wdt { + compatible = "ti,omap4-wdt", "ti,omap2-wdt"; + ti,hwmods = "wd_timer2"; + }; }; };Infos for omap3:
# dmesg|grep Machine<6>[ 0.000000] Machine: Generic OMAP3 (Flattened Device Tree), model: TI OMAP3 EVM (OMAP3530, AM/DM37x) # dmesg|grep omap_wdt_probe <4>[ 2.552825] in omap_wdt_probe: 299, res->start = 0x48314000Infos for omap4:
root at localhost:/root> dmesg|grep Machine[ 0.000000] Machine: Generic OMAP4 (Flattened Device Tree), model: TI OMAP4 SDP board root at localhost:/root> dmesg|grep omap_wdt_probe [ 1.687896] in omap_wdt_probe: 299, res->start = 0x4a314000
Quoted 5 lines
Quoted 3 lines
So can I drop the wdt addr from dts file? otherwise it is not feasible to add omap2 wdt node in
omap2.dtsi
due to different addrs for omap2420 and omap2430.Benoit, what is your preference here?
Get rid of both omap2420 and 2430 :-)
The point is that only OMAP3 and OMAP4 are supposed to be migrated to DT for the moment.
If you do not have any OMAP2 board to test that, it is anyway safer to not touch the omap2.dtsi file.
If the 2 or 3 remaining users of OMAP2 boards want to have DT support, they'll be able to add that themselves.
Regards,
Benoit
PATCH 2/3 OMAP: avoid build wdt platform device if with dt support
In reply to [email protected]From: Xiao Jiang <[email protected]>
If provided dt support, then skip add wdt platform device as usual.
--- arch/arm/mach-omap2/devices.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/devices.c +1 -1
@@ -759,7 +759,7 @@ static int __init omap_init_wdt(void)char *oh_name ="wd_timer2" ;char *dev_name ="omap_wdt" ; -if (!cpu_class_is_omap2 ()) +if (!cpu_class_is_omap2 () ||of_have_populated_dt ())return 0 ; oh =omap_hwmod_lookup (oh_name);
Signature · 1 line
1.7.3
Re: [PATCH 2/3] OMAP: avoid build wdt platform device if with dt support
Quoted 14 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang <[email protected]>
If provided dt support, then skip add wdt platform device as usual.
Signed-off-by Xiao Jiang <[email protected]>--- arch/arm/mach-omap2/devices.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/mach-omap2/devices.c +0
-0
arch/arm/mach-omap2/devices.c static int __init omap_init_wdt(void) · line 765
Quoted 8 lines
arch/arm/mach-omap2/devices.c +1
-1@@ -759,7 +759,7 @@ static int __init omap_init_wdt(void)char *oh_name ="wd_timer2" ;char *dev_name ="omap_wdt" ; -if (!cpu_class_is_omap2 ()) +if (!cpu_class_is_omap2 () ||of_have_populated_dt ())return 0 ; oh =omap_hwmod_lookup (oh_name);
Cheers
Jon
PATCH 3/3 watchdog: omap_wdt: add device tree support
In reply to [email protected]From: Xiao Jiang <[email protected]>
Add device table for omap_wdt to support dt.
--- drivers/watchdog/omap_wdt.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/watchdog/omap_wdt.c +8 -0
@@ -430,6 +430,13 @@ static int omap_wdt_resume(struct platform_device *pdev)#define omap_wdt_resume NULL#endif +static const struct of_device_id omap_wdt_of_match[] = { + { .compatible ="ti,omap3-wdt" , }, + { .compatible ="ti,omap4-wdt" , }, + {}, +}; +MODULE_DEVICE_TABLE (of, omap_wdt_of_match); +static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe, .remove =__devexit_p (omap_wdt_remove),
@@ -439,6 +446,7 @@ static struct platform_driver omap_wdt_driver = { .driver = { .owner = THIS_MODULE, .name = "omap_wdt", + .of_match_table = omap_wdt_of_match, }, };
Signature · 1 line
1.7.3
Re: [PATCH 3/3] watchdog: omap_wdt: add device tree support
Quoted 28 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang <[email protected]>
Add device table for
omap_wdtto support dt.Signed-off-by Xiao Jiang <[email protected]>--- drivers/watchdog/omap_wdt.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)drivers/watchdog/omap_wdt.c +7
-0@@ -430,6 +430,13 @@ static int omap_wdt_resume(struct platform_device *pdev)#define omap_wdt_resume NULL#endif +static const struct of_device_id omap_wdt_of_match[] = { + { .compatible ="ti,omap3-wdt" , }, + { .compatible ="ti,omap4-wdt" , }, + {}, +}; +MODULE_DEVICE_TABLE (of, omap_wdt_of_match); +static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe, .remove =__devexit_p (omap_wdt_remove),
drivers/watchdog/omap_wdt.c static struct platform_driver omap_wdt_driver = { · line 452
Quoted 7 lines
drivers/watchdog/omap_wdt.c +1
-0@@ -439,6 +446,7 @@ static struct platform_driver omap_wdt_driver = { .driver = { .owner = THIS_MODULE, .name = "omap_wdt", + .of_match_table = omap_wdt_of_match, }, };
I think we need to add some code to the probe function that calls of_match_device() and ensures we find a match. For example ...
if (of_have_populated_dt()) if (!of_match_device(omap_wdt_of_match, &pdev->dev)) return -EINVAL;
Cheers
Jon
Re: [PATCH 3/3] watchdog: omap_wdt: add device tree support
Quoted 42 lines · Jon Hunter
Quoted 29 lines · On 05/25/2012 05:42 AM, [email protected] wrote:
From: Xiao Jiang <[email protected]>
Add device table for
omap_wdtto support dt.Signed-off-by Xiao Jiang <[email protected]>--- drivers/watchdog/omap_wdt.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)drivers/watchdog/omap_wdt.c +7
-0@@ -430,6 +430,13 @@ static int omap_wdt_resume(struct platform_device *pdev)#define omap_wdt_resume NULL#endif +static const struct of_device_id omap_wdt_of_match[] = { + { .compatible ="ti,omap3-wdt" , }, + { .compatible ="ti,omap4-wdt" , }, + {}, +}; +MODULE_DEVICE_TABLE (of, omap_wdt_of_match); +static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe, .remove =__devexit_p (omap_wdt_remove),drivers/watchdog/omap_wdt.c static struct platform_driver omap_wdt_driver = { · line 452
Quoted 7 lines
drivers/watchdog/omap_wdt.c +1
-0@@ -439,6 +446,7 @@ static struct platform_driver omap_wdt_driver = { .driver = { .owner = THIS_MODULE, .name = "omap_wdt", + .of_match_table = omap_wdt_of_match, }, };I think we need to add some code to the probe function that calls
of_match_device()and ensures we find a match. For example ...
Quoted 5 lines
if (of_have_populated_dt()) if (!of_match_device(omap_wdt_of_match, &pdev->dev)) return -EINVAL;
Will add it in v2, thanks for suggestion.
Regards,
Xiao
Quoted 3 lines
Cheers
Jon
Re: [PATCH 3/3] watchdog: omap_wdt: add device tree support
Quoted 20 lines · Xiao Jiang
Quoted 19 lines · Jon Hunter
Quoted 18 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang <[email protected]>
Add device table for
omap_wdtto support dt.Signed-off-by Xiao Jiang <[email protected]>---
drivers/watchdog/omap_wdt.c| 8 ++++++++1 files changed, 8 insertions(+), 0 deletions(-)drivers/watchdog/omap_wdt.c +0
-0@@ -430,6 +430,13 @@ static int omap_wdt_resume(struct platform_device *pdev)#define omap_wdt_resume NULL#endif
Quoted 3 lines
Quoted 3 lines
drivers/watchdog/omap_wdt.c static int omap_wdt_resume(struct platform_device *pdev) · line 435
Quoted 3 lines
drivers/watchdog/omap_wdt.c +3
-0+static const struct of_device_id omap_wdt_of_match[] = { + { .compatible ="ti,omap3-wdt" , }, + { .compatible ="ti,omap4-wdt" , },
If there is no difference between the OMAP3 and the OMAP4 WDT IP, just add one entry "ti,omap3-wdt". And then in the OMAP4 DTS you will just put : compatible = "ti,omap3-wdt"; or compatible = "ti,omap4-wdt", "ti,omap3-wdt";
I'm still a little bit confused about the real need for the "ti,omap4-wdt: entry, but it seems to be the way to do it in PPC.
Quoted 19 lines
Quoted 19 lines
Quoted 8 lines
drivers/watchdog/omap_wdt.c +4
-0+ {}, +}; +MODULE_DEVICE_TABLE (of, omap_wdt_of_match); +static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe,.remove =
__devexit_p(omap_wdt_remove),drivers/watchdog/omap_wdt.c static struct platform_driver omap_wdt_driver = { · line 452
Quoted 7 lines
drivers/watchdog/omap_wdt.c +1
-0@@ -439,6 +446,7 @@ static struct platform_driver omap_wdt_driver = { .driver = { .owner = THIS_MODULE, .name = "omap_wdt", + .of_match_table = omap_wdt_of_match, }, };I think we need to add some code to the probe function that calls
of_match_device()and ensures we find a match. For example ...
Quoted 5 lines
Quoted 4 lines
if (
of_have_populated_dt())
if (!of_match_device(omap_wdt_of_match,&pdev->dev)) return-EINVAL;Will add it in v2, thanks for suggestion.
No, in fact this is not needed. We need that mainly when several instances can match the same driver and thus we select the proper one using the of_match_device. Otherwise, just check is the device_node is there.
In that case, the driver does not even care about any DT node so there is no need to add extra code for that. Keep it simple.
Regards,
Benoit
Re: [PATCH 3/3] watchdog: omap_wdt: add device tree support
Quoted 21 lines · Benoit
Quoted 20 lines · Xiao Jiang
Quoted 19 lines · Jon Hunter
Quoted 18 lines · On 05/25/2012 05:42 AM, [email protected] wrote:
From: Xiao Jiang <[email protected]>
Add device table for
omap_wdtto support dt.Signed-off-by Xiao Jiang <[email protected]>---
drivers/watchdog/omap_wdt.c| 8 ++++++++1 files changed, 8 insertions(+), 0 deletions(-)drivers/watchdog/omap_wdt.c +0
-0@@ -430,6 +430,13 @@ static int omap_wdt_resume(struct platform_device *pdev)#define omap_wdt_resume NULL#endif
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
drivers/watchdog/omap_wdt.c static int omap_wdt_resume(struct platform_device *pdev) · line 435
Quoted 3 lines
drivers/watchdog/omap_wdt.c +3
-0+static const struct of_device_id omap_wdt_of_match[] = { + { .compatible ="ti,omap3-wdt" , }, + { .compatible ="ti,omap4-wdt" , },If there is no difference between the OMAP3 and the OMAP4 WDT IP, just add one entry "ti,omap3-wdt". And then in the OMAP4 DTS you will just put : compatible = "ti,omap3-wdt"; or compatible = "ti,omap4-wdt", "ti,omap3-wdt"; I'm still a little bit confused about the real need for the "ti,omap4-wdt: entry, but it seems to be the way to do it in PPC.
I believe OMAP2, OMAP3 and OMAP4 share the same IP, so how about use "ti, omap2-wdt"? and other dts files put compatible like "ti,omap4-wdt", "ti,omap2-wdt" and "ti,omap4-wdt", "ti,omap2-wdt".
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 9 lines
drivers/watchdog/omap_wdt.c +4
-0+ {}, +}; +MODULE_DEVICE_TABLE (of, omap_wdt_of_match); +static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe,.remove =
__devexit_p(omap_wdt_remove),drivers/watchdog/omap_wdt.c static struct platform_driver omap_wdt_driver = { · line 452
Quoted 7 lines
drivers/watchdog/omap_wdt.c +1
-0@@ -439,6 +446,7 @@ static struct platform_driver omap_wdt_driver = { .driver = { .owner = THIS_MODULE, .name = "omap_wdt", + .of_match_table = omap_wdt_of_match, }, };I think we need to add some code to the probe function that calls
of_match_device()and ensures we find a match. For example ...if (
of_have_populated_dt())
if (!of_match_device(omap_wdt_of_match,&pdev->dev)) return-EINVAL;
Quoted 6 lines
Quoted 1 line
Will add it in v2, thanks for suggestion.
No, in fact this is not needed. We need that mainly when several instances can match the same driver and thus we select the proper one using the
of_match_device. Otherwise, just check is thedevice_nodeis there.In that case, the driver does not even care about any DT node so there is no need to add extra code for that. Keep it simple.
Thanks for elaborating, simple is good for this one.
Regards,
Xiao
Quoted 2 lines
Regards,
Benoit
Re: [PATCH 3/3] watchdog: omap_wdt: add device tree support
Quoted 6 lines
Quoted 3 lines
If there is no difference between the OMAP3 and the OMAP4 WDT IP, just add one entry "ti,omap3-wdt". And then in the OMAP4 DTS you will just put : compatible = "ti,omap3-wdt"; or compatible = "ti,omap4-wdt", "ti,omap3-wdt"; I'm still a little bit confused about the real need for the "ti,omap4-wdt: entry, but it seems to be the way to do it in PPC.
I believe OMAP2, OMAP3 and OMAP4 share the same IP, so how about use "ti, omap2-wdt"? and other dts files put compatible like "ti,omap4-wdt", "ti,omap2-wdt" and "ti,omap4-wdt", "ti,omap2-wdt".
Typo, should be "ti,omap3-wdt", "ti,omap2-wdt" and "ti,omap4-wdt", "ti,omap2-wdt".
Regards,
Xiao
Re: [PATCH 3/3] watchdog: omap_wdt: add device tree support
In reply to Cousson, BenoitHi Benoit,
Quoted 21 lines · Benoit
Quoted 20 lines · Xiao Jiang
Quoted 19 lines · Jon Hunter
Quoted 18 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang <[email protected]>
Add device table for
omap_wdtto support dt.Signed-off-by Xiao Jiang <[email protected]>---
drivers/watchdog/omap_wdt.c| 8 ++++++++1 files changed, 8 insertions(+), 0 deletions(-)drivers/watchdog/omap_wdt.c +0
-0@@ -430,6 +430,13 @@ static int omap_wdt_resume(struct platform_device *pdev)#define omap_wdt_resume NULL#endif
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
drivers/watchdog/omap_wdt.c static int omap_wdt_resume(struct platform_device *pdev) · line 435
Quoted 3 lines
drivers/watchdog/omap_wdt.c +3
-0+static const struct of_device_id omap_wdt_of_match[] = { + { .compatible ="ti,omap3-wdt" , }, + { .compatible ="ti,omap4-wdt" , },If there is no difference between the OMAP3 and the OMAP4 WDT IP, just add one entry "ti,omap3-wdt". And then in the OMAP4 DTS you will just put : compatible = "ti,omap3-wdt"; or compatible = "ti,omap4-wdt", "ti,omap3-wdt";
Hmmm ... comparing the omap3 and omap4 wdt registers there are some differences. omap4 seems to have more registers than omap3. May be we are not using these right now, but from a register perspective the wdt in omap2, omap3 and omap4 appear to be slightly different. The revision ID register on omap3 and omap4 have different values too.
I guess from a driver perspective there is no difference, but it seemed to me that the IP is not completely the same.
Quoted 28 lines
I'm still a little bit confused about the real need for the "ti,omap4-wdt: entry, but it seems to be the way to do it in PPC.
Quoted 19 lines
Quoted 19 lines
Quoted 8 lines
drivers/watchdog/omap_wdt.c +4
-0+ {}, +}; +MODULE_DEVICE_TABLE (of, omap_wdt_of_match); +static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe,.remove =
__devexit_p(omap_wdt_remove),drivers/watchdog/omap_wdt.c static struct platform_driver omap_wdt_driver = { · line 452
Quoted 7 lines
drivers/watchdog/omap_wdt.c +1
-0@@ -439,6 +446,7 @@ static struct platform_driver omap_wdt_driver = { .driver = { .owner = THIS_MODULE, .name = "omap_wdt", + .of_match_table = omap_wdt_of_match, }, };I think we need to add some code to the probe function that calls
of_match_device()and ensures we find a match. For example ...Quoted 5 lines
Quoted 4 lines
if (
of_have_populated_dt())
if (!of_match_device(omap_wdt_of_match,&pdev->dev)) return-EINVAL;Will add it in v2, thanks for suggestion.
Quoted 7 lines
No, in fact this is not needed. We need that mainly when several instances can match the same driver and thus we select the proper one using the
of_match_device. Otherwise, just check is thedevice_nodeis there.In that case, the driver does not even care about any DT node so there is no need to add extra code for that. Keep it simple.
Ok. So are you saying get rid of the match table altogether? In other words, drop this patch?
I agree that it does not really do anything today, but I did not know if in the future you were planning to pass things like, register addresses, via DT.
Cheers
Jon
Re: [PATCH 3/3] watchdog: omap_wdt: add device tree support
Hi Jon,
Quoted 33 lines · Jon Hunter
Hi Benoit,
Quoted 21 lines · Benoit
Quoted 20 lines · Xiao Jiang
Quoted 19 lines · Jon Hunter
Quoted 18 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang<[email protected]>
Add device table for
omap_wdtto support dt.Signed-off-by Xiao Jiang<[email protected]>---
drivers/watchdog/omap_wdt.c| 8 ++++++++1 files changed, 8 insertions(+), 0 deletions(-)drivers/watchdog/omap_wdt.c +0
-0@@ -430,6 +430,13 @@ static int omap_wdt_resume(struct platform_device *pdev)#define omap_wdt_resume NULL#endif Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
drivers/watchdog/omap_wdt.c static int omap_wdt_resume(struct platform_device *pdev) · line 435
Quoted 3 lines
drivers/watchdog/omap_wdt.c +3
-0+static const struct of_device_id omap_wdt_of_match[] = { + { .compatible ="ti,omap3-wdt" , }, + { .compatible ="ti,omap4-wdt" , },If there is no difference between the OMAP3 and the OMAP4 WDT IP, just add one entry "ti,omap3-wdt". And then in the OMAP4 DTS you will just put : compatible = "ti,omap3-wdt"; or compatible = "ti,omap4-wdt", "ti,omap3-wdt";
Quoted 8 lines
Hmmm ... comparing the omap3 and omap4 wdt registers there are some differences. omap4 seems to have more registers than omap3. May be we are not using these right now, but from a register perspective the wdt in omap2, omap3 and omap4 appear to be slightly different. The revision ID register on omap3 and omap4 have different values too.
I guess from a driver perspective there is no difference, but it seemed to me that the IP is not completely the same.
Well, in that case, and assuming that there is no proper HW_REVISION information to detect the IP difference, the proper compatible entries will indeed have to be used.
Quoted 34 lines
Quoted 34 lines
I'm still a little bit confused about the real need for the "ti,omap4-wdt: entry, but it seems to be the way to do it in PPC.
Quoted 19 lines
Quoted 19 lines
Quoted 8 lines
drivers/watchdog/omap_wdt.c +4
-0+ {}, +}; +MODULE_DEVICE_TABLE (of, omap_wdt_of_match); +static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe,.remove =
__devexit_p(omap_wdt_remove),drivers/watchdog/omap_wdt.c static struct platform_driver omap_wdt_driver = { · line 452
Quoted 7 lines
drivers/watchdog/omap_wdt.c +1
-0@@ -439,6 +446,7 @@ static struct platform_driver omap_wdt_driver = { .driver = { .owner = THIS_MODULE, .name = "omap_wdt", + .of_match_table = omap_wdt_of_match, }, };I think we need to add some code to the probe function that calls
of_match_device()and ensures we find a match. For example ...Quoted 5 lines
Quoted 4 lines
if (
of_have_populated_dt())
if (!of_match_device(omap_wdt_of_match,&pdev->dev)) return-EINVAL;Will add it in v2, thanks for suggestion.
No, in fact this is not needed. We need that mainly when several instances can match the same driver and thus we select the proper one using the
of_match_device. Otherwise, just check is thedevice_nodeis there.
Quoted 5 lines
Quoted 2 lines
In that case, the driver does not even care about any DT node so there is no need to add extra code for that. Keep it simple.
Ok. So are you saying get rid of the match table altogether? In other words, drop this patch?
No, the match table is used by the LDM to find the proper driver to be bound to a device. So we do need it. But we do not have to use the of_match_device if we do not want to get the entry in the device table.
Quoted 3 lines
I agree that it does not really do anything today, but I did not know if in the future you were planning to pass things like, register addresses, via DT.
Well, yes we will have to, otherwise people will keep complaining that our DTS sucks and are not compliant with the DTS standards :-)
Regards,
Benoit
Re: [PATCH 3/3] watchdog: omap_wdt: add device tree support
Hi Benoit,
Quoted 43 lines · Benoit
Hi Jon,
Quoted 40 lines · Jon Hunter
Hi Benoit,
Quoted 22 lines · Benoit
Quoted 21 lines · Xiao Jiang
Quoted 20 lines · Jon Hunter
Quoted 19 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang<[email protected]>
Add device table for
omap_wdtto support dt.Signed-off-by Xiao Jiang<[email protected]>---
drivers/watchdog/omap_wdt.c| 8 ++++++++1 files changed, 8 insertions(+), 0 deletions(-)drivers/watchdog/omap_wdt.c +0
-0@@ -430,6 +430,13 @@ static int omap_wdt_resume(struct platform_device *pdev)#define omap_wdt_resume NULL#endif Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
drivers/watchdog/omap_wdt.c static int omap_wdt_resume(struct platform_device *pdev) · line 435
Quoted 3 lines
drivers/watchdog/omap_wdt.c +3
-0+static const struct of_device_id omap_wdt_of_match[] = { + { .compatible ="ti,omap3-wdt" , }, + { .compatible ="ti,omap4-wdt" , },If there is no difference between the OMAP3 and the OMAP4 WDT IP, just add one entry "ti,omap3-wdt". And then in the OMAP4 DTS you will just put : compatible = "ti,omap3-wdt"; or compatible = "ti,omap4-wdt", "ti,omap3-wdt";
Hmmm ... comparing the omap3 and omap4 wdt registers there are some differences. omap4 seems to have more registers than omap3. May be we are not using these right now, but from a register perspective the wdt in omap2, omap3 and omap4 appear to be slightly different. The revision ID register on omap3 and omap4 have different values too.
Quoted 6 lines
Quoted 2 lines
I guess from a driver perspective there is no difference, but it seemed to me that the IP is not completely the same.
Well, in that case, and assuming that there is no proper
HW_REVISIONinformation to detect the IP difference, the proper compatible entries will indeed have to be used.
So looking at a 4460 and 3430, the WIDR register (IP revision) can be used to distinguish between IP revisions. So it appears that we do have proper HW REV info.
So may be I am not completely up to speed of the intent of the compatible field. In other words, should this be used to indicate if the IP is same/compatible or the driver is compatible or both. Technically right now we could just have "ti-omap2-wdt" for all omap2+ devices as the driver is compatible for all devices. However, technically, the IP is not completely the same but it is compatible :-)
Quoted 36 lines
Quoted 36 lines
Quoted 35 lines
I'm still a little bit confused about the real need for the "ti,omap4-wdt: entry, but it seems to be the way to do it in PPC.
Quoted 19 lines
Quoted 19 lines
Quoted 8 lines
drivers/watchdog/omap_wdt.c +4
-0+ {}, +}; +MODULE_DEVICE_TABLE (of, omap_wdt_of_match); +static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe,.remove =
__devexit_p(omap_wdt_remove),drivers/watchdog/omap_wdt.c static struct platform_driver omap_wdt_driver = { · line 452
Quoted 7 lines
drivers/watchdog/omap_wdt.c +1
-0@@ -439,6 +446,7 @@ static struct platform_driver omap_wdt_driver = { .driver = { .owner = THIS_MODULE, .name = "omap_wdt", + .of_match_table = omap_wdt_of_match, }, };I think we need to add some code to the probe function that calls
of_match_device()and ensures we find a match. For example ...Quoted 5 lines
Quoted 4 lines
if (
of_have_populated_dt())
if (!of_match_device(omap_wdt_of_match,&pdev->dev)) return-EINVAL;Will add it in v2, thanks for suggestion.
No, in fact this is not needed. We need that mainly when several instances can match the same driver and thus we select the proper one using the
of_match_device. Otherwise, just check is thedevice_nodeis there.In that case, the driver does not even care about any DT node so there is no need to add extra code for that. Keep it simple.
Quoted 6 lines
Quoted 2 lines
Ok. So are you saying get rid of the match table altogether? In other words, drop this patch?
No, the match table is used by the LDM to find the proper driver to be bound to a device. So we do need it. But we do not have to use the
of_match_deviceif we do not want to get the entry in the device table.
Ok, thanks.
Quoted 6 lines
Quoted 3 lines
I agree that it does not really do anything today, but I did not know if in the future you were planning to pass things like, register addresses, via DT.
Well, yes we will have to, otherwise people will keep complaining that our DTS sucks and are not compliant with the DTS standards :-)
Ok.
Jon
Hi Xiao Jiang,
Quoted 3 lines · On 05/25/2012 05:42 AM, jgq516 at gmail.com wrote:
From: Xiao Jiang <[email protected]>
This series can be applied to dt branch of linux-omap tree.
Thanks for sending this!
Quoted 4 lines
Since omap24xx series has different wdt base addr (omap2420:
0x48022000and
omap2430:0x49016000) per commit2817142f31bfbf26c216bf4f9192540c81b2d071, so I don't add wdt node inomap2.dtsijust like omap3 and omap4, maybe different dts files are needed for omap2420 and omap2430.
Good point. I am wondering if we can simple drop the address from the wdt2 node for omap2. It is not really being used. May be Benoit can comment.
Cheers
Jon
Quoted 13 lines
Tested with omap4430 blaze board.
Xiao Jiang (3):
arm/dts: add wdt node for omap3 and omap4
OMAP: wdt: add device tree support
watchdog:omap_wdt: add device tree supportarch/arm/boot/dts/omap3.dtsi | 5 +++++ arch/arm/boot/dts/omap4.dtsi | 5 +++++ arch/arm/mach-omap2/devices.c | 2 +- drivers/watchdog/omap_wdt.c | 8 ++++++++ 4 files changed, 19 insertions(+), 1 deletions(-)
Quoted 12 lines · Jon Hunter
Hi Xiao Jiang,
Quoted 4 lines · On 05/25/2012 05:42 AM, [email protected] wrote:
From: Xiao Jiang <[email protected]>
This series can be applied to dt branch of linux-omap tree.
Thanks for sending this!
Quoted 10 lines
Quoted 5 lines
Since omap24xx series has different wdt base addr (omap2420:
0x48022000and
omap2430:0x49016000) per commit2817142f31bfbf26c216bf4f9192540c81b2d071, so I don't add wdt node inomap2.dtsijust like omap3 and omap4, maybe different dts files are needed for omap2420 and omap2430.Good point. I am wondering if we can simple drop the address from the wdt2 node for omap2. It is not really being used. May be Benoit can comment.
Hmm, I think the address doesn't need anymore since the related hw_mod has the right addr as follows.
static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = {
{
.pa_start = 0x48022000,
.pa_end = 0x4802207f,
.flags = ADDR_TYPE_RT
},
{ }
};static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = {
{
.pa_start = 0x49016000,
.pa_end = 0x4901607f,
.flags = ADDR_TYPE_RT
},
{ }
};static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = {
{
.pa_start = 0x48314000,
.pa_end = 0x4831407f,
.flags = ADDR_TYPE_RT
},
{ }
};static struct omap_hwmod_addr_space omap44xx_wd_timer2_addrs[] = {
{
.pa_start = 0x4a313000,
.pa_end = 0x4a31407f,
.flags = ADDR_TYPE_RT
},
{ }
};Regards,
Xiao
Quoted 2 lines
Cheers
Jon