public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 07/10] imx: iomux: add macros to setup iomux for multiple SoC types
Date: Mon,  2 Jun 2014 16:13:24 -0700	[thread overview]
Message-ID: <1401750807-5975-8-git-send-email-tharvey@gateworks.com> (raw)
In-Reply-To: <1401750807-5975-1-git-send-email-tharvey@gateworks.com>

Allow imx_iomux_v3_setup_multiple_pads to take a multi-cpu pad_list
and add macros for declaring the pad_list that take into account the
SoC types supported using CONFIG_MX6QDL (supports both the MX6Q and MX6DL
iomux).

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
v4:
 - no changes

v3:
 - remove commit msg 2nd paragrap about prior approaches
 - re-work to avoid needing to add a new function by making
   imx_iomux_v3_setup_multiple_pads more intelligent and adding macros
   that depend on SoC type support
v2:
 - moved macros for declaring and using structs for array variant
 - removed non-related whitespace cleanup

---
 arch/arm/imx-common/iomux-v3.c             | 16 ++++++++++++++--
 arch/arm/include/asm/imx-common/iomux-v3.h | 25 +++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/arch/arm/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c
index 6e46ea8..306183a 100644
--- a/arch/arm/imx-common/iomux-v3.c
+++ b/arch/arm/imx-common/iomux-v3.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
+#include <asm/arch/sys_proto.h>
 #include <asm/imx-common/iomux-v3.h>
 
 static void *base = (void *)IOMUXC_BASE_ADDR;
@@ -54,12 +55,23 @@ void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
 #endif
 }
 
+/* configures a list of pads within declared with IOMUX_PADS macro */
 void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
 				      unsigned count)
 {
 	iomux_v3_cfg_t const *p = pad_list;
+	int stride;
 	int i;
 
-	for (i = 0; i < count; i++)
-		imx_iomux_v3_setup_pad(*p++);
+#if defined(CONFIG_MX6QDL)
+	stride = 2;
+	if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D))
+		p += 1;
+#else
+	stride = 1;
+#endif
+	for (i = 0; i < count; i++) {
+		imx_iomux_v3_setup_pad(*p);
+		p += stride;
+	}
 }
diff --git a/arch/arm/include/asm/imx-common/iomux-v3.h b/arch/arm/include/asm/imx-common/iomux-v3.h
index cca920b..dfe1ebf 100644
--- a/arch/arm/include/asm/imx-common/iomux-v3.h
+++ b/arch/arm/include/asm/imx-common/iomux-v3.h
@@ -175,4 +175,29 @@ void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad);
 void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
 				     unsigned count);
 
+/* macros for declaring and using pinmux array */
+#if defined(CONFIG_MX6QDL)
+#define IOMUX_PADS(x) (MX6Q_##x), (MX6DL_##x)
+#define SETUP_IOMUX_PAD(def)					\
+if (is_cpu_type(MXC_CPU_MX6Q)) {				\
+	imx_iomux_v3_setup_pad(MX6Q_##def);			\
+} else {							\
+	imx_iomux_v3_setup_pad(MX6DL_##def);			\
+}
+#define SETUP_IOMUX_PADS(x)					\
+	imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)/2)
+#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
+#define IOMUX_PADS(x) MX6Q_##x
+#define SETUP_IOMUX_PAD(def)					\
+	imx_iomux_v3_setup_pad(MX6Q_##def);
+#define SETUP_IOMUX_PADS(x)					\
+	imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x))
+#else
+#define IOMUX_PADS(x) MX6DL_##x
+#define SETUP_IOMUX_PAD(def)					\
+	imx_iomux_v3_setup_pad(MX6DL_##def);
+#define SETUP_IOMUX_PADS(x)					\
+	imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x))
+#endif
+
 #endif	/* __MACH_IOMUX_V3_H__*/
-- 
1.8.3.2

  parent reply	other threads:[~2014-06-02 23:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02 23:13 [U-Boot] [PATCH v4 00/10] mx6: SPL NAND support Tim Harvey
2014-06-02 23:13 ` [U-Boot] [PATCH v4 01/10] spl: nand: add support for mxs nand Tim Harvey
2014-06-02 23:13 ` [U-Boot] [PATCH v4 02/10] mx6: add common SPL configuration Tim Harvey
2014-06-02 23:13 ` [U-Boot] [PATCH v4 03/10] mx6: add boot device support for SPL Tim Harvey
2014-06-02 23:13 ` [U-Boot] [PATCH v4 04/10] imx: add comments and remove unused struct fields Tim Harvey
2014-06-02 23:13 ` [U-Boot] [PATCH v4 05/10] mx6: add structs for mmdc and ddr iomux registers Tim Harvey
2014-06-02 23:13 ` [U-Boot] [PATCH v4 06/10] mx6: add mmdc configuration for MX6Q/MX6DL Tim Harvey
2014-06-02 23:13 ` Tim Harvey [this message]
2014-06-02 23:13 ` [U-Boot] [PATCH v4 08/10] imx: ventana: split read_eeprom into standalone file Tim Harvey
2014-06-02 23:13 ` [U-Boot] [PATCH v4 09/10] imx: ventana: auto-configure for IMX6Q vs IMX6DL Tim Harvey
2014-06-02 23:13 ` [U-Boot] [PATCH v4 10/10] imx: ventana: switch to SPL Tim Harvey
2014-06-06  8:12 ` [U-Boot] [PATCH v4 00/10] mx6: SPL NAND support Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401750807-5975-8-git-send-email-tharvey@gateworks.com \
    --to=tharvey@gateworks.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox