Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Apr 2017 20:41:01 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316661 - head/sys/arm/freescale/imx
Message-ID:  <201704092041.v39Kf1U4030323@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sun Apr  9 20:41:00 2017
New Revision: 316661
URL: https://svnweb.freebsd.org/changeset/base/316661

Log:
  Update the code that compensates for the lack of a GPC interrupt controller
  driver for imx6.  Some newer dts source puts the GIC node at the root
  instead of under /soc, so look in both places.  Also, sometimes the GIC
  node doesn't list itself as its own interrupt-parent, allow that too.

Modified:
  head/sys/arm/freescale/imx/imx6_machdep.c

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_machdep.c	Sun Apr  9 19:30:49 2017	(r316660)
+++ head/sys/arm/freescale/imx/imx6_machdep.c	Sun Apr  9 20:41:00 2017	(r316661)
@@ -78,7 +78,7 @@ static platform_cpu_reset_t imx6_cpu_res
  * We validate that we have data that looks like we expect before changing it:
  *  - SOC node exists and has GPC as its interrupt parent.
  *  - GPC node exists and has GIC as its interrupt parent.
- *  - GIC node exists and is its own interrupt parent.
+ *  - GIC node exists and is its own interrupt parent or has no parent.
  *
  * This applies to all models of imx6.  Luckily all of them have the devices
  * involved at the same addresses on the same buses, so we don't need any
@@ -102,14 +102,20 @@ fix_fdt_interrupt_data(void)
 	if (result <= 0)
 		return;
 
+	/* GIC node may be child of soc node, or appear directly at root. */
 	gicnode = OF_finddevice("/soc/interrupt-controller@00a01000");
+	if (gicnode == -1) {
+		gicnode = OF_finddevice("/interrupt-controller@00a01000");
 	if (gicnode == -1)
 		return;
+	}
+	gicxref = OF_xref_from_node(gicnode);
+
+	/* If gic node has no parent, pretend it is its own parent. */
 	result = OF_getencprop(gicnode, "interrupt-parent", &gicipar,
 	    sizeof(gicipar));
 	if (result <= 0)
-		return;
-	gicxref = OF_xref_from_node(gicnode);
+		gicipar = gicxref;
 
 	gpcnode = OF_finddevice("/soc/aips-bus@02000000/gpc@020dc000");
 	if (gpcnode == -1)



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