mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
Make VCHI driver compatible with upstream DT
- Add compatibility string - Compensate difference in base address between our custom DTB and upstream one
This commit is contained in:
parent
43be86e31b
commit
79f6c27f4c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=307095
@ -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);
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user