Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3840053ybv; Tue, 25 Feb 2020 08:13:35 -0800 (PST) X-Google-Smtp-Source: APXvYqwnP8l80945z9bDeWvaqUY2MCQnhm9L8aKHHM4YITYz94ndmQS66HsBdD8QkLo77QXDLnPu X-Received: by 2002:aca:5fc6:: with SMTP id t189mr4415722oib.166.1582647215535; Tue, 25 Feb 2020 08:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582647215; cv=none; d=google.com; s=arc-20160816; b=GMF/8VPth8px9Pmm8IUrmer5TBorAY5NHuF6A8RKML71cOo49E37UsWockuoNUOv5O Z/POWB1S26ChT53xr0W5jjcUjUKVDr9ntk4MMtu/XfvKTLTgXO/wU4wtI+NZ1yWySPG5 31mbu7RPOxn5fHgqwre7lJadEAJPVfHPIC4vgnmUJ6mN6wjzi3K6YNOUurrfmV79WL3e 0VSoVzJfDSxWXxL/IwYDKJkrOnWaV2L7aX92+TYX+KDHEGq3rYhORx2ozuGliPczbyvD S3NA4pHzxj3dKz6Hth3VsWcj1CLQR+/uxDzy0RbArALnPN6izrbdIg1LM28GJSqWEuPF CGLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=rBTYLOJxueHGv87G/pZ9na5aEuIHM+dXY7heDA/nAPM=; b=JOIjfi2MlbN1Su2zThmO3FnteKJq/NXKzSe3ErzhqFsZt1NCbQlqUcpxs6PeGCOTjl NxzCQq2rkq6D235dYpWMlhTeZwrc0XrQ4d0BhBrC6qUEUR06pdmtqpqKS+8I/7i2tgs0 65z71dtfy8VZ31uhTNzYVqWzTzQ2ej6dzs5ObA90hdPssNiIV1/9VJCj8LkFu1oFTwY5 Jvehy9nOdVHpxeuoKiqt80nvIg2MImP/xkYVgWJfHGUXfEZqyIqifvz2s8wfPaJDLYCR widaWETcFAq8VkSAekoD2H1VE/fZHl/wIZm5hblq8qp1YeDIZn0IWjyboIQ/yuVGsjq+ RPEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si8493769otn.216.2020.02.25.08.13.19; Tue, 25 Feb 2020 08:13:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730939AbgBYQBC (ORCPT + 99 others); Tue, 25 Feb 2020 11:01:02 -0500 Received: from mx2.suse.de ([195.135.220.15]:41860 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730422AbgBYQBB (ORCPT ); Tue, 25 Feb 2020 11:01:01 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2B30FADBE; Tue, 25 Feb 2020 16:00:58 +0000 (UTC) Message-ID: <71cd7b35af81ee91c3b4dc5e7c05760ecd590c5d.camel@suse.de> Subject: Re: [PATCH 07/89] clk: bcm: rpi: Allow the driver to be probed by DT From: Nicolas Saenz Julienne To: Maxime Ripard , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Date: Tue, 25 Feb 2020 17:00:56 +0100 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-rHY9rlJOyK3Y6KPoBaSb" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-rHY9rlJOyK3Y6KPoBaSb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Maxime, On Mon, 2020-02-24 at 10:06 +0100, Maxime Ripard wrote: > The current firmware clock driver for the RaspberryPi can only be probed = by > manually registering an associated platform_device. >=20 > While this works fine for cpufreq where the device gets attached a clkdev > lookup, it would be tedious to maintain a table of all the devices using > one of the clocks exposed by the firmware. >=20 > Since the DT on the other hand is the perfect place to store those > associations, make the firmware clocks driver probe-able through the devi= ce > tree so that we can represent it as a node. I'm not convinced this is the right approach, and if we decide to go this w= ay, there are more changes to take into account. For one, if we create a dt node for this driver, we'd have to delete the platform device creation in firmware/raspberrypi.c and then we'd be even ab= le to bypass raspberrypi-cpufreq altogether by creating opp tables in dt. But there are reasons we didn't go that way at the time. We've made an effort to avoid using dt for firmware interfaces whenever possible as, on one hand, it's arguable they don't fit device-tree's hardwa= re description paradigm and, on the other, the lack of flexibility they impose once the binding is defined. VC4's firmware interfaces are not set in stone= , nor standardized like SCMI, so the more flexible we are to future changes t= he better. Another thing I'm not all that happy about it's how dynamic clock registeri= ng is handled in patch #22 (but I'll keep it here as relevant to the discussio= n): - Some of those fw managed clocks you're creating have their mmio counterpa= rt being registered by clk-bcm238. IMO either register one or the other, giv= ing precedence to the mmio counterpart. Note that for pllb, we deleted the relevant code from clk-bcm2385. - The same way we were able to map the fw CPU clock into the clk tree (pllb/pllb_arm) there are no reasons we shouldn't be able to do the same = for the VPU clocks. It's way nicer and less opaque to users (this being a learning platform adds to the argument). - On top of that, having a special case for the CPU clock registration is nasty. Lets settle for one solution and make everyone follow it. - I don't see what's so bad about creating clock lookups. IIUC there are on= ly two clocks that need this special handling CPU & HDMI, It's manageable. Y= ou don't even have to mess with the consumer driver, if there was ever to be= a dt provided mmio option to this clock. > drivers/clk/bcm/clk-raspberrypi.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk- > raspberrypi.c > index 1654fd0eedc9..94870234824c 100644 > --- a/drivers/clk/bcm/clk-raspberrypi.c > +++ b/drivers/clk/bcm/clk-raspberrypi.c > @@ -255,15 +255,13 @@ static int raspberrypi_clk_probe(struct platform_de= vice > *pdev) > struct raspberrypi_clk *rpi; > int ret; > =20 > - firmware_node =3D of_find_compatible_node(NULL, NULL, > - "raspberrypi,bcm2835-firmware"); > + firmware_node =3D of_parse_phandle(dev->of_node, "raspberrypi,firmware"= , > 0); There is no such phandle in the upstream device tree. Maybe this was aimed = at the downstream dt? Regards, Nicolas --=-rHY9rlJOyK3Y6KPoBaSb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl5VRLgACgkQlfZmHno8 x/6Q2gf+ISkwE0dJhNaeauh1TOB9Ymx8NHoZYccWJLmwg4vqH+nOGwxQM4O26qbu lXwrXTBzGcDwvdJkGmBsrTqRGGRbgtmeBQu4siPFNjD7hl775Uz2FIfNlWnUEieQ lKbdquRkNjoHvXoDDuHEHuBlHQ2W0IckhNFiEMhdDGb2n9eAvBaILoba+pgjgwP6 IAnRGDlk7JBf7kuWHk6RWEOjOwKoCJlHJsNA09ZK2tjXMkaOqKLWnGIVGFMECm7/ ThGgG9gqv65WG/8uK1E/F5hnR3qVbYXLcXAXZLK28nxkXODDw7fNBEXEUfXHJKqT TtEHMJ79mu2FeQA32GE0G3lduoWGjg== =HBgi -----END PGP SIGNATURE----- --=-rHY9rlJOyK3Y6KPoBaSb--