Commit 269f1aac authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Linus Walleij

ARM: ux500: use CLK_OF_DECLARE()

The ux500 DT support predates the CLK_OF_DECLARE macro and calls
directly into the clk driver from platform code.

Converting this to CLK_OF_DECLARE makes the code much nicer and
similar to how modern platforms do it today. It also removes the
last user of cpu_is_u8500_family() etc.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 1e6cbc06
...@@ -1821,7 +1821,6 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) ...@@ -1821,7 +1821,6 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
T: git git://git.linaro.org/people/ulfh/clk.git T: git git://git.linaro.org/people/ulfh/clk.git
S: Maintained S: Maintained
F: drivers/clk/ux500/ F: drivers/clk/ux500/
F: include/linux/platform_data/clk-ux500.h
ARM/VERSATILE EXPRESS PLATFORM ARM/VERSATILE EXPRESS PLATFORM
M: Liviu Dudau <liviu.dudau@arm.com> M: Liviu Dudau <liviu.dudau@arm.com>
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/irqchip.h> #include <linux/irqchip.h>
#include <linux/irqchip/arm-gic.h> #include <linux/irqchip/arm-gic.h>
#include <linux/platform_data/clk-ux500.h>
#include <linux/platform_data/arm-ux500-pm.h> #include <linux/platform_data/arm-ux500-pm.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
...@@ -66,17 +65,6 @@ void __init ux500_init_irq(void) ...@@ -66,17 +65,6 @@ void __init ux500_init_irq(void)
prcmu_early_init(r.start, r.end-r.start); prcmu_early_init(r.start, r.end-r.start);
ux500_pm_init(r.start, r.end-r.start); ux500_pm_init(r.start, r.end-r.start);
ux500_l2x0_init(); ux500_l2x0_init();
/*
* Init clocks here so that they are available for system timer
* initialization.
*/
if (cpu_is_u8500_family())
u8500_clk_init();
else if (cpu_is_u9540())
u9540_clk_init();
else if (cpu_is_u8540())
u8540_clk_init();
} }
static const char * __init ux500_get_machine(void) static const char * __init ux500_get_machine(void)
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/mfd/dbx500-prcmu.h> #include <linux/mfd/dbx500-prcmu.h>
#include <linux/platform_data/clk-ux500.h>
#include "clk.h" #include "clk.h"
#define PRCC_NUM_PERIPH_CLUSTERS 6 #define PRCC_NUM_PERIPH_CLUSTERS 6
...@@ -48,11 +47,6 @@ static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec, ...@@ -48,11 +47,6 @@ static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec,
return PRCC_SHOW(clk_data, base, bit); return PRCC_SHOW(clk_data, base, bit);
} }
static const struct of_device_id u8500_clk_of_match[] = {
{ .compatible = "stericsson,u8500-clks", },
{ },
};
/* CLKRST4 is missing making it hard to index things */ /* CLKRST4 is missing making it hard to index things */
enum clkrst_index { enum clkrst_index {
CLKRST1_INDEX = 0, CLKRST1_INDEX = 0,
...@@ -63,22 +57,15 @@ enum clkrst_index { ...@@ -63,22 +57,15 @@ enum clkrst_index {
CLKRST_MAX, CLKRST_MAX,
}; };
void u8500_clk_init(void) static void u8500_clk_init(struct device_node *np)
{ {
struct prcmu_fw_version *fw_version; struct prcmu_fw_version *fw_version;
struct device_node *np = NULL;
struct device_node *child = NULL; struct device_node *child = NULL;
const char *sgaclk_parent = NULL; const char *sgaclk_parent = NULL;
struct clk *clk, *rtc_clk, *twd_clk; struct clk *clk, *rtc_clk, *twd_clk;
u32 bases[CLKRST_MAX]; u32 bases[CLKRST_MAX];
int i; int i;
if (of_have_populated_dt())
np = of_find_matching_node(NULL, u8500_clk_of_match);
if (!np) {
pr_err("Either DT or U8500 Clock node not found\n");
return;
}
for (i = 0; i < ARRAY_SIZE(bases); i++) { for (i = 0; i < ARRAY_SIZE(bases); i++) {
struct resource r; struct resource r;
...@@ -573,3 +560,4 @@ void u8500_clk_init(void) ...@@ -573,3 +560,4 @@ void u8500_clk_init(void)
of_clk_add_provider(child, of_clk_src_simple_get, twd_clk); of_clk_add_provider(child, of_clk_src_simple_get, twd_clk);
} }
} }
CLK_OF_DECLARE(u8500_clks, "stericsson,u8500-clks", u8500_clk_init);
...@@ -12,14 +12,8 @@ ...@@ -12,14 +12,8 @@
#include <linux/clkdev.h> #include <linux/clkdev.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/mfd/dbx500-prcmu.h> #include <linux/mfd/dbx500-prcmu.h>
#include <linux/platform_data/clk-ux500.h>
#include "clk.h" #include "clk.h"
static const struct of_device_id u8540_clk_of_match[] = {
{ .compatible = "stericsson,u8540-clks", },
{ }
};
/* CLKRST4 is missing making it hard to index things */ /* CLKRST4 is missing making it hard to index things */
enum clkrst_index { enum clkrst_index {
CLKRST1_INDEX = 0, CLKRST1_INDEX = 0,
...@@ -30,19 +24,12 @@ enum clkrst_index { ...@@ -30,19 +24,12 @@ enum clkrst_index {
CLKRST_MAX, CLKRST_MAX,
}; };
void u8540_clk_init(void) static void u8540_clk_init(struct device_node *np)
{ {
struct clk *clk; struct clk *clk;
struct device_node *np = NULL;
u32 bases[CLKRST_MAX]; u32 bases[CLKRST_MAX];
int i; int i;
if (of_have_populated_dt())
np = of_find_matching_node(NULL, u8540_clk_of_match);
if (!np) {
pr_err("Either DT or U8540 Clock node not found\n");
return;
}
for (i = 0; i < ARRAY_SIZE(bases); i++) { for (i = 0; i < ARRAY_SIZE(bases); i++) {
struct resource r; struct resource r;
...@@ -607,3 +594,4 @@ void u8540_clk_init(void) ...@@ -607,3 +594,4 @@ void u8540_clk_init(void)
bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE); bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE);
clk_register_clkdev(clk, NULL, "rng"); clk_register_clkdev(clk, NULL, "rng");
} }
CLK_OF_DECLARE(u8540_clks, "stericsson,u8540-clks", u8540_clk_init);
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/mfd/dbx500-prcmu.h> #include <linux/mfd/dbx500-prcmu.h>
#include <linux/platform_data/clk-ux500.h>
#include "clk.h" #include "clk.h"
void u9540_clk_init(void) static void u9540_clk_init(struct device_node *np)
{ {
/* register clocks here */ /* register clocks here */
} }
CLK_OF_DECLARE(u9540_clks, "stericsson,u9540-clks", u9540_clk_init);
/*
* Clock definitions for ux500 platforms
*
* Copyright (C) 2012 ST-Ericsson SA
* Author: Ulf Hansson <ulf.hansson@linaro.org>
*
* License terms: GNU General Public License (GPL) version 2
*/
#ifndef __CLK_UX500_H
#define __CLK_UX500_H
void u8500_clk_init(void);
void u9540_clk_init(void);
void u8540_clk_init(void);
#endif /* __CLK_UX500_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment