[PATCH 07/12] pinctrl: airoha: an7583: fix SPI pin mux config

From: Zhengping Zhang

Date: Tue Nov 10 2026 - 04:58:03 EST


From: Daniel Schwierzeck <daniel.schwierzeck@xxxxxxxxx>

The SPI function does not advertise the base "spi" group or provide its
mux configuration, so a DTS state using function = "spi" and
groups = "spi" cannot be selected successfully.

On AN7583, pinctrl pins 45-48 correspond to GPIO43-46 and are shared
with the first SPI bus. Bits 19-22 of REG_GPIO_PON_MODE select GPIO
operation when set. If the bootloader leaves these bits enabled,
selecting SPI must clear them to release the GPIO overrides.

Add the "spi" group to the SPI function and clear its GPIO mode bits
when selecting it.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@xxxxxxxxx>
Signed-off-by: Zhengping Zhang <zhengping.zhang@xxxxxxxxxx>
---
drivers/pinctrl/airoha/pinctrl-an7583.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/airoha/pinctrl-an7583.c b/drivers/pinctrl/airoha/pinctrl-an7583.c
index 1cd0f442ddc1d..986f10c9f1786 100644
--- a/drivers/pinctrl/airoha/pinctrl-an7583.c
+++ b/drivers/pinctrl/airoha/pinctrl-an7583.c
@@ -43,6 +43,7 @@
#define MDC_0_GPIO_MODE_MASK BIT(25)
#define UART_RXD_GPIO_MODE_MASK BIT(24)
#define UART_TXD_GPIO_MODE_MASK BIT(23)
+#define SPI_GPIO_MODE_MASK GENMASK(22, 19)
#define SPI_MISO_GPIO_MODE_MASK BIT(22)
#define SPI_MOSI_GPIO_MODE_MASK BIT(21)
#define SPI_CS_GPIO_MODE_MASK BIT(20)
@@ -584,7 +585,7 @@ static const char *const uart_groups[] = {
static const char *const i2c_groups[] = { "i2c0", "i2c1" };
static const char *const jtag_groups[] = { "jtag_udi", "jtag_dfd" };
static const char *const pcm_groups[] = { "pcm1", "pcm2" };
-static const char *const spi_groups[] = { "spi_quad", "spi_cs1" };
+static const char *const spi_groups[] = { "spi", "spi_quad", "spi_cs1" };
static const char *const pcm_spi_groups[] = {
"pcm_spi", "pcm_spi_rst", "pcm_spi_cs1"
};
@@ -861,6 +862,15 @@ static const struct airoha_pinctrl_func_group pcm_func_group[] = {

static const struct airoha_pinctrl_func_group spi_func_group[] = {
{
+ .name = "spi",
+ .regmap[0] = {
+ AIROHA_FUNC_MUX,
+ REG_GPIO_PON_MODE,
+ SPI_GPIO_MODE_MASK,
+ 0
+ },
+ .regmap_size = 1,
+ }, {
.name = "spi_quad",
.regmap[0] = {
AIROHA_FUNC_MUX,
--
2.43.0