From patchwork Fri Sep 16 18:32:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 76416 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp632717qgf; Fri, 16 Sep 2016 11:33:40 -0700 (PDT) X-Received: by 10.194.85.45 with SMTP id e13mr13800989wjz.5.1474050819973; Fri, 16 Sep 2016 11:33:39 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id w66si8255717wme.12.2016.09.16.11.33.39; Fri, 16 Sep 2016 11:33:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0048A4B979; Fri, 16 Sep 2016 20:33:37 +0200 (CEST) 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 nehoT-f7EqFH; Fri, 16 Sep 2016 20:33:37 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F25F4B6B3; Fri, 16 Sep 2016 20:33:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 248324BA3B for ; Fri, 16 Sep 2016 20:33:32 +0200 (CEST) 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 QpY9u5PYIg5b for ; Fri, 16 Sep 2016 20:33:31 +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 conuserg-07.nifty.com (conuserg-07.nifty.com [210.131.2.74]) by theia.denx.de (Postfix) with ESMTPS id 384784B6B3 for ; Fri, 16 Sep 2016 20:33:27 +0200 (CEST) Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-07.nifty.com with ESMTP id u8GIXENH003360; Sat, 17 Sep 2016 03:33:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com u8GIXENH003360 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1474050798; bh=zy7q7yklHlwNXgSNO+/vd84c19UpRGCrBb0ke2Uo4EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=flD/O9gehWdRzHRBtKL5AcEu8hlavTgrJJ1jIUIMdZFM0OsKAerg3HSImjEy+XW4D 4kPeuB6b1y1xFjSYJXY+N0XjJurKm/dGWdFAUoOXWPmUwc+s+hprvwLn49SlUxp8if 4mWkoZHroUqkp23qcdefF0IGEZKZygWr8YpzmsCVJwNdwOPnZ3oGiug3Xkqn7s9V+Y JodK0NwyKhnWcsmWf5oapELWUh/2HLKz+GVE4U+gu4Ik2Q2ooeCgUGWmKB1oRs/4xC fRHNKI5OtfH3xjCCiw/1Ky67lIPhOQ4RKNn2NNvA2rhWeJSILogthkOVKm2tWtmzAU Xh+cQpTEyuMEA== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sat, 17 Sep 2016 03:32:58 +0900 Message-Id: <1474050792-23218-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474050792-23218-1-git-send-email-yamada.masahiro@socionext.com> References: <1474050792-23218-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH 01/15] pinctrl: uniphier: support 4bit-width pin-mux register capability X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" On LD4 SoC or later, the pin-mux registers are 8bit wide, while 4bit wide on sLD3 SoC. Support it for the sLD3 pinctrl driver. Signed-off-by: Masahiro Yamada --- drivers/pinctrl/uniphier/pinctrl-uniphier-core.c | 20 ++++++++------------ drivers/pinctrl/uniphier/pinctrl-uniphier.h | 5 +++-- 2 files changed, 11 insertions(+), 14 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c index f2fe313..51144b8 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c @@ -105,8 +105,10 @@ static void uniphier_pinmux_set_one(struct udevice *dev, unsigned pin, int muxval) { struct uniphier_pinctrl_priv *priv = dev_get_priv(dev); - unsigned mux_bits, reg_stride, reg, reg_end, shift, mask; - bool load_pinctrl; + unsigned reg, reg_end, shift, mask; + unsigned mux_bits = 8; + unsigned reg_stride = 4; + bool load_pinctrl = false; u32 tmp; /* some pins need input-enabling */ @@ -115,24 +117,18 @@ static void uniphier_pinmux_set_one(struct udevice *dev, unsigned pin, if (muxval < 0) return; /* dedicated pin; nothing to do for pin-mux */ + if (priv->socdata->caps & UNIPHIER_PINCTRL_CAPS_MUX_4BIT) + mux_bits = 4; + if (priv->socdata->caps & UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE) { /* * Mode offset bit * Normal 4 * n shift+3:shift * Debug 4 * n shift+7:shift+4 */ - mux_bits = 4; + mux_bits /= 2; reg_stride = 8; load_pinctrl = true; - } else { - /* - * Mode offset bit - * Normal 8 * n shift+3:shift - * Debug 8 * n + 4 shift+3:shift - */ - mux_bits = 8; - reg_stride = 4; - load_pinctrl = false; } reg = UNIPHIER_PINCTRL_PINMUX_BASE + pin * mux_bits / 32 * reg_stride; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier.h b/drivers/pinctrl/uniphier/pinctrl-uniphier.h index 76ea1be..5c3db2a 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier.h +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier.h @@ -67,8 +67,9 @@ struct uniphier_pinctrl_socdata { const char * const *functions; int functions_count; unsigned caps; -#define UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL BIT(1) -#define UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE BIT(0) +#define UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL BIT(2) +#define UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE BIT(1) +#define UNIPHIER_PINCTRL_CAPS_MUX_4BIT BIT(0) }; #define UNIPHIER_PINCTRL_PIN(a, b) \