public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenz@kernel.org>
To: Stephen Boyd <sboyd@kernel.org>,
	Maxime Ripard <maxime@cerno.tech>,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: linux-rpi-kernel@lists.infradead.org, geert@linux-m68k.org,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] clk: bcm: rpi: Don't register as OF provider if !dev->np
Date: Thu, 25 Mar 2021 19:57:48 +0100	[thread overview]
Message-ID: <20210325185749.27984-1-nsaenz@kernel.org> (raw)

There are two ways clk-raspberrypi might be registered: through
device-tree or through an explicit platform device registration. The
latter happens after firmware/raspberrypi's probe, and it's limited to
RPi3s, which solely use the ARM clock to scale CPU's frequency. That
clock is matched with cpu0's device thanks to the ARM clock being
registered as a clkdev.

In that scenario, don't register the device as an OF clock provider, as
it makes no sense and will cause trouble.

Fixes: d4b4f1b6b97e ("clk: bcm: rpi: Add DT provider for the clocks")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
---
 drivers/clk/bcm/clk-raspberrypi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
index f89b9cfc4309..27e85687326f 100644
--- a/drivers/clk/bcm/clk-raspberrypi.c
+++ b/drivers/clk/bcm/clk-raspberrypi.c
@@ -337,10 +337,12 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
-					  clk_data);
-	if (ret)
-		return ret;
+	if (dev->of_node) {
+		ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
+						  clk_data);
+		if (ret)
+			return ret;
+	}
 
 	rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
 						     -1, NULL, 0);
-- 
2.30.2


             reply	other threads:[~2021-03-25 18:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210325185810eucas1p1d36da720896060cc37b8d33db012044d@eucas1p1.samsung.com>
2021-03-25 18:57 ` Nicolas Saenz Julienne [this message]
2021-03-26  6:24   ` [PATCH] clk: bcm: rpi: Don't register as OF provider if !dev->np Marek Szyprowski
2021-03-26 18:09   ` Stephen Boyd
2021-03-26 18:13     ` 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=20210325185749.27984-1-nsaenz@kernel.org \
    --to=nsaenz@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=maxime@cerno.tech \
    --cc=mturquette@baylibre.com \
    --cc=nsaenzjulienne@suse.de \
    --cc=sboyd@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