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
This commit is contained in:
Ian Lepore 2017-10-02 00:49:33 +00:00
parent 3f43239f21
commit c5765d84ac
4 changed files with 15 additions and 6 deletions

View File

@ -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

View File

@ -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");

View File

@ -30,7 +30,7 @@
/ {
model = "Raspberry Pi 2 Model B";
compatible = "brcm,bcm2709";
compatible = "brcm,bcm2836";
memreserve = <0x08000000 0x08000000>; /* Set by VideoCore */

View File

@ -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)