linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Claudiu <claudiu.beznea@tuxon.dev>
Cc: vkoul@kernel.org, kishon@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org,  conor+dt@kernel.org, p.zabel@pengutronix.de,
	magnus.damm@gmail.com,  gregkh@linuxfoundation.org,
	mturquette@baylibre.com, sboyd@kernel.org,
	 yoshihiro.shimoda.uh@renesas.com, biju.das.jz@bp.renesas.com,
	 ulf.hansson@linaro.org, linux-phy@lists.infradead.org,
	 devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-renesas-soc@vger.kernel.org, linux-usb@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	 linux-pm@vger.kernel.org,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH 05/16] soc: renesas: sysc: Move RZ/G3S SoC detection on SYSC driver
Date: Tue, 8 Oct 2024 15:23:26 +0200	[thread overview]
Message-ID: <CAMuHMdU_kyPb9VAosStrwmQg9vOMgyogQu==u1XQEBWFQLbSdQ@mail.gmail.com> (raw)
In-Reply-To: <20240822152801.602318-6-claudiu.beznea.uj@bp.renesas.com>

Hi Claudiu,

On Thu, Aug 22, 2024 at 5:28 PM Claudiu <claudiu.beznea@tuxon.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Now that we have a driver for SYSC driver for RZ/G3S move the SoC detection
> for RZ/G3S in SYSC driver.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Thanks for your patch!

> --- a/drivers/soc/renesas/rzg3s-sysc.c
> +++ b/drivers/soc/renesas/rzg3s-sysc.c
> @@ -85,6 +97,39 @@ static int rzg3s_sysc_probe(struct platform_device *pdev)
>         sysc->dev = dev;
>         spin_lock_init(&sysc->lock);
>
> +       compatible = of_get_property(dev->of_node, "compatible", NULL);
> +       if (!compatible)
> +               return -ENODEV;

Please use of_match_device() and of_device_id.compatible instead.

> +
> +       soc_id_start = strchr(compatible, ',') + 1;
> +       soc_id_end = strchr(compatible, '-');
> +       size = soc_id_end - soc_id_start;
> +       if (size > 32)
> +               size = 32;
> +       strscpy(soc_id, soc_id_start, size);
> +
> +       soc_dev_attr = devm_kzalloc(dev, sizeof(*soc_dev_attr), GFP_KERNEL);
> +       if (!soc_dev_attr)
> +               return -ENOMEM;
> +
> +       soc_dev_attr->family = "RZ/G3S";
> +       soc_dev_attr->soc_id = devm_kstrdup(dev, soc_id, GFP_KERNEL);
> +       if (!soc_dev_attr->soc_id)
> +               return -ENOMEM;
> +
> +       devid = readl(sysc->base + RZG3S_SYS_LSI_DEVID);
> +       revision = FIELD_GET(RZG3S_SYS_LSI_DEVID_REV, devid);
> +       soc_dev_attr->revision = devm_kasprintf(dev, GFP_KERNEL, "%u", revision);
> +       if (!soc_dev_attr->revision)
> +               return -ENOMEM;
> +
> +       dev_info(dev, "Detected Renesas %s %s Rev %s\n", soc_dev_attr->family,
> +                soc_dev_attr->soc_id, soc_dev_attr->revision);
> +
> +       soc_dev = soc_device_register(soc_dev_attr);
> +       if (IS_ERR(soc_dev))
> +               return PTR_ERR(soc_dev);
> +
>         return rzg3s_sysc_reset_probe(sysc, "reset", 0);
>  }

My first thought was "oh no, now this is handled/duplicated in two
places", but if you later migrate the chip identification support for
the rest of RZ/G2L devices to here, it may start to look better ;-)

