[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241022155658.1647350-4-antonio.borneo@foss.st.com>
Date: Tue, 22 Oct 2024 17:56:47 +0200
From: Antonio Borneo <antonio.borneo@...s.st.com>
To: Linus Walleij <linus.walleij@...aro.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue
<alexandre.torgue@...s.st.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, <linux-gpio@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>
CC: Antonio Borneo <antonio.borneo@...s.st.com>,
<linux-kernel@...r.kernel.org>,
Clément Le Goffic
<clement.legoffic@...s.st.com>,
Stephane Danieau
<stephane.danieau@...s.st.com>,
Amelie Delaunay
<amelie.delaunay@...s.st.com>,
Fabien Dessenne <fabien.dessenne@...s.st.com>,
Valentin Caron <valentin.caron@...s.st.com>,
Gatien Chevallier
<gatien.chevallier@...s.st.com>,
Cheick Traore <cheick.traore@...s.st.com>,
<linux-stm32@...md-mailman.stormreply.com>
Subject: [PATCH 03/14] pinctrl: stm32: Handle RSVD pin configuration
From: Fabien Dessenne <fabien.dessenne@...s.st.com>
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@...s.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@...s.st.com>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 9 +++++++++
drivers/pinctrl/stm32/pinctrl-stm32.h | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 30fa39688a8c0..cb7929feb6a0a 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -76,6 +76,7 @@ static const char * const stm32_gpio_functions[] = {
"af8", "af9", "af10",
"af11", "af12", "af13",
"af14", "af15", "analog",
+ "reserved",
};
struct stm32_pinctrl_group {
@@ -540,6 +541,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;
@@ -839,6 +843,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);
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.h b/drivers/pinctrl/stm32/pinctrl-stm32.h
index 8790fef2d58a2..a5f62fb271442 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.h
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.h
@@ -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)
--
2.34.1
Powered by blists - more mailing lists