From owner-svn-src-all@FreeBSD.ORG Wed Nov 12 02:37:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD528A56; Wed, 12 Nov 2014 02:37:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A06663BB; Wed, 12 Nov 2014 02:37:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAC2bSue069409; Wed, 12 Nov 2014 02:37:28 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAC2bSLr069408; Wed, 12 Nov 2014 02:37:28 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201411120237.sAC2bSLr069408@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 12 Nov 2014 02:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274412 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Nov 2014 02:37:28 -0000 Author: ian Date: Wed Nov 12 02:37:27 2014 New Revision: 274412 URL: https://svnweb.freebsd.org/changeset/base/274412 Log: Bugfixes for the imx5/imx6 iomux fdt_pinctrl driver. I originally overlooked a couple flag bits defined in the fdt binding docs. One flag suppresses the pad configuration (pullup/pulldown/etc). The other one requires that the SION (set input on) flag be set in the mux register. Also, it appears from the data involved that if the input register address in the config tuple is zero, there is no input configuration. The old code was writing to register zero, which contains a collection of misc control bits (having nothing to do with input configuration) that probably shouldn't get overwritten arbitrarily. The bindings doc doesn't explictly mention this. Modified: head/sys/arm/freescale/imx/imx_iomux.c Modified: head/sys/arm/freescale/imx/imx_iomux.c ============================================================================== --- head/sys/arm/freescale/imx/imx_iomux.c Wed Nov 12 01:28:28 2014 (r274411) +++ head/sys/arm/freescale/imx/imx_iomux.c Wed Nov 12 02:37:27 2014 (r274412) @@ -99,6 +99,10 @@ struct pincfg { uint32_t padconf_val; }; +#define PADCONF_NONE (1U << 31) /* Do not configure pad. */ +#define PADCONF_SION (1U << 30) /* Force SION bit in mux register. */ +#define PADMUX_SION (1U << 4) /* The SION bit in the mux register. */ + static inline uint32_t RD4(struct iomux_softc *sc, bus_size_t off) { @@ -120,6 +124,7 @@ iomux_configure_pins(device_t dev, phand struct pincfg *cfgtuples, *cfg; phandle_t cfgnode; int i, ntuples; + uint32_t sion; sc = device_get_softc(dev); cfgnode = OF_node_from_xref(cfgxref); @@ -130,9 +135,22 @@ iomux_configure_pins(device_t dev, phand if (ntuples == 0) return (0); /* Empty property is not an error. */ for (i = 0, cfg = cfgtuples; i < ntuples; i++, cfg++) { - WR4(sc, cfg->mux_reg, cfg->mux_val); - WR4(sc, cfg->input_reg, cfg->input_val); - WR4(sc, cfg->padconf_reg, cfg->padconf_val); + sion = (cfg->padconf_val & PADCONF_SION) ? PADMUX_SION : 0; + WR4(sc, cfg->mux_reg, cfg->mux_val | sion); + if (cfg->input_reg != 0) + WR4(sc, cfg->input_reg, cfg->input_val); + if ((cfg->padconf_val & PADCONF_NONE) != 0) + WR4(sc, cfg->padconf_reg, cfg->padconf_val); + if (bootverbose) { + char name[32]; + OF_getprop(cfgnode, "name", &name, sizeof(name)); + printf("%16s: muxreg 0x%04x muxval 0x%02x " + "inpreg 0x%04x inpval 0x%02x " + "padreg 0x%04x padval 0x%08x\n", + name, cfg->mux_reg, cfg->mux_val | sion, + cfg->input_reg, cfg->input_val, + cfg->padconf_reg, cfg->padconf_val); + } } free(cfgtuples, M_OFWPROP); return (0);