Skip to content

Commit a3a632e

Browse files
prabhakarladgeertu
authored andcommitted
pinctrl: renesas: rzg2l: Validate power registers for SD and ETH
On RZ/V2H(P) SoC, the power registers for SD and ETH do not exist, resulting in invalid register offsets. Ensure that the register offsets are valid before any read/write operations are performed. If the power registers are not available, both SD and ETH will be set to '0'. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> # on RZ/G3S Link: https://lore.kernel.org/r/20240530173857.164073-7-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 08b68ae commit a3a632e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

drivers/pinctrl/renesas/pinctrl-rzg2l.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,8 +2503,10 @@ static int rzg2l_pinctrl_suspend_noirq(struct device *dev)
25032503
rzg2l_pinctrl_pm_setup_dedicated_regs(pctrl, true);
25042504

25052505
for (u8 i = 0; i < 2; i++) {
2506-
cache->sd_ch[i] = readb(pctrl->base + SD_CH(regs->sd_ch, i));
2507-
cache->eth_poc[i] = readb(pctrl->base + ETH_POC(regs->eth_poc, i));
2506+
if (regs->sd_ch)
2507+
cache->sd_ch[i] = readb(pctrl->base + SD_CH(regs->sd_ch, i));
2508+
if (regs->eth_poc)
2509+
cache->eth_poc[i] = readb(pctrl->base + ETH_POC(regs->eth_poc, i));
25082510
}
25092511

25102512
cache->qspi = readb(pctrl->base + QSPI);
@@ -2535,8 +2537,10 @@ static int rzg2l_pinctrl_resume_noirq(struct device *dev)
25352537
writeb(cache->qspi, pctrl->base + QSPI);
25362538
writeb(cache->eth_mode, pctrl->base + ETH_MODE);
25372539
for (u8 i = 0; i < 2; i++) {
2538-
writeb(cache->sd_ch[i], pctrl->base + SD_CH(regs->sd_ch, i));
2539-
writeb(cache->eth_poc[i], pctrl->base + ETH_POC(regs->eth_poc, i));
2540+
if (regs->sd_ch)
2541+
writeb(cache->sd_ch[i], pctrl->base + SD_CH(regs->sd_ch, i));
2542+
if (regs->eth_poc)
2543+
writeb(cache->eth_poc[i], pctrl->base + ETH_POC(regs->eth_poc, i));
25402544
}
25412545

25422546
rzg2l_pinctrl_pm_setup_pfc(pctrl);

0 commit comments

Comments
 (0)