u-boot/drivers/pinctrl
Daniel Golle bcfb23ec7e pinctrl: mediatek: set R1/R0 in case pullen/pullsel succeeded
Commit dafe0fbfb0 ("pinctrl: mediatek: rewrite mtk_pinconf_set and
related functions") changed the logic deciding to set R0 and R1
registers for V1 devices.

Before:
	/* Also set PUPD/R0/R1 if the pin has them */
	err = mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_PUPD, !pullup);
	if (err != -EINVAL) {
		mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_R0, r0);
		mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_R1, r1);
	}

After:
	/* try pupd_r1_r0 if pullen_pullsel return error */
	err = mtk_pinconf_bias_set_pullen_pullsel(dev, pin, disable, pullup,
						  val);
	if (err)
		return mtk_pinconf_bias_set_pupd_r1_r0(dev, pin, disable,
						       pullup, val);

Tracing mtk_pinconf_bias_set_pullen_pullsel shows that the function
always either returns 0 in case of success or -EINVAL in case any error
has occurred. Hence the logic responsible of the decision to program R0
and R1 has been inverted.

This leads to problems on BananaPi R2 (MT7623N) when booting from
SDMMC, it turns out accessing eMMC no longer works since
U-Boot 2022.07:

MT7623> mmc dev 0
Card did not respond to voltage select! : -110

The problem wasn't detected for a long time as both eMMC and SDMMC work
fine if they are used to boot from, and hence R0 and R1 were already
setup by the bootrom and/or preloader.

Fix the logic to restore the originally intended and correct behavior
and also change the descriptive comment accordingly.

Fixes: dafe0fbfb0 ("pinctrl: mediatek: rewrite mtk_pinconf_set and related functions")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Tested-By: Frank Wunderlich <frank-w@public-files.de>
2023-05-03 09:05:24 -04:00
..
aspeed pinctrl: aspeed: FWSPICS1 and SPI1CS1 pin support 2022-09-13 12:08:40 -04:00
ath79 common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
broadcom Correct SPL uses of OF_BOARD 2023-02-10 07:41:41 -05:00
exynos exynos78x0: pinctrl: set const to structs 2021-11-09 14:07:46 +09:00
intel doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
mediatek pinctrl: mediatek: set R1/R0 in case pullen/pullsel succeeded 2023-05-03 09:05:24 -04:00
meson pinctrl: meson: Correct the driver GPIO declaration 2021-11-19 18:15:26 +01:00
mscc pinctrl: mscc: Fix multiple definition error 2021-07-07 10:17:54 -04:00
mtmips pinctrl: mtmips: add support for MediaTek MT7621 SoC 2022-07-13 23:03:37 +02:00
mvebu arm64: a37xx: pinctrl: probe after binding 2023-03-01 11:22:27 -07:00
nexell global: Convert simple_strtoul() with decimal to dectoul() 2021-08-02 13:32:14 -04:00
nuvoton pinctrl: nuvoton: add NPCM7xx/NPCM8xx reset type detect 2023-01-10 15:39:06 -05:00
nxp global: Finish CONFIG -> CFG migration 2023-01-20 12:27:24 -05:00
renesas pinctrl: renesas: Add R8A779G0 V4H PFC tables 2023-04-07 17:13:28 +02:00
rockchip pinctrl: rockchip: Fix IO mux selection on RK3568 2023-04-21 15:16:01 +08:00
starfive pinctrl: starfive: Add StarFive JH7110 driver 2023-04-20 16:08:44 +08:00
sunxi pinctrl: sunxi: Add NAND pinmuxes 2023-04-28 01:06:57 +01:00
uniphier pinctrl: uniphier: add ethernet TX pin data for PXs3 2023-01-02 14:10:23 -05:00
Kconfig pinctrl: starfive: Add StarFive JH7110 driver 2023-04-20 16:08:44 +08:00
Makefile pinctrl: starfive: Add StarFive JH7110 driver 2023-04-20 16:08:44 +08:00
pinctrl-apple.c pinctrl: Add Apple pinctrl driver 2021-11-17 17:04:58 -05:00
pinctrl-at91-pio4.c Correct SPL use of ATMEL_PIO4 2023-02-10 08:22:52 -05:00
pinctrl-at91.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
pinctrl-generic.c pinctrl: fix buffer size for pinctrl_generic_set_state_prefix() 2022-10-11 15:40:48 -04:00
pinctrl-k210.c pinctrl: k210: Fix bias-pull-up 2022-03-15 17:43:11 +08:00
pinctrl-qe-io.c treewide: Simply conditions with the new OF_REAL 2021-09-25 09:46:15 -06:00
pinctrl-sandbox.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
pinctrl-single.c Correct SPL use of SANDBOX 2023-02-10 07:41:40 -05:00
pinctrl-sti.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
pinctrl-stmfx.c pinctrl: stmfx: define LOG_CATEGORY 2021-11-30 11:20:34 +01:00
pinctrl-uclass.c pinctrl: fix pinctrl_gpio_get_pinctrl_and_offset for gpio-ranges array 2023-04-03 06:53:53 +12:00
pinctrl-zynqmp.c global: Finish CONFIG -> CFG migration 2023-01-20 12:27:24 -05:00
pinctrl_pic32.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
pinctrl_stm32.c pinctrl: pinctrl_stm32: Add slew rate support for stm32_pinctrl_get_pin_muxing() 2023-04-19 09:50:32 +02:00