From 5d0707d5323d6826b95b7f94f6c6e29f794a58d3 Mon Sep 17 00:00:00 2001 From: cognet Date: Tue, 12 Sep 2017 10:43:02 +0000 Subject: [PATCH] Some devices come with the same name as TI devices, so we can't rely on the "probe" method of those drivers to mean we're on e TI SoC. Introduce a new function, ti_soc_is_supported(), and use it to be sure we're really a TI system. PR: 222250 --- sys/arm/ti/ti_cpuid.c | 6 +----- sys/arm/ti/ti_cpuid.h | 6 ++++++ sys/arm/ti/ti_scm.c | 5 +++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/arm/ti/ti_cpuid.c b/sys/arm/ti/ti_cpuid.c index ca64c811dfaf..354d7325c459 100644 --- a/sys/arm/ti/ti_cpuid.c +++ b/sys/arm/ti/ti_cpuid.c @@ -272,11 +272,7 @@ am335x_get_revision(void) static void ti_cpu_ident(void *dummy) { - phandle_t root; - - root = OF_finddevice("/"); - if (!ofw_bus_node_is_compatible(root, "ti,omap4") && - !ofw_bus_node_is_compatible(root, "ti,am33xx")) + if (!ti_soc_is_supported()) return; switch(ti_chip()) { case CHIP_OMAP_4: diff --git a/sys/arm/ti/ti_cpuid.h b/sys/arm/ti/ti_cpuid.h index 715f080e5ff7..7b2eb1618292 100644 --- a/sys/arm/ti/ti_cpuid.h +++ b/sys/arm/ti/ti_cpuid.h @@ -80,4 +80,10 @@ static __inline int ti_chip(void) uint32_t ti_revision(void); +static __inline bool ti_soc_is_supported(void) +{ + + return (_ti_chip != -1); +} + #endif /* _TI_CPUID_H_ */ diff --git a/sys/arm/ti/ti_scm.c b/sys/arm/ti/ti_scm.c index bc7861828f16..daeb89e5ccf8 100644 --- a/sys/arm/ti/ti_scm.c +++ b/sys/arm/ti/ti_scm.c @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include "ti_scm.h" +#include "ti_cpuid.h" static struct resource_spec ti_scm_res_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Control memory window */ @@ -86,6 +87,10 @@ static struct ti_scm_softc *ti_scm_sc; static int ti_scm_probe(device_t dev) { + + if (!ti_soc_is_supported()) + return (ENXIO); + if (!ofw_bus_status_okay(dev)) return (ENXIO);