]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pinctrl: stm32: Handle RSVD pin configuration
authorFabien Dessenne <fabien.dessenne@foss.st.com>
Tue, 10 Jun 2025 15:23:05 +0000 (17:23 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 18 Jun 2025 09:23:57 +0000 (11:23 +0200)
When a pin is assigned to a coprocessor not running Linux, the pin
should be flagged in the DT as reserved and not usable by Linux.

Add pin configuration RSVD (Reserved) and instrument the driver to
not update the mux setting.

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Link: https://lore.kernel.org/20250610152309.299438-2-antonio.borneo@foss.st.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/stm32/pinctrl-stm32.c
drivers/pinctrl/stm32/pinctrl-stm32.h

index ce2a5fee423037f483fa720adffa3dcb6213d072..f47c4e6f12b4b6750c04ee18eae6ba5d5f5234a3 100644 (file)
@@ -91,6 +91,7 @@ static const char * const stm32_gpio_functions[] = {
        "af8", "af9", "af10",
        "af11", "af12", "af13",
        "af14", "af15", "analog",
+       "reserved",
 };
 
 struct stm32_pinctrl_group {
@@ -663,6 +664,9 @@ static bool stm32_pctrl_is_function_valid(struct stm32_pinctrl *pctl,
                if (pin->pin.number != pin_num)
                        continue;
 
+               if (fnum == STM32_PIN_RSVD)
+                       return true;
+
                for (k = 0; k < STM32_CONFIG_NUM; k++) {
                        if (func->num == fnum)
                                return true;
@@ -962,6 +966,11 @@ static int stm32_pmx_set_mux(struct pinctrl_dev *pctldev,
                return -EINVAL;
        }
 
+       if (function == STM32_PIN_RSVD) {
+               dev_dbg(pctl->dev, "Reserved pins, skipping HW update.\n");
+               return 0;
+       }
+
        bank = gpiochip_get_data(range->gc);
        pin = stm32_gpio_pin(g->pin);
 
index 9e44ad8c35b3500ff39e8d2c41e8a51d127c637b..b98a4141bf2c0225d239d6e2673f46304c8b21d8 100644 (file)
@@ -17,7 +17,8 @@
 #define STM32_PIN_GPIO         0
 #define STM32_PIN_AF(x)                ((x) + 1)
 #define STM32_PIN_ANALOG       (STM32_PIN_AF(15) + 1)
-#define STM32_CONFIG_NUM       (STM32_PIN_ANALOG + 1)
+#define STM32_PIN_RSVD         (STM32_PIN_ANALOG + 1)
+#define STM32_CONFIG_NUM       (STM32_PIN_RSVD + 1)
 
 /*  package information */
 #define STM32MP_PKG_AA         BIT(0)