Re: [PATCH v2 5/7] pinctrl: renesas: rzg2l: Split SoC-specific masks in struct rzg2l_register_masks

From: Diogo Ivo

Date: Fri Nov 27 2026 - 09:03:39 EST


Hi Claudiu,

On 11/27/2026 10:16 AM, claudiu beznea wrote:
Hi, Diogo,

On 10/26/26 13:35, Diogo Ivo wrote:
struct rzg2l_register_masks declares the masks of the OTHER_POC register
of RZ/G3L and of the I3C_SET_POC register of RZ/G3S in two branches of an
anonymous union. As both branches share the same storage, initializing both
other_poc_pvdd1833_oth_awo_poc and i3c_set_poc on RZ/G3L would have the
designated initializers override each other, ending up with the I3C_SET_POC
value in the PVDD1833_OTH_AWO_POC mask.

Split the union into a common area, for masks shared by multiple SoCs, and
per-SoC areas: the RZ/G3S and RZ/G3L I3C_SET_POC mask moves to the common
area, and the RZ/G3L OTHER_POC masks stay in a dedicated RZ/G3L area. This
way every mask gets its own member,

> and new SoCs can be described by> adding their own struct
(possibly inside a union).

That may be missed by the next person adding it...

Ack, that is a good point. I will add it to v2 if Geert is ok with this approach.


The existing RZ/G3S data only initializes i3c_set_poc, so it is not
affected by this change.

Signed-off-by: Diogo Ivo <diogo.ivo.sx@xxxxxxxxxxx>
---
Changes in v2:
  - No changes
---
  drivers/pinctrl/renesas/pinctrl-rzg2l.c | 20 ++++++++------------
  1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/ pinctrl/renesas/pinctrl-rzg2l.c
index 9bf3743dc1ce..f73d273df362 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -278,18 +278,14 @@ struct rzg2l_register_offsets {
   * @i3c_set_poc: I3C_SET_POC mask
   */
  struct rzg2l_register_masks {
-    union {
-        /* RZ/G3L masks */
-        struct {
-            u8 other_poc_pvdd1833_oth_awo_poc;
-            u8 other_poc_pvdd1833_oth_iso_poc;
-            u8 other_poc_wdtovf_n_poc;
-        };
-
-        /* RZ/G3S masks */
-        struct {
-            u8 i3c_set_poc;
-        };
+    /* Masks common to multiple SoCs */
+    u8 i3c_set_poc; /* RZ/G3S, RZ/G3L */

I would drop the names of the SoCs close to the i3c_set_poc. That have the opportunity to grow over time. As Geert considers better.

Ok, I will wait for feedback here then but I am ok with dropping the SoC names.

+
+    /* RZ/G3L masks */
+    struct {
+        u8 other_poc_pvdd1833_oth_awo_poc;
+        u8 other_poc_pvdd1833_oth_iso_poc;
+        u8 other_poc_wdtovf_n_poc;
      };

OK, we can drop the union but the next SoC addition may be:

/* New SoC masks */
struct {
    u8 x;
    u8 y;
};

If we want to keep the initial form we may need to pay attention.

Patch is OK for me, just with the mention that we need to pay attention if we want to keep, for the future, the approach before this patch.

Ok, then if Geert is ok with removing the union for now and possibly reviving it later I will state this clearly in the commit message.


Thank you,
Claudiu