From: Arnd Bergmann <arnd@kernel.org>
To: linux-clk@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 1/7] mips: ar7: convert to clkdev_lookup
Date: Mon, 31 May 2021 19:34:23 +0200 [thread overview]
Message-ID: <20210531173429.2467403-2-arnd@kernel.org> (raw)
In-Reply-To: <20210531173429.2467403-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
next prev parent reply other threads:[~2021-05-31 17:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 17:34 [PATCH 0/7] clk: clean up legacy clock interfaces Arnd Bergmann
2021-05-31 17:34 ` Arnd Bergmann [this message]
2021-05-31 17:34 ` [PATCH 2/7] mips: ar7: convert to CONFIG_COMMON_CLK Arnd Bergmann
2021-05-31 17:34 ` [PATCH 3/7] mips: ralink: " Arnd Bergmann
2021-05-31 17:34 ` [PATCH 4/7] m68k: coldfire: use clkdev_lookup on most coldfire Arnd Bergmann
2021-05-31 17:34 ` [PATCH 5/7] m68k: coldfire: remove private clk_get/clk_put Arnd Bergmann
2021-05-31 17:34 ` [PATCH 6/7] clkdev: remove CONFIG_CLKDEV_LOOKUP Arnd Bergmann
2021-05-31 17:34 ` [PATCH 7/7] clkdev: remove unused clkdev_alloc() interfaces Arnd Bergmann
2021-05-31 18:44 ` [PATCH 0/7] clk: clean up legacy clock interfaces Dmitry Osipenko
2021-05-31 18:47 ` Arnd Bergmann
-- strict thread matches above, loose matches on Subject: below --
2021-05-31 18:47 Arnd Bergmann
2021-05-31 18:47 ` [PATCH 1/7] mips: ar7: convert to clkdev_lookup Arnd Bergmann
2021-06-01 13:23 ` Russell King (Oracle)
2021-06-01 14:41 ` 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=20210531173429.2467403-2-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=linux-clk@vger.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;
as well as URLs for NNTP newsgroup(s).