From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4412DCEF173 for ; Tue, 8 Oct 2024 13:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nCY3NIx/eYd1xSXTQBGOOuko+7cH0vhvxDiWRgqK6Zw=; b=Fn8S2ArXJqpBwIqWunHbkWiXU1 ZuarAuQX3gXRjVpqv38wYwRat1eAQw6B0qIoDcLufI6OB+CXMcbUa4lwcd+NFjA4b+CRvpQjMX6uo weEtpJPhUmv8K233n33HG5GGpUojn8BPWJSANvROixTRkQJoS+ia1UsdzVeT0yVdfxM62rdkisPWF Ei2j4myvn8rZk+qH9WBmWyMFipClth1EvHbeFLnoC9VB6oUfYXEgsIrWOtRTKwqAPC61Msa0UAiiJ yKaGY0MXjJiIVygCiejXQHSpe0jECfZLhGMCeJ2ySDFtmcRWz4nalBBwfuvyeXnhp1oVbFZeGYfhB Wd/m/5zA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syAM9-000000060lj-0O22; Tue, 08 Oct 2024 13:34:29 +0000 Received: from mail-yw1-f174.google.com ([209.85.128.174]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syABk-00000005y1u-2B0Z; Tue, 08 Oct 2024 13:23:47 +0000 Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-6e2b9e945b9so47241567b3.0; Tue, 08 Oct 2024 06:23:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728393821; x=1728998621; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nCY3NIx/eYd1xSXTQBGOOuko+7cH0vhvxDiWRgqK6Zw=; b=BuNLDWPm4kcXrrekX161cypK76IMWj9k2gdlJrJF9/+kBN2dXLJ70hNocT8qr9tia5 XtQ797Ck5UMNpb21SjUju8FU40hKKnnH5mpNU6n95Yb65Yve0zHJELlYWfaXiyti6dnU xyVNM4GDsLK4/ZVnEn2D8iOq+5gwheJZ9kFUKZzRL9BuSglpkaLoqwpfdWTGFOyC6TeP cL7+mwzOUQKb00nhAOXJ0Gsr9tzfmn3u3QH87MDEWhBYZgQkMHSVCsKJOGWnV2AYLw2p 8LwQL4Y8gLAi53aalzVgTMEAcdK1POggZKB6CXI2L8e/QHlFur8QoaxSG6/468FZLrXh EtYQ== X-Forwarded-Encrypted: i=1; AJvYcCV17hebaFuzUButQwbOAgen5Ez82CaXAAU1Q/6lGpmwEoYUrHsQbeeBp4StKADnK0Xwu0qWA41MrWdysD5bxxiM@lists.infradead.org, AJvYcCXwt6Q/6l01mDVdX8OxcLuN0k6qogtmaqxMa5PFAlnLcmFsPT22bCDd5YTFB5uGTN4hLYojr9nvJH42@lists.infradead.org X-Gm-Message-State: AOJu0Yz7RRrAZNSlqmbaVvxs8P378Zt8Ah8/dFV4pc3Ll7FdqwhMQd6m VPxnscnDpdSxe0OxYtZgKiAuISJyBzguRm8kh21ctwbvg0yujqWJLP5qN7BY X-Google-Smtp-Source: AGHT+IH4Bl1Yp8+R3zQ5GVOQsCAFJ/eQ+MC8fp0bssUWjjZHWBhoii/a82YFGFkMdG2rcX6WcQ1iwg== X-Received: by 2002:a05:690c:81:b0:6e2:f61e:c52 with SMTP id 00721157ae682-6e2f61e3ec4mr64528007b3.34.1728393821270; Tue, 08 Oct 2024 06:23:41 -0700 (PDT) Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com. [209.85.128.176]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6e2d93f8801sm14140137b3.141.2024.10.08.06.23.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Oct 2024 06:23:40 -0700 (PDT) Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-6dde476d3dfso44521337b3.3; Tue, 08 Oct 2024 06:23:40 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWG79VnA+zS4pQ+I5tlpLDnxF/f3xL/EwM16a9PMYy8qpCsBt3bkcZDanHl2UTK1Cto7jKCAW70G6qB@lists.infradead.org, AJvYcCXNO5XXYzVix0OoUuZak9uXYm0qtaMF/5LCWn8uStcyN8eJ/ogn6YK0TFAsAi/I1QRllM2v0muyLXhJNNlUeokw@lists.infradead.org X-Received: by 2002:a05:690c:fc2:b0:6e2:1090:af31 with SMTP id 00721157ae682-6e2c6fc7e31mr116307267b3.3.1728393819734; Tue, 08 Oct 2024 06:23:39 -0700 (PDT) MIME-Version: 1.0 References: <20240822152801.602318-1-claudiu.beznea.uj@bp.renesas.com> <20240822152801.602318-6-claudiu.beznea.uj@bp.renesas.com> In-Reply-To: <20240822152801.602318-6-claudiu.beznea.uj@bp.renesas.com> From: Geert Uytterhoeven Date: Tue, 8 Oct 2024 15:23:26 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 05/16] soc: renesas: sysc: Move RZ/G3S SoC detection on SYSC driver To: Claudiu 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_062344_586528_E9913819 X-CRM114-Status: GOOD ( 24.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Claudiu, On Thu, Aug 22, 2024 at 5:28=E2=80=AFPM Claudiu = wrote: > From: Claudiu Beznea > > Now that we have a driver for SYSC driver for RZ/G3S move the SoC detecti= on > for RZ/G3S in SYSC driver. > > Signed-off-by: Claudiu Beznea 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 *pd= ev) > sysc->dev =3D dev; > spin_lock_init(&sysc->lock); > > + compatible =3D 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 =3D strchr(compatible, ',') + 1; > + soc_id_end =3D strchr(compatible, '-'); > + size =3D soc_id_end - soc_id_start; > + if (size > 32) > + size =3D 32; > + strscpy(soc_id, soc_id_start, size); > + > + soc_dev_attr =3D devm_kzalloc(dev, sizeof(*soc_dev_attr), GFP_KER= NEL); > + if (!soc_dev_attr) > + return -ENOMEM; > + > + soc_dev_attr->family =3D "RZ/G3S"; > + soc_dev_attr->soc_id =3D devm_kstrdup(dev, soc_id, GFP_KERNEL); > + if (!soc_dev_attr->soc_id) > + return -ENOMEM; > + > + devid =3D readl(sysc->base + RZG3S_SYS_LSI_DEVID); > + revision =3D FIELD_GET(RZG3S_SYS_LSI_DEVID_REV, devid); > + soc_dev_attr->revision =3D 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->fa= mily, > + soc_dev_attr->soc_id, soc_dev_attr->revision); > + > + soc_dev =3D 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 --=20 Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k= .org In personal conversations with technical people, I call myself a hacker. Bu= t when I'm talking to journalists I just say "programmer" or something like t= hat. -- Linus Torvalds