From: Marek Vasut <marek.vasut@mailbox.org>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Conor Dooley <conor+dt@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Linus Walleij <linusw@kernel.org>, Rob Herring <robh@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH 2/2] gpio: rcar: Add R-Car X5H (R8A78000) support
Date: Mon, 6 Jul 2026 15:06:01 +0200 [thread overview]
Message-ID: <edc7505e-1103-42d7-b88d-013ca10753b3@mailbox.org> (raw)
In-Reply-To: <CAMRc=MeyKGv75rTLauZuGxSfgjCPXVE_r=A7uNduRr6kAd43aA@mail.gmail.com>
On 7/6/26 11:19 AM, Bartosz Golaszewski wrote:
Hello Bartosz,
>> +static inline int gpio_rcar_remap_offset(struct gpio_rcar_priv *p, int *offs)
>> +{
I am hoping to get some input on this remap function.
>> + /* R-Car Gen4 and older do not need any offset remap. */
>> + if (!p->info.has_layout_gen5)
>> + return 0;
>> +
>> + /*
>> + * R-Car Gen5 register layout is slightly different and the offsets
>> + * that have to be added to or subtracted from each register offset
>> + * can be divided into five groups, listed below.
>> + */
>> + switch (*offs) {
>> + case IOINTSEL...OUTDT:
>> + return 0;
>> + case INDT:
>> + *offs += 0x10;
>> + return 0;
>> + case INTDT...EDGLEVEL:
>> + fallthrough;
>> + case BOTHEDGE:
>> + *offs += 0x70;
>> + return 0;
>> + case OUTDTSEL:
>> + *offs -= 0x34;
>> + return 0;
>> + case INEN:
>> + *offs -= 0x38;
>> + return 0;
>> + default:
>> + /*
>> + * This here must never be reached, if this is reached, that
>> + * means there is a catastrophic failure in the driver. Skip
>> + * any IO read/write to prevent further damage.
>> + */
>> + WARN_ON(1);
>> + return -EINVAL;
>> + }
>> +}
>> +
[...]
>> @@ -399,6 +445,7 @@ static const struct gpio_rcar_info gpio_rcar_info_gen1 = {
>> .has_both_edge_trigger = false,
>> .has_always_in = false,
>> .has_inen = false,
>> + .has_layout_gen5 = false,
>> };
>>
>> static const struct gpio_rcar_info gpio_rcar_info_gen2 = {
>> @@ -406,6 +453,7 @@ static const struct gpio_rcar_info gpio_rcar_info_gen2 = {
>> .has_both_edge_trigger = true,
>> .has_always_in = false,
>> .has_inen = false,
>> + .has_layout_gen5 = false,
>> };
>>
>> static const struct gpio_rcar_info gpio_rcar_info_gen3 = {
>> @@ -413,6 +461,7 @@ static const struct gpio_rcar_info gpio_rcar_info_gen3 = {
>> .has_both_edge_trigger = true,
>> .has_always_in = true,
>> .has_inen = false,
>> + .has_layout_gen5 = false,
>> };
>>
>> static const struct gpio_rcar_info gpio_rcar_info_gen4 = {
>> @@ -420,6 +469,15 @@ static const struct gpio_rcar_info gpio_rcar_info_gen4 = {
>> .has_both_edge_trigger = true,
>> .has_always_in = true,
>> .has_inen = true,
>> + .has_layout_gen5 = false,
>
> This looks good but do we really need to change these lines if it's zeroes
> anyway?
I'm just following the pattern in the driver, which does full assignment
of all fields for all generations of the controller. See .has_inen =
false in Gen1 for example. We don't have to do the assignment, but maybe
doing so is more comprehensible ?
--
Best regards,
Marek Vasut
next prev parent reply other threads:[~2026-07-06 19:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 15:13 [PATCH 1/2] dt-bindings: gpio: renesas,rcar-gpio: Document " Marek Vasut
2026-07-04 15:13 ` [PATCH 2/2] gpio: rcar: Add " Marek Vasut
2026-07-06 9:19 ` Bartosz Golaszewski
2026-07-06 13:06 ` Marek Vasut [this message]
2026-07-07 6:52 ` Geert Uytterhoeven
2026-07-08 22:31 ` Marek Vasut
2026-07-07 13:48 ` Bartosz Golaszewski
2026-07-07 13:53 ` Geert Uytterhoeven
2026-09-04 11:15 ` Geert Uytterhoeven
2026-09-05 21:57 ` Marek Vasut
2026-09-07 7:53 ` Geert Uytterhoeven
2026-09-07 12:10 ` Marek Vasut
2026-09-08 7:49 ` Geert Uytterhoeven
2026-09-09 1:34 ` Marek Vasut
2026-09-09 7:09 ` Geert Uytterhoeven
2026-07-05 14:40 ` [PATCH 1/2] dt-bindings: gpio: renesas,rcar-gpio: Document " Conor Dooley
2026-09-04 11:11 ` Geert Uytterhoeven
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=edc7505e-1103-42d7-b88d-013ca10753b3@mailbox.org \
--to=marek.vasut@mailbox.org \
--cc=brgl@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=robh@kernel.org \
/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®