airoha: backport and fix pinctrl driver

Backport changes to the pinctrl driver to bring it closer to
the upstream version. Also fix the bug in the pinctrl driver:

pinctrl-airoha ...pinctrl: invalid function mdio in map table

Fixes: bd7f5b3 ("airoha: replace AN7583 pinctrl patch with upstream version")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Link: https://github.com/openwrt/openwrt/pull/20770
(cherry picked from commit 69f0ee5bafee745540e65f6e43d3fbf1ceb0f6d8)
[ fix conflict errors, adapt to 6.6 ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
(cherry picked from commit 9c04f527c62b38faf25e39e958679d2c717c618d)
This commit is contained in:
Chukun Pan 2025-11-12 23:18:09 +08:00 committed by ahmed sassi
parent f70b061ad2
commit 206291bfbb
9 changed files with 187 additions and 54 deletions

View File

@ -0,0 +1,53 @@
From 17d4f2a9e6cb224012d85fed52e9794a84fa501d Mon Sep 17 00:00:00 2001
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Date: Tue, 2 Sep 2025 13:59:13 +0200
Subject: [PATCH 1/1] pinctrl: airoha: replace struct function_desc with struct
pinfunction
struct function_desc is a wrapper around struct pinfunction with an
additional void *data pointer. This driver doesn't use the data pointer.
We're also working towards reducing the usage of struct function_desc in
pinctrl drivers - they should only be created by pinmux core and
accessed by drivers using pinmux_generic_get_function(). Replace the
struct function_desc objects in this driver with smaller struct
pinfunction instances.
Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/pinctrl/mediatek/pinctrl-airoha.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -35,7 +35,8 @@
#define PINCTRL_FUNC_DESC(id) \
{ \
- .desc = { #id, id##_groups, ARRAY_SIZE(id##_groups) }, \
+ .desc = PINCTRL_PINFUNCTION(#id, id##_groups, \
+ ARRAY_SIZE(id##_groups)), \
.groups = id##_func_group, \
.group_size = ARRAY_SIZE(id##_func_group), \
}
@@ -328,7 +329,7 @@ struct airoha_pinctrl_func_group {
};
struct airoha_pinctrl_func {
- const struct function_desc desc;
+ const struct pinfunction desc;
const struct airoha_pinctrl_func_group *groups;
u8 group_size;
};
@@ -2911,8 +2912,8 @@ static int airoha_pinctrl_probe(struct p
func = &airoha_pinctrl_funcs[i];
err = pinmux_generic_add_function(pinctrl->ctrl,
func->desc.name,
- func->desc.group_names,
- func->desc.num_group_names,
+ func->desc.groups,
+ func->desc.ngroups,
(void *)func);
if (err < 0) {
dev_err(dev, "Failed to register function %s\n",

View File

@ -22,7 +22,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -1746,8 +1746,8 @@ static const struct airoha_pinctrl_func_
@@ -1747,8 +1747,8 @@ static const struct airoha_pinctrl_func_
.regmap[0] = {
AIROHA_FUNC_MUX,
REG_GPIO_2ND_I2C_MODE,
@ -33,7 +33,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
},
.regmap[1] = {
AIROHA_FUNC_MUX,
@@ -1810,8 +1810,8 @@ static const struct airoha_pinctrl_func_
@@ -1811,8 +1811,8 @@ static const struct airoha_pinctrl_func_
.regmap[0] = {
AIROHA_FUNC_MUX,
REG_GPIO_2ND_I2C_MODE,
@ -44,7 +44,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
},
.regmap[1] = {
AIROHA_FUNC_MUX,
@@ -1874,8 +1874,8 @@ static const struct airoha_pinctrl_func_
@@ -1875,8 +1875,8 @@ static const struct airoha_pinctrl_func_
.regmap[0] = {
AIROHA_FUNC_MUX,
REG_GPIO_2ND_I2C_MODE,
@ -55,7 +55,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
},
.regmap[1] = {
AIROHA_FUNC_MUX,
@@ -1938,8 +1938,8 @@ static const struct airoha_pinctrl_func_
@@ -1939,8 +1939,8 @@ static const struct airoha_pinctrl_func_
.regmap[0] = {
AIROHA_FUNC_MUX,
REG_GPIO_2ND_I2C_MODE,

View File

@ -23,7 +23,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -102,6 +102,9 @@
@@ -103,6 +103,9 @@
#define JTAG_UDI_EN_MASK BIT(4)
#define JTAG_DFD_EN_MASK BIT(3)
@ -33,7 +33,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* LED MAP */
#define REG_LAN_LED0_MAPPING 0x027c
#define REG_LAN_LED1_MAPPING 0x0280
@@ -713,16 +716,16 @@ static const struct airoha_pinctrl_func_
@@ -714,16 +717,16 @@ static const struct airoha_pinctrl_func_
.name = "mdio",
.regmap[0] = {
AIROHA_FUNC_MUX,

View File

@ -19,7 +19,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -30,14 +30,14 @@
@@ -30,15 +30,15 @@
#include "../pinconf.h"
#include "../pinmux.h"
@ -31,16 +31,18 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-#define PINCTRL_FUNC_DESC(id) \
+#define PINCTRL_FUNC_DESC(id, table) \
{ \
- .desc = { #id, id##_groups, ARRAY_SIZE(id##_groups) }, \
- .desc = PINCTRL_PINFUNCTION(#id, id##_groups, \
- ARRAY_SIZE(id##_groups)), \
- .groups = id##_func_group, \
- .group_size = ARRAY_SIZE(id##_func_group), \
+ .desc = { #id, table##_groups, ARRAY_SIZE(table##_groups) },\
+ .desc = PINCTRL_PINFUNCTION(#id, table##_groups, \
+ ARRAY_SIZE(table##_groups)),\
+ .groups = table##_func_group, \
+ .group_size = ARRAY_SIZE(table##_func_group), \
}
#define PINCTRL_CONF_DESC(p, offset, mask) \
@@ -356,16 +356,46 @@ struct airoha_pinctrl_gpiochip {
@@ -357,16 +357,46 @@ struct airoha_pinctrl_gpiochip {
u32 irq_type[AIROHA_NUM_PINS];
};
@ -88,7 +90,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
PINCTRL_PIN(0, "uart1_txd"),
PINCTRL_PIN(1, "uart1_rxd"),
PINCTRL_PIN(2, "i2c_scl"),
@@ -426,172 +456,172 @@ static struct pinctrl_pin_desc airoha_pi
@@ -427,172 +457,172 @@ static struct pinctrl_pin_desc airoha_pi
PINCTRL_PIN(63, "pcie_reset2"),
};
@ -427,7 +429,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
};
static const char *const pon_groups[] = { "pon" };
@@ -1954,33 +1984,33 @@ static const struct airoha_pinctrl_func_
@@ -1955,33 +1985,33 @@ static const struct airoha_pinctrl_func_
},
};
@ -486,7 +488,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
PINCTRL_CONF_DESC(0, REG_I2C_SDA_PU, UART1_TXD_PU_MASK),
PINCTRL_CONF_DESC(1, REG_I2C_SDA_PU, UART1_RXD_PU_MASK),
PINCTRL_CONF_DESC(2, REG_I2C_SDA_PU, I2C_SDA_PU_MASK),
@@ -2041,7 +2071,7 @@ static const struct airoha_pinctrl_conf
@@ -2042,7 +2072,7 @@ static const struct airoha_pinctrl_conf
PINCTRL_CONF_DESC(63, REG_I2C_SDA_PU, PCIE2_RESET_PU_MASK),
};
@ -495,7 +497,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
PINCTRL_CONF_DESC(0, REG_I2C_SDA_PD, UART1_TXD_PD_MASK),
PINCTRL_CONF_DESC(1, REG_I2C_SDA_PD, UART1_RXD_PD_MASK),
PINCTRL_CONF_DESC(2, REG_I2C_SDA_PD, I2C_SDA_PD_MASK),
@@ -2102,7 +2132,7 @@ static const struct airoha_pinctrl_conf
@@ -2103,7 +2133,7 @@ static const struct airoha_pinctrl_conf
PINCTRL_CONF_DESC(63, REG_I2C_SDA_PD, PCIE2_RESET_PD_MASK),
};
@ -504,7 +506,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
PINCTRL_CONF_DESC(0, REG_I2C_SDA_E2, UART1_TXD_E2_MASK),
PINCTRL_CONF_DESC(1, REG_I2C_SDA_E2, UART1_RXD_E2_MASK),
PINCTRL_CONF_DESC(2, REG_I2C_SDA_E2, I2C_SDA_E2_MASK),
@@ -2163,7 +2193,7 @@ static const struct airoha_pinctrl_conf
@@ -2164,7 +2194,7 @@ static const struct airoha_pinctrl_conf
PINCTRL_CONF_DESC(63, REG_I2C_SDA_E2, PCIE2_RESET_E2_MASK),
};
@ -513,7 +515,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
PINCTRL_CONF_DESC(0, REG_I2C_SDA_E4, UART1_TXD_E4_MASK),
PINCTRL_CONF_DESC(1, REG_I2C_SDA_E4, UART1_RXD_E4_MASK),
PINCTRL_CONF_DESC(2, REG_I2C_SDA_E4, I2C_SDA_E4_MASK),
@@ -2224,7 +2254,7 @@ static const struct airoha_pinctrl_conf
@@ -2225,7 +2255,7 @@ static const struct airoha_pinctrl_conf
PINCTRL_CONF_DESC(63, REG_I2C_SDA_E4, PCIE2_RESET_E4_MASK),
};
@ -522,7 +524,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
PINCTRL_CONF_DESC(61, REG_PCIE_RESET_OD, PCIE0_RESET_OD_MASK),
PINCTRL_CONF_DESC(62, REG_PCIE_RESET_OD, PCIE1_RESET_OD_MASK),
PINCTRL_CONF_DESC(63, REG_PCIE_RESET_OD, PCIE2_RESET_OD_MASK),
@@ -2551,12 +2581,17 @@ airoha_pinctrl_get_conf_reg(const struct
@@ -2552,12 +2582,17 @@ airoha_pinctrl_get_conf_reg(const struct
}
static int airoha_pinctrl_get_conf(struct airoha_pinctrl *pinctrl,
@ -543,7 +545,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
if (!reg)
return -EINVAL;
@@ -2569,12 +2604,17 @@ static int airoha_pinctrl_get_conf(struc
@@ -2570,12 +2605,17 @@ static int airoha_pinctrl_get_conf(struc
}
static int airoha_pinctrl_set_conf(struct airoha_pinctrl *pinctrl,
@ -564,7 +566,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
if (!reg)
return -EINVAL;
@@ -2587,44 +2627,34 @@ static int airoha_pinctrl_set_conf(struc
@@ -2588,44 +2628,34 @@ static int airoha_pinctrl_set_conf(struc
}
#define airoha_pinctrl_get_pullup_conf(pinctrl, pin, val) \
@ -619,7 +621,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(pin), (val))
static int airoha_pinconf_get_direction(struct pinctrl_dev *pctrl_dev, u32 p)
@@ -2803,12 +2833,13 @@ static int airoha_pinconf_set(struct pin
@@ -2804,12 +2834,13 @@ static int airoha_pinconf_set(struct pin
static int airoha_pinconf_group_get(struct pinctrl_dev *pctrl_dev,
unsigned int group, unsigned long *config)
{
@ -635,7 +637,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
config))
return -ENOTSUPP;
@@ -2825,13 +2856,14 @@ static int airoha_pinconf_group_set(stru
@@ -2826,13 +2857,14 @@ static int airoha_pinconf_group_set(stru
unsigned int group, unsigned long *configs,
unsigned int num_configs)
{
@ -652,7 +654,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
configs, num_configs);
if (err)
return err;
@@ -2857,23 +2889,16 @@ static const struct pinctrl_ops airoha_p
@@ -2858,23 +2890,16 @@ static const struct pinctrl_ops airoha_p
.dt_free_map = pinconf_generic_dt_free_map,
};
@ -679,7 +681,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
pinctrl = devm_kzalloc(dev, sizeof(*pinctrl), GFP_KERNEL);
if (!pinctrl)
return -ENOMEM;
@@ -2888,14 +2913,23 @@ static int airoha_pinctrl_probe(struct p
@@ -2889,14 +2914,23 @@ static int airoha_pinctrl_probe(struct p
pinctrl->chip_scu = map;
@ -706,7 +708,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
err = pinctrl_generic_add_group(pinctrl->ctrl, grp->name,
(int *)grp->pins, grp->npins,
@@ -2908,10 +2942,10 @@ static int airoha_pinctrl_probe(struct p
@@ -2909,10 +2943,10 @@ static int airoha_pinctrl_probe(struct p
}
/* build functions */
@ -718,8 +720,8 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+ func = &data->funcs[i];
err = pinmux_generic_add_function(pinctrl->ctrl,
func->desc.name,
func->desc.group_names,
@@ -2924,6 +2958,10 @@ static int airoha_pinctrl_probe(struct p
func->desc.groups,
@@ -2925,6 +2959,10 @@ static int airoha_pinctrl_probe(struct p
}
}
@ -730,7 +732,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
err = pinctrl_enable(pinctrl->ctrl);
if (err)
return err;
@@ -2932,8 +2970,39 @@ static int airoha_pinctrl_probe(struct p
@@ -2933,8 +2971,39 @@ static int airoha_pinctrl_probe(struct p
return airoha_pinctrl_add_gpiochip(pinctrl, pdev);
}

View File

@ -16,7 +16,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -1472,516 +1472,128 @@ static const struct airoha_pinctrl_func_
@@ -1473,516 +1473,128 @@ static const struct airoha_pinctrl_func_
},
};

View File

@ -17,7 +17,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -1072,404 +1072,75 @@ static const struct airoha_pinctrl_func_
@@ -1073,404 +1073,75 @@ static const struct airoha_pinctrl_func_
};
/* PWM */

View File

@ -16,7 +16,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -69,6 +69,7 @@
@@ -70,6 +70,7 @@
#define GPIO_PCM_SPI_CS3_MODE_MASK BIT(20)
#define GPIO_PCM_SPI_CS2_MODE_P156_MASK BIT(19)
#define GPIO_PCM_SPI_CS2_MODE_P128_MASK BIT(18)
@ -24,7 +24,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
#define GPIO_PCM_SPI_CS1_MODE_MASK BIT(17)
#define GPIO_PCM_SPI_MODE_MASK BIT(16)
#define GPIO_PCM2_MODE_MASK BIT(13)
@@ -126,6 +127,8 @@
@@ -127,6 +128,8 @@
/* CONF */
#define REG_I2C_SDA_E2 0x001c
@ -33,7 +33,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
#define SPI_MISO_E2_MASK BIT(14)
#define SPI_MOSI_E2_MASK BIT(13)
#define SPI_CLK_E2_MASK BIT(12)
@@ -133,12 +136,16 @@
@@ -134,12 +137,16 @@
#define PCIE2_RESET_E2_MASK BIT(10)
#define PCIE1_RESET_E2_MASK BIT(9)
#define PCIE0_RESET_E2_MASK BIT(8)
@ -50,7 +50,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
#define SPI_MISO_E4_MASK BIT(14)
#define SPI_MOSI_E4_MASK BIT(13)
#define SPI_CLK_E4_MASK BIT(12)
@@ -146,6 +153,8 @@
@@ -147,6 +154,8 @@
#define PCIE2_RESET_E4_MASK BIT(10)
#define PCIE1_RESET_E4_MASK BIT(9)
#define PCIE0_RESET_E4_MASK BIT(8)
@ -59,7 +59,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
#define UART1_RXD_E4_MASK BIT(3)
#define UART1_TXD_E4_MASK BIT(2)
#define I2C_SCL_E4_MASK BIT(1)
@@ -157,6 +166,8 @@
@@ -158,6 +167,8 @@
#define REG_GPIO_H_E4 0x0030
#define REG_I2C_SDA_PU 0x0044
@ -68,7 +68,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
#define SPI_MISO_PU_MASK BIT(14)
#define SPI_MOSI_PU_MASK BIT(13)
#define SPI_CLK_PU_MASK BIT(12)
@@ -164,12 +175,16 @@
@@ -165,12 +176,16 @@
#define PCIE2_RESET_PU_MASK BIT(10)
#define PCIE1_RESET_PU_MASK BIT(9)
#define PCIE0_RESET_PU_MASK BIT(8)
@ -85,7 +85,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
#define SPI_MISO_PD_MASK BIT(14)
#define SPI_MOSI_PD_MASK BIT(13)
#define SPI_CLK_PD_MASK BIT(12)
@@ -177,6 +192,8 @@
@@ -178,6 +193,8 @@
#define PCIE2_RESET_PD_MASK BIT(10)
#define PCIE1_RESET_PD_MASK BIT(9)
#define PCIE0_RESET_PD_MASK BIT(8)
@ -94,7 +94,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
#define UART1_RXD_PD_MASK BIT(3)
#define UART1_TXD_PD_MASK BIT(2)
#define I2C_SCL_PD_MASK BIT(1)
@@ -624,10 +641,223 @@ static const struct pingroup en7581_pinc
@@ -625,10 +642,223 @@ static const struct pingroup en7581_pinc
PINCTRL_PIN_GROUP("pcie_reset2", en7581_pcie_reset2),
};
@ -318,7 +318,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const char *const uart_groups[] = { "uart2", "uart2_cts_rts", "hsuart",
"hsuart_cts_rts", "uart4",
"uart5" };
@@ -640,11 +870,16 @@ static const char *const pcm_spi_groups[
@@ -641,11 +871,16 @@ static const char *const pcm_spi_groups[
"pcm_spi_cs2_p156",
"pcm_spi_cs2_p128",
"pcm_spi_cs3", "pcm_spi_cs4" };
@ -335,7 +335,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const char *const pwm_groups[] = { "gpio0", "gpio1",
"gpio2", "gpio3",
"gpio4", "gpio5",
@@ -683,6 +918,22 @@ static const char *const phy3_led1_group
@@ -684,6 +919,22 @@ static const char *const phy3_led1_group
"gpio45", "gpio46" };
static const char *const phy4_led1_groups[] = { "gpio43", "gpio44",
"gpio45", "gpio46" };
@ -358,7 +358,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const struct airoha_pinctrl_func_group pon_func_group[] = {
{
@@ -760,6 +1011,25 @@ static const struct airoha_pinctrl_func_
@@ -761,6 +1012,25 @@ static const struct airoha_pinctrl_func_
},
};
@ -384,7 +384,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const struct airoha_pinctrl_func_group uart_func_group[] = {
{
.name = "uart2",
@@ -1001,6 +1271,73 @@ static const struct airoha_pinctrl_func_
@@ -1002,6 +1272,73 @@ static const struct airoha_pinctrl_func_
},
};
@ -458,7 +458,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const struct airoha_pinctrl_func_group i2s_func_group[] = {
{
.name = "i2s",
@@ -1071,6 +1408,28 @@ static const struct airoha_pinctrl_func_
@@ -1072,6 +1409,28 @@ static const struct airoha_pinctrl_func_
},
};
@ -487,7 +487,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
/* PWM */
#define AIROHA_PINCTRL_PWM(gpio, mux_val) \
{ \
@@ -1267,6 +1626,94 @@ static const struct airoha_pinctrl_func_
@@ -1268,6 +1627,94 @@ static const struct airoha_pinctrl_func_
LAN3_LED_MAPPING_MASK, LAN3_PHY_LED_MAP(2)),
};
@ -582,7 +582,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const struct airoha_pinctrl_func en7581_pinctrl_funcs[] = {
PINCTRL_FUNC_DESC("pon", pon),
PINCTRL_FUNC_DESC("tod_1pps", tod_1pps),
@@ -1293,6 +1740,31 @@ static const struct airoha_pinctrl_func
@@ -1294,6 +1741,31 @@ static const struct airoha_pinctrl_func
PINCTRL_FUNC_DESC("phy4_led1", phy4_led1),
};
@ -614,7 +614,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const struct airoha_pinctrl_conf en7581_pinctrl_pullup_conf[] = {
PINCTRL_CONF_DESC(0, REG_I2C_SDA_PU, UART1_TXD_PU_MASK),
PINCTRL_CONF_DESC(1, REG_I2C_SDA_PU, UART1_RXD_PU_MASK),
@@ -1354,6 +1826,62 @@ static const struct airoha_pinctrl_conf
@@ -1355,6 +1827,62 @@ static const struct airoha_pinctrl_conf
PINCTRL_CONF_DESC(63, REG_I2C_SDA_PU, PCIE2_RESET_PU_MASK),
};
@ -677,7 +677,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const struct airoha_pinctrl_conf en7581_pinctrl_pulldown_conf[] = {
PINCTRL_CONF_DESC(0, REG_I2C_SDA_PD, UART1_TXD_PD_MASK),
PINCTRL_CONF_DESC(1, REG_I2C_SDA_PD, UART1_RXD_PD_MASK),
@@ -1415,6 +1943,62 @@ static const struct airoha_pinctrl_conf
@@ -1416,6 +1944,62 @@ static const struct airoha_pinctrl_conf
PINCTRL_CONF_DESC(63, REG_I2C_SDA_PD, PCIE2_RESET_PD_MASK),
};
@ -740,7 +740,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const struct airoha_pinctrl_conf en7581_pinctrl_drive_e2_conf[] = {
PINCTRL_CONF_DESC(0, REG_I2C_SDA_E2, UART1_TXD_E2_MASK),
PINCTRL_CONF_DESC(1, REG_I2C_SDA_E2, UART1_RXD_E2_MASK),
@@ -1476,6 +2060,62 @@ static const struct airoha_pinctrl_conf
@@ -1477,6 +2061,62 @@ static const struct airoha_pinctrl_conf
PINCTRL_CONF_DESC(63, REG_I2C_SDA_E2, PCIE2_RESET_E2_MASK),
};
@ -803,7 +803,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static const struct airoha_pinctrl_conf en7581_pinctrl_drive_e4_conf[] = {
PINCTRL_CONF_DESC(0, REG_I2C_SDA_E4, UART1_TXD_E4_MASK),
PINCTRL_CONF_DESC(1, REG_I2C_SDA_E4, UART1_RXD_E4_MASK),
@@ -1537,12 +2177,73 @@ static const struct airoha_pinctrl_conf
@@ -1538,12 +2178,73 @@ static const struct airoha_pinctrl_conf
PINCTRL_CONF_DESC(63, REG_I2C_SDA_E4, PCIE2_RESET_E4_MASK),
};
@ -877,7 +877,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
static int airoha_convert_pin_to_reg_offset(struct pinctrl_dev *pctrl_dev,
struct pinctrl_gpio_range *range,
int pin)
@@ -1713,7 +2414,7 @@ static int airoha_pinctrl_gpio_direction
@@ -1714,7 +2415,7 @@ static int airoha_pinctrl_gpio_direction
}
static int airoha_pinctrl_add_gpiochip(struct airoha_pinctrl *pinctrl,
@ -886,7 +886,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
{
struct airoha_pinctrl_gpiochip *chip = &pinctrl->gpiochip;
struct gpio_chip *gc = &chip->chip;
@@ -1748,7 +2449,7 @@ static int airoha_pinctrl_add_gpiochip(s
@@ -1749,7 +2450,7 @@ static int airoha_pinctrl_add_gpiochip(s
return irq;
err = devm_request_irq(dev, irq, airoha_irq_handler, IRQF_SHARED,
@ -895,7 +895,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
if (err) {
dev_err(dev, "error requesting irq %d: %d\n", irq, err);
return err;
@@ -1812,8 +2513,8 @@ static int airoha_pinmux_set_mux(struct
@@ -1813,8 +2514,8 @@ static int airoha_pinmux_set_mux(struct
}
static int airoha_pinmux_set_direction(struct pinctrl_dev *pctrl_dev,
@ -906,7 +906,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
{
struct airoha_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev);
u32 mask, index;
@@ -1903,7 +2604,7 @@ static int airoha_pinctrl_set_conf(struc
@@ -1904,7 +2605,7 @@ static int airoha_pinctrl_set_conf(struc
if (regmap_update_bits(pinctrl->chip_scu, reg->offset, reg->mask,
@ -915,7 +915,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
return -EINVAL;
return 0;
@@ -2122,8 +2823,8 @@ static int airoha_pinconf_group_get(stru
@@ -2123,8 +2824,8 @@ static int airoha_pinconf_group_get(stru
for (i = 0; i < pinctrl->grps[group].npins; i++) {
if (airoha_pinconf_get(pctrl_dev,
@ -926,7 +926,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
return -ENOTSUPP;
if (i && cur_config != *config)
@@ -2284,8 +2985,40 @@ static const struct airoha_pinctrl_match
@@ -2285,8 +2986,40 @@ static const struct airoha_pinctrl_match
},
};

View File

@ -0,0 +1,38 @@
From f2bd5a0f59d052d16749bccf637690e51947a5d6 Mon Sep 17 00:00:00 2001
From: Chukun Pan <amadeus@jmu.edu.cn>
Date: Sat, 15 Nov 2025 18:00:00 +0800
Subject: [PATCH] pinctrl: airoha: fix pinctrl function mismatch issue
The blamed commit made the following changes:
-#define PINCTRL_FUNC_DESC(id)...
- .desc = PINCTRL_PINFUNCTION(#id, ...
+#define PINCTRL_FUNC_DESC(id, table)...
+ .desc = PINCTRL_PINFUNCTION(#id, ...
- PINCTRL_FUNC_DESC(pon)...
+ PINCTRL_FUNC_DESC("pon", pon)...
It's clear that the id of funcs doesn't match the definition.
Remove redundant #string from the definition to fix this issue:
pinctrl-airoha ...: invalid function mdio in map table
Fixes: 4043b0c45f85 ("pinctrl: airoha: generalize pins/group/function/confs handling")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Acked-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/pinctrl/mediatek/pinctrl-airoha.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -35,7 +35,7 @@
#define PINCTRL_FUNC_DESC(id, table) \
{ \
- .desc = PINCTRL_PINFUNCTION(#id, table##_groups, \
+ .desc = PINCTRL_PINFUNCTION(id, table##_groups, \
ARRAY_SIZE(table##_groups)),\
.groups = table##_func_group, \
.group_size = ARRAY_SIZE(table##_func_group), \

View File

@ -0,0 +1,40 @@
From 0341d1b1ebf10bcbb9f35e174e83dbb21068387d Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <nathan@kernel.org>
Date: Wed, 12 Nov 2025 11:44:30 -0700
Subject: [PATCH] pinctrl: airoha: Fix AIROHA_PINCTRL_CONFS_DRIVE_E2 in
an7583_pinctrl_match_data
Clang warns (or errors with CONFIG_WERROR=y / W=e):
pinctrl/mediatek/pinctrl-airoha.c:2064:41: error: variable 'an7583_pinctrl_drive_e2_conf' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
2064 | static const struct airoha_pinctrl_conf an7583_pinctrl_drive_e2_conf[] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to a typo, an7583_pinctrl_drive_e2_conf is only used within
ARRAY_SIZE() (hence no instance of -Wunused-variable), which is
evaluated at compile time, so it will not be needed in the final object
file.
Fix the .confs assignment for AIROHA_PINCTRL_CONFS_DRIVE_E2 in
an7583_pinctrl_match_data to clear up the warning.
Closes: https://github.com/ClangBuiltLinux/linux/issues/2142
Fixes: 3ffeb17a9a27 ("pinctrl: airoha: add support for Airoha AN7583 PINs")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/pinctrl/mediatek/pinctrl-airoha.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/pinctrl/mediatek/pinctrl-airoha.c
+++ b/drivers/pinctrl/mediatek/pinctrl-airoha.c
@@ -3003,7 +3003,7 @@ static const struct airoha_pinctrl_match
.num_confs = ARRAY_SIZE(an7583_pinctrl_pulldown_conf),
},
[AIROHA_PINCTRL_CONFS_DRIVE_E2] = {
- .confs = en7581_pinctrl_drive_e2_conf,
+ .confs = an7583_pinctrl_drive_e2_conf,
.num_confs = ARRAY_SIZE(an7583_pinctrl_drive_e2_conf),
},
[AIROHA_PINCTRL_CONFS_DRIVE_E4] = {