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.
This commit is contained in:
Ian Lepore 2019-09-15 19:38:15 +00:00
parent 52f6a8090e
commit 7887a5a140
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=352363

View File

@ -148,6 +148,34 @@ 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@2000000/iomuxc-gpr@20e0000");
if (node != -1)
OF_setprop(node, "status", "disabled", sizeof("disabled"));
}
static int
imx6_attach(platform_t plat)
{
@ -155,6 +183,9 @@ 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);