Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Sep 2017 10:43:02 +0000 (UTC)
From:      Olivier Houchard <cognet@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323490 - head/sys/arm/ti
Message-ID:  <201709121043.v8CAh2tE066737@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cognet
Date: Tue Sep 12 10:43:02 2017
New Revision: 323490
URL: https://svnweb.freebsd.org/changeset/base/323490

Log:
  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

Modified:
  head/sys/arm/ti/ti_cpuid.c
  head/sys/arm/ti/ti_cpuid.h
  head/sys/arm/ti/ti_scm.c

Modified: head/sys/arm/ti/ti_cpuid.c
==============================================================================
--- head/sys/arm/ti/ti_cpuid.c	Tue Sep 12 06:34:02 2017	(r323489)
+++ head/sys/arm/ti/ti_cpuid.c	Tue Sep 12 10:43:02 2017	(r323490)
@@ -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:

Modified: head/sys/arm/ti/ti_cpuid.h
==============================================================================
--- head/sys/arm/ti/ti_cpuid.h	Tue Sep 12 06:34:02 2017	(r323489)
+++ head/sys/arm/ti/ti_cpuid.h	Tue Sep 12 10:43:02 2017	(r323490)
@@ -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_ */

Modified: head/sys/arm/ti/ti_scm.c
==============================================================================
--- head/sys/arm/ti/ti_scm.c	Tue Sep 12 06:34:02 2017	(r323489)
+++ head/sys/arm/ti/ti_scm.c	Tue Sep 12 10:43:02 2017	(r323490)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/fdt/fdt_pinctrl.h>
 
 #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);
 



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