Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 2014 15:11:58 +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: r271102 - head/sys/arm/freescale/imx
Message-ID:  <201409041511.s84FBwt4078742@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Thu Sep  4 15:11:57 2014
New Revision: 271102
URL: http://svnweb.freebsd.org/changeset/base/271102

Log:
  Implement the imx_iomux_get/set_gpr() interface for imx6.

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

Modified: head/sys/arm/freescale/imx/imx6_iomux.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_iomux.c	Thu Sep  4 14:59:27 2014	(r271101)
+++ head/sys/arm/freescale/imx/imx6_iomux.c	Thu Sep  4 15:11:57 2014	(r271102)
@@ -166,6 +166,42 @@ iomux_get_pad_config(unsigned int pin)
 	return(iomux_get_pad_config_sub(iomuxsc, pin));
 }
 
+
+uint32_t
+imx_iomux_gpr_get(u_int regnum)
+{
+
+	KASSERT(iomuxsc != NULL, ("imx_iomux_gpr_get() called before attach"));
+	KASSERT(regnum >= 0 && regnum <= 13, 
+	    ("imx_iomux_gpr_get bad regnum %u", regnum));
+	return (IOMUX_READ(iomuxsc, IOMUXC_GPR0 + regnum));
+}
+
+void
+imx_iomux_gpr_set(u_int regnum, uint32_t val)
+{
+
+	KASSERT(iomuxsc != NULL, ("imx_iomux_gpr_set() called before attach"));
+	KASSERT(regnum >= 0 && regnum <= 13, 
+	    ("imx_iomux_gpr_set bad regnum %u", regnum));
+	IOMUX_WRITE(iomuxsc, IOMUXC_GPR0 + regnum, val);
+}
+
+void
+imx_iomux_gpr_set_masked(u_int regnum, uint32_t clrbits, uint32_t setbits)
+{
+	uint32_t val;
+
+	KASSERT(iomuxsc != NULL, 
+	    ("imx_iomux_gpr_set_masked called before attach"));
+	KASSERT(regnum >= 0 && regnum <= 13, 
+	    ("imx_iomux_gpr_set_masked bad regnum %u", regnum));
+
+	val = IOMUX_READ(iomuxsc, IOMUXC_GPR0 + regnum);
+	val = (val & ~clrbits) | setbits;
+	IOMUX_WRITE(iomuxsc, IOMUXC_GPR0 + regnum, val);
+}
+
 static device_method_t imx6_iomux_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,         imx6_iomux_probe),



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