One caveat is that soc_device_match() can be called quite early in
the boot process, hence renesas_soc_init() is an early_initcall().
So registering the soc_device from a platform_driver might be too late,
especially since fw_devlinks won't help you in this particular case.
However, I think all real early calls to soc_device_match() are gone
since the removal of the support for R-Car H3 ES1.x, and all remaining
calls impact only R-Car and RZ/Gx (not G2L) SoCs.

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


  reply	other threads:[~2024-10-08 13:34 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 15:27 [PATCH 00/16] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
2024-08-22 15:27 ` [PATCH 01/16] clk: renesas: r9a08g045: Add clocks, resets and power domains for USB Claudiu
2024-08-29 12:35   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 02/16] dt-bindings: soc: renesas: renesas,rzg2l-sysc: Add #reset-cells for RZ/G3S Claudiu
2024-08-22 16:42   ` Conor Dooley
2024-08-22 16:44     ` Conor Dooley
2024-08-23  7:59       ` claudiu beznea
2024-08-23  7:54     ` claudiu beznea
2024-08-23 16:18       ` Conor Dooley
2024-08-23 16:26         ` claudiu beznea
2024-08-23 16:33           ` Conor Dooley
2024-08-26 10:15             ` claudiu beznea
2024-08-26 17:09               ` Conor Dooley
2024-10-08 13:24   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 03/16] dt-bindings: reset: renesas,r9a08g045-sysc: Add reset IDs for RZ/G3S SYSC reset Claudiu
2024-08-22 16:45   ` Conor Dooley
2024-10-08 13:25   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 04/16] soc: renesas: Add SYSC driver for Renesas RZ/G3S Claudiu
2024-09-24 11:32   ` Geert Uytterhoeven
2024-09-25  7:50     ` claudiu beznea
2024-10-08 13:54       ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 05/16] soc: renesas: sysc: Move RZ/G3S SoC detection on SYSC driver Claudiu
2024-10-08 13:23   ` Geert Uytterhoeven [this message]
2024-10-09  8:26     ` claudiu beznea
2024-08-22 15:27 ` [PATCH 06/16] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S SoC Claudiu
2024-08-22 16:45   ` Conor Dooley
2024-10-08 14:46   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 07/16] reset: rzg2l-usbphy-ctrl: Get reset control array Claudiu
2024-08-23  7:25   ` Biju Das
2024-08-23  8:05     ` claudiu beznea
2024-08-23  8:17       ` Biju Das
2024-10-08 14:46   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 08/16] reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S Claudiu
2024-08-22 16:59   ` Biju Das
2024-08-23  8:40     ` claudiu beznea
2024-08-23  8:46       ` Biju Das
2024-10-08 14:47   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 09/16] dt-bindings: usb: renesas,usbhs: Document RZ/G3S SoC Claudiu
2024-08-22 16:46   ` Conor Dooley
2024-10-08 14:51   ` Geert Uytterhoeven
2024-10-09  8:28     ` claudiu beznea
2024-08-22 15:27 ` [PATCH 10/16] phy: renesas: rcar-gen3-usb2: Add support to initialize the bus Claudiu
2024-08-23  7:35   ` Biju Das
2024-08-23  8:57     ` claudiu beznea
2024-08-23  9:01       ` Biju Das
2024-08-30  8:02         ` Vinod Koul
2024-08-30  8:06           ` Biju Das
2024-10-08 14:57   ` Geert Uytterhoeven
2024-10-09  8:31     ` claudiu beznea
2024-08-22 15:27 ` [PATCH 11/16] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3S phy bindings Claudiu
2024-08-22 16:46   ` Conor Dooley
2024-10-08 14:58   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 12/16] phy: renesas: rcar-gen3-usb2: Add support for the RZ/G3S SoC Claudiu
2024-10-08 14:59   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 13/16] arm64: dts: renesas: Add #reset-cells to system controller node Claudiu
2024-10-08 14:59   ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 14/16] arm64: dts: renesas: r9a08g045: Add USB support Claudiu
2024-10-08 15:00   ` Geert Uytterhoeven
2024-08-22 15:28 ` [PATCH 15/16] arm64: dts: renesas: rzg3s-smarc: Enable " Claudiu
2024-10-08 15:16   ` Geert Uytterhoeven
2024-10-09  8:42     ` claudiu beznea
2024-08-22 15:28 ` [PATCH 16/16] arm64: defconfig: Enable RZ/G3S SYSC reset driver Claudiu
2024-10-08 15:17   ` Geert Uytterhoeven
2024-08-29 15:26 ` [PATCH 00/16] Add initial USB support for the Renesas RZ/G3S SoC Ulf Hansson
2024-08-30  8:22   ` claudiu beznea
2024-08-30 10:14     ` Ulf Hansson
2024-08-30 11:32       ` claudiu beznea
2024-08-31 10:32         ` Ulf Hansson
2024-09-03 10:35           ` Ulf Hansson
2024-09-03 10:58             ` claudiu beznea
2024-09-03 11:50               ` Ulf Hansson
2024-08-31  5:13     ` Biju Das
2024-09-02  7:54       ` Biju Das
2024-09-02  8:47         ` claudiu beznea
2024-09-02  8:53           ` Biju Das
2024-09-02  9:14             ` claudiu beznea
2024-09-02  9:18               ` Biju Das
2024-09-02 10:40                 ` claudiu beznea
2024-09-02 10:47                   ` Biju Das
2024-09-03  7:18                     ` Biju Das
2024-09-03 10:25                       ` claudiu beznea
2024-09-03 10:31                         ` Biju Das
2024-09-03 11:00                           ` claudiu beznea
2024-09-03 11:07                             ` Biju Das
2024-09-03 12:00                               ` Biju Das
2024-09-03 12:25                                 ` claudiu beznea
2024-09-03 12:37                                   ` Biju Das
2024-09-03 12:57                                     ` claudiu beznea
2024-09-03 13:09                                       ` Biju Das
2024-09-03 14:46                                         ` claudiu beznea
2024-09-03 15:30                                           ` Biju Das
2024-09-03 13:45                                       ` Biju Das
2024-09-03 14:48                                         ` claudiu beznea
2024-11-07 10:00                                           ` Claudiu Beznea
2024-11-07 16:22                                             ` Philipp Zabel
2024-09-03 10:19                     ` claudiu beznea
2024-09-02  8:28       ` claudiu beznea
2024-08-30  8:10 ` (subset) " Vinod Koul

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='CAMuHMdU_kyPb9VAosStrwmQg9vOMgyogQu==u1XQEBWFQLbSdQ@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=vkoul@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.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;
as well as URLs for NNTP newsgroup(s).