]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
pinctrl: mediatek: add handling for RSEL register
authorDavid Lechner <dlechner@baylibre.com>
Mon, 30 Mar 2026 16:00:33 +0000 (11:00 -0500)
committerDavid Lechner <dlechner@baylibre.com>
Tue, 7 Apr 2026 15:47:04 +0000 (10:47 -0500)
Add a new PINCTRL_PIN_REG_RSEL register type and a new function
mtk_pinconf_bias_set_pu_pd_rsel() to handle setting it.

Some MediaTek SoCs have a pin configuration register called RSEL that
sets the resistance value for bias pullup/pulldown.

Link: https://patch.msgid.link/20260330-pinctrl-mtk-fix-mt8189-v2-1-05a737ec623d@baylibre.com
Signed-off-by: David Lechner <dlechner@baylibre.com>
drivers/pinctrl/mediatek/pinctrl-mtk-common.c
drivers/pinctrl/mediatek/pinctrl-mtk-common.h

index d152e2166348d361b9b20c6a1e16f281cecbe278..1028b8a93f589ce589952bf72d1abe2df131bf84 100644 (file)
@@ -450,6 +450,20 @@ int mtk_pinconf_bias_set_pupd_r1_r0(struct udevice *dev, u32 pin, bool disable,
        return 0;
 }
 
+int mtk_pinconf_bias_set_pu_pd_rsel(struct udevice *dev, u32 pin, bool disable,
+                                   bool pullup, u32 val)
+{
+       int err;
+
+       /* val is expected to be one of MTK_PULL_SET_RSEL_XXX */
+
+       err = mtk_pinconf_bias_set_pu_pd(dev, pin, disable, pullup, val);
+       if (err)
+               return err;
+
+       return mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_RSEL, val & 0x7);
+}
+
 int mtk_pinconf_bias_set(struct udevice *dev, u32 pin, u32 arg, u32 val)
 {
        int err;
index 58f136136330b30e9fab6e0ff6dad529f71a221f..1215fb7094b6c24c8dfae5a63947d9e8d4c15b8f 100644 (file)
@@ -67,6 +67,7 @@ enum {
        PINCTRL_PIN_REG_PUPD,
        PINCTRL_PIN_REG_R0,
        PINCTRL_PIN_REG_R1,
+       PINCTRL_PIN_REG_RSEL,
        PINCTRL_PIN_REG_MAX,
 };
 
@@ -253,6 +254,8 @@ int mtk_pinconf_bias_set_pullen_pullsel(struct udevice *dev, u32 pin,
                                        bool disable, bool pullup, u32 val);
 int mtk_pinconf_bias_set_pupd_r1_r0(struct udevice *dev, u32 pin, bool disable,
                                    bool pullup, u32 val);
+int mtk_pinconf_bias_set_pu_pd_rsel(struct udevice *dev, u32 pin, bool disable,
+                                   bool pullup, u32 val);
 int mtk_pinconf_bias_set_v0(struct udevice *dev, u32 pin, bool disable,
                            bool pullup, u32 val);
 int mtk_pinconf_bias_set_v1(struct udevice *dev, u32 pin, bool disable,