[PATCH v5 4/4] i3c: master: Add basic driver for the Renesas I3C controller
Geert Uytterhoeven
geert at linux-m68k.org
Wed Jul 30 07:39:46 PDT 2025
Hi Wolfram,
On Thu, 24 Jul 2025 at 11:41, Wolfram Sang
<wsa+renesas at sang-engineering.com> wrote:
> Add a basic driver for the I3C controller found in Renesas RZ/G3S and
> G3E SoCs. Support I3C pure busses (tested with two targets) and mixed
> busses (two I3C devices plus various I2C targets). DAA and communication
> with temperature sensors worked reliably at various speeds.
>
> Missing features such as IBI, HotJoin, and target mode will be added
> incrementally.
>
> Signed-off-by: Wolfram Sang <wsa+renesas at sang-engineering.com>
> Tested-by: Tommaso Merciai <tommaso.merciai.xr at bp.renesas.com>
> Reviewed-by: Frank Li <Frank.Li at nxp.com>
Thanks for your patch!
Just a few stylistic comments for now...
> --- /dev/null
> +++ b/drivers/i3c/master/renesas-i3c.c
> +#define REFCKCTL 0x70
> +#define REFCKCTL_IREFCKS(x) FIELD_PREP(GENMASK(2, 0), x)
Interesting... Usually the FIELD_*() macros are used like this:
#define REFCKCTL_IREFCKS GENMASK(2, 0)
x = readl(base + REFCKCTL);
a = FIELD_GET(REFCKCTL_IREFCKS, x);
y = FIELD_PREP(REFCKCTL_IREFCKS, b);
writel(y, base + REFCKCTL);
That way you do not have to duplicate "GENMASK(2, 0)" in the read and
write marshalling macros. But I do agree this driver does not seem
to have register fields that are both read and written ;-)
> +static inline u32 renesas_readl(void __iomem *base, u32 reg)
> +{
> + return readl(base + reg);
> +}
> +
> +static inline void renesas_writel(void __iomem *base, u32 reg, u32 val)
> +{
> + writel(val, base + reg);
> +}
Why not use readl() and writel() directly?
To make it easier to add debug prints during initial development?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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
More information about the linux-i3c
mailing list