Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: sh-pfc: r8a7791: Implement voltage switching for SDHI

All the SHDIs can operate with either 3.3V or 1.8V signals, depending
on negotiation with the card.

Based on work by Wolfram Sang for the r8a7790.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

authored by

Simon Horman and committed by
Geert Uytterhoeven
0e1396f1 9a6caa13

+28 -1
+28 -1
drivers/pinctrl/sh-pfc/pfc-r8a7791.c
··· 13 13 14 14 #include "sh_pfc.h" 15 15 16 + /* 17 + * Pins 0-23 assigned to GPIO bank 6 can be used for SD interfaces in 18 + * which case they support both 3.3V and 1.8V signalling. 19 + */ 16 20 #define CPU_ALL_PORT(fn, sfx) \ 17 21 PORT_GP_32(0, fn, sfx), \ 18 22 PORT_GP_26(1, fn, sfx), \ ··· 24 20 PORT_GP_32(3, fn, sfx), \ 25 21 PORT_GP_32(4, fn, sfx), \ 26 22 PORT_GP_32(5, fn, sfx), \ 27 - PORT_GP_32(6, fn, sfx), \ 23 + PORT_GP_CFG_24(6, fn, sfx, SH_PFC_PIN_CFG_IO_VOLTAGE), \ 24 + PORT_GP_1(6, 24, fn, sfx), \ 25 + PORT_GP_1(6, 25, fn, sfx), \ 26 + PORT_GP_1(6, 26, fn, sfx), \ 27 + PORT_GP_1(6, 27, fn, sfx), \ 28 + PORT_GP_1(6, 28, fn, sfx), \ 29 + PORT_GP_1(6, 29, fn, sfx), \ 30 + PORT_GP_1(6, 30, fn, sfx), \ 31 + PORT_GP_1(6, 31, fn, sfx), \ 28 32 PORT_GP_26(7, fn, sfx) 29 33 30 34 enum { ··· 6416 6404 { }, 6417 6405 }; 6418 6406 6407 + static int r8a7791_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl) 6408 + { 6409 + if (pin < RCAR_GP_PIN(6, 0) || pin > RCAR_GP_PIN(6, 23)) 6410 + return -EINVAL; 6411 + 6412 + *pocctrl = 0xe606008c; 6413 + 6414 + return 31 - (pin & 0x1f); 6415 + } 6416 + 6417 + static const struct sh_pfc_soc_operations r8a7791_pinmux_ops = { 6418 + .pin_to_pocctrl = r8a7791_pin_to_pocctrl, 6419 + }; 6420 + 6419 6421 #ifdef CONFIG_PINCTRL_PFC_R8A7791 6420 6422 const struct sh_pfc_soc_info r8a7791_pinmux_info = { 6421 6423 .name = "r8a77910_pfc", 6424 + .ops = &r8a7791_pinmux_ops, 6422 6425 .unlock_reg = 0xe6060000, /* PMMR */ 6423 6426 6424 6427 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },