mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: magnus.damm@gmail.com, john.madieu.xa@bp.renesas.com,
	linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH] soc: renesas: rz-sysc: Populate readable_reg/writeable_reg in regmap config
Date: Fri, 26 Sep 2025 07:38:32 +0300	[thread overview]
Message-ID: <4cf2c655-053f-4ab7-a807-a63a1150e7bc@tuxon.dev> (raw)
In-Reply-To: <CAMuHMdV62NUeEYyYgf4LJ2JQLwA-fAzYyA-cy9h_nyYKmtB=1g@mail.gmail.com>

Hi, Geert,

On 9/25/25 17:05, Geert Uytterhoeven wrote:
> Hi Claudiu,
> 
> On Mon, 22 Sept 2025 at 09:41, Claudiu <claudiu.beznea@tuxon.dev> wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> Not all system controller registers are accessible from Linux. Accessing
>> such registers generates synchronous external abort. Populate the
>> readable_reg and writeable_reg members of the regmap config to inform the
>> regmap core which registers can be accessed. The list will need to be
>> updated whenever new system controller functionality is exported through
>> regmap.
>>
>> Fixes: 2da2740fb9c8 ("soc: renesas: rz-sysc: Add syscon/regmap support")
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Thanks for your patch!
> 
>> --- a/drivers/soc/renesas/r9a08g045-sysc.c
>> +++ b/drivers/soc/renesas/r9a08g045-sysc.c
>> @@ -6,10 +6,14 @@
>>   */
>>
>>  #include <linux/bits.h>
>> +#include <linux/device.h>
>>  #include <linux/init.h>
>>
>>  #include "rz-sysc.h"
>>
>> +#define SYS_USB_PWRRDY         0xd70
>> +#define SYS_PCIE_RST_RSM_B     0xd74
>> +
>>  static const struct rz_sysc_soc_id_init_data rzg3s_sysc_soc_id_init_data __initconst = {
>>         .family = "RZ/G3S",
>>         .id = 0x85e0447,
>> @@ -18,7 +22,20 @@ static const struct rz_sysc_soc_id_init_data rzg3s_sysc_soc_id_init_data __initc
>>         .specific_id_mask = GENMASK(27, 0),
>>  };
>>
>> +static bool rzg3s_regmap_readable_reg(struct device *dev, unsigned int reg)
>> +{
>> +       switch (reg) {
>> +       case SYS_USB_PWRRDY:
>> +       case SYS_PCIE_RST_RSM_B:
> 
> Given upstream has already support for RZ/G3S Ethernet, it may be wise
> to add the GEther0/1 Config Registers at 0x380/0x390, too.  That way
> you avoid a possible future hard dependency and regression when adding
> support for configuring that register from the Ethernet driver.
> The same is true for RZ/G3E, RZ/V2H, and RZ/V2N.

Ok, I'll update.

> 
>> +               return true;
>> +       default:
>> +               return false;
>> +       }
>> +}
>> +
>>  const struct rz_sysc_init_data rzg3s_sysc_init_data __initconst = {
>>         .soc_id_init_data = &rzg3s_sysc_soc_id_init_data,
>> +       .readable_reg = rzg3s_regmap_readable_reg,
>> +       .writeable_reg = rzg3s_regmap_readable_reg,
>>         .max_register = 0xe20,
>>  };
> 
>> --- a/drivers/soc/renesas/r9a09g056-sys.c
>> +++ b/drivers/soc/renesas/r9a09g056-sys.c
>> @@ -70,6 +70,13 @@ static const struct rz_sysc_soc_id_init_data rzv2n_sys_soc_id_init_data __initco
>>         .print_id = rzv2n_sys_print_id,
>>  };
>>
>> +static bool rzv2n_regmap_readable_reg(struct device *dev, unsigned int reg)
>> +{
>> +       return false;
> 
> I would already add the TRU trimming registers, also for RZ/V2H, as
> they can probably just reuse the RZ/G3E TSU driver.

Wasn't aware of it. I'll check it.

> 
>> +}
>> +
>>  const struct rz_sysc_init_data rzv2n_sys_init_data = {
>>         .soc_id_init_data = &rzv2n_sys_soc_id_init_data,
>> +       .readable_reg = rzv2n_regmap_readable_reg,
>> +       .writeable_reg = rzv2n_regmap_readable_reg,
> 
> Oops, this one does not have ".max_register = 0x170c" yet.
> Does this cause any ill effects that warrant an urgent fix?

Yes, similar crash. I wrongly checked it initially. I'll update it.

Thank you for your review,
Claudiu

> 
>>  };
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 


      reply	other threads:[~2025-09-26  4:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22  7:41 Claudiu
2025-09-24 13:44 ` Geert Uytterhoeven
2025-09-24 15:45   ` Claudiu Beznea
2025-09-25 13:46     ` Geert Uytterhoeven
2025-09-25 14:05 ` Geert Uytterhoeven
2025-09-26  4:38   ` Claudiu Beznea [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4cf2c655-053f-4ab7-a807-a63a1150e7bc@tuxon.dev \
    --to=claudiu.beznea@tuxon.dev \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=john.madieu.xa@bp.renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®