From patchwork Mon Apr 28 20:17:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 343580 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 296731400DE for ; Tue, 29 Apr 2014 06:20:31 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 80EDD4B9F2; Mon, 28 Apr 2014 22:20:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jTlk1-jB3XGm; Mon, 28 Apr 2014 22:20:17 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B0CF84BAC4; Mon, 28 Apr 2014 22:19:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 89A9B4BA86 for ; Mon, 28 Apr 2014 22:18:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Zzx-N-FaklR for ; Mon, 28 Apr 2014 22:18:33 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by theia.denx.de (Postfix) with ESMTPS id AAD8F4B9F5 for ; Mon, 28 Apr 2014 22:18:04 +0200 (CEST) Received: by mail-pa0-f43.google.com with SMTP id rd3so4348789pab.2 for ; Mon, 28 Apr 2014 13:18:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DHui3FiqeOMtfYfTr0qCgqCrSMWcfzoAzwzxispvWxI=; b=brQzYRMezI5wgvYG1J5d2D6KdM3qWgMIicYoy2guuYWPc5zs05PYEIkTFSCuVeUJ4B 4yW5nrfjbWWkQ9FFR2uzHzdH0kKfBIHd/lVv2KX4m0Rt0dLVt0sc8/H1RLjo3Txl4tnj uhtxeXc3DgOBpGxkoBvKOIyIJYyOuu9kiBoQ5vYTwJXFyrhy9GnsneRX5h+Ixgt+5yNe Dy7Pa5vlDRk6dR3819txDW4oETmVmjxyMIvQIx4sRqTdWhBzYeuCv96KziXuF1Llt7NJ Xw9/gqnrcAJXTfxCIV288K7ZpV+yXI+nHxdRjjDGod/dpFL8CH4c9+ZId24NMhogM4bz SDTg== X-Gm-Message-State: ALoCoQkDiWD4DKC1UGb+G+hRQmrOONEGFy2jN7XAsHE+A+zjqc4g1RPQqxx7uzL3v5sceMrwHNN4 X-Received: by 10.68.226.35 with SMTP id rp3mr27760746pbc.73.1398716283269; Mon, 28 Apr 2014 13:18:03 -0700 (PDT) Received: from tharvey-gw.gw (68-189-91-139.static.snlo.ca.charter.com. [68.189.91.139]) by mx.google.com with ESMTPSA id zv3sm96756925pab.20.2014.04.28.13.18.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 13:18:02 -0700 (PDT) From: Tim Harvey To: Stefano Babic Date: Mon, 28 Apr 2014 13:17:35 -0700 Message-Id: <1398716258-8420-10-git-send-email-tharvey@gateworks.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398716258-8420-1-git-send-email-tharvey@gateworks.com> References: <1398716258-8420-1-git-send-email-tharvey@gateworks.com> Cc: Otavio Salvador , u-boot@lists.denx.de, Tom Rini , Stefan Roese Subject: [U-Boot] [PATCH 09/12] IMX: add additional function for pinmux using an array X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add new function that can take an array of iomux configs, an index, and a stride to allow a multi-dimentional array of pinmux values to be used to define pinmux values per cpu-type. This takes a different approach to previously proposed solutions which used multiple arrays of pad lists. The goal is to eliminate having these multiple arrays such as 'mx6q_uart1_pads' and 'mx6dl_uart1_pads' which are almost identical copies of each other except for the MX6Q/MX6DL prefix on the PAD. Signed-off-by: Tim Harvey --- v2: - moved macros for declaring and using structs for array variant - removed non-related whitespace cleanup --- arch/arm/imx-common/iomux-v3.c | 19 +++++++++++++++---- arch/arm/include/asm/imx-common/iomux-v3.h | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/arch/arm/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c index b59b802..d3e1e30 100644 --- a/arch/arm/imx-common/iomux-v3.c +++ b/arch/arm/imx-common/iomux-v3.c @@ -46,12 +46,23 @@ void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad) #endif } -void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list, - unsigned count) +/* configures a list of pads within an array of lists */ +void imx_iomux_v3_setup_multiple_pads_array(iomux_v3_cfg_t const *pad_list, + unsigned count, unsigned list, + unsigned stride) { iomux_v3_cfg_t const *p = pad_list; int i; - for (i = 0; i < count; i++) - imx_iomux_v3_setup_pad(*p++); + p += list; + for (i = 0; i < count; i++) { + imx_iomux_v3_setup_pad(*p); + p += stride; + } +} + +void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list, + unsigned count) +{ + imx_iomux_v3_setup_multiple_pads_array(pad_list, count, 0, 1); } diff --git a/arch/arm/include/asm/imx-common/iomux-v3.h b/arch/arm/include/asm/imx-common/iomux-v3.h index dec11a1..2f7a1cb 100644 --- a/arch/arm/include/asm/imx-common/iomux-v3.h +++ b/arch/arm/include/asm/imx-common/iomux-v3.h @@ -167,7 +167,22 @@ typedef u64 iomux_v3_cfg_t; #define GPIO_PORTF (5 << GPIO_PORT_SHIFT) void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad); +void imx_iomux_v3_setup_multiple_pads_array(iomux_v3_cfg_t const *pad_list, + unsigned count, unsigned list, + unsigned stride); void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list, unsigned count); +/* macros for declaring and using pinmux array */ +#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_array(x, \ + ARRAY_SIZE(x)/2, is_cpu_type(MXC_CPU_MX6Q) ? 0 : 1, 2) + #endif /* __MACH_IOMUX_V3_H__*/