aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/allwinner/aw_rtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm/allwinner/aw_rtc.c')
-rw-r--r--sys/arm/allwinner/aw_rtc.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/sys/arm/allwinner/aw_rtc.c b/sys/arm/allwinner/aw_rtc.c
index 9938601f17ce..4af57ab879e8 100644
--- a/sys/arm/allwinner/aw_rtc.c
+++ b/sys/arm/allwinner/aw_rtc.c
@@ -134,6 +134,7 @@ 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 }
@@ -147,11 +148,13 @@ 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);
@@ -250,23 +253,33 @@ aw_rtc_install_clocks(struct aw_rtc_softc *sc, device_t dev) {
int nclocks;
node = ofw_bus_get_node(dev);
- nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", &clknames);
- /* No clocks to export */
- if (nclocks <= 0)
- return;
- if (nclocks != 3) {
- device_printf(dev, "Having only %d clocks instead of 3, aborting\n", nclocks);
+ /* Nothing to do. */
+ if (!OF_hasprop(node, "clocks"))
return;
+
+ /*
+ * If the device tree gives us specific output names for the clocks,
+ * use them.
+ */
+ nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", &clknames);
+ if (nclocks > 0) {
+ if (nclocks != 3) {
+ device_printf(dev,
+ "Found %d clocks names instead of 3, aborting\n",
+ nclocks);
+ return;
+ }
+
+ aw_rtc_osc32k.clkdef.name = clknames[0];
+ aw_rtc_iosc.clkdef.name = clknames[2];
}
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");