Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Sep 2016 10:00:58 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r306489 - head/sys/arm/broadcom/bcm2835
Message-ID:  <201609301000.u8UA0wSN081971@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Fri Sep 30 10:00:57 2016
New Revision: 306489
URL: https://svnweb.freebsd.org/changeset/base/306489

Log:
  bcm2835_cpufreq: Only attach driver if we correcly match on the machine
  compatible string.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c	Fri Sep 30 09:23:29 2016	(r306488)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c	Fri Sep 30 10:00:57 2016	(r306489)
@@ -44,6 +44,11 @@ __FBSDID("$FreeBSD$");
 #include <machine/cpu.h>
 #include <machine/intr.h>
 
+#include <dev/fdt/fdt_common.h>
+
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
 #include <arm/broadcom/bcm2835/bcm2835_mbox.h>
 #include <arm/broadcom/bcm2835/bcm2835_mbox_prop.h>
 #include <arm/broadcom/bcm2835/bcm2835_vcbus.h>
@@ -119,6 +124,13 @@ struct bcm2835_cpufreq_softc {
 	struct intr_config_hook	init_hook;
 };
 
+static struct ofw_compat_data compat_data[] = {
+	{ "broadcom,bcm2835-vc",	1 },
+	{ "broadcom,bcm2708-vc",	1 },
+	{ "brcm,bcm2709",	1 },
+	{ NULL, 0 }
+};
+
 static int cpufreq_verbose = 0;
 TUNABLE_INT("hw.bcm2835.cpufreq.verbose", &cpufreq_verbose);
 static int cpufreq_lowest_freq = DEFAULT_LOWEST_FREQ;
@@ -1244,6 +1256,16 @@ bcm2835_cpufreq_init(void *arg)
 static void
 bcm2835_cpufreq_identify(driver_t *driver, device_t parent)
 {
+	const struct ofw_compat_data *compat;
+	phandle_t root;
+
+	root = OF_finddevice("/");
+	for (compat = compat_data; compat->ocd_str != NULL; compat++)
+		if (fdt_is_compatible(root, compat->ocd_str))
+			break;
+
+	if (compat->ocd_data == 0)
+		return;
 
 	DPRINTF("driver=%p, parent=%p\n", driver, parent);
 	if (device_find_child(parent, "bcm2835_cpufreq", -1) != NULL)



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