From owner-svn-src-all@freebsd.org Sat Feb 1 17:12:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29CE81FCCFD; Sat, 1 Feb 2020 17:12:16 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4890y73bvMz3Hvc; Sat, 1 Feb 2020 17:12:15 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 766FA229C; Sat, 1 Feb 2020 17:12:15 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 011HCFKZ031642; Sat, 1 Feb 2020 17:12:15 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 011HCFhG031641; Sat, 1 Feb 2020 17:12:15 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202002011712.011HCFhG031641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 1 Feb 2020 17:12:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357370 - head/sys/riscv/sifive X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/sifive X-SVN-Commit-Revision: 357370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Feb 2020 17:12:16 -0000 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 +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; }