Message ID | 20240512121633.1632597-3-jonas@kwiboo.se |
---|---|
State | Accepted |
Commit | 264475514c90de2d432af1953c2d55c86c4e48ac |
Delegated to: | Kever Yang |
Headers | show |
Series | rockchip: pinctrl: Minor fixes and add support for pinmux status cmd | expand |
On 2024/5/12 20:16, Jonas Karlman wrote: > GPIO0_C0-C4 iomux is set using PMUGRF_GPIO0C_IOMUX_L reg on RV1126. This > is indicated using the IOMUX_L_SOURCE_PMU flag. Fix reading current mux > by fully adopting the IOMUX_L_SOURCE_PMU related code in Linux kernel. > > Based on Linux commit fd4ea48688c6 ("pinctrl: rockchip: Add RV1126 > pinctrl support"). > > Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Thanks, - Kever > --- > drivers/pinctrl/rockchip/pinctrl-rockchip-core.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c > index b6e2ab474d0f..973e6a4f6db9 100644 > --- a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c > +++ b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c > @@ -132,8 +132,12 @@ static int rockchip_get_mux(struct rockchip_pin_bank *bank, int pin) > if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) > return RK_FUNC_GPIO; > > - regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU) > - ? priv->regmap_pmu : priv->regmap_base; > + if (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU) > + regmap = priv->regmap_pmu; > + else if (bank->iomux[iomux_num].type & IOMUX_L_SOURCE_PMU) > + regmap = (pin % 8 < 4) ? priv->regmap_pmu : priv->regmap_base; > + else > + regmap = priv->regmap_base; > > /* get basic quadrupel of mux registers and the correct reg inside */ > mux_type = bank->iomux[iomux_num].type; > @@ -563,12 +567,14 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(struct udevice *d > > /* preset iomux offset value, set new start value */ > if (iom->offset >= 0) { > - if (iom->type & IOMUX_SOURCE_PMU) > + if ((iom->type & IOMUX_SOURCE_PMU) || > + (iom->type & IOMUX_L_SOURCE_PMU)) > pmu_offs = iom->offset; > else > grf_offs = iom->offset; > } else { /* set current iomux offset */ > - iom->offset = (iom->type & IOMUX_SOURCE_PMU) ? > + iom->offset = ((iom->type & IOMUX_SOURCE_PMU) || > + (iom->type & IOMUX_L_SOURCE_PMU)) ? > pmu_offs : grf_offs; > } >
diff --git a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c index b6e2ab474d0f..973e6a4f6db9 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c +++ b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c @@ -132,8 +132,12 @@ static int rockchip_get_mux(struct rockchip_pin_bank *bank, int pin) if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) return RK_FUNC_GPIO; - regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU) - ? priv->regmap_pmu : priv->regmap_base; + if (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU) + regmap = priv->regmap_pmu; + else if (bank->iomux[iomux_num].type & IOMUX_L_SOURCE_PMU) + regmap = (pin % 8 < 4) ? priv->regmap_pmu : priv->regmap_base; + else + regmap = priv->regmap_base; /* get basic quadrupel of mux registers and the correct reg inside */ mux_type = bank->iomux[iomux_num].type; @@ -563,12 +567,14 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(struct udevice *d /* preset iomux offset value, set new start value */ if (iom->offset >= 0) { - if (iom->type & IOMUX_SOURCE_PMU) + if ((iom->type & IOMUX_SOURCE_PMU) || + (iom->type & IOMUX_L_SOURCE_PMU)) pmu_offs = iom->offset; else grf_offs = iom->offset; } else { /* set current iomux offset */ - iom->offset = (iom->type & IOMUX_SOURCE_PMU) ? + iom->offset = ((iom->type & IOMUX_SOURCE_PMU) || + (iom->type & IOMUX_L_SOURCE_PMU)) ? pmu_offs : grf_offs; }
GPIO0_C0-C4 iomux is set using PMUGRF_GPIO0C_IOMUX_L reg on RV1126. This is indicated using the IOMUX_L_SOURCE_PMU flag. Fix reading current mux by fully adopting the IOMUX_L_SOURCE_PMU related code in Linux kernel. Based on Linux commit fd4ea48688c6 ("pinctrl: rockchip: Add RV1126 pinctrl support"). Signed-off-by: Jonas Karlman <jonas@kwiboo.se> --- drivers/pinctrl/rockchip/pinctrl-rockchip-core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)