From owner-svn-src-head@freebsd.org Mon Oct 2 00:49:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8575CE32622; Mon, 2 Oct 2017 00:49:35 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id 511CB748AA; Mon, 2 Oct 2017 00:49:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v920nYgt036436; Mon, 2 Oct 2017 00:49:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v920nYtW036432; Mon, 2 Oct 2017 00:49:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710020049.v920nYtW036432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 2 Oct 2017 00:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324184 - in head/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm dev/usb/net X-SVN-Commit-Revision: 324184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Oct 2017 00:49:35 -0000 Author: ian Date: Mon Oct 2 00:49:33 2017 New Revision: 324184 URL: https://svnweb.freebsd.org/changeset/base/324184 Log: Allow Raspberry Pi platform and drivers to be configured with upstream DTBs. - Added more compatibility strings to drivers not yet converted - Added new RPI platform code compatibility string to match the ones used upstream - Adapted RPI and RPI2 DTS to match the new platform code compatibility string The goal is to use the upstream DTBs as a replacement for our custom one. This is now possible with these changes. Additionally, as the RPI firmware automatically chooses the right DTB for us, this would allow to have one common armv6 kernel for RPI0 and RPI1 (BCM2835-based), and one common armv7 kernel for RPI2 v1.1 (BCM2836-based), and RPI2 v1.2 / RPI3 (BCM2837-based). Submitted by: Sylvain Garrigues Differential Revision: https://reviews.freebsd.org/D12360 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c head/sys/arm/broadcom/bcm2835/bcm2835_rng.c head/sys/boot/fdt/dts/arm/rpi2.dts head/sys/dev/usb/net/if_smsc.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Oct 2 00:08:58 2017 (r324183) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Oct 2 00:49:33 2017 (r324184) @@ -133,7 +133,8 @@ static platform_method_t bcm2835_methods[] = { PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b", 100); +FDT_PLATFORM_DEF2(bcm2835, bcm2835_legacy, "bcm2835 (legacy)", 0, "raspberrypi,model-b", 100); +FDT_PLATFORM_DEF2(bcm2835, bcm2835, "bcm2835", 0, "brcm,bcm2835", 100); #endif #ifdef SOC_BCM2836 @@ -149,5 +150,6 @@ static platform_method_t bcm2836_methods[] = { PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709", 100); +FDT_PLATFORM_DEF2(bcm2836, bcm2836_legacy, "bcm2836 (legacy)", 0, "brcm,bcm2709", 100); +FDT_PLATFORM_DEF2(bcm2836, bcm2836, "bcm2836", 0, "brcm,bcm2836", 100); #endif Modified: head/sys/arm/broadcom/bcm2835/bcm2835_rng.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_rng.c Mon Oct 2 00:08:58 2017 (r324183) +++ head/sys/arm/broadcom/bcm2835/bcm2835_rng.c Mon Oct 2 00:49:33 2017 (r324184) @@ -109,6 +109,12 @@ struct bcm2835_rng_softc { long sc_underrun; }; +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-rng", 1}, + {"brcm,bcm2835-rng", 1}, + {NULL, 0} +}; + static __inline void bcm2835_rng_stat_inc_underrun(struct bcm2835_rng_softc *sc) { @@ -364,7 +370,7 @@ bcm2835_rng_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-rng")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "Broadcom BCM2835 RNG"); Modified: head/sys/boot/fdt/dts/arm/rpi2.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/rpi2.dts Mon Oct 2 00:08:58 2017 (r324183) +++ head/sys/boot/fdt/dts/arm/rpi2.dts Mon Oct 2 00:49:33 2017 (r324184) @@ -30,7 +30,7 @@ / { model = "Raspberry Pi 2 Model B"; - compatible = "brcm,bcm2709"; + compatible = "brcm,bcm2836"; memreserve = <0x08000000 0x08000000>; /* Set by VideoCore */ Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Mon Oct 2 00:08:58 2017 (r324183) +++ head/sys/dev/usb/net/if_smsc.c Mon Oct 2 00:49:33 2017 (r324184) @@ -1568,8 +1568,9 @@ smsc_fdt_find_eth_node(phandle_t start) /* Traverse through entire tree to find usb ethernet nodes. */ for (node = OF_child(start); node != 0; node = OF_peer(node)) { - if (ofw_bus_node_is_compatible(node, "net,ethernet") && - ofw_bus_node_is_compatible(node, "usb,device")) + if ((ofw_bus_node_is_compatible(node, "net,ethernet") && + ofw_bus_node_is_compatible(node, "usb,device")) || + ofw_bus_node_is_compatible(node, "usb424,ec00")) return (node); child = smsc_fdt_find_eth_node(node); if (child != -1)