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 AE586CED62A for ; Wed, 9 Oct 2024 08:27:54 +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:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TLhzHB7jiqaUdp6L8vmJycmlbC4To6/gc8QcXQMUb/E=; b=ZTwjFQK1GRDxgXiaaRlY+sfLtl qisMstoqAqo9qQZRRUcNP3zacj+X6pVEZpWWsZI3EfirSB+N+n0WjMEwKg6+120BjESowEnM07kQj SUNAdK3QXr8Zb5S/0C36/ViX7jQYQrbZ73Q+WaSWB0sV6QYi604idLjoT0p9bs+5N6CylxjGEjbD5 bKqAFZFSXUZZYeS9J5v1k3IgkIg8RxRFnHpmrYZ83ZMUg4ZP2lRPr0hrm/OlPy+8uq1jaKOp4q6xC yZ9iTRhjIPPAHeTl3ZefckBKdoc21nj7wGc/kxKHIhQGtF/pIzPJ6tAUWlCwQBntvn+rSet/Nu3X4 qbta4wMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syS2q-00000008S4p-3C7h; Wed, 09 Oct 2024 08:27:44 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syS1V-00000008RpD-2flo for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 08:26:22 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-53997328633so8767218e87.3 for ; Wed, 09 Oct 2024 01:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1728462380; x=1729067180; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TLhzHB7jiqaUdp6L8vmJycmlbC4To6/gc8QcXQMUb/E=; b=Gss/cw7s+FWoay72oagvhP1FTV8P8UpDL9nfVi4377Hs2xpRgqB+V2ErK8QDAaU+j0 wooyRJUB+KlcAd/UuixRmzAeS4YgDAZmpIBPchS2jxULZWshELjk8mqrBRAzd0gyMNBw hr0PB4F1o3IfE2q5QJwra5d7hWlIrFFntas25UfJQCwOMAdS40hjfUT4zCdafbqrvhCg 2IvOR1rQE7U1GBf3ie391w7CRVM+GFMbaXZOZnLWDMZHrBCulCuTielx8NvMpaFJfhfm 6p+woH33p/4kdHeYLkSpINGmIUCwsZMpHdzzb33um6Rx38zEu3bNgKVGxNkDrke4jNmW 0HiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728462380; x=1729067180; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TLhzHB7jiqaUdp6L8vmJycmlbC4To6/gc8QcXQMUb/E=; b=Fxxdkaoe/woBvKPJJ03oIrgk7OonKcXaLBzTl+arPspHlb39jN8lKN5ZLMHmmNp8h2 dmbXeEG9YG8TI95X0hwDREQ+HeR3GnYLpW1/YlPzoKKICZnjkDJq+41gplsXZcX2qhEt MXMUgZtRHltIS1lhl823oDgU2ImrNeFBFcFFoDhZHB18Hi25jEEpuy/APYNpYp0EpAYh csYZNH+UyL/hktJf97Q0Db7lC2Urx17ttyPSZNWZ66U+n1HJWTIb7ezj4TaWzC3zJrgE nVd1Qh4ULW6YwAwBEd3x458A7gDba289wgYr8zzD2HVzSLEAeCyUp4uljjybM+ZsqPpv xTwQ== X-Forwarded-Encrypted: i=1; AJvYcCVh0tY82LGO5gPkiE5+yb5QI46crtCRV2eJc8nPvsULN3MPF1vVyed5Fcy475a/IpDezuJBqvy2sfENsnyjVTGx@lists.infradead.org X-Gm-Message-State: AOJu0YzcfwsCQkYWMZZYagVcFhvJQxAQCBsWCSu9n45JaLOwdEStM/x5 iopQPj0bOroCmhFDcPs0tT0pLhNTsGUwYJXYfgwCa1saNvmTJlIE/1wE8XrLzpw= X-Google-Smtp-Source: AGHT+IECwquztc5SDa5khaaQXBkSkMjoGXF+/YXZtyWMOkWs1onDNY2dNBzakxpW7WCrmqB0Ej/WGQ== X-Received: by 2002:a05:6512:3d22:b0:52e:936e:a237 with SMTP id 2adb3069b0e04-539c4899783mr1251682e87.16.1728462379592; Wed, 09 Oct 2024 01:26:19 -0700 (PDT) Received: from [192.168.50.4] ([82.78.167.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9960ba14cfsm285051066b.187.2024.10.09.01.26.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 01:26:19 -0700 (PDT) Message-ID: <61842083-32c1-49d7-a1f5-de1fff0c9655@tuxon.dev> Date: Wed, 9 Oct 2024 11:26:17 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 05/16] soc: renesas: sysc: Move RZ/G3S SoC detection on SYSC driver Content-Language: en-US To: Geert Uytterhoeven 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 References: <20240822152801.602318-1-claudiu.beznea.uj@bp.renesas.com> <20240822152801.602318-6-claudiu.beznea.uj@bp.renesas.com> From: claudiu beznea In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_012621_707156_1E2829BB X-CRM114-Status: GOOD ( 24.88 ) 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, Geert, On 08.10.2024 16:23, Geert Uytterhoeven wrote: > Hi Claudiu, > > On Thu, Aug 22, 2024 at 5:28 PM Claudiu wrote: >> From: Claudiu Beznea >> >> 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 > > 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. OK. > >> + >> + 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 ;-) Yes, this is how I see it going forward. > > 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. That is good to know. I get that we should be safe going forward with this approach. Thank you, Claudiu Beznea > > Gr{oetje,eeting}s, > > Geert >