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

pinctrl: sunxi: Add I/O bias setting for H6 R-PIO

H6 requires I/O bias configuration on both of its PIO devices.
Previously it was only done for the main PIO.

The setting for Port L is at bit 0, so the bank calculation needs to
account for the pin base. Otherwise the wrong bit is used.

Fixes: cc62383fcebe ("pinctrl: sunxi: Support I/O bias voltage setting on H6")
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20220713025233.27248-3-samuel@sholland.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Samuel Holland and committed by
Linus Walleij
fc153c8f 329d32a9

+5 -3
+1
drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c
··· 106 106 .npins = ARRAY_SIZE(sun50i_h6_r_pins), 107 107 .pin_base = PL_BASE, 108 108 .irq_banks = 2, 109 + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, 109 110 }; 110 111 111 112 static int sun50i_h6_r_pinctrl_probe(struct platform_device *pdev)
+4 -3
drivers/pinctrl/sunxi/pinctrl-sunxi.c
··· 622 622 unsigned pin, 623 623 struct regulator *supply) 624 624 { 625 - unsigned short bank = pin / PINS_PER_BANK; 625 + unsigned short bank; 626 626 unsigned long flags; 627 627 u32 val, reg; 628 628 int uV; ··· 637 637 /* Might be dummy regulator with no voltage set */ 638 638 if (uV == 0) 639 639 return 0; 640 + 641 + pin -= pctl->desc->pin_base; 642 + bank = pin / PINS_PER_BANK; 640 643 641 644 switch (pctl->desc->io_bias_cfg_variant) { 642 645 case BIAS_VOLTAGE_GRP_CONFIG: ··· 657 654 val = 0xA; /* 3.0V */ 658 655 else 659 656 val = 0xD; /* 3.3V */ 660 - 661 - pin -= pctl->desc->pin_base; 662 657 663 658 reg = readl(pctl->membase + sunxi_grp_config_reg(pin)); 664 659 reg &= ~IO_BIAS_MASK;