Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Feb 2020 17:12:15 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357370 - head/sys/riscv/sifive
Message-ID:  <202002011712.011HCFhG031641@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mhorne
Date: Sat Feb  1 17:12:15 2020
New Revision: 357370
URL: https://svnweb.freebsd.org/changeset/base/357370

Log:
  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

Modified:
  head/sys/riscv/sifive/fu540_prci.c

Modified: head/sys/riscv/sifive/fu540_prci.c
==============================================================================
--- head/sys/riscv/sifive/fu540_prci.c	Sat Feb  1 17:09:56 2020	(r357369)
+++ head/sys/riscv/sifive/fu540_prci.c	Sat Feb  1 17:12:15 2020	(r357370)
@@ -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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002011712.011HCFhG031641>