svn commit: r352363 - head/sys/arm/freescale/imx

Ian Lepore ian at FreeBSD.org
Sun Sep 15 19:38:16 UTC 2019


Author: ian
Date: Sun Sep 15 19:38:15 2019
New Revision: 352363
URL: https://svnweb.freebsd.org/changeset/base/352363

Log:
  Apply a runtime patch to the FDT data for imx6 to fix iomuxc problems.
  
  The latest imported FDT data defines a node for an iomuxc-gpr device,
  which we don't support (or need, right now) in addition to the usual
  iomuxc device.  Unfortunately, the dts improperly assigns overlapping
  ranges of mmio space to both devices.  The -gpr device is also a syscon
  and simple_mfd device.
  
  At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then
  when the real iomuxc driver comes along later, it fails to attach because
  it tries to allocate its register space, and it's already partially in
  use by the bogus instance of simple_mfd.
  
  This change works around the problem by simply disabling the node for
  the iomuxc-gpr device, since we don't need it for anything.

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 Sep 15 19:16:42 2019	(r352362)
+++ head/sys/arm/freescale/imx/imx6_machdep.c	Sun Sep 15 19:38:15 2019	(r352363)
@@ -148,12 +148,43 @@ fix_fdt_interrupt_data(void)
 	OF_setprop(socnode, "interrupt-parent", &gicxref, sizeof(gicxref));
 }
 
+static void
+fix_fdt_iomuxc_data(void)
+{
+	phandle_t node;
+
+	/*
+	 * The linux dts defines two nodes with the same mmio address range,
+	 * iomuxc-gpr and the regular iomuxc.  The -grp node is a simple_mfd and
+	 * a syscon, but it only has access to a small subset of the iomuxc
+	 * registers, so it can't serve as the accessor for the iomuxc driver's
+	 * register IO.  But right now, the simple_mfd driver attaches first,
+	 * preventing the real iomuxc driver from allocating its mmio register
+	 * range because it partially overlaps with the -gpr range.
+	 *
+	 * For now, by far the easiest thing to do to keep imx6 working is to
+	 * just disable the iomuxc-gpr node because we don't have a driver for
+	 * it anyway, we just need to prevent attachment of simple_mfd.
+	 *
+	 * If we ever write a -gpr driver, this code should probably switch to
+	 * modifying the reg property so that the range covers all the iomuxc
+	 * regs, then the -gpr driver can be a regular syscon driver that iomuxc
+	 * uses for register access.
+	 */
+	node = OF_finddevice("/soc/aips-bus at 2000000/iomuxc-gpr at 20e0000");
+	if (node != -1)
+		OF_setprop(node, "status", "disabled", sizeof("disabled"));
+}
+
 static int
 imx6_attach(platform_t plat)
 {
 
 	/* Fix soc interrupt-parent property. */
 	fix_fdt_interrupt_data();
+
+	/* Fix iomuxc-gpr and iomuxc nodes both using the same mmio range. */
+	fix_fdt_iomuxc_data();
 
 	/* Inform the MPCore timer driver that its clock is variable. */
 	arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES);


More information about the svn-src-head mailing list