From owner-svn-src-releng@freebsd.org Sun Sep 29 18:33:30 2019 Return-Path: Delivered-To: svn-src-releng@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 425F712748C; Sun, 29 Sep 2019 18:33:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46hDgZ12c0z3Kdl; Sun, 29 Sep 2019 18:33:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 068661E364; Sun, 29 Sep 2019 18:33:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8TIXT3p047124; Sun, 29 Sep 2019 18:33:29 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8TIXTso047123; Sun, 29 Sep 2019 18:33:29 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201909291833.x8TIXTso047123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 29 Sep 2019 18:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r352871 - releng/12.1/sys/arm/freescale/imx X-SVN-Group: releng X-SVN-Commit-Author: ian X-SVN-Commit-Paths: releng/12.1/sys/arm/freescale/imx X-SVN-Commit-Revision: 352871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Sep 2019 18:33:30 -0000 Author: ian Date: Sun Sep 29 18:33:29 2019 New Revision: 352871 URL: https://svnweb.freebsd.org/changeset/base/352871 Log: MFC r352363: 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. Approved by: re@ (gjb) Modified: releng/12.1/sys/arm/freescale/imx/imx6_machdep.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- releng/12.1/sys/arm/freescale/imx/imx6_machdep.c Sun Sep 29 17:30:10 2019 (r352870) +++ releng/12.1/sys/arm/freescale/imx/imx6_machdep.c Sun Sep 29 18:33:29 2019 (r352871) @@ -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@2000000/iomuxc-gpr@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);