From: Magnus Damm <damm@opensource.se>
Add RZ/A1 and RZ/A2 compat strings to the rpc-if driver. Also make the
reset controller optional. This is because RZ/A1 does not have any reset
bits assigned to the device so there is no reset controller available.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
Changes since v1:
- New patch
Applies to next-20250710
drivers/memory/renesas-rpc-if.c | 15 ++++++++++++---
include/memory/renesas-rpc-if.h | 1 +
2 files changed, 13 insertions(+), 3 deletions(-)
--- 0001/drivers/memory/renesas-rpc-if.c
+++ work/drivers/memory/renesas-rpc-if.c 2025-07-11 03:45:25.605098312 +0900
@@ -234,7 +234,7 @@ static int rpcif_hw_init_impl(struct rpc
int ret;
if (rpc->info->type == RPCIF_RZ_G2L) {
- ret = reset_control_reset(rpc->rstc);
+ ret = rpc->rstc ? reset_control_reset(rpc->rstc) : 0;
if (ret)
return ret;
usleep_range(200, 300);
@@ -614,7 +614,7 @@ static int rpcif_manual_xfer_impl(struct
return ret;
err_out:
- if (reset_control_reset(rpc->rstc))
+ if (rpc->rstc && reset_control_reset(rpc->rstc))
dev_err(rpc->dev, "Failed to reset HW\n");
rpcif_hw_init_impl(rpc, rpc->bus_size == 2);
return ret;
@@ -1017,7 +1017,7 @@ static int rpcif_probe(struct platform_d
rpc->size = resource_size(res);
rpc->rstc = devm_reset_control_array_get_exclusive(dev);
if (IS_ERR(rpc->rstc))
- return PTR_ERR(rpc->rstc);
+ rpc->rstc = NULL;
/*
* The enabling/disabling of spi/spix2 clocks at runtime leading to
@@ -1115,7 +1115,16 @@ static const struct rpcif_info xspi_info
.type = XSPI_RZ_G3E,
};
+static const struct rpcif_info rpcif_info_rz_a = {
+ .regmap_config = &rpcif_regmap_config,
+ .impl = &rpcif_impl,
+ .type = RPCIF_RZ_A,
+ .strtim = 7,
+};
+
static const struct of_device_id rpcif_of_match[] = {
+ { .compatible = "renesas,r7s72100-rpc-if", .data = &rpcif_info_rz_a },
+ { .compatible = "renesas,r7s9210-rpc-if", .data = &rpcif_info_rz_a },
{ .compatible = "renesas,r8a7796-rpc-if", .data = &rpcif_info_r8a7796 },
{ .compatible = "renesas,r9a09g047-xspi", .data = &xspi_info_r9a09g047 },
{ .compatible = "renesas,rcar-gen3-rpc-if", .data = &rpcif_info_gen3 },
--- 0001/include/memory/renesas-rpc-if.h
+++ work/include/memory/renesas-rpc-if.h 2025-07-11 03:38:33.472749814 +0900
@@ -62,6 +62,7 @@ enum rpcif_type {
RPCIF_RCAR_GEN4,
RPCIF_RZ_G2L,
XSPI_RZ_G3E,
+ RPCIF_RZ_A,
};
struct rpcif {
Hi Magnus, On Sat, 12 Jul 2025 at 15:39, Magnus Damm <damm@opensource.se> wrote: > From: Magnus Damm <damm@opensource.se> > > Add RZ/A1 and RZ/A2 compat strings to the rpc-if driver. Also make the > reset controller optional. This is because RZ/A1 does not have any reset > bits assigned to the device so there is no reset controller available. > > Signed-off-by: Magnus Damm <damm@opensource.se> Thanks for your patch! > --- 0001/drivers/memory/renesas-rpc-if.c > +++ work/drivers/memory/renesas-rpc-if.c 2025-07-11 03:45:25.605098312 +0900 > @@ -234,7 +234,7 @@ static int rpcif_hw_init_impl(struct rpc > int ret; > > if (rpc->info->type == RPCIF_RZ_G2L) { > - ret = reset_control_reset(rpc->rstc); > + ret = rpc->rstc ? reset_control_reset(rpc->rstc) : 0; No need for this, as reset_control_reset() does nothing in case an optional reset is not present. > if (ret) > return ret; > usleep_range(200, 300); > @@ -614,7 +614,7 @@ static int rpcif_manual_xfer_impl(struct > return ret; > > err_out: > - if (reset_control_reset(rpc->rstc)) > + if (rpc->rstc && reset_control_reset(rpc->rstc)) Likewise. > dev_err(rpc->dev, "Failed to reset HW\n"); > rpcif_hw_init_impl(rpc, rpc->bus_size == 2); > return ret; > @@ -1017,7 +1017,7 @@ static int rpcif_probe(struct platform_d > rpc->size = resource_size(res); > rpc->rstc = devm_reset_control_array_get_exclusive(dev); > if (IS_ERR(rpc->rstc)) > - return PTR_ERR(rpc->rstc); > + rpc->rstc = NULL; Errors should be propagated correctly, also for probe deferral. devm_reset_control_array_get_optional_exclusive() is what you are looking for. You can enforce the presence of the resets where needed through the DT bindings. > > /* > * The enabling/disabling of spi/spix2 clocks at runtime leading to Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
On 12/07/2025 15:39, Magnus Damm wrote: > From: Magnus Damm <damm@opensource.se> > > Add RZ/A1 and RZ/A2 compat strings to the rpc-if driver. Also make the > reset controller optional. This is because RZ/A1 does not have any reset > bits assigned to the device so there is no reset controller available. That's different ABI and if you tested bindings, you would see warnings. My previous instruction was really important so I am disappointed that you replied that you are not going to test bindings or your DTS patches. Fix the bindings. > + > static const struct of_device_id rpcif_of_match[] = { > + { .compatible = "renesas,r7s72100-rpc-if", .data = &rpcif_info_rz_a }, > + { .compatible = "renesas,r7s9210-rpc-if", .data = &rpcif_info_rz_a }, So devices are compatible. Express it with proper fallbacks and don't create redundant entries. Or explain in the binding WHY they are not compatible. Best regards, Krzysztof
© 2016 - 2025 Red Hat, Inc.