All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: linux-clk@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>, Dmitry Osipenko <digetx@gmail.com>,
	Florian Fainelli <florian@openwrt.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Greg Ungerer <gerg@linux-m68k.org>,
	John Crispin <john@phrozen.org>,
	Jonas Gorski <jonas.gorski@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Russell King <linux@armlinux.org.uk>,
	Stephen Boyd <sboyd@kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org
Subject: [PATCH 1/7] mips: ar7: convert to clkdev_lookup
Date: Mon, 31 May 2021 20:47:43 +0200	[thread overview]
Message-ID: <20210531184749.2475868-2-arnd@kernel.org> (raw)
In-Reply-To: <20210531184749.2475868-1-arnd@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

ar7 is one of only two platforms that provide the clock interface but
implement a custom version of the clkdev_lookup code.

Change this to use the generic version instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/mips/Kconfig     |  1 +
 arch/mips/ar7/clock.c | 32 ++++++++++++--------------------
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index ed51970c08e7..1cc03a7652a9 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -215,6 +215,7 @@ config AR7
 	select SYS_SUPPORTS_ZBOOT_UART16550
 	select GPIOLIB
 	select VLYNQ
+	select CLKDEV_LOOKUP
 	select HAVE_LEGACY_CLK
 	help
 	  Support for the Texas Instruments AR7 System-on-a-Chip
diff --git a/arch/mips/ar7/clock.c b/arch/mips/ar7/clock.c
index 95def949c971..c614f254f370 100644
--- a/arch/mips/ar7/clock.c
+++ b/arch/mips/ar7/clock.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
  */
 
+#include <linux/clkdev.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -14,6 +15,7 @@
 #include <linux/io.h>
 #include <linux/err.h>
 #include <linux/clk.h>
+#include <linux/clkdev.h>
 
 #include <asm/addrspace.h>
 #include <asm/mach-ar7/ar7.h>
@@ -424,27 +426,15 @@ unsigned long clk_get_rate(struct clk *clk)
 }
 EXPORT_SYMBOL(clk_get_rate);
 
-struct clk *clk_get(struct device *dev, const char *id)
-{
-	if (!strcmp(id, "bus"))
-		return &bus_clk;
+static struct clk_lookup ar7_clkdev_table[] = {
+	CLKDEV_INIT(NULL, "bus", &bus_clk),
 	/* cpmac and vbus share the same rate */
-	if (!strcmp(id, "cpmac"))
-		return &vbus_clk;
-	if (!strcmp(id, "cpu"))
-		return &cpu_clk;
-	if (!strcmp(id, "dsp"))
-		return &dsp_clk;
-	if (!strcmp(id, "vbus"))
-		return &vbus_clk;
-	return ERR_PTR(-ENOENT);
-}
-EXPORT_SYMBOL(clk_get);
-
-void clk_put(struct clk *clk)
-{
-}
-EXPORT_SYMBOL(clk_put);
+	CLKDEV_INIT("cpmac.0", "cpmac", &vbus_clk),
+	CLKDEV_INIT("cpmac.1", "cpmac", &vbus_clk),
+	CLKDEV_INIT(NULL, "cpu", &cpu_clk),
+	CLKDEV_INIT(NULL, "dsp", &dsp_clk),
+	CLKDEV_INIT(NULL, "vbus", &vbus_clk),
+};
 
 void __init ar7_init_clocks(void)
 {
@@ -462,6 +452,8 @@ void __init ar7_init_clocks(void)
 	}
 	/* adjust vbus clock rate */
 	vbus_clk.rate = bus_clk.rate / 2;
+
+	clkdev_add_table(ar7_clkdev_table, ARRAY_SIZE(ar7_clkdev_table));
 }
 
 /* dummy functions, should not be called */
-- 
2.29.2


  reply	other threads:[~2021-05-31 18:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 18:47 [PATCH 0/7] clk: clean up legacy clock interfaces Arnd Bergmann
2021-05-31 18:47 ` Arnd Bergmann [this message]
2021-06-01 13:23   ` [PATCH 1/7] mips: ar7: convert to clkdev_lookup Russell King (Oracle)
2021-06-01 14:41     ` Arnd Bergmann
2021-05-31 18:47 ` [PATCH 2/7] mips: ar7: convert to CONFIG_COMMON_CLK Arnd Bergmann
2021-05-31 18:47 ` [PATCH 3/7] mips: ralink: " Arnd Bergmann
2021-05-31 18:47 ` [PATCH 4/7] m68k: coldfire: use clkdev_lookup on most coldfire Arnd Bergmann
2021-06-01  9:02   ` Geert Uytterhoeven
2021-06-01 12:22     ` Arnd Bergmann
2021-06-01 11:54   ` Greg Ungerer
2021-05-31 18:47 ` [PATCH 5/7] m68k: coldfire: remove private clk_get/clk_put Arnd Bergmann
2021-05-31 18:47 ` [PATCH 6/7] clkdev: remove CONFIG_CLKDEV_LOOKUP Arnd Bergmann
2021-05-31 18:47 ` [PATCH 7/7] clkdev: remove unused clkdev_alloc() interfaces Arnd Bergmann
2021-06-02  7:54   ` Stephen Boyd
2021-06-01  9:51 ` [PATCH 0/7] clk: clean up legacy clock interfaces Thomas Bogendoerfer
2021-06-01 12:24   ` Arnd Bergmann
2021-06-01 22:05     ` Stephen Boyd
2021-06-02 10:37       ` Arnd Bergmann
2021-06-01 12:02 ` Greg Ungerer
  -- strict thread matches above, loose matches on Subject: below --
2021-05-31 17:34 Arnd Bergmann
2021-05-31 17:34 ` [PATCH 1/7] mips: ar7: convert to clkdev_lookup Arnd Bergmann

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=20210531184749.2475868-2-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=digetx@gmail.com \
    --cc=florian@openwrt.org \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=john@phrozen.org \
    --cc=jonas.gorski@gmail.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.