On 2025/1/29 20:42, Quentin Schulz wrote:
From: Quentin Schulz <quentin.sch...@cherry.de>

Each controller has an nr_pins member that is set either through the
rockchip_pin_ctrl struct or from the core (or both).

This is an issue because on RK3568, RK3588 and RV1126, the struct is
const, this means it shouldn't be modified at all. This will trigger a
CPU abort once we enforce the read-only at the MMU level in a few
releases, therefore let's remove this useless (and broken, and soon
breaking) code.

Signed-off-by: Quentin Schulz <quentin.sch...@cherry.de>
Reviewed-by: Kever Yang <kever.y...@rock-chips.com>

Thanks,
- Kever
---
  drivers/pinctrl/rockchip/pinctrl-rk3568.c        | 1 -
  drivers/pinctrl/rockchip/pinctrl-rk3588.c        | 1 -
  drivers/pinctrl/rockchip/pinctrl-rockchip-core.c | 1 -
  drivers/pinctrl/rockchip/pinctrl-rockchip.h      | 1 -
  drivers/pinctrl/rockchip/pinctrl-rv1126.c        | 1 -
  5 files changed, 5 deletions(-)

diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3568.c 
b/drivers/pinctrl/rockchip/pinctrl-rk3568.c
index 
5deedc648a41950461b6a468e4852fa0a5384207..c8a91b8bb6e925e0f2e7d6cd09f8a06a58be60dd
 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3568.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3568.c
@@ -345,7 +345,6 @@ static struct rockchip_pin_bank rk3568_pin_banks[] = {
  static const struct rockchip_pin_ctrl rk3568_pin_ctrl = {
        .pin_banks              = rk3568_pin_banks,
        .nr_banks               = ARRAY_SIZE(rk3568_pin_banks),
-       .nr_pins                = 160,
        .grf_mux_offset         = 0x0,
        .pmu_mux_offset         = 0x0,
        .iomux_routes           = rk3568_mux_route_data,
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3588.c 
b/drivers/pinctrl/rockchip/pinctrl-rk3588.c
index 
98ababc7c90700c4b27359fc3625519f20437306..fd8e617b9108c7314b8fdd4bbe1dfae71f1b6449
 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3588.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3588.c
@@ -324,7 +324,6 @@ static struct rockchip_pin_bank rk3588_pin_banks[] = {
  static const struct rockchip_pin_ctrl rk3588_pin_ctrl = {
        .pin_banks              = rk3588_pin_banks,
        .nr_banks               = ARRAY_SIZE(rk3588_pin_banks),
-       .nr_pins                = 160,
        .set_mux                = rk3588_set_mux,
        .set_pull               = rk3588_set_pull,
        .set_drive              = rk3588_set_drive,
diff --git a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c 
b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
index 
7369fe12b961290742f6ba24fb32b768531f56f9..b87aed709d62d1e85d0d199c2d6c92aeaec67487
 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
@@ -543,7 +543,6 @@ static struct rockchip_pin_ctrl 
*rockchip_pinctrl_get_soc_data(struct udevice *d
                int bank_pins = 0;
bank->priv = priv;
-               ctrl->nr_pins += bank->nr_pins;
/* calculate iomux and drv offsets */
                for (j = 0; j < 4; j++) {
diff --git a/drivers/pinctrl/rockchip/pinctrl-rockchip.h 
b/drivers/pinctrl/rockchip/pinctrl-rockchip.h
index 
ebd008eede24af32c123634a57f50c0294e76842..2910bbb570d8736487b8cb6c9f87f3e164858b5b
 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rockchip.h
+++ b/drivers/pinctrl/rockchip/pinctrl-rockchip.h
@@ -498,7 +498,6 @@ struct rockchip_mux_route_data {
  struct rockchip_pin_ctrl {
        struct rockchip_pin_bank        *pin_banks;
        u32                             nr_banks;
-       u32                             nr_pins;
        int                             grf_mux_offset;
        int                             pmu_mux_offset;
        int                             grf_drv_offset;
diff --git a/drivers/pinctrl/rockchip/pinctrl-rv1126.c 
b/drivers/pinctrl/rockchip/pinctrl-rv1126.c
index 
efa2408b204b421ad1c5a36b039d8c07c5b7237e..3878a5420dcc98f591e4eefadd78a2fe98b61c7e
 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rv1126.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rv1126.c
@@ -381,7 +381,6 @@ static struct rockchip_pin_bank rv1126_pin_banks[] = {
  static const struct rockchip_pin_ctrl rv1126_pin_ctrl = {
        .pin_banks              = rv1126_pin_banks,
        .nr_banks               = ARRAY_SIZE(rv1126_pin_banks),
-       .nr_pins                = 130,
        .grf_mux_offset         = 0x10004, /* mux offset from GPIO0_D0 */
        .pmu_mux_offset         = 0x0,
        .iomux_routes           = rv1126_mux_route_data,

Reply via email to