pinctrl: rockchip: fix editing const struct + constify rockchip_pin_ctrl
Subsystems (2)
v2 cover pinctrl: rockchip: fix editing const struct + constify rockchip_pin_ctrl
While testing some WIP work done by Ilias Apalodimas on guaranteeing read-only memory areas truly are handled as read-only[1], my RK3588 Tiger couldn't reach U-Boot CLI anymore because of the pinctrl driver modifying a const struct rockchip_pin_ctrl, triggering a CPU abort.
Instead of going the lazy way and unconstify it, let's fix the actual issue in play.
This also means we should be able to constify the private data of the controller device for all Rockchip devices, instead of having those only for RK356x, RK3588 and RV1126. With the constify done on top of Ilias patch series[1], my PX30 Ringneck, RK3399 Puma and RK3588 Tiger all reach U-Boot CLI. No further testing (like booting into Linux userspace) was done.
[1] https://lore.kernel.org/u-boot/[email protected]/
---
Changes in v2:
- remove removal of bank's pin_base because Jonas said he'll need it for
a new version of https://lore.kernel.org/u-boot/[email protected]/
- fix pin_base computing by init'ing the controller nr_pins to 0,
- make controller nr_pins local to the probe function instead of keeping
it in rockchip_pin_ctrl struct,
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Quentin Schulz (13):
pinctrl: rockchip: fix bank's pin_base computing
pinctrl: rockchip: constify rockchip_pin_ctrl for PX30
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3036
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3066
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3128
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3188
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3228
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3288
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3308
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3328
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3368
pinctrl: rockchip: constify rockchip_pin_ctrl for RK3399
pinctrl: rockchip: constify rockchip_pin_ctrl for RV1108
drivers/pinctrl/rockchip/pinctrl-px30.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3036.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3066.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3128.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3188.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk322x.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3288.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3308.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3328.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3368.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3399.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3568.c | 1 - drivers/pinctrl/rockchip/pinctrl-rk3588.c | 1 - drivers/pinctrl/rockchip/pinctrl-rockchip-core.c | 5 +++-- drivers/pinctrl/rockchip/pinctrl-rockchip.h | 1 - drivers/pinctrl/rockchip/pinctrl-rv1108.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rv1126.c | 1 - 17 files changed, 15 insertions(+), 18 deletions(-)
---
base-commit: 021baf7b08cceb58bb850859dba1614424e16a83
change-id: 20250129-rockchip-pinctrl-const-f4123019a584
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
PATCH v2 1/13 pinctrl: rockchip: fix bank's pin_base computing
From: Quentin Schulz <[email protected]>
The logic in the core reads the nr_pins of the controller and uses it as the index of the first pin in the bank (pin_base) it currently parses. It then increments the number of pins in the controller before going to the next bank.
This works "fine" for controllers where nr_pins isn't defined in their rockchip_pin_ctrl struct as it defaults to 0. However, when it is already set, it'll make the index pin of each bank offset by the number in nr_pins declared in the struct at initialization, and it'll keep growing while adding banks, which means the total number of pins in the controller will be misrepresented.
Additionally, U-Boot proper may probe this driver twice (pre-reloc and true proper) and not reset nr_pins of the controller in-between meaning the second probe will have an offset of the actual correct nr_pins.
Instead, let's just store locally the number of pins in the controller and make sure it's reset between probes.
Finally, this stops modifying a const struct which will soon be triggering a CPU abort at runtime.
--- drivers/pinctrl/rockchip/pinctrl-rk3568.c | 1 - drivers/pinctrl/rockchip/pinctrl-rk3588.c | 1 - drivers/pinctrl/rockchip/pinctrl-rockchip-core.c | 5 +++-- drivers/pinctrl/rockchip/pinctrl-rockchip.h | 1 - drivers/pinctrl/rockchip/pinctrl-rv1126.c | 1 - 5 files changed, 3 insertions(+), 6 deletions(-)
drivers/pinctrl/rockchip/pinctrl-rk3568.c +0 -1
@@ -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,
drivers/pinctrl/rockchip/pinctrl-rk3588.c +0 -1
@@ -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,
drivers/pinctrl/rockchip/pinctrl-rockchip-core.c +3 -2
@@ -532,6 +532,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(struct udevice *d (struct rockchip_pin_ctrl *)dev_get_driver_data (dev);struct rockchip_pin_bank *bank;int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j; +u32 ctrl_nr_pins =0 ; grf_offs = ctrl->grf_mux_offset; pmu_offs = ctrl->pmu_mux_offset;
@@ -543,8 +544,8 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(struct udevice *dint bank_pins =0 ; bank->priv = priv; - bank->pin_base = ctrl->nr_pins; - ctrl->nr_pins += bank->nr_pins; + bank->pin_base = ctrl_nr_pins; + ctrl_nr_pins += bank->nr_pins;/* calculate iomux and drv offsets */ for (j =0 ; j <4 ; j++) {
drivers/pinctrl/rockchip/pinctrl-rockchip.h +0 -1
@@ -500,7 +500,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;
drivers/pinctrl/rockchip/pinctrl-rv1126.c +0 -1
@@ -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,
Signature · 1 line
2.48.1
Re: [PATCH v2 01/13] pinctrl: rockchip: fix bank's pin_base computing
Quoted 18 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
The logic in the core reads the
nr_pinsof the controller and uses it as the index of the first pin in the bank (pin_base) it currently parses. It then increments the number of pins in the controller before going to the next bank.This works "fine" for controllers where
nr_pinsisn't defined in theirrockchip_pin_ctrlstruct as it defaults to 0. However, when it is already set, it'll make the index pin of each bank offset by the number innr_pinsdeclared in the struct at initialization, and it'll keep growing while adding banks, which means the total number of pins in the controller will be misrepresented.Additionally, U-Boot proper may probe this driver twice (pre-reloc and true proper) and not reset
nr_pinsof the controller in-between meaning the second probe will have an offset of the actual correctnr_pins.
Quoted 7 lines
Instead, let's just store locally the number of pins in the controller and make sure it's reset between probes.
Finally, this stops modifying a const struct which will soon be triggering a CPU abort at runtime.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 80 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3568.c | 1 - drivers/pinctrl/rockchip/pinctrl-rk3588.c | 1 - drivers/pinctrl/rockchip/pinctrl-rockchip-core.c | 5 +++-- drivers/pinctrl/rockchip/pinctrl-rockchip.h | 1 - drivers/pinctrl/rockchip/pinctrl-rv1126.c | 1 - 5 files changed, 3 insertions(+), 6 deletions(-)drivers/pinctrl/rockchip/pinctrl-rk3568.c +0
-1@@ -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,drivers/pinctrl/rockchip/pinctrl-rk3588.c +0
-1@@ -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,drivers/pinctrl/rockchip/pinctrl-rockchip-core.c +3
-2@@ -532,6 +532,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(struct udevice *d (struct rockchip_pin_ctrl *)dev_get_driver_data (dev);struct rockchip_pin_bank *bank;int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j; +u32 ctrl_nr_pins =0 ; grf_offs = ctrl->grf_mux_offset; pmu_offs = ctrl->pmu_mux_offset;@@ -543,8 +544,8 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(struct udevice *dint bank_pins =0 ; bank->priv = priv; - bank->pin_base = ctrl->nr_pins; - ctrl->nr_pins += bank->nr_pins; + bank->pin_base = ctrl_nr_pins; + ctrl_nr_pins += bank->nr_pins;/* calculate iomux and drv offsets */ for (j =0 ; j <4 ; j++) {drivers/pinctrl/rockchip/pinctrl-rockchip.h +0
-1@@ -500,7 +500,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;drivers/pinctrl/rockchip/pinctrl-rv1126.c +0
-1@@ -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,
PATCH v2 2/13 pinctrl: rockchip: constify rockchip_pin_ctrl for PX30
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-px30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-px30.c +1 -1
@@ -324,7 +324,7 @@ static struct rockchip_pin_bank px30_pin_banks[] = { ), }; -static struct rockchip_pin_ctrl px30_pin_ctrl = { +static const struct rockchip_pin_ctrl px30_pin_ctrl = { .pin_banks = px30_pin_banks, .nr_banks =ARRAY_SIZE (px30_pin_banks), .grf_mux_offset =0x0 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 02/13] pinctrl: rockchip: constify rockchip_pin_ctrl for PX30
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-px30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-px30.c +1
-1@@ -324,7 +324,7 @@ static struct rockchip_pin_bank px30_pin_banks[] = { ), }; -static struct rockchip_pin_ctrl px30_pin_ctrl = { +static const struct rockchip_pin_ctrl px30_pin_ctrl = { .pin_banks = px30_pin_banks, .nr_banks =ARRAY_SIZE (px30_pin_banks), .grf_mux_offset =0x0 ,
PATCH v2 3/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3036
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3036.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3036.c +1 -1
@@ -80,7 +80,7 @@ static struct rockchip_pin_bank rk3036_pin_banks[] = { PIN_BANK(2, 32, "gpio2"), }; -static struct rockchip_pin_ctrl rk3036_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3036_pin_ctrl = { .pin_banks = rk3036_pin_banks, .nr_banks =ARRAY_SIZE (rk3036_pin_banks), .grf_mux_offset =0xa8 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 03/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3036
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3036.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3036.c +1
-1@@ -80,7 +80,7 @@ static struct rockchip_pin_bank rk3036_pin_banks[] = { PIN_BANK(2, 32, "gpio2"), }; -static struct rockchip_pin_ctrl rk3036_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3036_pin_ctrl = { .pin_banks = rk3036_pin_banks, .nr_banks =ARRAY_SIZE (rk3036_pin_banks), .grf_mux_offset =0xa8 ,
PATCH v2 4/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3066
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3066.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3066.c +1 -1
@@ -82,7 +82,7 @@ static struct rockchip_pin_bank rk3066_pin_banks[] = { PIN_BANK(6, 16, "gpio6"), }; -static struct rockchip_pin_ctrl rk3066_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3066_pin_ctrl = { .pin_banks = rk3066_pin_banks, .nr_banks =ARRAY_SIZE (rk3066_pin_banks), .grf_mux_offset =0xa8 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 04/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3066
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3066.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3066.c +1
-1@@ -82,7 +82,7 @@ static struct rockchip_pin_bank rk3066_pin_banks[] = { PIN_BANK(6, 16, "gpio6"), }; -static struct rockchip_pin_ctrl rk3066_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3066_pin_ctrl = { .pin_banks = rk3066_pin_banks, .nr_banks =ARRAY_SIZE (rk3066_pin_banks), .grf_mux_offset =0xa8 ,
PATCH v2 5/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3128
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3128.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3128.c +1 -1
@@ -171,7 +171,7 @@ static struct rockchip_pin_bank rk3128_pin_banks[] = { PIN_BANK(3, 32, "gpio3"), }; -static struct rockchip_pin_ctrl rk3128_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3128_pin_ctrl = { .pin_banks = rk3128_pin_banks, .nr_banks =ARRAY_SIZE (rk3128_pin_banks), .grf_mux_offset =0xa8 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 05/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3128
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3128.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3128.c +1
-1@@ -171,7 +171,7 @@ static struct rockchip_pin_bank rk3128_pin_banks[] = { PIN_BANK(3, 32, "gpio3"), }; -static struct rockchip_pin_ctrl rk3128_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3128_pin_ctrl = { .pin_banks = rk3128_pin_banks, .nr_banks =ARRAY_SIZE (rk3128_pin_banks), .grf_mux_offset =0xa8 ,
PATCH v2 6/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3188
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3188.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3188.c +1 -1
@@ -105,7 +105,7 @@ static struct rockchip_pin_bank rk3188_pin_banks[] = { PIN_BANK(3, 32, "gpio3"), }; -static struct rockchip_pin_ctrl rk3188_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3188_pin_ctrl = { .pin_banks = rk3188_pin_banks, .nr_banks =ARRAY_SIZE (rk3188_pin_banks), .grf_mux_offset =0x60 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 06/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3188
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3188.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3188.c +1
-1@@ -105,7 +105,7 @@ static struct rockchip_pin_bank rk3188_pin_banks[] = { PIN_BANK(3, 32, "gpio3"), }; -static struct rockchip_pin_ctrl rk3188_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3188_pin_ctrl = { .pin_banks = rk3188_pin_banks, .nr_banks =ARRAY_SIZE (rk3188_pin_banks), .grf_mux_offset =0x60 ,
PATCH v2 7/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3228
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk322x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk322x.c +1 -1
@@ -257,7 +257,7 @@ static struct rockchip_pin_bank rk3228_pin_banks[] = { PIN_BANK(3, 32, "gpio3"), }; -static struct rockchip_pin_ctrl rk3228_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3228_pin_ctrl = { .pin_banks = rk3228_pin_banks, .nr_banks =ARRAY_SIZE (rk3228_pin_banks), .grf_mux_offset =0x0 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 07/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3228
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk322x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk322x.c +1
-1@@ -257,7 +257,7 @@ static struct rockchip_pin_bank rk3228_pin_banks[] = { PIN_BANK(3, 32, "gpio3"), }; -static struct rockchip_pin_ctrl rk3228_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3228_pin_ctrl = { .pin_banks = rk3228_pin_banks, .nr_banks =ARRAY_SIZE (rk3228_pin_banks), .grf_mux_offset =0x0 ,
PATCH v2 8/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3288
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3288.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3288.c +1 -1
@@ -212,7 +212,7 @@ static struct rockchip_pin_bank rk3288_pin_banks[] = { PIN_BANK(8, 16, "gpio8"), }; -static struct rockchip_pin_ctrl rk3288_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3288_pin_ctrl = { .pin_banks = rk3288_pin_banks, .nr_banks =ARRAY_SIZE (rk3288_pin_banks), .grf_mux_offset =0x0 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 08/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3288
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3288.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3288.c +1
-1@@ -212,7 +212,7 @@ static struct rockchip_pin_bank rk3288_pin_banks[] = { PIN_BANK(8, 16, "gpio8"), }; -static struct rockchip_pin_ctrl rk3288_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3288_pin_ctrl = { .pin_banks = rk3288_pin_banks, .nr_banks =ARRAY_SIZE (rk3288_pin_banks), .grf_mux_offset =0x0 ,
PATCH v2 9/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3308
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3308.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3308.c +1 -1
@@ -421,7 +421,7 @@ static struct rockchip_pin_bank rk3308_pin_banks[] = { IOMUX_8WIDTH_2BIT), }; -static struct rockchip_pin_ctrl rk3308_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3308_pin_ctrl = { .pin_banks = rk3308_pin_banks, .nr_banks =ARRAY_SIZE (rk3308_pin_banks), .grf_mux_offset =0x0 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 09/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3308
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3308.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3308.c +1
-1@@ -421,7 +421,7 @@ static struct rockchip_pin_bank rk3308_pin_banks[] = { IOMUX_8WIDTH_2BIT), }; -static struct rockchip_pin_ctrl rk3308_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3308_pin_ctrl = { .pin_banks = rk3308_pin_banks, .nr_banks =ARRAY_SIZE (rk3308_pin_banks), .grf_mux_offset =0x0 ,
PATCH v2 10/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3328
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3328.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3328.c +1 -1
@@ -285,7 +285,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = { 0), }; -static struct rockchip_pin_ctrl rk3328_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3328_pin_ctrl = { .pin_banks = rk3328_pin_banks, .nr_banks =ARRAY_SIZE (rk3328_pin_banks), .grf_mux_offset =0x0 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 10/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3328
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3328.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3328.c +1
-1@@ -285,7 +285,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = { 0), }; -static struct rockchip_pin_ctrl rk3328_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3328_pin_ctrl = { .pin_banks = rk3328_pin_banks, .nr_banks =ARRAY_SIZE (rk3328_pin_banks), .grf_mux_offset =0x0 ,
PATCH v2 11/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3368
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3368.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3368.c +1 -1
@@ -152,7 +152,7 @@ static struct rockchip_pin_bank rk3368_pin_banks[] = { PIN_BANK(3, 32, "gpio3"), }; -static struct rockchip_pin_ctrl rk3368_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3368_pin_ctrl = { .pin_banks = rk3368_pin_banks, .nr_banks =ARRAY_SIZE (rk3368_pin_banks), .grf_mux_offset =0x0 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 11/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3368
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3368.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3368.c +1
-1@@ -152,7 +152,7 @@ static struct rockchip_pin_bank rk3368_pin_banks[] = { PIN_BANK(3, 32, "gpio3"), }; -static struct rockchip_pin_ctrl rk3368_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3368_pin_ctrl = { .pin_banks = rk3368_pin_banks, .nr_banks =ARRAY_SIZE (rk3368_pin_banks), .grf_mux_offset =0x0 ,
PATCH v2 12/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RK3399
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rk3399.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rk3399.c +1 -1
@@ -279,7 +279,7 @@ static struct rockchip_pin_bank rk3399_pin_banks[] = { ), }; -static struct rockchip_pin_ctrl rk3399_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3399_pin_ctrl = { .pin_banks = rk3399_pin_banks, .nr_banks =ARRAY_SIZE (rk3399_pin_banks), .grf_mux_offset =0xe000 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 12/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RK3399
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rk3399.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rk3399.c +1
-1@@ -279,7 +279,7 @@ static struct rockchip_pin_bank rk3399_pin_banks[] = { ), }; -static struct rockchip_pin_ctrl rk3399_pin_ctrl = { +static const struct rockchip_pin_ctrl rk3399_pin_ctrl = { .pin_banks = rk3399_pin_banks, .nr_banks =ARRAY_SIZE (rk3399_pin_banks), .grf_mux_offset =0xe000 ,
PATCH v2 13/13 pinctrl: rockchip: constify rockchip_pin_ctrl for RV1108
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
--- drivers/pinctrl/rockchip/pinctrl-rv1108.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/rockchip/pinctrl-rv1108.c +1 -1
@@ -263,7 +263,7 @@ static struct rockchip_pin_bank rv1108_pin_banks[] = { PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", 0, 0, 0, 0), }; -static struct rockchip_pin_ctrl rv1108_pin_ctrl = { +static const struct rockchip_pin_ctrl rv1108_pin_ctrl = { .pin_banks = rv1108_pin_banks, .nr_banks =ARRAY_SIZE (rv1108_pin_banks), .grf_mux_offset =0x10 ,
Signature · 1 line
2.48.1
Re: [PATCH v2 13/13] pinctrl: rockchip: constify rockchip_pin_ctrl for RV1108
Quoted 6 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
There's no need to modify private data from the controller, so let's make that struct const.
Signed-off-by Quentin Schulz <[email protected]>
Thanks,
- Kever
Quoted 18 lines
--- drivers/pinctrl/rockchip/pinctrl-rv1108.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/rockchip/pinctrl-rv1108.c +1
-1@@ -263,7 +263,7 @@ static struct rockchip_pin_bank rv1108_pin_banks[] = { PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", 0, 0, 0, 0), }; -static struct rockchip_pin_ctrl rv1108_pin_ctrl = { +static const struct rockchip_pin_ctrl rv1108_pin_ctrl = { .pin_banks = rv1108_pin_banks, .nr_banks =ARRAY_SIZE (rv1108_pin_banks), .grf_mux_offset =0x10 ,
Hi Kever,
Quoted 15 lines · Quentin Schulz
While testing some WIP work done by Ilias Apalodimas on guaranteeing read-only memory areas truly are handled as read-only[1], my RK3588 Tiger couldn't reach U-Boot CLI anymore because of the pinctrl driver modifying a const struct
rockchip_pin_ctrl, triggering a CPU abort.Instead of going the lazy way and unconstify it, let's fix the actual issue in play.
This also means we should be able to constify the private data of the controller device for all Rockchip devices, instead of having those only for RK356x, RK3588 and RV1126. With the constify done on top of Ilias patch series[1], my PX30 Ringneck, RK3399 Puma and RK3588 Tiger all reach U-Boot CLI. No further testing (like booting into Linux userspace) was done.
Quoted 4 lines
[1] https://lore.kernel.org/u-boot/[email protected]/
Signed-off-by Quentin Schulz <[email protected]>---
Gentle ping as I don't see it in your u-boot-rockchip custodian tree right now? I see that you added your Reviewed-by on the v1, but please take the v2!
Cheers,
Quentin