summaryrefslogtreecommitdiffstats
path: root/sys/contrib
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2016-10-18 19:15:43 +0000
committergonzo <gonzo@FreeBSD.org>2016-10-18 19:15:43 +0000
commitd22dbc027acd8e1fb3a6cae3a949d867aa316cac (patch)
treead5aa9489837faa3ba112340e078e7b0c35b9e8a /sys/contrib
parent409b6e99037bc3adddcd7fd011bc139e45a45d4e (diff)
downloadFreeBSD-src-d22dbc027acd8e1fb3a6cae3a949d867aa316cac.zip
FreeBSD-src-d22dbc027acd8e1fb3a6cae3a949d867aa316cac.tar.gz
MFC r307067, r307068, r307087, r307088, r307089,
r307091, r307092, r307093, r307095, r307098, r307115: r307067: Make intc driver compatible with upstream DTS - Fix compatibility strings - Properly decode upstream's two-cell interrupt specs. Our home-made dts does not have two-cell interrupts so no need to preserve backward compatibility r307068: Make Rapsberry Pi watchdog driver compatible with upstream DTS - Fix compatibility strings - Compensate the difference in base address for our custom DTS and upstream one (for backward compatibility) r307087: Make sure intc is attached before interrupt consumers If pass order is not specified devices are attached in the order they are defined in dts. Some interrupt consumers may be defined before intc. Also make sure intc interrupt-parent local_intc is attached before intc itself. r307088: Add compatible strings used in upstream dts files r307089: Make framebuffer driver compatible with upstream DT - Add compatibility string - Add simplebus as possible parent bus r307091: Add compatibility string from upstream DT r307092: Make BCM2835 GPIO driver compatible with upstream DT - Add compatibility string - Make reserverd and read-only properties optional r307093: Make BCM283x USB driver compatible with upstream DT - Make resource allocation logic depend on compatibility string to check what format of DTS node should be used - FreeBSD's or upstream r307095: Make VCHI driver compatible with upstream DT - Add compatibility string - Compensate difference in base address between our custom DTB and upstream one r307098: Make BCM28x USB driver compatible with upstream device tree This should have been committed in r307093: resource allocation depends on source of the device tree. upstream dts has extra interrupt that we can ignore r307115: Fix typo in comment Spotted by: loos
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c
index 93aa6f8..53d1819 100644
--- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c
+++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c
@@ -73,14 +73,25 @@ struct bcm_vchiq_softc {
void* intr_hl;
bus_space_tag_t bst;
bus_space_handle_t bsh;
+ int regs_offset;
};
static struct bcm_vchiq_softc *bcm_vchiq_sc = NULL;
+#define BSD_DTB 1
+#define UPSTREAM_DTB 2
+static struct ofw_compat_data compat_data[] = {
+ {"broadcom,bcm2835-vchiq", BSD_DTB},
+ {"brcm,bcm2835-vchiq", UPSTREAM_DTB},
+ {NULL, 0}
+};
+
#define vchiq_read_4(reg) \
- bus_space_read_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, reg)
+ bus_space_read_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, (reg) + \
+ bcm_vchiq_sc->regs_offset)
#define vchiq_write_4(reg, val) \
- bus_space_write_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, reg, val)
+ bus_space_write_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, (reg) + \
+ bcm_vchiq_sc->regs_offset, val)
/*
* Extern functions */
@@ -122,12 +133,11 @@ static int
bcm_vchiq_probe(device_t dev)
{
- if (ofw_bus_is_compatible(dev, "broadcom,bcm2835-vchiq")) {
- device_set_desc(dev, "BCM2835 VCHIQ");
- return(BUS_PROBE_DEFAULT);
- }
+ if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
+ return (ENXIO);
- return (ENXIO);
+ device_set_desc(dev, "BCM2835 VCHIQ");
+ return (BUS_PROBE_DEFAULT);
}
static int
@@ -157,6 +167,9 @@ bcm_vchiq_attach(device_t dev)
return (ENXIO);
}
+ if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == UPSTREAM_DTB)
+ sc->regs_offset = -0x40;
+
node = ofw_bus_get_node(dev);
if ((OF_getencprop(node, "cache-line-size", &cell, sizeof(cell))) > 0)
g_cache_line_size = cell;
OpenPOWER on IntegriCloud