From patchwork Mon Nov 5 21:40:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10669243 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F12F15E9 for ; Mon, 5 Nov 2018 21:40:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A83229DFB for ; Mon, 5 Nov 2018 21:40:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E9B729DF8; Mon, 5 Nov 2018 21:40:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1673B29DEF for ; Mon, 5 Nov 2018 21:40:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388000AbeKFHCE (ORCPT ); Tue, 6 Nov 2018 02:02:04 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39165 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387580AbeKFHCE (ORCPT ); Tue, 6 Nov 2018 02:02:04 -0500 Received: by mail-wm1-f67.google.com with SMTP id u13-v6so9554413wmc.4; Mon, 05 Nov 2018 13:40:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=esLGrgVY/qf3Vt6Q+h5MPb0yfwxEB3ZtJmdleIU37kw=; b=GIsd1xxfQFm7pnd7G0RInw8Lh9xrRShrYwFrJI456Lg8fbJKxhriVnC7W1s5jaccB6 3e4CY2wl0V+0izsAfuCAquuUkdbCrZGGPH+pGplSkRw4Bdn8YLjJtMD8Chz5Zth0t0HC Y+PGuqV+3AwMciGaE/ijT8fvhFihDrqyafSeJXLn+cV7yLOImDw2DsiWiWuEFjtFreQT XeSRNX+qUe1qff7Tzn5O4tQCIm9uc9g9L+aKG+xxWzNmeflxHuDq/YXYMQW5l7E2cx+c +8ppkyn37JFHMFd82x/HWA2E5ej+PzViXFl3K3C2Bz5WmdqXrZmF4uqCq+xOIRzevUjv /GFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=esLGrgVY/qf3Vt6Q+h5MPb0yfwxEB3ZtJmdleIU37kw=; b=bNDpMjCoGHDu4uIqQABivE5pv6ZK53+O+gqUPYi63lkjAcW/beTys/Pmc7EGZ4DdzQ T7pyIwpweeaACKHEljW1L3e5ev5DLzawmQ8rPYi9W3Puz1Dgci8b63mGhCVkKomt5SvT Q38FW0bZej2H7t/O8J8GN4830EFfm4Lf54QRYUFw6j/IST1bsIr7ypq2e+Kl0WZ1Hymr lB0Nzs18mgz7qYxzyFKBtUIhLi+ojf5krjvg7XOGIxlnxiF3/2evv3psWf/LVSECHwd8 mnJqMyPb0xfvhfsNxr7B3RTpxhGPvGpQaQ73hjp7wy/bNgpa/7budlxj/v49xz9T8XcA j9Ig== X-Gm-Message-State: AGRZ1gJvvzpIkKYPFHiQWvg/2D9JwCmK+y2uD1pYsjtEZ6102N6VEgZ4 OIK/SpDWRpyJ62ZNV5qznF2WGybz X-Google-Smtp-Source: AJdET5dypbEyiUlsupLUngPB5ymnvq7LbcnGy047iHxz3bKsQUeVMStfmQn44suftvsxm4Ei0mQjWw== X-Received: by 2002:a1c:32ca:: with SMTP id y193-v6mr7609592wmy.29.1541454019009; Mon, 05 Nov 2018 13:40:19 -0800 (PST) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id x139-v6sm228851wme.3.2018.11.05.13.40.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 13:40:18 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-gpio@vger.kernel.org Cc: Takeshi Kihara , Marek Vasut , Geert Uytterhoeven , Simon Horman , Wolfram Sang , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org Subject: [PATCH 2/2] pinctrl: sh-pfc: r8a77990: Add voltage switch operations for SDHI Date: Mon, 5 Nov 2018 22:40:12 +0100 Message-Id: <20181105214012.11626-2-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181105214012.11626-1-marek.vasut+renesas@gmail.com> References: <20181105214012.11626-1-marek.vasut+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Takeshi Kihara This patch supports the {get,set}_io_voltage operations of SDHI. This operates the IOCTRL30 register on the R8A77990 SoC and makes 1.8V/3.3V signal voltage switch possible. Signed-off-by: Takeshi Kihara Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Simon Horman Cc: Wolfram Sang Cc: Yoshihiro Shimoda Cc: linux-renesas-soc@vger.kernel.org Reviewed-by: Yoshihiro Shimoda Acked-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven --- drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 35 +++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c index 97aba270a515..95d478353627 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c @@ -23,8 +23,12 @@ PORT_GP_CFG_18(0, fn, sfx, CFG_FLAGS), \ PORT_GP_CFG_23(1, fn, sfx, CFG_FLAGS), \ PORT_GP_CFG_26(2, fn, sfx, CFG_FLAGS), \ - PORT_GP_CFG_16(3, fn, sfx, CFG_FLAGS), \ - PORT_GP_CFG_11(4, fn, sfx, CFG_FLAGS), \ + PORT_GP_CFG_12(3, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE), \ + PORT_GP_CFG_1(3, 12, fn, sfx, CFG_FLAGS), \ + PORT_GP_CFG_1(3, 13, fn, sfx, CFG_FLAGS), \ + PORT_GP_CFG_1(3, 14, fn, sfx, CFG_FLAGS), \ + PORT_GP_CFG_1(3, 15, fn, sfx, CFG_FLAGS), \ + PORT_GP_CFG_11(4, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE), \ PORT_GP_CFG_20(5, fn, sfx, CFG_FLAGS), \ PORT_GP_CFG_18(6, fn, sfx, CFG_FLAGS) /* @@ -3494,6 +3498,31 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { { }, }; +enum ioctrl_regs { + IOCTRL30, +}; + +static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = { + [IOCTRL30] = { 0xe6060380, }, + { /* sentinel */ }, +}; + +static int r8a77990_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, + u32 *pocctrl) +{ + int bit = -EINVAL; + + *pocctrl = pinmux_ioctrl_regs[IOCTRL30].reg; + + if (pin >= RCAR_GP_PIN(3, 0) && pin <= RCAR_GP_PIN(3, 11)) + bit = pin & 0x1f; + + if (pin >= RCAR_GP_PIN(4, 0) && pin <= RCAR_GP_PIN(4, 10)) + bit = (pin & 0x1f) + 19; + + return bit; +} + static const struct pinmux_bias_reg pinmux_bias_regs[] = { { PINMUX_BIAS_REG("PUEN0", 0xe6060400, "PUD0", 0xe6060440) { [0] = RCAR_GP_PIN(2, 23), /* RD# */ @@ -3744,6 +3773,7 @@ static void r8a77990_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, } static const struct sh_pfc_soc_operations r8a77990_pinmux_ops = { + .pin_to_pocctrl = r8a77990_pin_to_pocctrl, .get_bias = r8a77990_pinmux_get_bias, .set_bias = r8a77990_pinmux_set_bias, }; @@ -3790,6 +3820,7 @@ const struct sh_pfc_soc_info r8a77990_pinmux_info = { .cfg_regs = pinmux_config_regs, .bias_regs = pinmux_bias_regs, + .ioctrl_regs = pinmux_ioctrl_regs, .pinmux_data = pinmux_data, .pinmux_data_size = ARRAY_SIZE(pinmux_data),