prci: fix up compat

Add two additional compat strings that can be used to identify the PRCI.

With newer device trees the PRCI has two parents, hfclk and rtcclk, so
allow the driver to attach when more than one parent is found.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D23405
This commit is contained in:
Mitchell Horne 2020-02-01 17:12:15 +00:00
parent f6029f2bc9
commit adec0ce785
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357370

View File

@ -52,6 +52,13 @@ __FBSDID("$FreeBSD$");
#include <gnu/dts/include/dt-bindings/clock/sifive-fu540-prci.h>
static struct ofw_compat_data compat_data[] = {
{ "sifive,aloeprci0", 1 },
{ "sifive,ux00prci0", 1 },
{ "sifive,fu540-c000-prci", 1 },
{ NULL, 0 },
};
static struct resource_spec prci_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
RESOURCE_SPEC_END
@ -177,7 +184,7 @@ prci_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (!ofw_bus_is_compatible(dev, "sifive,aloeprci0"))
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
device_set_desc(dev, "SiFive FU540 Power Reset Clocking Interrupt");
@ -229,7 +236,7 @@ prci_attach(device_t dev)
node = ofw_bus_get_node(dev);
error = ofw_bus_parse_xref_list_get_length(node, "clocks",
"#clock-cells", &ncells);
if (error != 0 || ncells != 1) {
if (error != 0 || ncells < 1) {
device_printf(dev, "couldn't find parent clock\n");
goto fail;
}