diff mbox series

[v2,1/3] ARM: dts: aspeed: Add WDT controller into alias field

Message ID 20241028024813.2416962-2-chin-ting_kuo@aspeedtech.com
State New
Headers show
Series Update ASPEED WDT bootstatus | expand

Commit Message

Chin-Ting Kuo Oct. 28, 2024, 2:48 a.m. UTC
Add WDT controller into alias field. After that, WDT index,
used to distinguish different WDT controllers in the driver,
can be gotten by using of_alias_get_id dts API.

Signed-off-by: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
---
 arch/arm/boot/dts/aspeed/aspeed-g4.dtsi | 2 ++
 arch/arm/boot/dts/aspeed/aspeed-g5.dtsi | 3 +++
 arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 4 ++++
 3 files changed, 9 insertions(+)

Comments

Andrew Jeffery Oct. 28, 2024, 11:55 p.m. UTC | #1
On Mon, 2024-10-28 at 10:48 +0800, Chin-Ting Kuo wrote:
> Add WDT controller into alias field. After that, WDT index,
> used to distinguish different WDT controllers in the driver,
> can be gotten by using of_alias_get_id dts API.

I feel it would be less brittle if we encode the mapping in the driver?
Based on reg the driver can derive the watchdog index. That way there's
no constraint on how the platform architect arranges the aliases for
the watchdogs (if they define them at all).

Andrew
Chin-Ting Kuo Oct. 29, 2024, 2:32 a.m. UTC | #2
Hi Andrew,

Thanks for the check.

> -----Original Message-----
> From: Andrew Jeffery <andrew@codeconstruct.com.au>
> Sent: Tuesday, October 29, 2024 7:55 AM
> Subject: Re: [PATCH v2 1/3] ARM: dts: aspeed: Add WDT controller into alias
> field
> 
> On Mon, 2024-10-28 at 10:48 +0800, Chin-Ting Kuo wrote:
> > Add WDT controller into alias field. After that, WDT index, used to
> > distinguish different WDT controllers in the driver, can be gotten by
> > using of_alias_get_id dts API.
> 
> I feel it would be less brittle if we encode the mapping in the driver?
> Based on reg the driver can derive the watchdog index. That way there's no
> constraint on how the platform architect arranges the aliases for the
> watchdogs (if they define them at all).
> 

It is also a feasible approach. It will be changed in the next patch version.

> Andrew

Chin-Ting
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/aspeed/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed/aspeed-g4.dtsi
index 78c967812492..d8b4136d0ca0 100644
--- a/arch/arm/boot/dts/aspeed/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed/aspeed-g4.dtsi
@@ -29,6 +29,8 @@  aliases {
 		serial3 = &uart4;
 		serial4 = &uart5;
 		serial5 = &vuart;
+		watchdog0 = &wdt1;
+		watchdog1 = &wdt2;
 	};
 
 	cpus {
diff --git a/arch/arm/boot/dts/aspeed/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed/aspeed-g5.dtsi
index 57a699a7c149..4dd220bca617 100644
--- a/arch/arm/boot/dts/aspeed/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed/aspeed-g5.dtsi
@@ -30,6 +30,9 @@  aliases {
 		serial3 = &uart4;
 		serial4 = &uart5;
 		serial5 = &vuart;
+		watchdog0 = &wdt1;
+		watchdog1 = &wdt2;
+		watchdog2 = &wdt3;
 	};
 
 	cpus {
diff --git a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi
index 8ed715bd53aa..c0a47c795fff 100644
--- a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi
+++ b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi
@@ -40,6 +40,10 @@  aliases {
 		mdio1 = &mdio1;
 		mdio2 = &mdio2;
 		mdio3 = &mdio3;
+		watchdog0 = &wdt1;
+		watchdog1 = &wdt2;
+		watchdog2 = &wdt3;
+		watchdog3 = &wdt4;
 	};