Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Oct 2017 00:49:34 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
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
Message-ID:  <201710020049.v920nYtW036432@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sylgar@gmail.com>
  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)



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