git: 3816452ecac6 - main - Revert "riscv: enable allwinner RTC"

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Tue, 04 Mar 2025 15:26:02 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=3816452ecac64dcd2708c67fe0a1193d5e06feac

commit 3816452ecac64dcd2708c67fe0a1193d5e06feac
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2025-03-04 15:20:55 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2025-03-04 15:25:56 +0000

    Revert "riscv: enable allwinner RTC"
    
    It caused a regression on A10/A20 platforms. Revert until the proper fix
    can be determined.
    
    This reverts commit 9ddd516b886218af809dbf40eeda1ed388e2879c.
    
    PR:             285054
    Reported by:    mmel
---
 sys/arm/allwinner/aw_rtc.c          | 24 ++++++++----------------
 sys/riscv/allwinner/files.allwinner |  1 -
 sys/riscv/conf/std.allwinner        |  1 -
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/sys/arm/allwinner/aw_rtc.c b/sys/arm/allwinner/aw_rtc.c
index a13c0e7d926e..9938601f17ce 100644
--- a/sys/arm/allwinner/aw_rtc.c
+++ b/sys/arm/allwinner/aw_rtc.c
@@ -134,7 +134,6 @@ static struct ofw_compat_data compat_data[] = {
 	{ "allwinner,sun7i-a20-rtc", (uintptr_t) &a20_conf },
 	{ "allwinner,sun6i-a31-rtc", (uintptr_t) &a31_conf },
 	{ "allwinner,sun8i-h3-rtc", (uintptr_t) &h3_conf },
-	{ "allwinner,sun20i-d1-rtc", (uintptr_t) &h3_conf },
 	{ "allwinner,sun50i-h5-rtc", (uintptr_t) &h3_conf },
 	{ "allwinner,sun50i-h6-rtc", (uintptr_t) &h3_conf },
 	{ NULL, 0 }
@@ -148,13 +147,11 @@ struct aw_rtc_softc {
 
 static struct clk_fixed_def aw_rtc_osc32k = {
 	.clkdef.id = 0,
-	.clkdef.name = "osc32k",
 	.freq = 32768,
 };
 
 static struct clk_fixed_def aw_rtc_iosc = {
 	.clkdef.id = 2,
-	.clkdef.name = "iosc",
 };
 
 static void	aw_rtc_install_clocks(struct aw_rtc_softc *sc, device_t dev);
@@ -252,29 +249,24 @@ aw_rtc_install_clocks(struct aw_rtc_softc *sc, device_t dev) {
 	phandle_t node;
 	int nclocks;
 
-	/*
-	 * If the device tree gives us specific output names for the clocks,
-	 * use them.
-	 */
 	node = ofw_bus_get_node(dev);
 	nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", &clknames);
-	if (nclocks > 0) {
-		if (nclocks != 3) {
-			device_printf(dev,
-			    "Found %d clocks instead of 3, aborting\n",
-			    nclocks);
-			return;
-		}
+	/* No clocks to export */
+	if (nclocks <= 0)
+		return;
 
-		aw_rtc_osc32k.clkdef.name = clknames[0];
-		aw_rtc_iosc.clkdef.name = clknames[2];
+	if (nclocks != 3) {
+		device_printf(dev, "Having only %d clocks instead of 3, aborting\n", nclocks);
+		return;
 	}
 
 	clkdom = clkdom_create(dev);
 
+	aw_rtc_osc32k.clkdef.name = clknames[0];
 	if (clknode_fixed_register(clkdom, &aw_rtc_osc32k) != 0)
 		device_printf(dev, "Cannot register osc32k clock\n");
 
+	aw_rtc_iosc.clkdef.name = clknames[2];
 	aw_rtc_iosc.freq = sc->conf->iosc_freq;
 	if (clknode_fixed_register(clkdom, &aw_rtc_iosc) != 0)
 		device_printf(dev, "Cannot register iosc clock\n");
diff --git a/sys/riscv/allwinner/files.allwinner b/sys/riscv/allwinner/files.allwinner
index 73fa9660e2d2..423a89c10c78 100644
--- a/sys/riscv/allwinner/files.allwinner
+++ b/sys/riscv/allwinner/files.allwinner
@@ -1,6 +1,5 @@
 
 arm/allwinner/aw_gpio.c			optional gpio aw_gpio fdt
-arm/allwinner/aw_rtc.c			optional aw_rtc fdt
 arm/allwinner/aw_syscon.c		optional syscon
 arm/allwinner/aw_sid.c			optional aw_sid nvmem
 arm/allwinner/aw_timer.c		optional aw_timer fdt
diff --git a/sys/riscv/conf/std.allwinner b/sys/riscv/conf/std.allwinner
index 2b1e0d4e09dc..1bf6b027a4cb 100644
--- a/sys/riscv/conf/std.allwinner
+++ b/sys/riscv/conf/std.allwinner
@@ -7,7 +7,6 @@ options 	SOC_ALLWINNER_D1
 
 device		aw_ccu		# Allwinner clock controller
 device		aw_gpio		# Allwinner GPIO controller
-device		aw_rtc		# Allwinner Real-time Clock
 device		aw_sid		# Allwinner Secure ID EFUSE
 device		aw_timer	# Allwinner Timer
 device		aw_usbphy	# Allwinner USB PHY