From patchwork Thu Sep 8 11:57:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 667530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3sVJkJ0yWmz9s2Q for ; Thu, 8 Sep 2016 21:58:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=verge.net.au header.i=@verge.net.au header.b=mHP3PmzF; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941659AbcIHL5p (ORCPT ); Thu, 8 Sep 2016 07:57:45 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:49725 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932308AbcIHL5n (ORCPT ); Thu, 8 Sep 2016 07:57:43 -0400 Received: from penelope.kanocho.kobe.vergenet.net (unknown [217.111.208.18]) by kirsty.vergenet.net (Postfix) with ESMTPSA id 5B22925B739; Thu, 8 Sep 2016 21:57:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=verge.net.au; s=mail; t=1473335860; bh=LrVlkMgyolQQg3CmhCeqEZ7Os7gRjiwNCqaTWcYJ9+o=; h=From:To:Cc:Subject:Date:From; b=mHP3PmzFOWYOwoyn98/+Zb7GRsyLf/rG1wDZytwBIbrT2ev2nmFOI9X0GOVLVCjnX l9ZgVBOmn5GRbSvp1Ns9xvReOUA5FDEBPtsPl7F1Ge7/TBE5zN/9LfEN66b8fVY3t4 pf2wQw1xJ7J49F9DAvlg6Sq7XtqYrRVwhVAUSDkQ= Received: by penelope.kanocho.kobe.vergenet.net (Postfix, from userid 7100) id D1AF160F0A; Thu, 8 Sep 2016 13:57:36 +0200 (CEST) From: Simon Horman To: Geert Uytterhoeven Cc: Laurent Pinchart , Linus Walleij , Magnus Damm , linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, Wolfram Sang Subject: [PATCH] pinctrl: sh-pfc: r8a7796: Add voltage switch operations for SDHI Date: Thu, 8 Sep 2016 13:57:33 +0200 Message-Id: <1473335853-32102-1-git-send-email-horms+renesas@verge.net.au> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This patch supports the {get,set}_io_voltage operations of SDHI. This operates the POCCTRL0 register on R8A7796 SoC and makes 1.8v/3.3v voltage switch. Based on work by Takeshi Kihara and Wolfram Sang. Cc: Wolfram Sang Cc: Takeshi Kihara Signed-off-by: Simon Horman Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang --- drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7796.c b/drivers/pinctrl/sh-pfc/pfc-r8a7796.c index f8ab74dd0506..dc9b671ccf2e 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7796.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7796.c @@ -23,8 +23,12 @@ PORT_GP_16(0, fn, sfx), \ PORT_GP_29(1, fn, sfx), \ PORT_GP_15(2, fn, sfx), \ - PORT_GP_16(3, fn, sfx), \ - PORT_GP_18(4, fn, sfx), \ + PORT_GP_CFG_12(3, fn, sfx, SH_PFC_PIN_CFG_IO_VOLTAGE), \ + PORT_GP_1(3, 12, fn, sfx), \ + PORT_GP_1(3, 13, fn, sfx), \ + PORT_GP_1(3, 14, fn, sfx), \ + PORT_GP_1(3, 15, fn, sfx), \ + PORT_GP_CFG_18(4, fn, sfx, SH_PFC_PIN_CFG_IO_VOLTAGE), \ PORT_GP_26(5, fn, sfx), \ PORT_GP_32(6, fn, sfx), \ PORT_GP_4(7, fn, sfx) @@ -2627,8 +2631,28 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { { }, }; +static int r8a7796_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl) +{ + int bit = -EINVAL; + + *pocctrl = 0xe6060380; + + 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, 17)) + bit = (pin & 0x1f) + 12; + + return bit; +} + +static const struct sh_pfc_soc_operations r8a7796_pinmux_ops = { + .pin_to_pocctrl = r8a7796_pin_to_pocctrl, +}; + const struct sh_pfc_soc_info r8a7796_pinmux_info = { .name = "r8a77960_pfc", + .ops = &r8a7796_pinmux_ops, .unlock_reg = 0xe6060000, /* PMMR */ .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },