2013-09-18 18:00:33

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 00/26] ARM: provide common arch init for DT clocks

This is a patch set based on an RFC [1][2] sent earlier to provide a common
arch/arm init for DT clock providers. Currently, the call to of_clk_init(NULL)
to initialize DT clock providers is spread among several mach-dirs. Since most
machs require DT clocks initialized before timers, no initcall can be used.

By adding of_clk_init(NULL) to arch/arm time_init(), we can remove all
mach-specific .init_time hooks that basically called of_clk_init and
clocksource_of_init.

In contrast to the RFC version, of_clk_init(NULL) is now only called if no
custom .init_time callback is set. This allows some machs to still call clock
init themselves, as not all can be converted now. Therefore, this patch sets
drops conversion of mach-mvebu and mach-zynq. New machs that were introduced
with v3.12-rc1 are also converted, except mach-u300 that requires clocks
before irqs.

The patch set is based on v3.12-rc1 and further depends on a topic branch
created by Stephen Warren for mach-tegra [3]. It is now split into preparation
and removal patches to not break bisectability. I added all Acked-by/Tested-by's
where applicable or dropped them, if the patch was separated into two.
It has been compile tested for all machs involved with the following defconfigs
(multi_v7, bcm2835, dove, exynos, kirkwood, mxs, nhk8815) and nspire selected
on multi_v4_v5.

Patches 1-8 comprise preparation patches that convert machs nomadik, prima2,
socfpga, sunxi, tegra, and vt8500 to usual .init_time callbacks calling only
of_clk_init and clocksource_of_init.

Patch 9 then introduces of_clk_init(NULL) to the arch-wide default .init_time
callback.

Patches 10-26 finally remove custom .init_time callbacks from the machs involved.

The patches have been pushed to a topic branch based on v3.12-rc1 with tegra's
tegra-for-3.13-deps-for-arm-init-time-cleanup branch merged in to

https://github.com/shesselba/linux-dove.git clk-of-init-v1_for-3.13

[1] http://www.spinics.net/lists/arm-kernel/msg268260.html
[2] http://www.spinics.net/lists/arm-kernel/msg270173.html
[3] http://www.spinics.net/lists/arm-kernel/msg273957.html
git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra.git tegra-for-3.13-deps-for-arm-init-time-cleanup

Sebastian Hesselbarth (26):
ARM: nomadik: move mtu setup to clocksource init
clk: nomadik: move src init out of nomadik_clk_init
clk: nomadik: declare OF clock provider
clk: prima2: declare OF clock provider
ARM: socfgpa: prepare for arch-wide .init_time callback
clk: sunxi: declare OF clock provider
clk: vt8500: parse pmc_base from clock driver
ARM: vt8500: prepare for arch-wide .init_time callback
ARM: call of_clk_init from default time_init handler
ARM: bcm2835: remove custom .init_time hook
ARM: dove: remove custom .init_time hook
ARM: exynos: remove custom .init_time hook
ARM: highbank: remove custom .init_time hook
ARM: imx: remove custom .init_time hook
ARM: kirkwood: remove custom .init_time hook
ARM: mxs: remove custom .init_time hook
ARM: nomadik: remove custom .init_time hook
ARM: nspire: remove custom .init_time hook
ARM: prima2: remove custom .init_time hook
ARM: rockchip: remove custom .init_time hook
ARM: socfpga: remove custom .init_time hook
ARM: sti: remove custom .init_time hook
ARM: sunxi: remove custom .init_time hook
ARM: tegra: remove custom .init_time hook
ARM: vexpress: remove custom .init_time hook
ARM: vt8500: remove custom .init_time hook

arch/arm/kernel/time.c | 27 ++---
arch/arm/mach-bcm2835/bcm2835.c | 2 -
arch/arm/mach-dove/board-dt.c | 11 --
arch/arm/mach-exynos/common.c | 8 --
arch/arm/mach-exynos/common.h | 1 -
arch/arm/mach-exynos/mach-exynos4-dt.c | 2 -
arch/arm/mach-exynos/mach-exynos5-dt.c | 2 -
arch/arm/mach-highbank/highbank.c | 23 ++---
arch/arm/mach-imx/clk-imx51-imx53.c | 29 ++----
arch/arm/mach-imx/common.h | 4 -
arch/arm/mach-imx/imx51-dt.c | 6 --
arch/arm/mach-imx/mach-imx53.c | 6 --
arch/arm/mach-imx/mach-imx6q.c | 14 +--
arch/arm/mach-imx/mach-imx6sl.c | 7 --
arch/arm/mach-imx/mach-vf610.c | 9 --
arch/arm/mach-kirkwood/board-dt.c | 8 --
arch/arm/mach-mxs/mach-mxs.c | 13 ---
arch/arm/mach-nomadik/cpu-8815.c | 36 -------
arch/arm/mach-nspire/nspire.c | 9 --
arch/arm/mach-prima2/common.c | 11 --
arch/arm/mach-prima2/common.h | 1 -
arch/arm/mach-rockchip/rockchip.c | 9 --
arch/arm/mach-socfpga/socfpga.c | 2 -
arch/arm/mach-sti/board-dt.c | 10 +-
arch/arm/mach-sunxi/sunxi.c | 10 --
arch/arm/mach-tegra/tegra.c | 9 --
arch/arm/mach-vexpress/v2m.c | 14 +--
arch/arm/mach-vt8500/common.h | 24 -----
arch/arm/mach-vt8500/vt8500.c | 6 --
drivers/clk/clk-bcm2835.c | 8 --
drivers/clk/clk-highbank.c | 10 +-
drivers/clk/clk-nomadik.c | 161 ++++++++++++++---------------
drivers/clk/clk-prima2.c | 29 ++----
drivers/clk/clk-vt8500.c | 31 ++++--
drivers/clk/mxs/clk-imx23.c | 15 +--
drivers/clk/mxs/clk-imx28.c | 16 +--
drivers/clk/sunxi/clk-sunxi.c | 11 +-
drivers/clocksource/nomadik-mtu.c | 11 ++
include/linux/clk/mxs.h | 2 -
include/linux/clk/sunxi.h | 22 ----
include/linux/platform_data/clk-nomadik.h | 2 -
41 files changed, 182 insertions(+), 449 deletions(-)
delete mode 100644 arch/arm/mach-vt8500/common.h
delete mode 100644 include/linux/clk/sunxi.h
delete mode 100644 include/linux/platform_data/clk-nomadik.h

---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: STEricsson <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--
1.7.10.4


2013-09-18 17:54:16

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 04/26] clk: prima2: declare OF clock provider

Common clock framework allows to register clock providers to get called
on of_clk_init() by using CLK_OF_DECLARE. This converts prima2 clock
provider to make use of it and get rid of the mach specific clk init
call.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Russell King <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-prima2/common.c | 4 ++--
arch/arm/mach-prima2/common.h | 1 -
drivers/clk/clk-prima2.c | 29 ++++++-----------------------
3 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index e110b6d..9b7663d 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -6,6 +6,7 @@
* Licensed under GPLv2 or later.
*/

+#include <linux/clk-provider.h>
#include <linux/clocksource.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -23,8 +24,7 @@ void __init sirfsoc_init_late(void)

static __init void sirfsoc_init_time(void)
{
- /* initialize clocking early, we want to set the OS timer */
- sirfsoc_of_clk_init();
+ of_clk_init(NULL);
clocksource_of_init();
}

diff --git a/arch/arm/mach-prima2/common.h b/arch/arm/mach-prima2/common.h
index a630485..4b76806 100644
--- a/arch/arm/mach-prima2/common.h
+++ b/arch/arm/mach-prima2/common.h
@@ -23,7 +23,6 @@ extern void sirfsoc_secondary_startup(void);
extern void sirfsoc_cpu_die(unsigned int cpu);

extern void __init sirfsoc_of_irq_init(void);
-extern void __init sirfsoc_of_clk_init(void);
extern void sirfsoc_restart(enum reboot_mode, const char *);
extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs);

diff --git a/drivers/clk/clk-prima2.c b/drivers/clk/clk-prima2.c
index 5ab95f1..6c15e33 100644
--- a/drivers/clk/clk-prima2.c
+++ b/drivers/clk/clk-prima2.c
@@ -1015,16 +1015,6 @@ static struct clk_std clk_usb1 = {
},
};

-static struct of_device_id clkc_ids[] = {
- { .compatible = "sirf,prima2-clkc" },
- {},
-};
-
-static struct of_device_id rsc_ids[] = {
- { .compatible = "sirf,prima2-rsc" },
- {},
-};
-
enum prima2_clk_index {
/* 0 1 2 3 4 5 6 7 8 9 */
rtc, osc, pll1, pll2, pll3, mem, sys, security, dsp, gps,
@@ -1082,24 +1072,16 @@ static struct clk_hw *prima2_clk_hw_array[maxclk] __initdata = {
static struct clk *prima2_clks[maxclk];
static struct clk_onecell_data clk_data;

-void __init sirfsoc_of_clk_init(void)
+static void __init sirfsoc_clk_init(struct device_node *np)
{
- struct device_node *np;
+ struct device_node *rscnp;
int i;

- np = of_find_matching_node(NULL, rsc_ids);
- if (!np)
- panic("unable to find compatible rsc node in dtb\n");
-
- sirfsoc_rsc_vbase = of_iomap(np, 0);
+ rscnp = of_find_compatible_node(NULL, NULL, "sirf,prima2-rsc");
+ sirfsoc_rsc_vbase = of_iomap(rscnp, 0);
if (!sirfsoc_rsc_vbase)
panic("unable to map rsc registers\n");
-
- of_node_put(np);
-
- np = of_find_matching_node(NULL, clkc_ids);
- if (!np)
- return;
+ of_node_put(rscnp);

sirfsoc_clk_vbase = of_iomap(np, 0);
if (!sirfsoc_clk_vbase)
@@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)

of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
}
+CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
--
1.7.10.4

2013-09-18 17:54:14

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 02/26] clk: nomadik: move src init out of nomadik_clk_init

nomadik_clk_init currently also maps system reset controller base address
used by clocks and registers a reboot notifier. To allow further cleanup of
nomadik clk setup, this moves system reset controller setup from
nomadik_clk_init to its own function.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Alessandro Rubini <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: STEricsson <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/clk/clk-nomadik.c | 117 +++++++++++++++++++++++----------------------
1 file changed, 61 insertions(+), 56 deletions(-)

diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
index 51410c2..7849086 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -54,6 +54,66 @@ static DEFINE_SPINLOCK(src_lock);
/* Base address of the SRC */
static void __iomem *src_base;

+static int nomadik_clk_reboot_handler(struct notifier_block *this,
+ unsigned long code,
+ void *unused)
+{
+ u32 val;
+
+ /* The main chrystal need to be enabled for reboot to work */
+ val = readl(src_base + SRC_XTALCR);
+ val &= ~SRC_XTALCR_MXTALOVER;
+ val |= SRC_XTALCR_MXTALEN;
+ pr_crit("force-enabling MXTALO\n");
+ writel(val, src_base + SRC_XTALCR);
+ return NOTIFY_OK;
+}
+
+static struct notifier_block nomadik_clk_reboot_notifier = {
+ .notifier_call = nomadik_clk_reboot_handler,
+};
+
+static const struct of_device_id nomadik_src_match[] __initconst = {
+ { .compatible = "stericsson,nomadik-src" },
+ { /* sentinel */ }
+};
+
+static void __init nomadik_src_init(void)
+{
+ struct device_node *np;
+ u32 val;
+
+ np = of_find_matching_node(NULL, nomadik_src_match);
+ if (!np) {
+ pr_crit("no matching node for SRC, aborting clock init\n");
+ return;
+ }
+ src_base = of_iomap(np, 0);
+ if (!src_base) {
+ pr_err("%s: must have src parent node with REGS (%s)\n",
+ __func__, np->name);
+ return;
+ }
+ val = readl(src_base + SRC_XTALCR);
+ pr_info("SXTALO is %s\n",
+ (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
+ pr_info("MXTAL is %s\n",
+ (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
+ if (of_property_read_bool(np, "disable-sxtalo")) {
+ /* The machine uses an external oscillator circuit */
+ val |= SRC_XTALCR_SXTALDIS;
+ pr_info("disabling SXTALO\n");
+ }
+ if (of_property_read_bool(np, "disable-mxtalo")) {
+ /* Disable this too: also run by external oscillator */
+ val |= SRC_XTALCR_MXTALOVER;
+ val &= ~SRC_XTALCR_MXTALEN;
+ pr_info("disabling MXTALO\n");
+ }
+ writel(val, src_base + SRC_XTALCR);
+ register_reboot_notifier(&nomadik_clk_reboot_notifier);
+}
+
/**
* struct clk_pll1 - Nomadik PLL1 clock
* @hw: corresponding clock hardware entry
@@ -479,11 +539,6 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}

-static const struct of_device_id nomadik_src_match[] __initconst = {
- { .compatible = "stericsson,nomadik-src" },
- { /* sentinel */ }
-};
-
static const struct of_device_id nomadik_src_clk_match[] __initconst = {
{
.compatible = "fixed-clock",
@@ -508,59 +563,9 @@ static const struct of_device_id nomadik_src_clk_match[] __initconst = {
{ /* sentinel */ }
};

-static int nomadik_clk_reboot_handler(struct notifier_block *this,
- unsigned long code,
- void *unused)
-{
- u32 val;
-
- /* The main chrystal need to be enabled for reboot to work */
- val = readl(src_base + SRC_XTALCR);
- val &= ~SRC_XTALCR_MXTALOVER;
- val |= SRC_XTALCR_MXTALEN;
- pr_crit("force-enabling MXTALO\n");
- writel(val, src_base + SRC_XTALCR);
- return NOTIFY_OK;
-}
-
-static struct notifier_block nomadik_clk_reboot_notifier = {
- .notifier_call = nomadik_clk_reboot_handler,
-};

void __init nomadik_clk_init(void)
{
- struct device_node *np;
- u32 val;
-
- np = of_find_matching_node(NULL, nomadik_src_match);
- if (!np) {
- pr_crit("no matching node for SRC, aborting clock init\n");
- return;
- }
- src_base = of_iomap(np, 0);
- if (!src_base) {
- pr_err("%s: must have src parent node with REGS (%s)\n",
- __func__, np->name);
- return;
- }
- val = readl(src_base + SRC_XTALCR);
- pr_info("SXTALO is %s\n",
- (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
- pr_info("MXTAL is %s\n",
- (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
- if (of_property_read_bool(np, "disable-sxtalo")) {
- /* The machine uses an external oscillator circuit */
- val |= SRC_XTALCR_SXTALDIS;
- pr_info("disabling SXTALO\n");
- }
- if (of_property_read_bool(np, "disable-mxtalo")) {
- /* Disable this too: also run by external oscillator */
- val |= SRC_XTALCR_MXTALOVER;
- val &= ~SRC_XTALCR_MXTALEN;
- pr_info("disabling MXTALO\n");
- }
- writel(val, src_base + SRC_XTALCR);
- register_reboot_notifier(&nomadik_clk_reboot_notifier);
-
+ nomadik_src_init();
of_clk_init(nomadik_src_clk_match);
}
--
1.7.10.4

2013-09-18 17:54:32

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 15/26] ARM: kirkwood: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Jason Cooper <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-kirkwood/board-dt.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 82d3ad8..a32a3e5 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -15,7 +15,6 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/clk-provider.h>
-#include <linux/clocksource.h>
#include <linux/dma-mapping.h>
#include <linux/irqchip.h>
#include <linux/kexec.h>
@@ -66,12 +65,6 @@ static void __init kirkwood_legacy_clk_init(void)
clk_prepare_enable(clk);
}

-static void __init kirkwood_dt_time_init(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static void __init kirkwood_dt_init_early(void)
{
mvebu_mbus_init("marvell,kirkwood-mbus",
@@ -122,7 +115,6 @@ DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
/* Maintainer: Jason Cooper <[email protected]> */
.map_io = kirkwood_map_io,
.init_early = kirkwood_dt_init_early,
- .init_time = kirkwood_dt_time_init,
.init_machine = kirkwood_dt_init,
.restart = kirkwood_restart,
.dt_compat = kirkwood_dt_board_compat,
--
1.7.10.4

2013-09-18 17:54:47

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 26/26] ARM: vt8500: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Tony Prisk <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-vt8500/vt8500.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index 5041563..4a73464 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

-#include <linux/clk-provider.h>
-#include <linux/clocksource.h>
#include <linux/io.h>
#include <linux/pm.h>
#include <linux/reboot.h>
@@ -74,12 +72,6 @@ static void vt8500_power_off(void)
asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0));
}

-static void __init vt8500_init_time(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
void __init vt8500_init(void)
{
struct device_node *np;
@@ -183,7 +175,6 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
.dt_compat = vt8500_dt_compat,
.map_io = vt8500_map_io,
.init_machine = vt8500_init,
- .init_time = vt8500_init_time,
.restart = vt8500_restart,
MACHINE_END

--
1.7.10.4

2013-09-18 17:54:38

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 18/26] ARM: nspire: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: Daniel Tang <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-nspire/nspire.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
index 99e2609..4b2ed2e 100644
--- a/arch/arm/mach-nspire/nspire.c
+++ b/arch/arm/mach-nspire/nspire.c
@@ -14,11 +14,9 @@
#include <linux/of_platform.h>
#include <linux/irqchip.h>
#include <linux/irqchip/arm-vic.h>
-#include <linux/clk-provider.h>
#include <linux/clkdev.h>
#include <linux/amba/bus.h>
#include <linux/amba/clcd.h>
-#include <linux/clocksource.h>

#include <asm/mach/arch.h>
#include <asm/mach-types.h>
@@ -65,12 +63,6 @@ static void __init nspire_init(void)
nspire_auxdata, NULL);
}

-static void __init nspire_init_time(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static void nspire_restart(char mode, const char *cmd)
{
void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K);
@@ -83,7 +75,6 @@ static void nspire_restart(char mode, const char *cmd)
DT_MACHINE_START(NSPIRE, "TI-NSPIRE")
.dt_compat = nspire_dt_match,
.map_io = nspire_map_io,
- .init_time = nspire_init_time,
.init_machine = nspire_init,
.restart = nspire_restart,
MACHINE_END
--
1.7.10.4

2013-09-18 17:54:46

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 24/26] ARM: tegra: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-tegra/tegra.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 4da271d..2e21928 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -16,7 +16,6 @@
*
*/

-#include <linux/clocksource.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
@@ -33,7 +32,6 @@
#include <linux/slab.h>
#include <linux/sys_soc.h>
#include <linux/usb/tegra_usb_phy.h>
-#include <linux/clk-provider.h>
#include <linux/clk/tegra.h>

#include <asm/mach-types.h>
@@ -84,12 +82,6 @@ out:
of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
}

-static void __init tegra_dt_init_time(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static void __init paz00_init(void)
{
if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
@@ -129,7 +121,6 @@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
.smp = smp_ops(tegra_smp_ops),
.init_early = tegra_init_early,
.init_irq = tegra_dt_init_irq,
- .init_time = tegra_dt_init_time,
.init_machine = tegra_dt_init,
.init_late = tegra_dt_init_late,
.restart = tegra_assert_system_reset,
--
1.7.10.4

2013-09-18 17:54:44

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 22/26] ARM: sti: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. To get rid of it, move l2cc init to
.init_machine hook instead.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Acked-by: Srinivas Kandagatla <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: Stuart Menefy <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-sti/board-dt.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
index 8fe6f0c..1217fb5 100644
--- a/arch/arm/mach-sti/board-dt.c
+++ b/arch/arm/mach-sti/board-dt.c
@@ -7,9 +7,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/clk-provider.h>
-#include <linux/clocksource.h>
#include <linux/irq.h>
+#include <linux/of_platform.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/mach/arch.h>

@@ -28,11 +27,10 @@ void __init stih41x_l2x0_init(void)
l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK);
}

-static void __init stih41x_timer_init(void)
+static void __init stih41x_machine_init(void)
{
- of_clk_init(NULL);
- clocksource_of_init();
stih41x_l2x0_init();
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}

static const char *stih41x_dt_match[] __initdata = {
@@ -42,7 +40,7 @@ static const char *stih41x_dt_match[] __initdata = {
};

DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree")
- .init_time = stih41x_timer_init,
+ .init_machine = stih41x_machine_init,
.smp = smp_ops(sti_smp_ops),
.dt_compat = stih41x_dt_match,
MACHINE_END
--
1.7.10.4

2013-09-18 17:54:43

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 23/26] ARM: sunxi: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-sunxi/sunxi.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index e5a6975..90dda62 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -10,7 +10,6 @@
* warranty of any kind, whether express or implied.
*/

-#include <linux/clocksource.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/init.h>
@@ -114,12 +113,6 @@ static void sunxi_setup_restart(void)
arm_pm_restart = of_id->data;
}

-static void __init sunxi_timer_init(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static void __init sunxi_dt_init(void)
{
sunxi_setup_restart();
@@ -138,6 +131,5 @@ static const char * const sunxi_board_dt_compat[] = {

DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
.init_machine = sunxi_dt_init,
- .init_time = sunxi_timer_init,
.dt_compat = sunxi_board_dt_compat,
MACHINE_END
--
1.7.10.4

2013-09-18 17:54:41

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 21/26] ARM: socfpga: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-socfpga/socfpga.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index 6df7bb9..dd0d49c 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -14,8 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <linux/clk-provider.h>
-#include <linux/clocksource.h>
#include <linux/irqchip.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
@@ -91,12 +89,6 @@ static void __init socfpga_init_irq(void)
socfpga_sysmgr_init();
}

-static void __init socfpga_init_time(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
{
u32 temp;
@@ -126,7 +118,6 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
.smp = smp_ops(socfpga_smp_ops),
.map_io = socfpga_map_io,
.init_irq = socfpga_init_irq,
- .init_time = socfpga_init_time,
.init_machine = socfpga_cyclone5_init,
.restart = socfpga_cyclone5_restart,
.dt_compat = altera_dt_match,
--
1.7.10.4

2013-09-18 17:54:40

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 19/26] ARM: prima2: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-prima2/common.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index 9b7663d..d49aff7 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -6,8 +6,6 @@
* Licensed under GPLv2 or later.
*/

-#include <linux/clk-provider.h>
-#include <linux/clocksource.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <asm/sizes.h>
@@ -22,12 +20,6 @@ void __init sirfsoc_init_late(void)
sirfsoc_pm_init();
}

-static __init void sirfsoc_init_time(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static __init void sirfsoc_map_io(void)
{
sirfsoc_map_lluart();
@@ -43,7 +35,6 @@ static const char *atlas6_dt_match[] __initdata = {
DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)")
/* Maintainer: Barry Song <[email protected]> */
.map_io = sirfsoc_map_io,
- .init_time = sirfsoc_init_time,
.init_late = sirfsoc_init_late,
.dt_compat = atlas6_dt_match,
.restart = sirfsoc_restart,
@@ -59,7 +50,6 @@ static const char *prima2_dt_match[] __initdata = {
DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)")
/* Maintainer: Barry Song <[email protected]> */
.map_io = sirfsoc_map_io,
- .init_time = sirfsoc_init_time,
.dma_zone_size = SZ_256M,
.init_late = sirfsoc_init_late,
.dt_compat = prima2_dt_match,
@@ -77,7 +67,6 @@ DT_MACHINE_START(MARCO_DT, "Generic MARCO (Flattened Device Tree)")
/* Maintainer: Barry Song <[email protected]> */
.smp = smp_ops(sirfsoc_smp_ops),
.map_io = sirfsoc_map_io,
- .init_time = sirfsoc_init_time,
.init_late = sirfsoc_init_late,
.dt_compat = marco_dt_match,
.restart = sirfsoc_restart,
--
1.7.10.4

2013-09-18 17:54:37

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 17/26] ARM: nomadik: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Alessandro Rubini <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: STEricsson <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-nomadik/cpu-8815.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 2be38a0..53fbf63 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -25,8 +25,6 @@
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/dma-mapping.h>
-#include <linux/clk-provider.h>
-#include <linux/clocksource.h>
#include <linux/of_irq.h>
#include <linux/of_gpio.h>
#include <linux/of_address.h>
@@ -113,12 +111,6 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
writel(1, srcbase + 0x18);
}

-static void __init cpu8815_timer_init_of(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static struct fsmc_nand_timings cpu8815_nand_timings = {
.thiz = 0,
.thold = 0x10,
@@ -232,7 +224,6 @@ static const char * cpu8815_board_compat[] = {

DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815")
.map_io = cpu8815_map_io,
- .init_time = cpu8815_timer_init_of,
.init_machine = cpu8815_init_of,
.restart = cpu8815_restart,
.dt_compat = cpu8815_board_compat,
--
1.7.10.4

2013-09-18 17:54:35

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 16/26] ARM: mxs: remove custom .init_time hook

This patch converts clk-imx2[38] clocksource_of_init compatible init
associated with fsl,imx2[38]-clkctrl. With arch/arm calling
of_clk_init(NULL) from time_init(), we can now also remove custom
.init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Acked-by: Mike Turquette <[email protected]>
---
Changelog:
RFCv2->v1:
- do not reuse device_node for digctl (Reported by Shawn Guo)

Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Russell King <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-mxs/mach-mxs.c | 13 -------------
drivers/clk/mxs/clk-imx23.c | 15 ++++++++-------
drivers/clk/mxs/clk-imx28.c | 16 ++++++++--------
include/linux/clk/mxs.h | 2 --
4 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 98f6e2a..cc511a4 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -13,8 +13,6 @@
#include <linux/clk.h>
#include <linux/clk/mxs.h>
#include <linux/clkdev.h>
-#include <linux/clocksource.h>
-#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio.h>
@@ -490,16 +488,6 @@ static void mxs_restart(enum reboot_mode mode, const char *cmd)
soft_restart(0);
}

-static void __init mxs_timer_init(void)
-{
- if (of_machine_is_compatible("fsl,imx23"))
- mx23_clocks_init();
- else
- mx28_clocks_init();
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static const char *mxs_dt_compat[] __initdata = {
"fsl,imx28",
"fsl,imx23",
@@ -508,7 +496,6 @@ static const char *mxs_dt_compat[] __initdata = {

DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)")
.handle_irq = icoll_handle_irq,
- .init_time = mxs_timer_init,
.init_machine = mxs_machine_init,
.init_late = mxs_pm_init,
.dt_compat = mxs_dt_compat,
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index c396fe3..9fc9359 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -12,6 +12,7 @@
#include <linux/clk.h>
#include <linux/clk/mxs.h>
#include <linux/clkdev.h>
+#include <linux/clk-provider.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
@@ -100,16 +101,16 @@ static enum imx23_clk clks_init_on[] __initdata = {
cpu, hbus, xbus, emi, uart,
};

-int __init mx23_clocks_init(void)
+static void __init mx23_clocks_init(struct device_node *np)
{
- struct device_node *np;
+ struct device_node *dcnp;
u32 i;

- np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl");
- digctrl = of_iomap(np, 0);
+ dcnp = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl");
+ digctrl = of_iomap(dcnp, 0);
WARN_ON(!digctrl);
+ of_node_put(dcnp);

- np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
clkctrl = of_iomap(np, 0);
WARN_ON(!clkctrl);

@@ -162,7 +163,7 @@ int __init mx23_clocks_init(void)
if (IS_ERR(clks[i])) {
pr_err("i.MX23 clk %d: register failed with %ld\n",
i, PTR_ERR(clks[i]));
- return PTR_ERR(clks[i]);
+ return;
}

clk_data.clks = clks;
@@ -172,5 +173,5 @@ int __init mx23_clocks_init(void)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);

- return 0;
}
+CLK_OF_DECLARE(imx23_clkctrl, "fsl,imx23-clkctrl", mx23_clocks_init);
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 4faf0af..a6c3501 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -12,6 +12,7 @@
#include <linux/clk.h>
#include <linux/clk/mxs.h>
#include <linux/clkdev.h>
+#include <linux/clk-provider.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
@@ -154,16 +155,16 @@ static enum imx28_clk clks_init_on[] __initdata = {
cpu, hbus, xbus, emi, uart,
};

-int __init mx28_clocks_init(void)
+static void __init mx28_clocks_init(struct device_node *np)
{
- struct device_node *np;
+ struct device_node *dcnp;
u32 i;

- np = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl");
- digctrl = of_iomap(np, 0);
+ dcnp = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl");
+ digctrl = of_iomap(dcnp, 0);
WARN_ON(!digctrl);
+ of_node_put(dcnp);

- np = of_find_compatible_node(NULL, NULL, "fsl,imx28-clkctrl");
clkctrl = of_iomap(np, 0);
WARN_ON(!clkctrl);

@@ -239,7 +240,7 @@ int __init mx28_clocks_init(void)
if (IS_ERR(clks[i])) {
pr_err("i.MX28 clk %d: register failed with %ld\n",
i, PTR_ERR(clks[i]));
- return PTR_ERR(clks[i]);
+ return;
}

clk_data.clks = clks;
@@ -250,6 +251,5 @@ int __init mx28_clocks_init(void)

for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
-
- return 0;
}
+CLK_OF_DECLARE(imx28_clkctrl, "fsl,imx28-clkctrl", mx28_clocks_init);
diff --git a/include/linux/clk/mxs.h b/include/linux/clk/mxs.h
index 90c30dc..5138a90 100644
--- a/include/linux/clk/mxs.h
+++ b/include/linux/clk/mxs.h
@@ -9,8 +9,6 @@
#ifndef __LINUX_CLK_MXS_H
#define __LINUX_CLK_MXS_H

-int mx23_clocks_init(void);
-int mx28_clocks_init(void);
int mxs_saif_clkmux_select(unsigned int clkmux);

#endif
--
1.7.10.4

2013-09-18 17:54:34

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 25/26] ARM: vexpress: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. The call to versatile_sched_clock_init
is moved to .init_early instead, were it is also for non-DT boards.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Tested-by: Jon Medhurst (Tixy) <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: Pawel Moll <[email protected]>
Cc: Jon Medhurst (Tixy) <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-vexpress/v2m.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 95a469e..4f8b8cb 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -1,12 +1,10 @@
/*
* Versatile Express V2M Motherboard Support
*/
-#include <linux/clocksource.h>
#include <linux/device.h>
#include <linux/amba/bus.h>
#include <linux/amba/mmci.h>
#include <linux/io.h>
-#include <linux/clocksource.h>
#include <linux/smp.h>
#include <linux/init.h>
#include <linux/of_address.h>
@@ -22,7 +20,6 @@
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/vexpress.h>
-#include <linux/clk-provider.h>
#include <linux/clkdev.h>

#include <asm/mach-types.h>
@@ -422,16 +419,8 @@ void __init v2m_dt_init_early(void)
pr_warning("vexpress: DT HBI (%x) is not matching "
"hardware (%x)!\n", dt_hbi, hbi);
}
-}
-
-static void __init v2m_dt_timer_init(void)
-{
- of_clk_init(NULL);

- clocksource_of_init();
-
- versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
- 24000000);
+ versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000);
}

static const struct of_device_id v2m_dt_bus_match[] __initconst = {
@@ -458,6 +447,5 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
.smp_init = smp_init_ops(vexpress_smp_init_ops),
.map_io = v2m_dt_map_io,
.init_early = v2m_dt_init_early,
- .init_time = v2m_dt_timer_init,
.init_machine = v2m_dt_init,
MACHINE_END
--
1.7.10.4

2013-09-18 17:54:30

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 10/26] ARM: bcm2835: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. Also remove call to of_clk_init from
clk-bcm2835 with core fixed_clock match, as this has already been
registered now.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Russell King <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-bcm2835/bcm2835.c | 2 --
drivers/clk/clk-bcm2835.c | 8 --------
2 files changed, 10 deletions(-)

diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
index 40686d7..d50135b 100644
--- a/arch/arm/mach-bcm2835/bcm2835.c
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -18,7 +18,6 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/clk/bcm2835.h>
-#include <linux/clocksource.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -134,7 +133,6 @@ DT_MACHINE_START(BCM2835, "BCM2835")
.init_irq = bcm2835_init_irq,
.handle_irq = bcm2835_handle_irq,
.init_machine = bcm2835_init,
- .init_time = clocksource_of_init,
.restart = bcm2835_restart,
.dt_compat = bcm2835_compat
MACHINE_END
diff --git a/drivers/clk/clk-bcm2835.c b/drivers/clk/clk-bcm2835.c
index 5fb4ff5..6b950ca 100644
--- a/drivers/clk/clk-bcm2835.c
+++ b/drivers/clk/clk-bcm2835.c
@@ -20,14 +20,8 @@
#include <linux/clk-provider.h>
#include <linux/clkdev.h>
#include <linux/clk/bcm2835.h>
-#include <linux/clk-provider.h>
#include <linux/of.h>

-static const struct of_device_id clk_match[] __initconst = {
- { .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
- { }
-};
-
/*
* These are fixed clocks. They're probably not all root clocks and it may
* be possible to turn them on and off but until this is mapped out better
@@ -63,6 +57,4 @@ void __init bcm2835_init_clocks(void)
ret = clk_register_clkdev(clk, NULL, "20215000.uart");
if (ret)
pr_err("uart1_pclk alias not registered\n");
-
- of_clk_init(clk_match);
}
--
1.7.10.4

2013-09-18 17:54:28

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 07/26] clk: vt8500: parse pmc_base from clock driver

Currently, clock providers for vt8500 depend on machine_init providing
pmc_base address before calling of_clk_init. With upcoming arch-wide
.time_init calling of_clk_init, we should make clock providers independent
of mach code. This adds a pmc_base parsing helper to current clock provider
that gets called if there is no pmc_base set, yet.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Tony Prisk <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/clk/clk-vt8500.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index 82306f5..a5ee01c 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -15,11 +15,14 @@

#include <linux/io.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>

+#define LEGACY_PMC_BASE 0xD8130000
+
/* All clocks share the same lock as none can be changed concurrently */
static DEFINE_SPINLOCK(_lock);

@@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = {
.recalc_rate = vtwm_pll_recalc_rate,
};

+static __init void vtwm_set_pmc_base(void)
+{
+ struct device_node *np =
+ of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
+
+ if (np)
+ pmc_base = of_iomap(np, 0);
+ else
+ pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
+ of_node_put(np);
+
+ if (!pmc_base)
+ pr_err("%s:of_iomap(pmc) failed\n", __func__);
+}
+
static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
{
u32 reg;
@@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
struct clk_init_data init;
int rc;

+ if (!pmc_base)
+ vtwm_set_pmc_base();
+
rc = of_property_read_u32(node, "reg", &reg);
if (WARN_ON(rc))
return;
--
1.7.10.4

2013-09-18 17:57:47

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 14/26] ARM: imx: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Acked-by: Shawn Guo <[email protected]>
---
Changelog:
RFCv1->RFCv2:
- added missing CLK_OF_DECLARE for imx51 and imx53 (Reported by Sascha Hauer)
mx53_clocks_init can be converted as it is used DT only, mx51_clocks_init
still is used by non-DT.

Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Russell King <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-imx/clk-imx51-imx53.c | 29 ++++++++++-------------------
arch/arm/mach-imx/common.h | 4 ----
arch/arm/mach-imx/imx51-dt.c | 6 ------
arch/arm/mach-imx/mach-imx53.c | 6 ------
arch/arm/mach-imx/mach-imx6q.c | 14 +++-----------
arch/arm/mach-imx/mach-imx6sl.c | 7 -------
arch/arm/mach-imx/mach-vf610.c | 9 ---------
7 files changed, 13 insertions(+), 62 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 1a56a33..1b796db 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -11,6 +11,7 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/clkdev.h>
+#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/err.h>

@@ -131,8 +132,6 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
{
int i;

- of_clk_init(NULL);
-
clk[dummy] = imx_clk_fixed("dummy", 0);
clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil);
clk[osc] = imx_obtain_fixed_clock("osc", rate_osc);
@@ -465,12 +464,16 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
return 0;
}

-int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
- unsigned long rate_ckih1, unsigned long rate_ckih2)
+static void __init mx51_clocks_init_dt(struct device_node *np)
+{
+ mx51_clocks_init(0, 0, 0, 0);
+}
+CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init_dt);
+
+static void __init mx53_clocks_init(struct device_node *np)
{
int i;
unsigned long r;
- struct device_node *np;

clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
@@ -529,12 +532,11 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
pr_err("i.MX53 clk %d: register failed with %ld\n",
i, PTR_ERR(clk[i]));

- np = of_find_compatible_node(NULL, NULL, "fsl,imx53-ccm");
clk_data.clks = clk;
clk_data.clk_num = ARRAY_SIZE(clk);
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);

- mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
+ mx5_clocks_common_init(0, 0, 0, 0);

clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0");
clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
@@ -566,16 +568,5 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,

r = clk_round_rate(clk[usboh3_per_gate], 54000000);
clk_set_rate(clk[usboh3_per_gate], r);
-
- return 0;
-}
-
-int __init mx51_clocks_init_dt(void)
-{
- return mx51_clocks_init(0, 0, 0, 0);
-}
-
-int __init mx53_clocks_init_dt(void)
-{
- return mx53_clocks_init(0, 0, 0, 0);
}
+CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 4517fd7..28e8ca0 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -63,13 +63,9 @@ extern int mx31_clocks_init(unsigned long fref);
extern int mx35_clocks_init(void);
extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
unsigned long ckih1, unsigned long ckih2);
-extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
- unsigned long ckih1, unsigned long ckih2);
extern int mx25_clocks_init_dt(void);
extern int mx27_clocks_init_dt(void);
extern int mx31_clocks_init_dt(void);
-extern int mx51_clocks_init_dt(void);
-extern int mx53_clocks_init_dt(void);
extern struct platform_device *mxc_register_gpio(char *name, int id,
resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
extern void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 53e43e5..bece8a6 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -34,17 +34,11 @@ static const char *imx51_dt_board_compat[] __initdata = {
NULL
};

-static void __init imx51_timer_init(void)
-{
- mx51_clocks_init_dt();
-}
-
DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
.map_io = mx51_map_io,
.init_early = imx51_init_early,
.init_irq = mx51_init_irq,
.handle_irq = imx51_handle_irq,
- .init_time = imx51_timer_init,
.init_machine = imx51_dt_init,
.init_late = imx51_init_late,
.dt_compat = imx51_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 98c5894..c9c4d8d 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -36,17 +36,11 @@ static const char *imx53_dt_board_compat[] __initdata = {
NULL
};

-static void __init imx53_timer_init(void)
-{
- mx53_clocks_init_dt();
-}
-
DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
.map_io = mx53_map_io,
.init_early = imx53_init_early,
.init_irq = mx53_init_irq,
.handle_irq = imx53_handle_irq,
- .init_time = imx53_timer_init,
.init_machine = imx53_dt_init,
.init_late = imx53_init_late,
.dt_compat = imx53_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 85a1b51..47ebc36 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -11,9 +11,7 @@
*/

#include <linux/clk.h>
-#include <linux/clk-provider.h>
#include <linux/clkdev.h>
-#include <linux/clocksource.h>
#include <linux/cpu.h>
#include <linux/delay.h>
#include <linux/export.h>
@@ -192,6 +190,9 @@ static void __init imx6q_1588_init(void)

static void __init imx6q_init_machine(void)
{
+ imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
+ imx6q_revision());
+
imx6q_enet_phy_init();

of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
@@ -288,14 +289,6 @@ static void __init imx6q_init_irq(void)
irqchip_init();
}

-static void __init imx6q_timer_init(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
- imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
- imx6q_revision());
-}
-
static const char *imx6q_dt_compat[] __initdata = {
"fsl,imx6dl",
"fsl,imx6q",
@@ -306,7 +299,6 @@ DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)")
.smp = smp_ops(imx_smp_ops),
.map_io = imx6q_map_io,
.init_irq = imx6q_init_irq,
- .init_time = imx6q_timer_init,
.init_machine = imx6q_init_machine,
.init_late = imx6q_init_late,
.dt_compat = imx6q_dt_compat,
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index 0d75dc5..c70bd7c 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -7,7 +7,6 @@
*
*/

-#include <linux/clk-provider.h>
#include <linux/irqchip.h>
#include <linux/of.h>
#include <linux/of_platform.h>
@@ -31,11 +30,6 @@ static void __init imx6sl_init_irq(void)
irqchip_init();
}

-static void __init imx6sl_timer_init(void)
-{
- of_clk_init(NULL);
-}
-
static const char *imx6sl_dt_compat[] __initdata = {
"fsl,imx6sl",
NULL,
@@ -44,7 +38,6 @@ static const char *imx6sl_dt_compat[] __initdata = {
DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
.map_io = debug_ll_io_init,
.init_irq = imx6sl_init_irq,
- .init_time = imx6sl_timer_init,
.init_machine = imx6sl_init_machine,
.dt_compat = imx6sl_dt_compat,
.restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c
index 816991d..af0cb8a 100644
--- a/arch/arm/mach-imx/mach-vf610.c
+++ b/arch/arm/mach-imx/mach-vf610.c
@@ -8,9 +8,7 @@
*/

#include <linux/of_platform.h>
-#include <linux/clocksource.h>
#include <linux/irqchip.h>
-#include <linux/clk-provider.h>
#include <asm/mach/arch.h>
#include <asm/hardware/cache-l2x0.h>

@@ -28,12 +26,6 @@ static void __init vf610_init_irq(void)
irqchip_init();
}

-static void __init vf610_init_time(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static const char *vf610_dt_compat[] __initdata = {
"fsl,vf610",
NULL,
@@ -41,7 +33,6 @@ static const char *vf610_dt_compat[] __initdata = {

DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)")
.init_irq = vf610_init_irq,
- .init_time = vf610_init_time,
.init_machine = vf610_init_machine,
.dt_compat = vf610_dt_compat,
.restart = mxc_restart,
--
1.7.10.4

2013-09-18 17:58:19

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 11/26] ARM: dove: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. While at it, also remove some obsolete
includes.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Jason Cooper <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-dove/board-dt.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
index 49f72a8..ddb8663 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-dove/board-dt.c
@@ -10,17 +10,13 @@

#include <linux/init.h>
#include <linux/clk-provider.h>
-#include <linux/clocksource.h>
-#include <linux/irqchip.h>
#include <linux/of.h>
#include <linux/of_platform.h>
-#include <linux/platform_data/usb-ehci-orion.h>
#include <asm/hardware/cache-tauros2.h>
#include <asm/mach/arch.h>
#include <mach/dove.h>
#include <mach/pm.h>
#include <plat/common.h>
-#include <plat/irq.h>
#include "common.h"

/*
@@ -45,12 +41,6 @@ static void __init dove_legacy_clk_init(void)
of_clk_get_from_provider(&clkspec));
}

-static void __init dove_dt_time_init(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static void __init dove_dt_init_early(void)
{
mvebu_mbus_init("marvell,dove-mbus",
@@ -84,7 +74,6 @@ static const char * const dove_dt_board_compat[] = {
DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
.map_io = dove_map_io,
.init_early = dove_dt_init_early,
- .init_time = dove_dt_time_init,
.init_machine = dove_dt_init,
.restart = dove_restart,
.dt_compat = dove_dt_board_compat,
--
1.7.10.4

2013-09-18 17:58:17

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 09/26] ARM: call of_clk_init from default time_init handler

Most DT ARM machs require common clock providers initialized before timers.
Currently, arch/arm machs use .init_time to call of_clk_init right before
clocksource_of_init. This prevents to remove that callback and use the default
one instead.

This patch adds a call to of_clk_init() to the default .init_time callback
to allow to remove custom callbacks where applicable. While at it, also
reorder includes alphabetically.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Changelog:
RFCv2->v1:
- only call of_clk_init(NULL) when no custom .init_time is set
(Suggested by Soeren Brinkmann)
RFCv1->RFCv2:
- reorder includes alphabetically

Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: STEricsson <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
arch/arm/kernel/time.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 98aee32..bc0468b 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -11,25 +11,26 @@
* This file contains the ARM-specific time handling details:
* reading the RTC at bootup, etc...
*/
+#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
+#include <linux/errno.h>
#include <linux/export.h>
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/time.h>
#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/kernel.h>
+#include <linux/profile.h>
#include <linux/sched.h>
+#include <linux/sched_clock.h>
#include <linux/smp.h>
+#include <linux/time.h>
#include <linux/timex.h>
-#include <linux/errno.h>
-#include <linux/profile.h>
#include <linux/timer.h>
-#include <linux/clocksource.h>
-#include <linux/irq.h>
-#include <linux/sched_clock.h>

-#include <asm/thread_info.h>
-#include <asm/stacktrace.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
+#include <asm/stacktrace.h>
+#include <asm/thread_info.h>

#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
@@ -116,8 +117,10 @@ int __init register_persistent_clock(clock_access_fn read_boot,

void __init time_init(void)
{
- if (machine_desc->init_time)
+ if (machine_desc->init_time) {
machine_desc->init_time();
- else
+ } else {
+ of_clk_init(NULL);
clocksource_of_init();
+ }
}
--
1.7.10.4

2013-09-18 17:58:15

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 13/26] ARM: highbank: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. Highbank clock provider need a reference
to system registers, as a workaround current clk driver maps those
independent of arch code now.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Acked-by: Rob Herring <[email protected]>
Acked-by: Mike Turquette <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Russell King <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-highbank/highbank.c | 23 +++++++----------------
drivers/clk/clk-highbank.c | 10 +++++++---
2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 8e63ccd..e6d6eac 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -24,7 +24,6 @@
#include <linux/of_platform.h>
#include <linux/of_address.h>
#include <linux/amba/bus.h>
-#include <linux/clk-provider.h>

#include <asm/cacheflush.h>
#include <asm/cputype.h>
@@ -83,20 +82,6 @@ static void __init highbank_init_irq(void)
}
}

-static void __init highbank_timer_init(void)
-{
- struct device_node *np;
-
- /* Map system registers */
- np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
- sregs_base = of_iomap(np, 0);
- WARN_ON(!sregs_base);
-
- of_clk_init(NULL);
-
- clocksource_of_init();
-}
-
static void highbank_power_off(void)
{
highbank_set_pwr_shutdown();
@@ -155,6 +140,13 @@ static struct notifier_block highbank_platform_nb = {

static void __init highbank_init(void)
{
+ struct device_node *np;
+
+ /* Map system registers */
+ np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
+ sregs_base = of_iomap(np, 0);
+ WARN_ON(!sregs_base);
+
pm_power_off = highbank_power_off;
highbank_pm_init();

@@ -176,7 +168,6 @@ DT_MACHINE_START(HIGHBANK, "Highbank")
#endif
.smp = smp_ops(highbank_smp_ops),
.init_irq = highbank_init_irq,
- .init_time = highbank_timer_init,
.init_machine = highbank_init,
.dt_compat = highbank_match,
.restart = highbank_restart,
diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c
index 2e08cb0..2e7e9d9 100644
--- a/drivers/clk/clk-highbank.c
+++ b/drivers/clk/clk-highbank.c
@@ -20,8 +20,7 @@
#include <linux/clk-provider.h>
#include <linux/io.h>
#include <linux/of.h>
-
-extern void __iomem *sregs_base;
+#include <linux/of_address.h>

#define HB_PLL_LOCK_500 0x20000000
#define HB_PLL_LOCK 0x10000000
@@ -280,6 +279,7 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
const char *clk_name = node->name;
const char *parent_name;
struct clk_init_data init;
+ struct device_node *srnp;
int rc;

rc = of_property_read_u32(node, "reg", &reg);
@@ -290,7 +290,11 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
if (WARN_ON(!hb_clk))
return NULL;

- hb_clk->reg = sregs_base + reg;
+ /* Map system registers */
+ srnp = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
+ hb_clk->reg = of_iomap(srnp, 0);
+ BUG_ON(!hb_clk->reg);
+ hb_clk->reg += reg;

of_property_read_string(node, "clock-output-names", &clk_name);

--
1.7.10.4

2013-09-18 17:58:12

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 06/26] clk: sunxi: declare OF clock provider

Common clock framework allows to register clock providers to get called
on of_clk_init() by using CLK_OF_DECLARE. This converts sunxi clock
providers to make use of it and get rid of the mach specific clk init
call. As sunxi has a bunch of independent clk provider nodes, we hook
current clock init to board compatible to make it called once.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Russell King <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-sunxi/sunxi.c | 4 +---
drivers/clk/sunxi/clk-sunxi.c | 11 ++++++-----
include/linux/clk/sunxi.h | 22 ----------------------
3 files changed, 7 insertions(+), 30 deletions(-)
delete mode 100644 include/linux/clk/sunxi.h

diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index e79fb34..e5a6975 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -20,8 +20,6 @@
#include <linux/io.h>
#include <linux/reboot.h>

-#include <linux/clk/sunxi.h>
-
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/system_misc.h>
@@ -118,7 +116,7 @@ static void sunxi_setup_restart(void)

static void __init sunxi_timer_init(void)
{
- sunxi_init_clocks();
+ of_clk_init(NULL);
clocksource_of_init();
}

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 34ee69f..9bbd035 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -16,7 +16,6 @@

#include <linux/clk-provider.h>
#include <linux/clkdev.h>
-#include <linux/clk/sunxi.h>
#include <linux/of.h>
#include <linux/of_address.h>

@@ -617,11 +616,8 @@ static void __init of_sunxi_table_clock_setup(const struct of_device_id *clk_mat
}
}

-void __init sunxi_init_clocks(void)
+static void __init sunxi_init_clocks(struct device_node *np)
{
- /* Register all the simple and basic clocks on DT */
- of_clk_init(NULL);
-
/* Register factor clocks */
of_sunxi_table_clock_setup(clk_factors_match, sunxi_factors_clk_setup);

@@ -634,3 +630,8 @@ void __init sunxi_init_clocks(void)
/* Register gate clocks */
of_sunxi_table_clock_setup(clk_gates_match, sunxi_gates_clk_setup);
}
+CLK_OF_DECLARE(sun4i_a10_clk_init, "allwinner,sun4i-a10", sunxi_init_clocks);
+CLK_OF_DECLARE(sun5i_a10s_clk_init, "allwinner,sun5i-a10s", sunxi_init_clocks);
+CLK_OF_DECLARE(sun5i_a13_clk_init, "allwinner,sun5i-a13", sunxi_init_clocks);
+CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sunxi_init_clocks);
+CLK_OF_DECLARE(sun7i_a20_clk_init, "allwinner,sun7i-a20", sunxi_init_clocks);
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
deleted file mode 100644
index e074fdd..0000000
--- a/include/linux/clk/sunxi.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2012 Maxime Ripard
- *
- * Maxime Ripard <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef __LINUX_CLK_SUNXI_H_
-#define __LINUX_CLK_SUNXI_H_
-
-void __init sunxi_init_clocks(void);
-
-#endif
--
1.7.10.4

2013-09-18 17:58:09

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 12/26] ARM: exynos: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks. While at it, also remove some now
redundant includes.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: Kukjin Kim <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-exynos/common.c | 8 --------
arch/arm/mach-exynos/common.h | 1 -
arch/arm/mach-exynos/mach-exynos4-dt.c | 2 --
arch/arm/mach-exynos/mach-exynos5-dt.c | 2 --
4 files changed, 13 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index ba95e5d..a4e7ba8 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -26,8 +26,6 @@
#include <linux/export.h>
#include <linux/irqdomain.h>
#include <linux/of_address.h>
-#include <linux/clocksource.h>
-#include <linux/clk-provider.h>
#include <linux/irqchip/arm-gic.h>
#include <linux/irqchip/chained_irq.h>

@@ -367,12 +365,6 @@ static void __init exynos5_map_io(void)
iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
}

-void __init exynos_init_time(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
struct bus_type exynos_subsys = {
.name = "exynos-core",
.dev_name = "exynos-core",
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 8646a14..f0fa205 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -16,7 +16,6 @@
#include <linux/of.h>

void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
-void exynos_init_time(void);

struct map_desc;
void exynos_init_io(void);
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 0099c6c..6858d73 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -16,7 +16,6 @@
#include <linux/of_fdt.h>
#include <linux/serial_core.h>
#include <linux/memblock.h>
-#include <linux/clocksource.h>

#include <asm/mach/arch.h>
#include <plat/mfc.h>
@@ -54,7 +53,6 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
.init_early = exynos_firmware_init,
.init_machine = exynos4_dt_machine_init,
.init_late = exynos_init_late,
- .init_time = exynos_init_time,
.dt_compat = exynos4_dt_compat,
.restart = exynos4_restart,
.reserve = exynos4_reserve,
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index f874b77..bac2105 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -13,7 +13,6 @@
#include <linux/of_fdt.h>
#include <linux/memblock.h>
#include <linux/io.h>
-#include <linux/clocksource.h>

#include <asm/mach/arch.h>
#include <mach/regs-pmu.h>
@@ -76,7 +75,6 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
.map_io = exynos_init_io,
.init_machine = exynos5_dt_machine_init,
.init_late = exynos_init_late,
- .init_time = exynos_init_time,
.dt_compat = exynos5_dt_compat,
.restart = exynos5_restart,
.reserve = exynos5_reserve,
--
1.7.10.4

2013-09-18 17:59:35

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 08/26] ARM: vt8500: prepare for arch-wide .init_time callback

Current vt8500 board init calls of_clk_init() from vtwm_clk_init. To allow
consolidation of DT driven .time_init, move of_clock_init() to a temporary
.time_init callback that will be removed when arch-wide callback is available.
With previous pmc_base parsing helper for vt8500 clock providers, we can also
safely remove the call to vtwm_clk_init() and get rid of some includes.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Tony Prisk <[email protected]>
Cc: Russell King <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-vt8500/common.h | 24 ------------------------
arch/arm/mach-vt8500/vt8500.c | 13 ++++++++-----
drivers/clk/clk-vt8500.c | 10 ----------
3 files changed, 8 insertions(+), 39 deletions(-)
delete mode 100644 arch/arm/mach-vt8500/common.h

diff --git a/arch/arm/mach-vt8500/common.h b/arch/arm/mach-vt8500/common.h
deleted file mode 100644
index 087787a..0000000
--- a/arch/arm/mach-vt8500/common.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* linux/arch/arm/mach-vt8500/dt_common.h
- *
- * Copyright (C) 2012 Tony Prisk <[email protected]>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __ARCH_ARM_MACH_VT8500_DT_COMMON_H
-#define __ARCH_ARM_MACH_VT8500_DT_COMMON_H
-
-#include <linux/of.h>
-
-/* defined in drivers/clk/clk-vt8500.c */
-void __init vtwm_clk_init(void __iomem *pmc_base);
-
-#endif
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index eefaa60..5041563 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

+#include <linux/clk-provider.h>
#include <linux/clocksource.h>
#include <linux/io.h>
#include <linux/pm.h>
@@ -33,8 +34,6 @@
#include <linux/of_irq.h>
#include <linux/of_platform.h>

-#include "common.h"
-
#define LEGACY_GPIO_BASE 0xD8110000
#define LEGACY_PMC_BASE 0xD8130000

@@ -75,6 +74,12 @@ static void vt8500_power_off(void)
asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0));
}

+static void __init vt8500_init_time(void)
+{
+ of_clk_init(NULL);
+ clocksource_of_init();
+}
+
void __init vt8500_init(void)
{
struct device_node *np;
@@ -162,8 +167,6 @@ void __init vt8500_init(void)
else
pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);

- vtwm_clk_init(pmc_base);
-
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}

@@ -180,7 +183,7 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
.dt_compat = vt8500_dt_compat,
.map_io = vt8500_map_io,
.init_machine = vt8500_init,
- .init_time = clocksource_of_init,
+ .init_time = vt8500_init_time,
.restart = vt8500_restart,
MACHINE_END

diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index a5ee01c..88212d7 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -715,13 +715,3 @@ static void __init wm8850_pll_init(struct device_node *node)
vtwm_pll_clk_init(node, PLL_TYPE_WM8850);
}
CLK_OF_DECLARE(wm8850_pll, "wm,wm8850-pll-clock", wm8850_pll_init);
-
-void __init vtwm_clk_init(void __iomem *base)
-{
- if (!base)
- return;
-
- pmc_base = base;
-
- of_clk_init(NULL);
-}
--
1.7.10.4

2013-09-18 17:59:48

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 05/26] ARM: socfgpa: prepare for arch-wide .init_time callback

Current socfpga board init calls of_clk_init() from .machine_init. To
allow consolidation of DT driven .time_init, move of_clock_init() to
a temporary .time_init that will be removed when arch-wide callback is
available.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-socfpga/socfpga.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index bfce964..6df7bb9 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
#include <linux/irqchip.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
@@ -90,6 +91,12 @@ static void __init socfpga_init_irq(void)
socfpga_sysmgr_init();
}

+static void __init socfpga_init_time(void)
+{
+ of_clk_init(NULL);
+ clocksource_of_init();
+}
+
static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
{
u32 temp;
@@ -107,7 +114,6 @@ static void __init socfpga_cyclone5_init(void)
{
l2x0_of_init(0, ~0UL);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
- of_clk_init(NULL);
socfpga_init_clocks();
}

@@ -120,6 +126,7 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
.smp = smp_ops(socfpga_smp_ops),
.map_io = socfpga_map_io,
.init_irq = socfpga_init_irq,
+ .init_time = socfpga_init_time,
.init_machine = socfpga_cyclone5_init,
.restart = socfpga_cyclone5_restart,
.dt_compat = altera_dt_match,
--
1.7.10.4

2013-09-18 17:54:12

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init

MTU timer initialization is stuffed into .init_time callback, while
cpu8815_timer_init_of again maps addresses from the same device node.
Therefore, this patch moves mtu setup from to clocksource init.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Alessandro Rubini <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: STEricsson <[email protected]>
Cc: Russell King <[email protected]>
Cc: Daniel Lezcano <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-nomadik/cpu-8815.c | 26 --------------------------
drivers/clocksource/nomadik-mtu.c | 11 +++++++++++
2 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 13e0df9..0fcb149 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -113,36 +113,10 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
writel(1, srcbase + 0x18);
}

-/* Initial value for SRC control register: all timers use MXTAL/8 source */
-#define SRC_CR_INIT_MASK 0x00007fff
-#define SRC_CR_INIT_VAL 0x2aaa8000
-
static void __init cpu8815_timer_init_of(void)
{
- struct device_node *mtu;
- void __iomem *base;
- int irq;
- u32 src_cr;
-
/* We need this to be up now */
nomadik_clk_init();
-
- mtu = of_find_node_by_path("/mtu@101e2000");
- if (!mtu)
- return;
- base = of_iomap(mtu, 0);
- if (WARN_ON(!base))
- return;
- irq = irq_of_parse_and_map(mtu, 0);
-
- pr_info("Remapped MTU @ %p, irq: %d\n", base, irq);
-
- /* Configure timer sources in "system reset controller" ctrl reg */
- src_cr = readl(base);
- src_cr &= SRC_CR_INIT_MASK;
- src_cr |= SRC_CR_INIT_VAL;
- writel(src_cr, base);
-
clocksource_of_init();
}

diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c
index 1b74bea..b9f97ba 100644
--- a/drivers/clocksource/nomadik-mtu.c
+++ b/drivers/clocksource/nomadik-mtu.c
@@ -257,12 +257,17 @@ void __init nmdk_timer_init(void __iomem *base, int irq)
__nmdk_timer_init(base, irq, pclk0, clk0);
}

+/* Initial value for SRC control register: all timers use MXTAL/8 source */
+#define SRC_CR_INIT_MASK 0x00007fff
+#define SRC_CR_INIT_VAL 0x2aaa8000
+
static void __init nmdk_timer_of_init(struct device_node *node)
{
struct clk *pclk;
struct clk *clk;
void __iomem *base;
int irq;
+ u32 src_cr;

base = of_iomap(node, 0);
if (!base)
@@ -280,6 +285,12 @@ static void __init nmdk_timer_of_init(struct device_node *node)
if (irq <= 0)
panic("Can't parse IRQ");

+ /* Configure timer sources in "system reset controller" ctrl reg */
+ src_cr = readl(base);
+ src_cr &= SRC_CR_INIT_MASK;
+ src_cr |= SRC_CR_INIT_VAL;
+ writel(src_cr, base);
+
__nmdk_timer_init(base, irq, pclk, clk);
}
CLOCKSOURCE_OF_DECLARE(nomadik_mtu, "st,nomadik-mtu",
--
1.7.10.4

2013-09-18 18:00:35

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 03/26] clk: nomadik: declare OF clock provider

Common clock framework allows to register clock providers to get called
on of_clk_init() by using CLK_OF_DECLARE. This converts nomadik clock
provider to make use of it and get rid of the mach specific clk init
call. As clocks require system reset controller base address to be
initialized each clock driver checks src_base and calls new
nomadik_src_init if required.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Alessandro Rubini <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: STEricsson <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-nomadik/cpu-8815.c | 5 ++--
drivers/clk/clk-nomadik.c | 46 ++++++++++-------------------
include/linux/platform_data/clk-nomadik.h | 2 --
3 files changed, 17 insertions(+), 36 deletions(-)
delete mode 100644 include/linux/platform_data/clk-nomadik.h

diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 0fcb149..2be38a0 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -25,7 +25,7 @@
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/dma-mapping.h>
-#include <linux/platform_data/clk-nomadik.h>
+#include <linux/clk-provider.h>
#include <linux/clocksource.h>
#include <linux/of_irq.h>
#include <linux/of_gpio.h>
@@ -115,8 +115,7 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)

static void __init cpu8815_timer_init_of(void)
{
- /* We need this to be up now */
- nomadik_clk_init();
+ of_clk_init(NULL);
clocksource_of_init();
}

diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
index 7849086..74978f0 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -491,6 +491,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
const char *parent_name;
u32 pll_id;

+ if (!src_base)
+ nomadik_src_init();
+
if (of_property_read_u32(np, "pll-id", &pll_id)) {
pr_err("%s: PLL \"%s\" missing pll-id property\n",
__func__, clk_name);
@@ -501,6 +504,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
+CLK_OF_DECLARE(nomadik_pll_clk,
+ "st,nomadik-pll-clock", of_nomadik_pll_setup);

static void __init of_nomadik_hclk_setup(struct device_node *np)
{
@@ -508,6 +513,9 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
const char *clk_name = np->name;
const char *parent_name;

+ if (!src_base)
+ nomadik_src_init();
+
parent_name = of_clk_get_parent_name(np, 0);
/*
* The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4.
@@ -520,6 +528,8 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
+CLK_OF_DECLARE(nomadik_hclk_clk,
+ "st,nomadik-hclk-clock", of_nomadik_hclk_setup);

static void __init of_nomadik_src_clk_setup(struct device_node *np)
{
@@ -528,6 +538,9 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
const char *parent_name;
u32 clk_id;

+ if (!src_base)
+ nomadik_src_init();
+
if (of_property_read_u32(np, "clock-id", &clk_id)) {
pr_err("%s: SRC clock \"%s\" missing clock-id property\n",
__func__, clk_name);
@@ -538,34 +551,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
-
-static const struct of_device_id nomadik_src_clk_match[] __initconst = {
- {
- .compatible = "fixed-clock",
- .data = of_fixed_clk_setup,
- },
- {
- .compatible = "fixed-factor-clock",
- .data = of_fixed_factor_clk_setup,
- },
- {
- .compatible = "st,nomadik-pll-clock",
- .data = of_nomadik_pll_setup,
- },
- {
- .compatible = "st,nomadik-hclk-clock",
- .data = of_nomadik_hclk_setup,
- },
- {
- .compatible = "st,nomadik-src-clock",
- .data = of_nomadik_src_clk_setup,
- },
- { /* sentinel */ }
-};
-
-
-void __init nomadik_clk_init(void)
-{
- nomadik_src_init();
- of_clk_init(nomadik_src_clk_match);
-}
+CLK_OF_DECLARE(nomadik_src_clk,
+ "st,nomadik-src-clock", of_nomadik_src_clk_setup);
diff --git a/include/linux/platform_data/clk-nomadik.h b/include/linux/platform_data/clk-nomadik.h
deleted file mode 100644
index 5713c87..0000000
--- a/include/linux/platform_data/clk-nomadik.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Minimal platform data header */
-void nomadik_clk_init(void);
--
1.7.10.4

2013-09-18 18:01:31

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 20/26] ARM: rockchip: remove custom .init_time hook

With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-rockchip/rockchip.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 724d2d8..82c0b07 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -19,18 +19,10 @@
#include <linux/init.h>
#include <linux/of_platform.h>
#include <linux/irqchip.h>
-#include <linux/dw_apb_timer.h>
-#include <linux/clk-provider.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/hardware/cache-l2x0.h>

-static void __init rockchip_timer_init(void)
-{
- of_clk_init(NULL);
- clocksource_of_init();
-}
-
static void __init rockchip_dt_init(void)
{
l2x0_of_init(0, ~0UL);
@@ -47,6 +39,5 @@ static const char * const rockchip_board_dt_compat[] = {

DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
.init_machine = rockchip_dt_init,
- .init_time = rockchip_timer_init,
.dt_compat = rockchip_board_dt_compat,
MACHINE_END
--
1.7.10.4

2013-09-18 19:38:04

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH 10/26] ARM: bcm2835: remove custom .init_time hook

On 09/18/2013 11:53 AM, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks. Also remove call to of_clk_init from
> clk-bcm2835 with core fixed_clock match, as this has already been
> registered now.

Acked-by: Stephen Warren <[email protected]>

2013-09-18 19:38:19

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH 24/26] ARM: tegra: remove custom .init_time hook

On 09/18/2013 11:53 AM, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks.

Acked-by: Stephen Warren <[email protected]>

2013-09-18 19:47:32

by Jason Cooper

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

Sebastian,

On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
...
> Sebastian Hesselbarth (26):
> ARM: nomadik: move mtu setup to clocksource init
> clk: nomadik: move src init out of nomadik_clk_init
> clk: nomadik: declare OF clock provider
> clk: prima2: declare OF clock provider
> ARM: socfgpa: prepare for arch-wide .init_time callback
> clk: sunxi: declare OF clock provider
> clk: vt8500: parse pmc_base from clock driver
> ARM: vt8500: prepare for arch-wide .init_time callback
> ARM: call of_clk_init from default time_init handler
> ARM: bcm2835: remove custom .init_time hook
> ARM: dove: remove custom .init_time hook
> ARM: exynos: remove custom .init_time hook
> ARM: highbank: remove custom .init_time hook
> ARM: imx: remove custom .init_time hook
> ARM: kirkwood: remove custom .init_time hook
> ARM: mxs: remove custom .init_time hook
> ARM: nomadik: remove custom .init_time hook
> ARM: nspire: remove custom .init_time hook
> ARM: prima2: remove custom .init_time hook
> ARM: rockchip: remove custom .init_time hook
> ARM: socfpga: remove custom .init_time hook
> ARM: sti: remove custom .init_time hook
> ARM: sunxi: remove custom .init_time hook
> ARM: tegra: remove custom .init_time hook
> ARM: vexpress: remove custom .init_time hook
> ARM: vt8500: remove custom .init_time hook
>
> arch/arm/kernel/time.c | 27 ++---
> arch/arm/mach-bcm2835/bcm2835.c | 2 -
> arch/arm/mach-dove/board-dt.c | 11 --
> arch/arm/mach-exynos/common.c | 8 --
> arch/arm/mach-exynos/common.h | 1 -
> arch/arm/mach-exynos/mach-exynos4-dt.c | 2 -
> arch/arm/mach-exynos/mach-exynos5-dt.c | 2 -
> arch/arm/mach-highbank/highbank.c | 23 ++---
> arch/arm/mach-imx/clk-imx51-imx53.c | 29 ++----
> arch/arm/mach-imx/common.h | 4 -
> arch/arm/mach-imx/imx51-dt.c | 6 --
> arch/arm/mach-imx/mach-imx53.c | 6 --
> arch/arm/mach-imx/mach-imx6q.c | 14 +--
> arch/arm/mach-imx/mach-imx6sl.c | 7 --
> arch/arm/mach-imx/mach-vf610.c | 9 --
> arch/arm/mach-kirkwood/board-dt.c | 8 --
> arch/arm/mach-mxs/mach-mxs.c | 13 ---
> arch/arm/mach-nomadik/cpu-8815.c | 36 -------
> arch/arm/mach-nspire/nspire.c | 9 --
> arch/arm/mach-prima2/common.c | 11 --
> arch/arm/mach-prima2/common.h | 1 -
> arch/arm/mach-rockchip/rockchip.c | 9 --
> arch/arm/mach-socfpga/socfpga.c | 2 -
> arch/arm/mach-sti/board-dt.c | 10 +-
> arch/arm/mach-sunxi/sunxi.c | 10 --
> arch/arm/mach-tegra/tegra.c | 9 --
> arch/arm/mach-vexpress/v2m.c | 14 +--
> arch/arm/mach-vt8500/common.h | 24 -----
> arch/arm/mach-vt8500/vt8500.c | 6 --
> drivers/clk/clk-bcm2835.c | 8 --
> drivers/clk/clk-highbank.c | 10 +-
> drivers/clk/clk-nomadik.c | 161 ++++++++++++++---------------
> drivers/clk/clk-prima2.c | 29 ++----
> drivers/clk/clk-vt8500.c | 31 ++++--
> drivers/clk/mxs/clk-imx23.c | 15 +--
> drivers/clk/mxs/clk-imx28.c | 16 +--
> drivers/clk/sunxi/clk-sunxi.c | 11 +-
> drivers/clocksource/nomadik-mtu.c | 11 ++
> include/linux/clk/mxs.h | 2 -
> include/linux/clk/sunxi.h | 22 ----
> include/linux/platform_data/clk-nomadik.h | 2 -
> 41 files changed, 182 insertions(+), 449 deletions(-)
> delete mode 100644 arch/arm/mach-vt8500/common.h
> delete mode 100644 include/linux/clk/sunxi.h
> delete mode 100644 include/linux/platform_data/clk-nomadik.h

How would you like to handle this series?

thx,

Jason.

2013-09-18 19:52:23

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

On 09/18/2013 09:47 PM, Jason Cooper wrote:
> On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
> ...
>> Sebastian Hesselbarth (26):
>> ARM: nomadik: move mtu setup to clocksource init
>> clk: nomadik: move src init out of nomadik_clk_init
>> clk: nomadik: declare OF clock provider
>> clk: prima2: declare OF clock provider
>> ARM: socfgpa: prepare for arch-wide .init_time callback
>> clk: sunxi: declare OF clock provider
>> clk: vt8500: parse pmc_base from clock driver
>> ARM: vt8500: prepare for arch-wide .init_time callback
>> ARM: call of_clk_init from default time_init handler
>> ARM: bcm2835: remove custom .init_time hook
>> ARM: dove: remove custom .init_time hook
>> ARM: exynos: remove custom .init_time hook
>> ARM: highbank: remove custom .init_time hook
>> ARM: imx: remove custom .init_time hook
>> ARM: kirkwood: remove custom .init_time hook
>> ARM: mxs: remove custom .init_time hook
>> ARM: nomadik: remove custom .init_time hook
>> ARM: nspire: remove custom .init_time hook
>> ARM: prima2: remove custom .init_time hook
>> ARM: rockchip: remove custom .init_time hook
>> ARM: socfpga: remove custom .init_time hook
>> ARM: sti: remove custom .init_time hook
>> ARM: sunxi: remove custom .init_time hook
>> ARM: tegra: remove custom .init_time hook
>> ARM: vexpress: remove custom .init_time hook
>> ARM: vt8500: remove custom .init_time hook
>>
>> arch/arm/kernel/time.c | 27 ++---
>> arch/arm/mach-bcm2835/bcm2835.c | 2 -
>> arch/arm/mach-dove/board-dt.c | 11 --
>> arch/arm/mach-exynos/common.c | 8 --
>> arch/arm/mach-exynos/common.h | 1 -
>> arch/arm/mach-exynos/mach-exynos4-dt.c | 2 -
>> arch/arm/mach-exynos/mach-exynos5-dt.c | 2 -
>> arch/arm/mach-highbank/highbank.c | 23 ++---
>> arch/arm/mach-imx/clk-imx51-imx53.c | 29 ++----
>> arch/arm/mach-imx/common.h | 4 -
>> arch/arm/mach-imx/imx51-dt.c | 6 --
>> arch/arm/mach-imx/mach-imx53.c | 6 --
>> arch/arm/mach-imx/mach-imx6q.c | 14 +--
>> arch/arm/mach-imx/mach-imx6sl.c | 7 --
>> arch/arm/mach-imx/mach-vf610.c | 9 --
>> arch/arm/mach-kirkwood/board-dt.c | 8 --
>> arch/arm/mach-mxs/mach-mxs.c | 13 ---
>> arch/arm/mach-nomadik/cpu-8815.c | 36 -------
>> arch/arm/mach-nspire/nspire.c | 9 --
>> arch/arm/mach-prima2/common.c | 11 --
>> arch/arm/mach-prima2/common.h | 1 -
>> arch/arm/mach-rockchip/rockchip.c | 9 --
>> arch/arm/mach-socfpga/socfpga.c | 2 -
>> arch/arm/mach-sti/board-dt.c | 10 +-
>> arch/arm/mach-sunxi/sunxi.c | 10 --
>> arch/arm/mach-tegra/tegra.c | 9 --
>> arch/arm/mach-vexpress/v2m.c | 14 +--
>> arch/arm/mach-vt8500/common.h | 24 -----
>> arch/arm/mach-vt8500/vt8500.c | 6 --
>> drivers/clk/clk-bcm2835.c | 8 --
>> drivers/clk/clk-highbank.c | 10 +-
>> drivers/clk/clk-nomadik.c | 161 ++++++++++++++---------------
>> drivers/clk/clk-prima2.c | 29 ++----
>> drivers/clk/clk-vt8500.c | 31 ++++--
>> drivers/clk/mxs/clk-imx23.c | 15 +--
>> drivers/clk/mxs/clk-imx28.c | 16 +--
>> drivers/clk/sunxi/clk-sunxi.c | 11 +-
>> drivers/clocksource/nomadik-mtu.c | 11 ++
>> include/linux/clk/mxs.h | 2 -
>> include/linux/clk/sunxi.h | 22 ----
>> include/linux/platform_data/clk-nomadik.h | 2 -
>> 41 files changed, 182 insertions(+), 449 deletions(-)
>> delete mode 100644 arch/arm/mach-vt8500/common.h
>> delete mode 100644 include/linux/clk/sunxi.h
>> delete mode 100644 include/linux/platform_data/clk-nomadik.h
>
> How would you like to handle this series?

Jason,

honestly I don't really know, yet. I was hoping for Arnd and Olof
decide on that. Maybe they also create a topic branch up to where
arch-wide of_clk_init is introduced. Then each removal patch can
go through the independent sub-trees. There may be more machs
introduced before, that can then also depend on the common branch.

Sebastian

2013-09-18 20:45:47

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

On 09/18/2013 01:52 PM, Sebastian Hesselbarth wrote:
> On 09/18/2013 09:47 PM, Jason Cooper wrote:
>> On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
>> ...
>>> Sebastian Hesselbarth (26):
>>> ARM: nomadik: move mtu setup to clocksource init
...
>>
>> How would you like to handle this series?
>
> Jason,
>
> honestly I don't really know, yet. I was hoping for Arnd and Olof
> decide on that. Maybe they also create a topic branch up to where
> arch-wide of_clk_init is introduced. Then each removal patch can
> go through the independent sub-trees. There may be more machs
> introduced before, that can then also depend on the common branch.

Oh, I was assuming you'd just take the whole thing through one tree,
likely in arm-soc. That's why I created the topic branch for the Tegra
PMIC patch that's a dependency of this... However, I guess if you just
merge the core into a topic branch in arm-soc and everyone merges it
back, that's fine. I assume the Tegra topic branch I created won't be
necessary in that case.

2013-09-18 20:48:12

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

On Wed, Sep 18, 2013 at 12:52 PM, Sebastian Hesselbarth
<[email protected]> wrote:
> On 09/18/2013 09:47 PM, Jason Cooper wrote:
>>
>> On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
>> ...
>>>
>>> Sebastian Hesselbarth (26):
>>> ARM: nomadik: move mtu setup to clocksource init
>>> clk: nomadik: move src init out of nomadik_clk_init
>>> clk: nomadik: declare OF clock provider
>>> clk: prima2: declare OF clock provider
>>> ARM: socfgpa: prepare for arch-wide .init_time callback
>>> clk: sunxi: declare OF clock provider
>>> clk: vt8500: parse pmc_base from clock driver
>>> ARM: vt8500: prepare for arch-wide .init_time callback
>>> ARM: call of_clk_init from default time_init handler
>>> ARM: bcm2835: remove custom .init_time hook
>>> ARM: dove: remove custom .init_time hook
>>> ARM: exynos: remove custom .init_time hook
>>> ARM: highbank: remove custom .init_time hook
>>> ARM: imx: remove custom .init_time hook
>>> ARM: kirkwood: remove custom .init_time hook
>>> ARM: mxs: remove custom .init_time hook
>>> ARM: nomadik: remove custom .init_time hook
>>> ARM: nspire: remove custom .init_time hook
>>> ARM: prima2: remove custom .init_time hook
>>> ARM: rockchip: remove custom .init_time hook
>>> ARM: socfpga: remove custom .init_time hook
>>> ARM: sti: remove custom .init_time hook
>>> ARM: sunxi: remove custom .init_time hook
>>> ARM: tegra: remove custom .init_time hook
>>> ARM: vexpress: remove custom .init_time hook
>>> ARM: vt8500: remove custom .init_time hook
>>>
>>> arch/arm/kernel/time.c | 27 ++---
>>> arch/arm/mach-bcm2835/bcm2835.c | 2 -
>>> arch/arm/mach-dove/board-dt.c | 11 --
>>> arch/arm/mach-exynos/common.c | 8 --
>>> arch/arm/mach-exynos/common.h | 1 -
>>> arch/arm/mach-exynos/mach-exynos4-dt.c | 2 -
>>> arch/arm/mach-exynos/mach-exynos5-dt.c | 2 -
>>> arch/arm/mach-highbank/highbank.c | 23 ++---
>>> arch/arm/mach-imx/clk-imx51-imx53.c | 29 ++----
>>> arch/arm/mach-imx/common.h | 4 -
>>> arch/arm/mach-imx/imx51-dt.c | 6 --
>>> arch/arm/mach-imx/mach-imx53.c | 6 --
>>> arch/arm/mach-imx/mach-imx6q.c | 14 +--
>>> arch/arm/mach-imx/mach-imx6sl.c | 7 --
>>> arch/arm/mach-imx/mach-vf610.c | 9 --
>>> arch/arm/mach-kirkwood/board-dt.c | 8 --
>>> arch/arm/mach-mxs/mach-mxs.c | 13 ---
>>> arch/arm/mach-nomadik/cpu-8815.c | 36 -------
>>> arch/arm/mach-nspire/nspire.c | 9 --
>>> arch/arm/mach-prima2/common.c | 11 --
>>> arch/arm/mach-prima2/common.h | 1 -
>>> arch/arm/mach-rockchip/rockchip.c | 9 --
>>> arch/arm/mach-socfpga/socfpga.c | 2 -
>>> arch/arm/mach-sti/board-dt.c | 10 +-
>>> arch/arm/mach-sunxi/sunxi.c | 10 --
>>> arch/arm/mach-tegra/tegra.c | 9 --
>>> arch/arm/mach-vexpress/v2m.c | 14 +--
>>> arch/arm/mach-vt8500/common.h | 24 -----
>>> arch/arm/mach-vt8500/vt8500.c | 6 --
>>> drivers/clk/clk-bcm2835.c | 8 --
>>> drivers/clk/clk-highbank.c | 10 +-
>>> drivers/clk/clk-nomadik.c | 161
>>> ++++++++++++++---------------
>>> drivers/clk/clk-prima2.c | 29 ++----
>>> drivers/clk/clk-vt8500.c | 31 ++++--
>>> drivers/clk/mxs/clk-imx23.c | 15 +--
>>> drivers/clk/mxs/clk-imx28.c | 16 +--
>>> drivers/clk/sunxi/clk-sunxi.c | 11 +-
>>> drivers/clocksource/nomadik-mtu.c | 11 ++
>>> include/linux/clk/mxs.h | 2 -
>>> include/linux/clk/sunxi.h | 22 ----
>>> include/linux/platform_data/clk-nomadik.h | 2 -
>>> 41 files changed, 182 insertions(+), 449 deletions(-)
>>> delete mode 100644 arch/arm/mach-vt8500/common.h
>>> delete mode 100644 include/linux/clk/sunxi.h
>>> delete mode 100644 include/linux/platform_data/clk-nomadik.h
>>
>>
>> How would you like to handle this series?
>
>
> Jason,
>
> honestly I don't really know, yet. I was hoping for Arnd and Olof
> decide on that. Maybe they also create a topic branch up to where
> arch-wide of_clk_init is introduced. Then each removal patch can
> go through the independent sub-trees. There may be more machs
> introduced before, that can then also depend on the common branch.

I'd like to see this merged early into arm-soc and have it as a base
branch for other platform branches if there will be much conflicts
(for trivial or small conflicts we can resolve, of course). So please
collect acks and prepare a branch for me to merge, Sebastian. Or if
it's easier I can just apply the patches directly -- just let me know.
But given the tegra dependency it's probably easier to take a branch.

The long tail might be the cases where you rewrote some of the init
code, since that'll need to be tested on those platforms. I wonder if
we can pick up most of the other pieces if that ends up taking a
while.


-Olof

2013-09-18 21:04:15

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

On 09/18/2013 10:48 PM, Olof Johansson wrote:
> On Wed, Sep 18, 2013 at 12:52 PM, Sebastian Hesselbarth
> <[email protected]> wrote:
>> On 09/18/2013 09:47 PM, Jason Cooper wrote:
>>>
>>> On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
>>> ...
>>>>
>>>> Sebastian Hesselbarth (26):
>>>> ARM: nomadik: move mtu setup to clocksource init
>>>> clk: nomadik: move src init out of nomadik_clk_init
>>>> clk: nomadik: declare OF clock provider
>>>> clk: prima2: declare OF clock provider
>>>> ARM: socfgpa: prepare for arch-wide .init_time callback
>>>> clk: sunxi: declare OF clock provider
>>>> clk: vt8500: parse pmc_base from clock driver
>>>> ARM: vt8500: prepare for arch-wide .init_time callback
>>>> ARM: call of_clk_init from default time_init handler
>>>> ARM: bcm2835: remove custom .init_time hook
>>>> ARM: dove: remove custom .init_time hook
>>>> ARM: exynos: remove custom .init_time hook
>>>> ARM: highbank: remove custom .init_time hook
>>>> ARM: imx: remove custom .init_time hook
>>>> ARM: kirkwood: remove custom .init_time hook
>>>> ARM: mxs: remove custom .init_time hook
>>>> ARM: nomadik: remove custom .init_time hook
>>>> ARM: nspire: remove custom .init_time hook
>>>> ARM: prima2: remove custom .init_time hook
>>>> ARM: rockchip: remove custom .init_time hook
>>>> ARM: socfpga: remove custom .init_time hook
>>>> ARM: sti: remove custom .init_time hook
>>>> ARM: sunxi: remove custom .init_time hook
>>>> ARM: tegra: remove custom .init_time hook
>>>> ARM: vexpress: remove custom .init_time hook
>>>> ARM: vt8500: remove custom .init_time hook
>>>>
>>>> arch/arm/kernel/time.c | 27 ++---
>>>> arch/arm/mach-bcm2835/bcm2835.c | 2 -
>>>> arch/arm/mach-dove/board-dt.c | 11 --
>>>> arch/arm/mach-exynos/common.c | 8 --
>>>> arch/arm/mach-exynos/common.h | 1 -
>>>> arch/arm/mach-exynos/mach-exynos4-dt.c | 2 -
>>>> arch/arm/mach-exynos/mach-exynos5-dt.c | 2 -
>>>> arch/arm/mach-highbank/highbank.c | 23 ++---
>>>> arch/arm/mach-imx/clk-imx51-imx53.c | 29 ++----
>>>> arch/arm/mach-imx/common.h | 4 -
>>>> arch/arm/mach-imx/imx51-dt.c | 6 --
>>>> arch/arm/mach-imx/mach-imx53.c | 6 --
>>>> arch/arm/mach-imx/mach-imx6q.c | 14 +--
>>>> arch/arm/mach-imx/mach-imx6sl.c | 7 --
>>>> arch/arm/mach-imx/mach-vf610.c | 9 --
>>>> arch/arm/mach-kirkwood/board-dt.c | 8 --
>>>> arch/arm/mach-mxs/mach-mxs.c | 13 ---
>>>> arch/arm/mach-nomadik/cpu-8815.c | 36 -------
>>>> arch/arm/mach-nspire/nspire.c | 9 --
>>>> arch/arm/mach-prima2/common.c | 11 --
>>>> arch/arm/mach-prima2/common.h | 1 -
>>>> arch/arm/mach-rockchip/rockchip.c | 9 --
>>>> arch/arm/mach-socfpga/socfpga.c | 2 -
>>>> arch/arm/mach-sti/board-dt.c | 10 +-
>>>> arch/arm/mach-sunxi/sunxi.c | 10 --
>>>> arch/arm/mach-tegra/tegra.c | 9 --
>>>> arch/arm/mach-vexpress/v2m.c | 14 +--
>>>> arch/arm/mach-vt8500/common.h | 24 -----
>>>> arch/arm/mach-vt8500/vt8500.c | 6 --
>>>> drivers/clk/clk-bcm2835.c | 8 --
>>>> drivers/clk/clk-highbank.c | 10 +-
>>>> drivers/clk/clk-nomadik.c | 161
>>>> ++++++++++++++---------------
>>>> drivers/clk/clk-prima2.c | 29 ++----
>>>> drivers/clk/clk-vt8500.c | 31 ++++--
>>>> drivers/clk/mxs/clk-imx23.c | 15 +--
>>>> drivers/clk/mxs/clk-imx28.c | 16 +--
>>>> drivers/clk/sunxi/clk-sunxi.c | 11 +-
>>>> drivers/clocksource/nomadik-mtu.c | 11 ++
>>>> include/linux/clk/mxs.h | 2 -
>>>> include/linux/clk/sunxi.h | 22 ----
>>>> include/linux/platform_data/clk-nomadik.h | 2 -
>>>> 41 files changed, 182 insertions(+), 449 deletions(-)
>>>> delete mode 100644 arch/arm/mach-vt8500/common.h
>>>> delete mode 100644 include/linux/clk/sunxi.h
>>>> delete mode 100644 include/linux/platform_data/clk-nomadik.h
>>>
>>>
>>> How would you like to handle this series?
>>
>>
>> Jason,
>>
>> honestly I don't really know, yet. I was hoping for Arnd and Olof
>> decide on that. Maybe they also create a topic branch up to where
>> arch-wide of_clk_init is introduced. Then each removal patch can
>> go through the independent sub-trees. There may be more machs
>> introduced before, that can then also depend on the common branch.
>
> I'd like to see this merged early into arm-soc and have it as a base
> branch for other platform branches if there will be much conflicts
> (for trivial or small conflicts we can resolve, of course). So please
> collect acks and prepare a branch for me to merge, Sebastian. Or if
> it's easier I can just apply the patches directly -- just let me know.
> But given the tegra dependency it's probably easier to take a branch.

Actually, I'd be happy if you make a decision. It would be my first
pull request and maybe it should go guided by more experienced devs
from now on. Although I am willing to learn.

> The long tail might be the cases where you rewrote some of the init
> code, since that'll need to be tested on those platforms. I wonder if
> we can pick up most of the other pieces if that ends up taking a
> while.

True, for an early merge that was a bad decision. I looked again into
patches 1-8 and if there are concerns:
- nomadik can be dropped as it still has custom .init_time.
- prima2 and sunxi are quite straight forward but also have custom
.init_time that protect them from the arch-wide call.
- socfpga needs some new custom .init_time then.
- vt8500 is a little bit more changes but has .init_time call to
clocksource_of_init alone.

Sebastian

2013-09-19 08:40:19

by Heiko Stübner

[permalink] [raw]
Subject: Re: [PATCH 20/26] ARM: rockchip: remove custom .init_time hook

Am Mittwoch, 18. September 2013, 19:53:53 schrieb Sebastian Hesselbarth:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>

Acked-by: Heiko Stuebner <[email protected]>


> ---
> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Heiko Stuebner <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-rockchip/rockchip.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/rockchip.c
> b/arch/arm/mach-rockchip/rockchip.c index 724d2d8..82c0b07 100644
> --- a/arch/arm/mach-rockchip/rockchip.c
> +++ b/arch/arm/mach-rockchip/rockchip.c
> @@ -19,18 +19,10 @@
> #include <linux/init.h>
> #include <linux/of_platform.h>
> #include <linux/irqchip.h>
> -#include <linux/dw_apb_timer.h>
> -#include <linux/clk-provider.h>
> #include <asm/mach/arch.h>
> #include <asm/mach/map.h>
> #include <asm/hardware/cache-l2x0.h>
>
> -static void __init rockchip_timer_init(void)
> -{
> - of_clk_init(NULL);
> - clocksource_of_init();
> -}
> -
> static void __init rockchip_dt_init(void)
> {
> l2x0_of_init(0, ~0UL);
> @@ -47,6 +39,5 @@ static const char * const rockchip_board_dt_compat[] = {
>
> DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
> .init_machine = rockchip_dt_init,
> - .init_time = rockchip_timer_init,
> .dt_compat = rockchip_board_dt_compat,
> MACHINE_END

2013-09-19 08:45:46

by Barry Song

[permalink] [raw]
Subject: Re: [PATCH 04/26] clk: prima2: declare OF clock provider

> @@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)
>
> of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
> }
> +CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);

hi Sebastian,
what if the driver is compatible with multiple clk controllers and we
want to add another compatible string here except "sirf,prima2-clkc"?

-barry

2013-09-19 08:49:06

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 04/26] clk: prima2: declare OF clock provider

On 09/19/13 10:45, Barry Song wrote:
>> @@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)
>>
>> of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
>> }
>> +CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
>
> hi Sebastian,
> what if the driver is compatible with multiple clk controllers and we
> want to add another compatible string here except "sirf,prima2-clkc"?
>
> -barry
>

Just add
CLK_OF_DECLARE(other_fancy_clk, "sirf,different-compatible",
sirfsoc_clk_init);

Sebastian

2013-09-19 13:34:08

by Pawel Moll

[permalink] [raw]
Subject: Re: [PATCH 25/26] ARM: vexpress: remove custom .init_time hook

On Wed, 2013-09-18 at 18:53 +0100, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks. The call to versatile_sched_clock_init
> is moved to .init_early instead, were it is also for non-DT boards.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> Tested-by: Jon Medhurst (Tixy) <[email protected]>

Acked-by: Pawel Moll <[email protected]>

Thanks!

Pawel

2013-09-19 19:02:23

by Tony Prisk

[permalink] [raw]
Subject: Re: [PATCH 07/26] clk: vt8500: parse pmc_base from clock driver

On 19/09/13 05:53, Sebastian Hesselbarth wrote:
> Currently, clock providers for vt8500 depend on machine_init providing
> pmc_base address before calling of_clk_init. With upcoming arch-wide
> .time_init calling of_clk_init, we should make clock providers independent
> of mach code. This adds a pmc_base parsing helper to current clock provider
> that gets called if there is no pmc_base set, yet.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Tony Prisk <[email protected]>
> Cc: Mike Turquette <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> drivers/clk/clk-vt8500.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
> index 82306f5..a5ee01c 100644
> --- a/drivers/clk/clk-vt8500.c
> +++ b/drivers/clk/clk-vt8500.c
> @@ -15,11 +15,14 @@
>
> #include <linux/io.h>
> #include <linux/of.h>
> +#include <linux/of_address.h>
> #include <linux/slab.h>
> #include <linux/bitops.h>
> #include <linux/clkdev.h>
> #include <linux/clk-provider.h>
>
> +#define LEGACY_PMC_BASE 0xD8130000
> +
> /* All clocks share the same lock as none can be changed concurrently */
> static DEFINE_SPINLOCK(_lock);
>
> @@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = {
> .recalc_rate = vtwm_pll_recalc_rate,
> };
>
> +static __init void vtwm_set_pmc_base(void)
> +{
> + struct device_node *np =
> + of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
> +
> + if (np)
> + pmc_base = of_iomap(np, 0);
> + else
> + pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
> + of_node_put(np);
> +
> + if (!pmc_base)
> + pr_err("%s:of_iomap(pmc) failed\n", __func__);
> +}
> +
> static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
> {
> u32 reg;
> @@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
> struct clk_init_data init;
> int rc;
>
> + if (!pmc_base)
> + vtwm_set_pmc_base();
> +
> rc = of_property_read_u32(node, "reg", &reg);
> if (WARN_ON(rc))
> return;
What happens if the first clock registered is a 'device clock' rather
than a 'pll'?

static __init void vtwm_device_clk_init(struct device_node *node)
{
u32 en_reg, div_reg;
struct clk *clk;
struct clk_device *dev_clk;
const char *clk_name = node->name;
const char *parent_name;
struct clk_init_data init;
int rc;
int clk_init_flags = 0;

dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL);
if (WARN_ON(!dev_clk))
return;

dev_clk->lock = &_lock;

rc = of_property_read_u32(node, "enable-reg", &en_reg);
if (!rc) {
dev_clk->en_reg = pmc_base + en_reg;
...
}
CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock",
vtwm_device_clk_init);

If a device clock is initialized first, pmc_base will be null and
dev_clk->en_reg (+ other register offsets) will be incorrect.


Regards
Tony Prisk

2013-09-19 19:12:35

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 07/26] clk: vt8500: parse pmc_base from clock driver

On 09/19/2013 09:02 PM, Tony Prisk wrote:
> On 19/09/13 05:53, Sebastian Hesselbarth wrote:
>> Currently, clock providers for vt8500 depend on machine_init providing
>> pmc_base address before calling of_clk_init. With upcoming arch-wide
>> .time_init calling of_clk_init, we should make clock providers
>> independent
>> of mach code. This adds a pmc_base parsing helper to current clock
>> provider
>> that gets called if there is no pmc_base set, yet.
>>
>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>> ---
>> Cc: Olof Johansson <[email protected]>
>> Cc: Arnd Bergmann <[email protected]>
>> Cc: Tony Prisk <[email protected]>
>> Cc: Mike Turquette <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> ---
>> drivers/clk/clk-vt8500.c | 21 +++++++++++++++++++++
>> 1 file changed, 21 insertions(+)
>>
>> diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
>> index 82306f5..a5ee01c 100644
>> --- a/drivers/clk/clk-vt8500.c
>> +++ b/drivers/clk/clk-vt8500.c
>> @@ -15,11 +15,14 @@
>> #include <linux/io.h>
>> #include <linux/of.h>
>> +#include <linux/of_address.h>
>> #include <linux/slab.h>
>> #include <linux/bitops.h>
>> #include <linux/clkdev.h>
>> #include <linux/clk-provider.h>
>> +#define LEGACY_PMC_BASE 0xD8130000
>> +
>> /* All clocks share the same lock as none can be changed
>> concurrently */
>> static DEFINE_SPINLOCK(_lock);
>> @@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = {
>> .recalc_rate = vtwm_pll_recalc_rate,
>> };
>> +static __init void vtwm_set_pmc_base(void)
>> +{
>> + struct device_node *np =
>> + of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
>> +
>> + if (np)
>> + pmc_base = of_iomap(np, 0);
>> + else
>> + pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
>> + of_node_put(np);
>> +
>> + if (!pmc_base)
>> + pr_err("%s:of_iomap(pmc) failed\n", __func__);
>> +}
>> +
>> static __init void vtwm_pll_clk_init(struct device_node *node, int
>> pll_type)
>> {
>> u32 reg;
>> @@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct
>> device_node *node, int pll_type)
>> struct clk_init_data init;
>> int rc;
>> + if (!pmc_base)
>> + vtwm_set_pmc_base();
>> +
>> rc = of_property_read_u32(node, "reg", &reg);
>> if (WARN_ON(rc))
>> return;
> What happens if the first clock registered is a 'device clock' rather
> than a 'pll'?
>
> static __init void vtwm_device_clk_init(struct device_node *node)
> {
> u32 en_reg, div_reg;
> struct clk *clk;
> struct clk_device *dev_clk;
> const char *clk_name = node->name;
> const char *parent_name;
> struct clk_init_data init;
> int rc;
> int clk_init_flags = 0;
>
> dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL);
> if (WARN_ON(!dev_clk))
> return;
>
> dev_clk->lock = &_lock;
>
> rc = of_property_read_u32(node, "enable-reg", &en_reg);
> if (!rc) {
> dev_clk->en_reg = pmc_base + en_reg;
> ...
> }
> CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock",
> vtwm_device_clk_init);
>
> If a device clock is initialized first, pmc_base will be null and
> dev_clk->en_reg (+ other register offsets) will be incorrect.

Tony,

looks like I just missed to add the same check for !pmc_base to
vtwm_device_clk_init. If you are ok with the general approach,
I send v2 for this patch shortly.

Optionally, you can also choose to take care of clk-vt8500 yourself,
as mach-vt8500 has its own .init_time callback and will be unaffected
by the arch-wide default callback. If so, I will drop vt8500 to not
stall this series too much now.

Sebastian

2013-09-20 04:51:12

by Tony Prisk

[permalink] [raw]
Subject: Re: [PATCH 07/26] clk: vt8500: parse pmc_base from clock driver

On 20/09/13 07:12, Sebastian Hesselbarth wrote:
> On 09/19/2013 09:02 PM, Tony Prisk wrote:
>> On 19/09/13 05:53, Sebastian Hesselbarth wrote:
>>> Currently, clock providers for vt8500 depend on machine_init providing
>>> pmc_base address before calling of_clk_init. With upcoming arch-wide
>>> .time_init calling of_clk_init, we should make clock providers
>>> independent
>>> of mach code. This adds a pmc_base parsing helper to current clock
>>> provider
>>> that gets called if there is no pmc_base set, yet.
>>>
>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>> ---
>>> Cc: Olof Johansson <[email protected]>
>>> Cc: Arnd Bergmann <[email protected]>
>>> Cc: Tony Prisk <[email protected]>
>>> Cc: Mike Turquette <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> ---
>>> drivers/clk/clk-vt8500.c | 21 +++++++++++++++++++++
>>> 1 file changed, 21 insertions(+)
>>>
>>> diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
>>> index 82306f5..a5ee01c 100644
>>> --- a/drivers/clk/clk-vt8500.c
>>> +++ b/drivers/clk/clk-vt8500.c
>>> @@ -15,11 +15,14 @@
>>> #include <linux/io.h>
>>> #include <linux/of.h>
>>> +#include <linux/of_address.h>
>>> #include <linux/slab.h>
>>> #include <linux/bitops.h>
>>> #include <linux/clkdev.h>
>>> #include <linux/clk-provider.h>
>>> +#define LEGACY_PMC_BASE 0xD8130000
>>> +
>>> /* All clocks share the same lock as none can be changed
>>> concurrently */
>>> static DEFINE_SPINLOCK(_lock);
>>> @@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = {
>>> .recalc_rate = vtwm_pll_recalc_rate,
>>> };
>>> +static __init void vtwm_set_pmc_base(void)
>>> +{
>>> + struct device_node *np =
>>> + of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
>>> +
>>> + if (np)
>>> + pmc_base = of_iomap(np, 0);
>>> + else
>>> + pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
>>> + of_node_put(np);
>>> +
>>> + if (!pmc_base)
>>> + pr_err("%s:of_iomap(pmc) failed\n", __func__);
>>> +}
>>> +
>>> static __init void vtwm_pll_clk_init(struct device_node *node, int
>>> pll_type)
>>> {
>>> u32 reg;
>>> @@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct
>>> device_node *node, int pll_type)
>>> struct clk_init_data init;
>>> int rc;
>>> + if (!pmc_base)
>>> + vtwm_set_pmc_base();
>>> +
>>> rc = of_property_read_u32(node, "reg", &reg);
>>> if (WARN_ON(rc))
>>> return;
>> What happens if the first clock registered is a 'device clock' rather
>> than a 'pll'?
>>
>> static __init void vtwm_device_clk_init(struct device_node *node)
>> {
>> u32 en_reg, div_reg;
>> struct clk *clk;
>> struct clk_device *dev_clk;
>> const char *clk_name = node->name;
>> const char *parent_name;
>> struct clk_init_data init;
>> int rc;
>> int clk_init_flags = 0;
>>
>> dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL);
>> if (WARN_ON(!dev_clk))
>> return;
>>
>> dev_clk->lock = &_lock;
>>
>> rc = of_property_read_u32(node, "enable-reg", &en_reg);
>> if (!rc) {
>> dev_clk->en_reg = pmc_base + en_reg;
>> ...
>> }
>> CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock",
>> vtwm_device_clk_init);
>>
>> If a device clock is initialized first, pmc_base will be null and
>> dev_clk->en_reg (+ other register offsets) will be incorrect.
>
> Tony,
>
> looks like I just missed to add the same check for !pmc_base to
> vtwm_device_clk_init. If you are ok with the general approach,
> I send v2 for this patch shortly.
>
> Optionally, you can also choose to take care of clk-vt8500 yourself,
> as mach-vt8500 has its own .init_time callback and will be unaffected
> by the arch-wide default callback. If so, I will drop vt8500 to not
> stall this series too much now.
>
> Sebastian
I have no issue with the concept - just pointing out the missing bit. If
you can fix that small issue for v2 then you can also add my:

Acked-by: Tony Prisk <[email protected]>

Regards
Tony P

2013-09-20 06:22:47

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 07/26] clk: vt8500: parse pmc_base from clock driver

Currently, clock providers for vt8500 depend on machine_init providing
pmc_base address before calling of_clk_init. With upcoming arch-wide
.time_init calling of_clk_init, we should make clock providers independent
of mach code. This adds a pmc_base parsing helper to current clock provider
that gets called if there is no pmc_base set, yet.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Acked-by: Tony Prisk <[email protected]>
---
Changelog:
v1->v2:
- Also check pmc_base in vtwm_device_clk_init (Reported by Tony Prisk)
This also requires vtwm_set_pmc_base to move upwards.

Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Tony Prisk <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/clk/clk-vt8500.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index 82306f5..39fe72a 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -15,11 +15,14 @@

#include <linux/io.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>

+#define LEGACY_PMC_BASE 0xD8130000
+
/* All clocks share the same lock as none can be changed concurrently */
static DEFINE_SPINLOCK(_lock);

@@ -53,6 +56,21 @@ struct clk_pll {

static void __iomem *pmc_base;

+static __init void vtwm_set_pmc_base(void)
+{
+ struct device_node *np =
+ of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
+
+ if (np)
+ pmc_base = of_iomap(np, 0);
+ else
+ pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
+ of_node_put(np);
+
+ if (!pmc_base)
+ pr_err("%s:of_iomap(pmc) failed\n", __func__);
+}
+
#define to_clk_device(_hw) container_of(_hw, struct clk_device, hw)

#define VT8500_PMC_BUSY_MASK 0x18
@@ -222,6 +240,9 @@ static __init void vtwm_device_clk_init(struct device_node *node)
int rc;
int clk_init_flags = 0;

+ if (!pmc_base)
+ vtwm_set_pmc_base();
+
dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL);
if (WARN_ON(!dev_clk))
return;
@@ -636,6 +657,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
struct clk_init_data init;
int rc;

+ if (!pmc_base)
+ vtwm_set_pmc_base();
+
rc = of_property_read_u32(node, "reg", &reg);
if (WARN_ON(rc))
return;
--
1.7.10.4

2013-09-20 06:24:00

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 07/26] clk: vt8500: parse pmc_base from clock driver

On 09/20/2013 06:51 AM, Tony Prisk wrote:
> On 20/09/13 07:12, Sebastian Hesselbarth wrote:
>> On 09/19/2013 09:02 PM, Tony Prisk wrote:
>>> On 19/09/13 05:53, Sebastian Hesselbarth wrote:
>>>> Currently, clock providers for vt8500 depend on machine_init providing
>>>> pmc_base address before calling of_clk_init. With upcoming arch-wide
>>>> .time_init calling of_clk_init, we should make clock providers
>>>> independent
>>>> of mach code. This adds a pmc_base parsing helper to current clock
>>>> provider
>>>> that gets called if there is no pmc_base set, yet.
>>>>
>>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>>> ---
>>>> Cc: Olof Johansson <[email protected]>
>>>> Cc: Arnd Bergmann <[email protected]>
>>>> Cc: Tony Prisk <[email protected]>
>>>> Cc: Mike Turquette <[email protected]>
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> ---
>>>> drivers/clk/clk-vt8500.c | 21 +++++++++++++++++++++
>>>> 1 file changed, 21 insertions(+)
>>>>
>>>> diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
>>>> index 82306f5..a5ee01c 100644
>>>> --- a/drivers/clk/clk-vt8500.c
>>>> +++ b/drivers/clk/clk-vt8500.c
>>>> @@ -15,11 +15,14 @@
>>>> #include <linux/io.h>
>>>> #include <linux/of.h>
>>>> +#include <linux/of_address.h>
>>>> #include <linux/slab.h>
>>>> #include <linux/bitops.h>
>>>> #include <linux/clkdev.h>
>>>> #include <linux/clk-provider.h>
>>>> +#define LEGACY_PMC_BASE 0xD8130000
>>>> +
>>>> /* All clocks share the same lock as none can be changed
>>>> concurrently */
>>>> static DEFINE_SPINLOCK(_lock);
>>>> @@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = {
>>>> .recalc_rate = vtwm_pll_recalc_rate,
>>>> };
>>>> +static __init void vtwm_set_pmc_base(void)
>>>> +{
>>>> + struct device_node *np =
>>>> + of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
>>>> +
>>>> + if (np)
>>>> + pmc_base = of_iomap(np, 0);
>>>> + else
>>>> + pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
>>>> + of_node_put(np);
>>>> +
>>>> + if (!pmc_base)
>>>> + pr_err("%s:of_iomap(pmc) failed\n", __func__);
>>>> +}
>>>> +
>>>> static __init void vtwm_pll_clk_init(struct device_node *node, int
>>>> pll_type)
>>>> {
>>>> u32 reg;
>>>> @@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct
>>>> device_node *node, int pll_type)
>>>> struct clk_init_data init;
>>>> int rc;
>>>> + if (!pmc_base)
>>>> + vtwm_set_pmc_base();
>>>> +
>>>> rc = of_property_read_u32(node, "reg", &reg);
>>>> if (WARN_ON(rc))
>>>> return;
>>> What happens if the first clock registered is a 'device clock' rather
>>> than a 'pll'?
>>>
>>> static __init void vtwm_device_clk_init(struct device_node *node)
>>> {
>>> u32 en_reg, div_reg;
>>> struct clk *clk;
>>> struct clk_device *dev_clk;
>>> const char *clk_name = node->name;
>>> const char *parent_name;
>>> struct clk_init_data init;
>>> int rc;
>>> int clk_init_flags = 0;
>>>
>>> dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL);
>>> if (WARN_ON(!dev_clk))
>>> return;
>>>
>>> dev_clk->lock = &_lock;
>>>
>>> rc = of_property_read_u32(node, "enable-reg", &en_reg);
>>> if (!rc) {
>>> dev_clk->en_reg = pmc_base + en_reg;
>>> ...
>>> }
>>> CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock",
>>> vtwm_device_clk_init);
>>>
>>> If a device clock is initialized first, pmc_base will be null and
>>> dev_clk->en_reg (+ other register offsets) will be incorrect.
>>
>> Tony,
>>
>> looks like I just missed to add the same check for !pmc_base to
>> vtwm_device_clk_init. If you are ok with the general approach,
>> I send v2 for this patch shortly.
>>
>> Optionally, you can also choose to take care of clk-vt8500 yourself,
>> as mach-vt8500 has its own .init_time callback and will be unaffected
>> by the arch-wide default callback. If so, I will drop vt8500 to not
>> stall this series too much now.
>>
>> Sebastian
> I have no issue with the concept - just pointing out the missing bit. If
> you can fix that small issue for v2 then you can also add my:
>
> Acked-by: Tony Prisk <[email protected]>

Just to make sure, does that also count for the other vt8500 patches?

Sebastian

2013-09-20 08:56:49

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH 16/26] ARM: mxs: remove custom .init_time hook

On Wed, Sep 18, 2013 at 07:53:49PM +0200, Sebastian Hesselbarth wrote:
> This patch converts clk-imx2[38] clocksource_of_init compatible init
> associated with fsl,imx2[38]-clkctrl. With arch/arm calling
> of_clk_init(NULL) from time_init(), we can now also remove custom
> .init_time hooks.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> Acked-by: Mike Turquette <[email protected]>

Acked-by: Shawn Guo <[email protected]>

2013-09-20 18:22:52

by Tony Prisk

[permalink] [raw]
Subject: Re: [PATCH 07/26] clk: vt8500: parse pmc_base from clock driver

On 20/09/13 18:23, Sebastian Hesselbarth wrote:
> On 09/20/2013 06:51 AM, Tony Prisk wrote:
>> On 20/09/13 07:12, Sebastian Hesselbarth wrote:
>>> On 09/19/2013 09:02 PM, Tony Prisk wrote:
>>>> On 19/09/13 05:53, Sebastian Hesselbarth wrote:
>>>>> Currently, clock providers for vt8500 depend on machine_init
>>>>> providing
>>>>> pmc_base address before calling of_clk_init. With upcoming arch-wide
>>>>> .time_init calling of_clk_init, we should make clock providers
>>>>> independent
>>>>> of mach code. This adds a pmc_base parsing helper to current clock
>>>>> provider
>>>>> that gets called if there is no pmc_base set, yet.
>>>>>
>>>>> Signed-off-by: Sebastian Hesselbarth
>>>>> <[email protected]>
>>>>> ---
>>>>> Cc: Olof Johansson <[email protected]>
>>>>> Cc: Arnd Bergmann <[email protected]>
>>>>> Cc: Tony Prisk <[email protected]>
>>>>> Cc: Mike Turquette <[email protected]>
>>>>> Cc: [email protected]
>>>>> Cc: [email protected]
>>>>> ---
>>>>> drivers/clk/clk-vt8500.c | 21 +++++++++++++++++++++
>>>>> 1 file changed, 21 insertions(+)
>>>>>
>>>>> diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
>>>>> index 82306f5..a5ee01c 100644
>>>>> --- a/drivers/clk/clk-vt8500.c
>>>>> +++ b/drivers/clk/clk-vt8500.c
>>>>> @@ -15,11 +15,14 @@
>>>>> #include <linux/io.h>
>>>>> #include <linux/of.h>
>>>>> +#include <linux/of_address.h>
>>>>> #include <linux/slab.h>
>>>>> #include <linux/bitops.h>
>>>>> #include <linux/clkdev.h>
>>>>> #include <linux/clk-provider.h>
>>>>> +#define LEGACY_PMC_BASE 0xD8130000
>>>>> +
>>>>> /* All clocks share the same lock as none can be changed
>>>>> concurrently */
>>>>> static DEFINE_SPINLOCK(_lock);
>>>>> @@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = {
>>>>> .recalc_rate = vtwm_pll_recalc_rate,
>>>>> };
>>>>> +static __init void vtwm_set_pmc_base(void)
>>>>> +{
>>>>> + struct device_node *np =
>>>>> + of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
>>>>> +
>>>>> + if (np)
>>>>> + pmc_base = of_iomap(np, 0);
>>>>> + else
>>>>> + pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
>>>>> + of_node_put(np);
>>>>> +
>>>>> + if (!pmc_base)
>>>>> + pr_err("%s:of_iomap(pmc) failed\n", __func__);
>>>>> +}
>>>>> +
>>>>> static __init void vtwm_pll_clk_init(struct device_node *node, int
>>>>> pll_type)
>>>>> {
>>>>> u32 reg;
>>>>> @@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct
>>>>> device_node *node, int pll_type)
>>>>> struct clk_init_data init;
>>>>> int rc;
>>>>> + if (!pmc_base)
>>>>> + vtwm_set_pmc_base();
>>>>> +
>>>>> rc = of_property_read_u32(node, "reg", &reg);
>>>>> if (WARN_ON(rc))
>>>>> return;
>>>> What happens if the first clock registered is a 'device clock' rather
>>>> than a 'pll'?
>>>>
>>>> static __init void vtwm_device_clk_init(struct device_node *node)
>>>> {
>>>> u32 en_reg, div_reg;
>>>> struct clk *clk;
>>>> struct clk_device *dev_clk;
>>>> const char *clk_name = node->name;
>>>> const char *parent_name;
>>>> struct clk_init_data init;
>>>> int rc;
>>>> int clk_init_flags = 0;
>>>>
>>>> dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL);
>>>> if (WARN_ON(!dev_clk))
>>>> return;
>>>>
>>>> dev_clk->lock = &_lock;
>>>>
>>>> rc = of_property_read_u32(node, "enable-reg", &en_reg);
>>>> if (!rc) {
>>>> dev_clk->en_reg = pmc_base + en_reg;
>>>> ...
>>>> }
>>>> CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock",
>>>> vtwm_device_clk_init);
>>>>
>>>> If a device clock is initialized first, pmc_base will be null and
>>>> dev_clk->en_reg (+ other register offsets) will be incorrect.
>>>
>>> Tony,
>>>
>>> looks like I just missed to add the same check for !pmc_base to
>>> vtwm_device_clk_init. If you are ok with the general approach,
>>> I send v2 for this patch shortly.
>>>
>>> Optionally, you can also choose to take care of clk-vt8500 yourself,
>>> as mach-vt8500 has its own .init_time callback and will be unaffected
>>> by the arch-wide default callback. If so, I will drop vt8500 to not
>>> stall this series too much now.
>>>
>>> Sebastian
>> I have no issue with the concept - just pointing out the missing bit. If
>> you can fix that small issue for v2 then you can also add my:
>>
>> Acked-by: Tony Prisk <[email protected]>
>
> Just to make sure, does that also count for the other vt8500 patches?
>
> Sebastian
Sorry, I should have been more specific.

For the whole series (vt8500-related):
Acked-by: Tony Prisk <[email protected]>

Regards
Tony P

2013-09-20 19:16:21

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
> This is a patch set based on an RFC [1][2] sent earlier to provide a common
> arch/arm init for DT clock providers. Currently, the call to of_clk_init(NULL)
> to initialize DT clock providers is spread among several mach-dirs. Since most
> machs require DT clocks initialized before timers, no initcall can be used.
>
> By adding of_clk_init(NULL) to arch/arm time_init(), we can remove all
> mach-specific .init_time hooks that basically called of_clk_init and
> clocksource_of_init.
>
> In contrast to the RFC version, of_clk_init(NULL) is now only called if no
> custom .init_time callback is set. This allows some machs to still call clock
> init themselves, as not all can be converted now. Therefore, this patch sets
> drops conversion of mach-mvebu and mach-zynq. New machs that were introduced
> with v3.12-rc1 are also converted, except mach-u300 that requires clocks
> before irqs.
>
> The patch set is based on v3.12-rc1 and further depends on a topic branch
> created by Stephen Warren for mach-tegra [3]. It is now split into preparation
> and removal patches to not break bisectability. I added all Acked-by/Tested-by's
> where applicable or dropped them, if the patch was separated into two.
> It has been compile tested for all machs involved with the following defconfigs
> (multi_v7, bcm2835, dove, exynos, kirkwood, mxs, nhk8815) and nspire selected
> on multi_v4_v5.
>
> Patches 1-8 comprise preparation patches that convert machs nomadik, prima2,
> socfpga, sunxi, tegra, and vt8500 to usual .init_time callbacks calling only
> of_clk_init and clocksource_of_init.
>
> Patch 9 then introduces of_clk_init(NULL) to the arch-wide default .init_time
> callback.
>
> Patches 10-26 finally remove custom .init_time callbacks from the machs involved.

Hi Sebastian,

Could you pick up the following patch for mach-bcm/ into this series?

Thanks,
Matt

>From f65d048b3453447bb3e693cb21701c4d0c6375ed Mon Sep 17 00:00:00 2001
From: Matt Porter <[email protected]>
Date: Fri, 20 Sep 2013 13:41:06 -0400
Subject: [PATCH] ARM: bcm: Remove custom .time_init hook

With arch/arm calling of_clk_init(NULL) and clocksource_of_init()
this is no longer needed. The former is useful because we can make
use of dummy fixed clocks for drivers until the bcm281xx common
clock driver is ready.

Signed-off-by: Matt Porter <[email protected]>
Reviewed-by: Markus Mayer <[email protected]>
Reviewed-by: Christian Daudt <[email protected]>
---
arch/arm/mach-bcm/board_bcm281xx.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index 8d9f931..26b2390 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -68,7 +68,6 @@ static void __init board_init(void)
static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, };

DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
- .init_time = clocksource_of_init,
.init_machine = board_init,
.restart = bcm_kona_restart,
.dt_compat = bcm11351_dt_compat,
--
1.8.4

2013-09-20 20:49:29

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init

On Wed, Sep 18, 2013 at 7:53 PM, Sebastian Hesselbarth
<[email protected]> wrote:

> MTU timer initialization is stuffed into .init_time callback, while
> cpu8815_timer_init_of again maps addresses from the same device node.
> Therefore, this patch moves mtu setup from to clocksource init.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>

Another happy Nomadik user? Or are you just compile testing
this?

Actually, this is superceded and collides with this pending fix:
http://marc.info/?l=linux-arm-kernel&m=137910161418706&w=2

We should wait for that to hit mainline and then see what we want
to do with this.

Yours,
Linus Walleij

2013-09-20 20:51:58

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init

On Fri, Sep 20, 2013 at 10:49 PM, Linus Walleij
<[email protected]> wrote:
> On Wed, Sep 18, 2013 at 7:53 PM, Sebastian Hesselbarth
> <[email protected]> wrote:
>
>> MTU timer initialization is stuffed into .init_time callback, while
>> cpu8815_timer_init_of again maps addresses from the same device node.
>> Therefore, this patch moves mtu setup from to clocksource init.
>>
>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>
> Another happy Nomadik user? Or are you just compile testing
> this?
>
> Actually, this is superceded and collides with this pending fix:
> http://marc.info/?l=linux-arm-kernel&m=137910161418706&w=2
>
> We should wait for that to hit mainline and then see what we want
> to do with this.

By the way - this can *definately* not be moved into the MTU
driver as it is pertaining to clocks, not the timer using it.

As nmdk_timer_init() can also be called from the ux500 which
does not want to do this, things get broken for ux500.

Yours,
Linus Walleij

2013-09-20 20:54:15

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 02/26] clk: nomadik: move src init out of nomadik_clk_init

On Wed, Sep 18, 2013 at 7:53 PM, Sebastian Hesselbarth
<[email protected]> wrote:

> nomadik_clk_init currently also maps system reset controller base address
> used by clocks and registers a reboot notifier. To allow further cleanup of
> nomadik clk setup, this moves system reset controller setup from
> nomadik_clk_init to its own function.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>

I don't see where it's going until I've seen the rest of the patches
but OK: Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2013-09-20 20:55:35

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 03/26] clk: nomadik: declare OF clock provider

On Wed, Sep 18, 2013 at 7:53 PM, Sebastian Hesselbarth
<[email protected]> wrote:

> Common clock framework allows to register clock providers to get called
> on of_clk_init() by using CLK_OF_DECLARE. This converts nomadik clock
> provider to make use of it and get rid of the mach specific clk init
> call. As clocks require system reset controller base address to be
> initialized each clock driver checks src_base and calls new
> nomadik_src_init if required.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>

Looks like a good idea!
Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2013-09-20 20:56:43

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 17/26] ARM: nomadik: remove custom .init_time hook

On Wed, Sep 18, 2013 at 7:53 PM, Sebastian Hesselbarth
<[email protected]> wrote:

> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>

Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2013-09-20 21:08:17

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init

On 09/20/2013 10:51 PM, Linus Walleij wrote:
> On Fri, Sep 20, 2013 at 10:49 PM, Linus Walleij
> <[email protected]> wrote:
>> On Wed, Sep 18, 2013 at 7:53 PM, Sebastian Hesselbarth
>> <[email protected]> wrote:
>>
>>> MTU timer initialization is stuffed into .init_time callback, while
>>> cpu8815_timer_init_of again maps addresses from the same device node.
>>> Therefore, this patch moves mtu setup from to clocksource init.
>>>
>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>
>> Another happy Nomadik user? Or are you just compile testing
>> this?

Linus,

I am not using nomadik but just though it could be integrated
in this patch set easily. Well, looks like I was at least not
that right ;)

>> Actually, this is superceded and collides with this pending fix:
>> http://marc.info/?l=linux-arm-kernel&m=137910161418706&w=2
>>
>> We should wait for that to hit mainline and then see what we want
>> to do with this.
>
> By the way - this can *definately* not be moved into the MTU
> driver as it is pertaining to clocks, not the timer using it.
>
> As nmdk_timer_init() can also be called from the ux500 which
> does not want to do this, things get broken for ux500.

Ok, well I was looking at v3.12-rc1 and did not really follow other
nomadik related threads. That time ux500 wasn't tangled up with
clk-nomadik.

As you ACK'd the remaining patches and therefore the general approach,
I will have a look at nomadik and the above changes again while waiting
for some other ACKs.

But as nomadik seems to be trickier than I initially thought and I
don't come with a clean solution in time, are you also ok with
dropping nomadik now and get back to it later? As long as you have a
custom .init_time, everything is safe for nomadik.

Sebastian

2013-09-20 21:11:43

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init

On Fri, Sep 20, 2013 at 11:08 PM, Sebastian Hesselbarth
<[email protected]> wrote:

> Ok, well I was looking at v3.12-rc1 and did not really follow other
> nomadik related threads. That time ux500 wasn't tangled up with
> clk-nomadik.

Well yeah, you're right. But Lee has a pending patch set that
makes the ux500 use this for its OF boot path...

Yours,
Linus Walleij

2013-09-20 21:13:13

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init

On 09/18/2013 07:53 PM, Sebastian Hesselbarth wrote:
> MTU timer initialization is stuffed into .init_time callback, while
> cpu8815_timer_init_of again maps addresses from the same device node.
> Therefore, this patch moves mtu setup from to clocksource init.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Alessandro Rubini <[email protected]>
> Cc: Linus Walleij <[email protected]>
> Cc: STEricsson <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Daniel Lezcano <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-nomadik/cpu-8815.c | 26 --------------------------
> drivers/clocksource/nomadik-mtu.c | 11 +++++++++++
> 2 files changed, 11 insertions(+), 26 deletions(-)
>
> diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
> index 13e0df9..0fcb149 100644
> --- a/arch/arm/mach-nomadik/cpu-8815.c
> +++ b/arch/arm/mach-nomadik/cpu-8815.c
> @@ -113,36 +113,10 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
> writel(1, srcbase + 0x18);
> }
>
> -/* Initial value for SRC control register: all timers use MXTAL/8 source */
> -#define SRC_CR_INIT_MASK 0x00007fff
> -#define SRC_CR_INIT_VAL 0x2aaa8000
> -
> static void __init cpu8815_timer_init_of(void)
> {
> - struct device_node *mtu;
> - void __iomem *base;
> - int irq;
> - u32 src_cr;
> -
> /* We need this to be up now */
> nomadik_clk_init();
> -
> - mtu = of_find_node_by_path("/mtu@101e2000");
> - if (!mtu)
> - return;
> - base = of_iomap(mtu, 0);
> - if (WARN_ON(!base))
> - return;
> - irq = irq_of_parse_and_map(mtu, 0);
> -
> - pr_info("Remapped MTU @ %p, irq: %d\n", base, irq);
> -
> - /* Configure timer sources in "system reset controller" ctrl reg */
> - src_cr = readl(base);
> - src_cr &= SRC_CR_INIT_MASK;
> - src_cr |= SRC_CR_INIT_VAL;
> - writel(src_cr, base);
> -
> clocksource_of_init();
> }

Linus,

looking at the fix you posted at [1], can I assume that the above it
redundant and can be removed?

[1] http://marc.info/?l=linux-arm-kernel&m=137910161418706&w=2

> diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c
> index 1b74bea..b9f97ba 100644
> --- a/drivers/clocksource/nomadik-mtu.c
> +++ b/drivers/clocksource/nomadik-mtu.c
> @@ -257,12 +257,17 @@ void __init nmdk_timer_init(void __iomem *base, int irq)
> __nmdk_timer_init(base, irq, pclk0, clk0);
> }
>
> +/* Initial value for SRC control register: all timers use MXTAL/8 source */
> +#define SRC_CR_INIT_MASK 0x00007fff
> +#define SRC_CR_INIT_VAL 0x2aaa8000
> +
> static void __init nmdk_timer_of_init(struct device_node *node)
> {
> struct clk *pclk;
> struct clk *clk;
> void __iomem *base;
> int irq;
> + u32 src_cr;
>
> base = of_iomap(node, 0);
> if (!base)
> @@ -280,6 +285,12 @@ static void __init nmdk_timer_of_init(struct device_node *node)
> if (irq <= 0)
> panic("Can't parse IRQ");
>
> + /* Configure timer sources in "system reset controller" ctrl reg */
> + src_cr = readl(base);
> + src_cr &= SRC_CR_INIT_MASK;
> + src_cr |= SRC_CR_INIT_VAL;
> + writel(src_cr, base);
> +
> __nmdk_timer_init(base, irq, pclk, clk);
> }
> CLOCKSOURCE_OF_DECLARE(nomadik_mtu, "st,nomadik-mtu",
>

2013-09-20 21:22:30

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init

On Fri, Sep 20, 2013 at 11:13 PM, Sebastian Hesselbarth
<[email protected]> wrote:

> Linus,
>
> looking at the fix you posted at [1], can I assume that the above it
> redundant and can be removed?
>
> [1] http://marc.info/?l=linux-arm-kernel&m=137910161418706&w=2

I think so, post a version doing that and I'll test it along with my other
patch.

If it blows up I'll notice :-)

Yours,
Linus Walleij

2013-09-20 21:37:14

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 01/26] ARM: nomadik: remove mtu initalization from .init_time

Nomadik clock initialization is properly done in clk-nomadik since
patch "clk: nomadik: set all timers to use 2.4 MHz TIMCLK".
Therefore, this patch removes now redundant mtu initialization from
.init_time callback.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Changelog:
v1->v2:
- adapt to clk-nomadik changes and just remove mtu init (Suggested by
Linus Walleij
- reword commit message and description accordingly

Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Alessandro Rubini <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: STEricsson <[email protected]>
Cc: Russell King <[email protected]>
Cc: Daniel Lezcano <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-nomadik/cpu-8815.c | 26 --------------------------
1 file changed, 26 deletions(-)

diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 13e0df9..0fcb149 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -113,36 +113,10 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
writel(1, srcbase + 0x18);
}

-/* Initial value for SRC control register: all timers use MXTAL/8 source */
-#define SRC_CR_INIT_MASK 0x00007fff
-#define SRC_CR_INIT_VAL 0x2aaa8000
-
static void __init cpu8815_timer_init_of(void)
{
- struct device_node *mtu;
- void __iomem *base;
- int irq;
- u32 src_cr;
-
/* We need this to be up now */
nomadik_clk_init();
-
- mtu = of_find_node_by_path("/mtu@101e2000");
- if (!mtu)
- return;
- base = of_iomap(mtu, 0);
- if (WARN_ON(!base))
- return;
- irq = irq_of_parse_and_map(mtu, 0);
-
- pr_info("Remapped MTU @ %p, irq: %d\n", base, irq);
-
- /* Configure timer sources in "system reset controller" ctrl reg */
- src_cr = readl(base);
- src_cr &= SRC_CR_INIT_MASK;
- src_cr |= SRC_CR_INIT_VAL;
- writel(src_cr, base);
-
clocksource_of_init();
}

--
1.7.10.4

2013-09-21 12:26:28

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 11/26] ARM: dove: remove custom .init_time hook

On Wed, Sep 18, 2013 at 07:53:44PM +0200, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks. While at it, also remove some obsolete
> includes.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Jason Cooper <[email protected]>
> Cc: Andrew Lunn <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-dove/board-dt.c | 11 -----------
> 1 file changed, 11 deletions(-)

Hi Sebastian

Boot tested on cubox.

Tested-by: Andrew Lunn <[email protected]>

Andrew

>
> diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
> index 49f72a8..ddb8663 100644
> --- a/arch/arm/mach-dove/board-dt.c
> +++ b/arch/arm/mach-dove/board-dt.c
> @@ -10,17 +10,13 @@
>
> #include <linux/init.h>
> #include <linux/clk-provider.h>
> -#include <linux/clocksource.h>
> -#include <linux/irqchip.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> -#include <linux/platform_data/usb-ehci-orion.h>
> #include <asm/hardware/cache-tauros2.h>
> #include <asm/mach/arch.h>
> #include <mach/dove.h>
> #include <mach/pm.h>
> #include <plat/common.h>
> -#include <plat/irq.h>
> #include "common.h"
>
> /*
> @@ -45,12 +41,6 @@ static void __init dove_legacy_clk_init(void)
> of_clk_get_from_provider(&clkspec));
> }
>
> -static void __init dove_dt_time_init(void)
> -{
> - of_clk_init(NULL);
> - clocksource_of_init();
> -}
> -
> static void __init dove_dt_init_early(void)
> {
> mvebu_mbus_init("marvell,dove-mbus",
> @@ -84,7 +74,6 @@ static const char * const dove_dt_board_compat[] = {
> DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
> .map_io = dove_map_io,
> .init_early = dove_dt_init_early,
> - .init_time = dove_dt_time_init,
> .init_machine = dove_dt_init,
> .restart = dove_restart,
> .dt_compat = dove_dt_board_compat,
> --
> 1.7.10.4
>

2013-09-21 20:31:36

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 15/26] ARM: kirkwood: remove custom .init_time hook

On Wed, Sep 18, 2013 at 07:53:48PM +0200, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Jason Cooper <[email protected]>
> Cc: Andrew Lunn <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-kirkwood/board-dt.c | 8 --------
> 1 file changed, 8 deletions(-)


Hi Sebastian

Boot tested on a Kirkwood Topkick.

Tested-by: Andrew Lunn <[email protected]>

Andrew

>
> diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
> index 82d3ad8..a32a3e5 100644
> --- a/arch/arm/mach-kirkwood/board-dt.c
> +++ b/arch/arm/mach-kirkwood/board-dt.c
> @@ -15,7 +15,6 @@
> #include <linux/of.h>
> #include <linux/of_platform.h>
> #include <linux/clk-provider.h>
> -#include <linux/clocksource.h>
> #include <linux/dma-mapping.h>
> #include <linux/irqchip.h>
> #include <linux/kexec.h>
> @@ -66,12 +65,6 @@ static void __init kirkwood_legacy_clk_init(void)
> clk_prepare_enable(clk);
> }
>
> -static void __init kirkwood_dt_time_init(void)
> -{
> - of_clk_init(NULL);
> - clocksource_of_init();
> -}
> -
> static void __init kirkwood_dt_init_early(void)
> {
> mvebu_mbus_init("marvell,kirkwood-mbus",
> @@ -122,7 +115,6 @@ DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
> /* Maintainer: Jason Cooper <[email protected]> */
> .map_io = kirkwood_map_io,
> .init_early = kirkwood_dt_init_early,
> - .init_time = kirkwood_dt_time_init,
> .init_machine = kirkwood_dt_init,
> .restart = kirkwood_restart,
> .dt_compat = kirkwood_dt_board_compat,
> --
> 1.7.10.4
>

2013-09-22 10:12:43

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 04/26] clk: prima2: declare OF clock provider

On 09/19/2013 10:48 AM, Sebastian Hesselbarth wrote:
> On 09/19/13 10:45, Barry Song wrote:
>>> @@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)
>>>
>>> of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
>>> }
>>> +CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
>>
>> hi Sebastian,
>> what if the driver is compatible with multiple clk controllers and we
>> want to add another compatible string here except "sirf,prima2-clkc"?
>>
>> -barry
>>
>
> Just add
> CLK_OF_DECLARE(other_fancy_clk, "sirf,different-compatible",
> sirfsoc_clk_init);

Barry, BTW, do I get your Acked-By for this and the corresponding
removal patch?

Sebastian

2013-09-22 10:14:24

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

On 09/20/2013 09:16 PM, Matt Porter wrote:
> On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
>> This is a patch set based on an RFC [1][2] sent earlier to provide a common
>> arch/arm init for DT clock providers. Currently, the call to of_clk_init(NULL)
>> to initialize DT clock providers is spread among several mach-dirs. Since most
>> machs require DT clocks initialized before timers, no initcall can be used.
[...]
> Could you pick up the following patch for mach-bcm/ into this series?
>
> Thanks,
> Matt
>
> From f65d048b3453447bb3e693cb21701c4d0c6375ed Mon Sep 17 00:00:00 2001
> From: Matt Porter <[email protected]>
> Date: Fri, 20 Sep 2013 13:41:06 -0400
> Subject: [PATCH] ARM: bcm: Remove custom .time_init hook
>
> With arch/arm calling of_clk_init(NULL) and clocksource_of_init()
> this is no longer needed. The former is useful because we can make
> use of dummy fixed clocks for drivers until the bcm281xx common
> clock driver is ready.
>
> Signed-off-by: Matt Porter <[email protected]>
> Reviewed-by: Markus Mayer <[email protected]>
> Reviewed-by: Christian Daudt <[email protected]>

As a v2 is required due to calling of_clk_init() breaks non-DT builds,
I will include this _if_ Christian actually gives his Acked-By.

Sebastian

> ---
> arch/arm/mach-bcm/board_bcm281xx.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
> index 8d9f931..26b2390 100644
> --- a/arch/arm/mach-bcm/board_bcm281xx.c
> +++ b/arch/arm/mach-bcm/board_bcm281xx.c
> @@ -68,7 +68,6 @@ static void __init board_init(void)
> static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, };
>
> DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
> - .init_time = clocksource_of_init,
> .init_machine = board_init,
> .restart = bcm_kona_restart,
> .dt_compat = bcm11351_dt_compat,
>

2013-09-22 10:18:24

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init

On 09/20/2013 11:13 PM, Sebastian Hesselbarth wrote:
> On 09/18/2013 07:53 PM, Sebastian Hesselbarth wrote:
>> MTU timer initialization is stuffed into .init_time callback, while
>> cpu8815_timer_init_of again maps addresses from the same device node.
>> Therefore, this patch moves mtu setup from to clocksource init.
>>
>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>> ---
>> Cc: Olof Johansson <[email protected]>
>> Cc: Arnd Bergmann <[email protected]>
>> Cc: Alessandro Rubini <[email protected]>
>> Cc: Linus Walleij <[email protected]>
>> Cc: STEricsson <[email protected]>
>> Cc: Russell King <[email protected]>
>> Cc: Daniel Lezcano <[email protected]>
>> Cc: Thomas Gleixner <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> ---
>> arch/arm/mach-nomadik/cpu-8815.c | 26 --------------------------
>> drivers/clocksource/nomadik-mtu.c | 11 +++++++++++
>> 2 files changed, 11 insertions(+), 26 deletions(-)
>>
>> diff --git a/arch/arm/mach-nomadik/cpu-8815.c
>> b/arch/arm/mach-nomadik/cpu-8815.c
>> index 13e0df9..0fcb149 100644
>> --- a/arch/arm/mach-nomadik/cpu-8815.c
>> +++ b/arch/arm/mach-nomadik/cpu-8815.c
>> @@ -113,36 +113,10 @@ static void cpu8815_restart(enum reboot_mode
>> mode, const char *cmd)
>> writel(1, srcbase + 0x18);
>> }
>>
>> -/* Initial value for SRC control register: all timers use MXTAL/8
>> source */
>> -#define SRC_CR_INIT_MASK 0x00007fff
>> -#define SRC_CR_INIT_VAL 0x2aaa8000
>> -
>> static void __init cpu8815_timer_init_of(void)
>> {
>> - struct device_node *mtu;
>> - void __iomem *base;
>> - int irq;
>> - u32 src_cr;
>> -
>> /* We need this to be up now */
>> nomadik_clk_init();
>> -
>> - mtu = of_find_node_by_path("/mtu@101e2000");
>> - if (!mtu)
>> - return;
>> - base = of_iomap(mtu, 0);
>> - if (WARN_ON(!base))
>> - return;
>> - irq = irq_of_parse_and_map(mtu, 0);
>> -
>> - pr_info("Remapped MTU @ %p, irq: %d\n", base, irq);
>> -
>> - /* Configure timer sources in "system reset controller" ctrl reg */
>> - src_cr = readl(base);
>> - src_cr &= SRC_CR_INIT_MASK;
>> - src_cr |= SRC_CR_INIT_VAL;
>> - writel(src_cr, base);
>> -
>> clocksource_of_init();
>> }
>
> Linus,
>
> looking at the fix you posted at [1], can I assume that the above it
> redundant and can be removed?
>
> [1] http://marc.info/?l=linux-arm-kernel&m=137910161418706&w=2

Linus,

can you please prepare a topic branch with the above patch. I can
merge that one with a stable commit id then. Also, I will rebase the
remaining nomadik patches for you to test.

Sebastian

>> diff --git a/drivers/clocksource/nomadik-mtu.c
>> b/drivers/clocksource/nomadik-mtu.c
>> index 1b74bea..b9f97ba 100644
>> --- a/drivers/clocksource/nomadik-mtu.c
>> +++ b/drivers/clocksource/nomadik-mtu.c
>> @@ -257,12 +257,17 @@ void __init nmdk_timer_init(void __iomem *base,
>> int irq)
>> __nmdk_timer_init(base, irq, pclk0, clk0);
>> }
>>
>> +/* Initial value for SRC control register: all timers use MXTAL/8
>> source */
>> +#define SRC_CR_INIT_MASK 0x00007fff
>> +#define SRC_CR_INIT_VAL 0x2aaa8000
>> +
>> static void __init nmdk_timer_of_init(struct device_node *node)
>> {
>> struct clk *pclk;
>> struct clk *clk;
>> void __iomem *base;
>> int irq;
>> + u32 src_cr;
>>
>> base = of_iomap(node, 0);
>> if (!base)
>> @@ -280,6 +285,12 @@ static void __init nmdk_timer_of_init(struct
>> device_node *node)
>> if (irq <= 0)
>> panic("Can't parse IRQ");
>>
>> + /* Configure timer sources in "system reset controller" ctrl reg */
>> + src_cr = readl(base);
>> + src_cr &= SRC_CR_INIT_MASK;
>> + src_cr |= SRC_CR_INIT_VAL;
>> + writel(src_cr, base);
>> +
>> __nmdk_timer_init(base, irq, pclk, clk);
>> }
>> CLOCKSOURCE_OF_DECLARE(nomadik_mtu, "st,nomadik-mtu",
>>
>

2013-09-22 10:20:37

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 11/26] ARM: dove: remove custom .init_time hook

On 09/21/2013 02:22 PM, Andrew Lunn wrote:
> On Wed, Sep 18, 2013 at 07:53:44PM +0200, Sebastian Hesselbarth wrote:
>> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
>> remove custom .init_time hooks. While at it, also remove some obsolete
>> includes.
>>
>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>> ---
>> Cc: Olof Johansson <[email protected]>
>> Cc: Arnd Bergmann <[email protected]>
>> Cc: Jason Cooper <[email protected]>
>> Cc: Andrew Lunn <[email protected]>
>> Cc: Russell King <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> ---
>> arch/arm/mach-dove/board-dt.c | 11 -----------
>> 1 file changed, 11 deletions(-)
[...]
> Boot tested on cubox.
>
> Tested-by: Andrew Lunn <[email protected]>

Thanks Andrew!

Aren't you giving any Acks for dove/kirkwood anymore?

Sebastian

2013-09-22 10:38:21

by Barry Song

[permalink] [raw]
Subject: Re: [PATCH 04/26] clk: prima2: declare OF clock provider

2013/9/22 Sebastian Hesselbarth <[email protected]>:
> On 09/19/2013 10:48 AM, Sebastian Hesselbarth wrote:
>>
>> On 09/19/13 10:45, Barry Song wrote:
>>>>
>>>> @@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)
>>>>
>>>> of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
>>>> }
>>>> +CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
>>>
>>>
>>> hi Sebastian,
>>> what if the driver is compatible with multiple clk controllers and we
>>> want to add another compatible string here except "sirf,prima2-clkc"?
>>>
>>> -barry
>>>
>>
>> Just add
>> CLK_OF_DECLARE(other_fancy_clk, "sirf,different-compatible",
>> sirfsoc_clk_init);
>
>
> Barry, BTW, do I get your Acked-By for this and the corresponding
> removal patch?

Sebastian, would you wait for a while as i need to merge them and make a test.

>
> Sebastian
>

-barry

2013-09-22 16:46:07

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 02/26] clk: nomadik: move src init out of nomadik_clk_init

nomadik_clk_init currently also maps system reset controller base address
used by clocks and registers a reboot notifier. To allow further cleanup of
nomadik clk setup, this moves system reset controller setup from
nomadik_clk_init to its own function.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Acked-by: Linus Walleij <[email protected]>
---
Changelog:
v1->v2:
- adapt to clk-nomadik changes

Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Alessandro Rubini <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: STEricsson <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/clk/clk-nomadik.c | 144 +++++++++++++++++++++++----------------------
1 file changed, 74 insertions(+), 70 deletions(-)

diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
index 4d978a3..06b29c26 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -62,6 +62,79 @@ static DEFINE_SPINLOCK(src_lock);
/* Base address of the SRC */
static void __iomem *src_base;

+static int nomadik_clk_reboot_handler(struct notifier_block *this,
+ unsigned long code,
+ void *unused)
+{
+ u32 val;
+
+ /* The main chrystal need to be enabled for reboot to work */
+ val = readl(src_base + SRC_XTALCR);
+ val &= ~SRC_XTALCR_MXTALOVER;
+ val |= SRC_XTALCR_MXTALEN;
+ pr_crit("force-enabling MXTALO\n");
+ writel(val, src_base + SRC_XTALCR);
+ return NOTIFY_OK;
+}
+
+static struct notifier_block nomadik_clk_reboot_notifier = {
+ .notifier_call = nomadik_clk_reboot_handler,
+};
+
+static const struct of_device_id nomadik_src_match[] __initconst = {
+ { .compatible = "stericsson,nomadik-src" },
+ { /* sentinel */ }
+};
+
+static void nomadik_src_init(void)
+{
+ struct device_node *np;
+ u32 val;
+
+ np = of_find_matching_node(NULL, nomadik_src_match);
+ if (!np) {
+ pr_crit("no matching node for SRC, aborting clock init\n");
+ return;
+ }
+ src_base = of_iomap(np, 0);
+ if (!src_base) {
+ pr_err("%s: must have src parent node with REGS (%s)\n",
+ __func__, np->name);
+ return;
+ }
+
+ /* Set all timers to use the 2.4 MHz TIMCLK */
+ val = readl(src_base + SRC_CR);
+ val |= SRC_CR_T0_ENSEL;
+ val |= SRC_CR_T1_ENSEL;
+ val |= SRC_CR_T2_ENSEL;
+ val |= SRC_CR_T3_ENSEL;
+ val |= SRC_CR_T4_ENSEL;
+ val |= SRC_CR_T5_ENSEL;
+ val |= SRC_CR_T6_ENSEL;
+ val |= SRC_CR_T7_ENSEL;
+ writel(val, src_base + SRC_CR);
+
+ val = readl(src_base + SRC_XTALCR);
+ pr_info("SXTALO is %s\n",
+ (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
+ pr_info("MXTAL is %s\n",
+ (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
+ if (of_property_read_bool(np, "disable-sxtalo")) {
+ /* The machine uses an external oscillator circuit */
+ val |= SRC_XTALCR_SXTALDIS;
+ pr_info("disabling SXTALO\n");
+ }
+ if (of_property_read_bool(np, "disable-mxtalo")) {
+ /* Disable this too: also run by external oscillator */
+ val |= SRC_XTALCR_MXTALOVER;
+ val &= ~SRC_XTALCR_MXTALEN;
+ pr_info("disabling MXTALO\n");
+ }
+ writel(val, src_base + SRC_XTALCR);
+ register_reboot_notifier(&nomadik_clk_reboot_notifier);
+}
+
/**
* struct clk_pll1 - Nomadik PLL1 clock
* @hw: corresponding clock hardware entry
@@ -487,11 +560,6 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}

-static const struct of_device_id nomadik_src_match[] __initconst = {
- { .compatible = "stericsson,nomadik-src" },
- { /* sentinel */ }
-};
-
static const struct of_device_id nomadik_src_clk_match[] __initconst = {
{
.compatible = "fixed-clock",
@@ -516,72 +584,8 @@ static const struct of_device_id nomadik_src_clk_match[] __initconst = {
{ /* sentinel */ }
};

-static int nomadik_clk_reboot_handler(struct notifier_block *this,
- unsigned long code,
- void *unused)
-{
- u32 val;
-
- /* The main chrystal need to be enabled for reboot to work */
- val = readl(src_base + SRC_XTALCR);
- val &= ~SRC_XTALCR_MXTALOVER;
- val |= SRC_XTALCR_MXTALEN;
- pr_crit("force-enabling MXTALO\n");
- writel(val, src_base + SRC_XTALCR);
- return NOTIFY_OK;
-}
-
-static struct notifier_block nomadik_clk_reboot_notifier = {
- .notifier_call = nomadik_clk_reboot_handler,
-};
-
void __init nomadik_clk_init(void)
{
- struct device_node *np;
- u32 val;
-
- np = of_find_matching_node(NULL, nomadik_src_match);
- if (!np) {
- pr_crit("no matching node for SRC, aborting clock init\n");
- return;
- }
- src_base = of_iomap(np, 0);
- if (!src_base) {
- pr_err("%s: must have src parent node with REGS (%s)\n",
- __func__, np->name);
- return;
- }
-
- /* Set all timers to use the 2.4 MHz TIMCLK */
- val = readl(src_base + SRC_CR);
- val |= SRC_CR_T0_ENSEL;
- val |= SRC_CR_T1_ENSEL;
- val |= SRC_CR_T2_ENSEL;
- val |= SRC_CR_T3_ENSEL;
- val |= SRC_CR_T4_ENSEL;
- val |= SRC_CR_T5_ENSEL;
- val |= SRC_CR_T6_ENSEL;
- val |= SRC_CR_T7_ENSEL;
- writel(val, src_base + SRC_CR);
-
- val = readl(src_base + SRC_XTALCR);
- pr_info("SXTALO is %s\n",
- (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
- pr_info("MXTAL is %s\n",
- (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
- if (of_property_read_bool(np, "disable-sxtalo")) {
- /* The machine uses an external oscillator circuit */
- val |= SRC_XTALCR_SXTALDIS;
- pr_info("disabling SXTALO\n");
- }
- if (of_property_read_bool(np, "disable-mxtalo")) {
- /* Disable this too: also run by external oscillator */
- val |= SRC_XTALCR_MXTALOVER;
- val &= ~SRC_XTALCR_MXTALEN;
- pr_info("disabling MXTALO\n");
- }
- writel(val, src_base + SRC_XTALCR);
- register_reboot_notifier(&nomadik_clk_reboot_notifier);
-
+ nomadik_src_init();
of_clk_init(nomadik_src_clk_match);
}
--
1.7.10.4

2013-09-22 16:46:55

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 03/26] clk: nomadik: declare OF clock provider

Common clock framework allows to register clock providers to get called
on of_clk_init() by using CLK_OF_DECLARE. This converts nomadik clock
provider to make use of it and get rid of the mach specific clk init
call. As clocks require system reset controller base address to be
initialized each clock driver checks src_base and calls new
nomadik_src_init if required.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Acked-by: Linus Walleij <[email protected]>
---
Changelog:
v1->v2:
- adapt to clk-nomadik changes

Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Alessandro Rubini <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: STEricsson <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-nomadik/cpu-8815.c | 5 ++--
drivers/clk/clk-nomadik.c | 45 ++++++++++-------------------
include/linux/platform_data/clk-nomadik.h | 2 --
3 files changed, 17 insertions(+), 35 deletions(-)
delete mode 100644 include/linux/platform_data/clk-nomadik.h

diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 0fcb149..2be38a0 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -25,7 +25,7 @@
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/dma-mapping.h>
-#include <linux/platform_data/clk-nomadik.h>
+#include <linux/clk-provider.h>
#include <linux/clocksource.h>
#include <linux/of_irq.h>
#include <linux/of_gpio.h>
@@ -115,8 +115,7 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)

static void __init cpu8815_timer_init_of(void)
{
- /* We need this to be up now */
- nomadik_clk_init();
+ of_clk_init(NULL);
clocksource_of_init();
}

diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
index 06b29c26..ce2d6b3 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -512,6 +512,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
const char *parent_name;
u32 pll_id;

+ if (!src_base)
+ nomadik_src_init();
+
if (of_property_read_u32(np, "pll-id", &pll_id)) {
pr_err("%s: PLL \"%s\" missing pll-id property\n",
__func__, clk_name);
@@ -522,6 +525,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
+CLK_OF_DECLARE(nomadik_pll_clk,
+ "st,nomadik-pll-clock", of_nomadik_pll_setup);

static void __init of_nomadik_hclk_setup(struct device_node *np)
{
@@ -529,6 +534,9 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
const char *clk_name = np->name;
const char *parent_name;

+ if (!src_base)
+ nomadik_src_init();
+
parent_name = of_clk_get_parent_name(np, 0);
/*
* The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4.
@@ -541,6 +549,8 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
+CLK_OF_DECLARE(nomadik_hclk_clk,
+ "st,nomadik-hclk-clock", of_nomadik_hclk_setup);

static void __init of_nomadik_src_clk_setup(struct device_node *np)
{
@@ -549,6 +559,9 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
const char *parent_name;
u32 clk_id;

+ if (!src_base)
+ nomadik_src_init();
+
if (of_property_read_u32(np, "clock-id", &clk_id)) {
pr_err("%s: SRC clock \"%s\" missing clock-id property\n",
__func__, clk_name);
@@ -559,33 +572,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
-
-static const struct of_device_id nomadik_src_clk_match[] __initconst = {
- {
- .compatible = "fixed-clock",
- .data = of_fixed_clk_setup,
- },
- {
- .compatible = "fixed-factor-clock",
- .data = of_fixed_factor_clk_setup,
- },
- {
- .compatible = "st,nomadik-pll-clock",
- .data = of_nomadik_pll_setup,
- },
- {
- .compatible = "st,nomadik-hclk-clock",
- .data = of_nomadik_hclk_setup,
- },
- {
- .compatible = "st,nomadik-src-clock",
- .data = of_nomadik_src_clk_setup,
- },
- { /* sentinel */ }
-};
-
-void __init nomadik_clk_init(void)
-{
- nomadik_src_init();
- of_clk_init(nomadik_src_clk_match);
-}
+CLK_OF_DECLARE(nomadik_src_clk,
+ "st,nomadik-src-clock", of_nomadik_src_clk_setup);
diff --git a/include/linux/platform_data/clk-nomadik.h b/include/linux/platform_data/clk-nomadik.h
deleted file mode 100644
index 5713c87..0000000
--- a/include/linux/platform_data/clk-nomadik.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Minimal platform data header */
-void nomadik_clk_init(void);
--
1.7.10.4

2013-09-23 07:55:04

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 09/26] ARM: call of_clk_init from default time_init handler

Most DT ARM machs require common clock providers initialized before timers.
Currently, arch/arm machs use .init_time to call of_clk_init right before
clocksource_of_init. This prevents to remove that callback and use the default
one instead.

This patch adds a call to of_clk_init() to the default .init_time callback
for COMMON_CLK enabled machs to allow to remove custom callbacks where applicable.
While at it, also reorder includes alphabetically.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Changelog:
v1->v2:
- protect call to of_clk_init which is only available for COMMON_CLK to
not break !COMMON_CLK machs. (Reported by Olof Johanssen)
RFCv2->v1:
- only call of_clk_init(NULL) when no custom .init_time is set
(Suggested by Soeren Brinkmann)
RFCv1->RFCv2:
- reorder includes alphabetically

Cc: Olof Johansson <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: STEricsson <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
arch/arm/kernel/time.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 98aee32..829a96d 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -11,25 +11,26 @@
* This file contains the ARM-specific time handling details:
* reading the RTC at bootup, etc...
*/
+#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
+#include <linux/errno.h>
#include <linux/export.h>
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/time.h>
#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/kernel.h>
+#include <linux/profile.h>
#include <linux/sched.h>
+#include <linux/sched_clock.h>
#include <linux/smp.h>
+#include <linux/time.h>
#include <linux/timex.h>
-#include <linux/errno.h>
-#include <linux/profile.h>
#include <linux/timer.h>
-#include <linux/clocksource.h>
-#include <linux/irq.h>
-#include <linux/sched_clock.h>

-#include <asm/thread_info.h>
-#include <asm/stacktrace.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
+#include <asm/stacktrace.h>
+#include <asm/thread_info.h>

#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
@@ -116,8 +117,12 @@ int __init register_persistent_clock(clock_access_fn read_boot,

void __init time_init(void)
{
- if (machine_desc->init_time)
+ if (machine_desc->init_time) {
machine_desc->init_time();
- else
+ } else {
+#ifdef CONFIG_COMMON_CLK
+ of_clk_init(NULL);
+#endif
clocksource_of_init();
+ }
}
--
1.7.10.4

2013-09-23 09:14:33

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 11/26] ARM: dove: remove custom .init_time hook

On Sun, Sep 22, 2013 at 02:20:28PM +0200, Sebastian Hesselbarth wrote:
> On 09/21/2013 02:22 PM, Andrew Lunn wrote:
> >On Wed, Sep 18, 2013 at 07:53:44PM +0200, Sebastian Hesselbarth wrote:
> >>With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> >>remove custom .init_time hooks. While at it, also remove some obsolete
> >>includes.
> >>
> >>Signed-off-by: Sebastian Hesselbarth <[email protected]>
> >>---
> >>Cc: Olof Johansson <[email protected]>
> >>Cc: Arnd Bergmann <[email protected]>
> >>Cc: Jason Cooper <[email protected]>
> >>Cc: Andrew Lunn <[email protected]>
> >>Cc: Russell King <[email protected]>
> >>Cc: [email protected]
> >>Cc: [email protected]
> >>---
> >> arch/arm/mach-dove/board-dt.c | 11 -----------
> >> 1 file changed, 11 deletions(-)
> [...]
> >Boot tested on cubox.
> >
> >Tested-by: Andrew Lunn <[email protected]>
>
> Thanks Andrew!
>
> Aren't you giving any Acks for dove/kirkwood anymore?

Hi Sebastian

In my opinion, a Tested-by: has more weight than an Acked-by. I could
of given you an Acked-by in about 60 seconds, given the simplicity of
the patch. It took a lot more effort to get your tree, build it, fix
my binutils, since it was the first 3.12 tree i had tried and my
binutils was too old, and boot it.

Andrew

2013-09-23 13:32:30

by Jason Cooper

[permalink] [raw]
Subject: Re: [PATCH 11/26] ARM: dove: remove custom .init_time hook

On Mon, Sep 23, 2013 at 11:10:36AM +0200, Andrew Lunn wrote:
> On Sun, Sep 22, 2013 at 02:20:28PM +0200, Sebastian Hesselbarth wrote:
> > On 09/21/2013 02:22 PM, Andrew Lunn wrote:
> > >On Wed, Sep 18, 2013 at 07:53:44PM +0200, Sebastian Hesselbarth wrote:
> > >>With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> > >>remove custom .init_time hooks. While at it, also remove some obsolete
> > >>includes.
> > >>
> > >>Signed-off-by: Sebastian Hesselbarth <[email protected]>
> > >>---
> > >>Cc: Olof Johansson <[email protected]>
> > >>Cc: Arnd Bergmann <[email protected]>
> > >>Cc: Jason Cooper <[email protected]>
> > >>Cc: Andrew Lunn <[email protected]>
> > >>Cc: Russell King <[email protected]>
> > >>Cc: [email protected]
> > >>Cc: [email protected]
> > >>---
> > >> arch/arm/mach-dove/board-dt.c | 11 -----------
> > >> 1 file changed, 11 deletions(-)
> > [...]
> > >Boot tested on cubox.
> > >
> > >Tested-by: Andrew Lunn <[email protected]>
> >
> > Thanks Andrew!
> >
> > Aren't you giving any Acks for dove/kirkwood anymore?
>
> Hi Sebastian
>
> In my opinion, a Tested-by: has more weight than an Acked-by. I could
> of given you an Acked-by in about 60 seconds, given the simplicity of
> the patch. It took a lot more effort to get your tree, build it, fix
> my binutils, since it was the first 3.12 tree i had tried and my
> binutils was too old, and boot it.

I would even go so far as to say that a Tested-by: from a maintainer
carries an implied Ack. ;-)

And, just for the record,

Acked-by: Jason Cooper <[email protected]>

thx,

Jason.

2013-09-23 13:32:59

by Jason Cooper

[permalink] [raw]
Subject: Re: [PATCH 15/26] ARM: kirkwood: remove custom .init_time hook

On Sat, Sep 21, 2013 at 10:27:53PM +0200, Andrew Lunn wrote:
> On Wed, Sep 18, 2013 at 07:53:48PM +0200, Sebastian Hesselbarth wrote:
> > With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> > remove custom .init_time hooks.
> >
> > Signed-off-by: Sebastian Hesselbarth <[email protected]>
> > ---
> > Cc: Olof Johansson <[email protected]>
> > Cc: Arnd Bergmann <[email protected]>
> > Cc: Jason Cooper <[email protected]>
> > Cc: Andrew Lunn <[email protected]>
> > Cc: Russell King <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > ---
> > arch/arm/mach-kirkwood/board-dt.c | 8 --------
> > 1 file changed, 8 deletions(-)
>
>
> Hi Sebastian
>
> Boot tested on a Kirkwood Topkick.
>
> Tested-by: Andrew Lunn <[email protected]>

Acked-by: Jason Cooper <[email protected]>

thx,

Jason.

2013-09-23 17:45:21

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

On 09/22/2013 08:14 AM, Sebastian Hesselbarth wrote:
> On 09/20/2013 09:16 PM, Matt Porter wrote:
>> On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
>>> This is a patch set based on an RFC [1][2] sent earlier to provide a
>>> common
>>> arch/arm init for DT clock providers. Currently, the call to
>>> of_clk_init(NULL)
>>> to initialize DT clock providers is spread among several mach-dirs.
>>> Since most
>>> machs require DT clocks initialized before timers, no initcall can be
>>> used.
> [...]
>> Could you pick up the following patch for mach-bcm/ into this series?
>>
>> Thanks,
>> Matt
>>
>> From f65d048b3453447bb3e693cb21701c4d0c6375ed Mon Sep 17 00:00:00 2001
>> From: Matt Porter <[email protected]>
>> Date: Fri, 20 Sep 2013 13:41:06 -0400
>> Subject: [PATCH] ARM: bcm: Remove custom .time_init hook
>>
>> With arch/arm calling of_clk_init(NULL) and clocksource_of_init()
>> this is no longer needed. The former is useful because we can make
>> use of dummy fixed clocks for drivers until the bcm281xx common
>> clock driver is ready.
>>
>> Signed-off-by: Matt Porter <[email protected]>
>> Reviewed-by: Markus Mayer <[email protected]>
>> Reviewed-by: Christian Daudt <[email protected]>
>
> As a v2 is required due to calling of_clk_init() breaks non-DT builds,
> I will include this _if_ Christian actually gives his Acked-By.

Understood. Ccing Christian's new email as it just changed.

Thanks,
Matt

2013-09-23 17:47:10

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 11/26] ARM: dove: remove custom .init_time hook

On 09/23/2013 03:32 PM, Jason Cooper wrote:
> On Mon, Sep 23, 2013 at 11:10:36AM +0200, Andrew Lunn wrote:
>> On Sun, Sep 22, 2013 at 02:20:28PM +0200, Sebastian Hesselbarth wrote:
>>> On 09/21/2013 02:22 PM, Andrew Lunn wrote:
>>>> On Wed, Sep 18, 2013 at 07:53:44PM +0200, Sebastian Hesselbarth wrote:
>>>>> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
>>>>> remove custom .init_time hooks. While at it, also remove some obsolete
>>>>> includes.
>>>>>
>>>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>>>> ---
>>>>> Cc: Olof Johansson <[email protected]>
>>>>> Cc: Arnd Bergmann <[email protected]>
>>>>> Cc: Jason Cooper <[email protected]>
>>>>> Cc: Andrew Lunn <[email protected]>
>>>>> Cc: Russell King <[email protected]>
>>>>> Cc: [email protected]
>>>>> Cc: [email protected]
>>>>> ---
>>>>> arch/arm/mach-dove/board-dt.c | 11 -----------
>>>>> 1 file changed, 11 deletions(-)
>>> [...]
>>>> Boot tested on cubox.
>>>>
>>>> Tested-by: Andrew Lunn <[email protected]>
>>>
>>> Thanks Andrew!
>>>
>>> Aren't you giving any Acks for dove/kirkwood anymore?
>>
>> Hi Sebastian
>>
>> In my opinion, a Tested-by: has more weight than an Acked-by. I could
>> of given you an Acked-by in about 60 seconds, given the simplicity of
>> the patch. It took a lot more effort to get your tree, build it, fix
>> my binutils, since it was the first 3.12 tree i had tried and my
>> binutils was too old, and boot it.
>
> I would even go so far as to say that a Tested-by: from a maintainer
> carries an implied Ack. ;-)
>
> And, just for the record,
>
> Acked-by: Jason Cooper <[email protected]>

True, True, True. Lesson learned ;)

Thanks for both testing and ack'ing.

Sebastian

2013-09-23 18:41:31

by Christian Daudt

[permalink] [raw]
Subject: Re: [PATCH 00/26] ARM: provide common arch init for DT clocks

On 13-09-23 10:45 AM, Matt Porter wrote:
> On 09/22/2013 08:14 AM, Sebastian Hesselbarth wrote:
>> On 09/20/2013 09:16 PM, Matt Porter wrote:
>>> On Wed, Sep 18, 2013 at 07:53:33PM +0200, Sebastian Hesselbarth wrote:
>>>> This is a patch set based on an RFC [1][2] sent earlier to provide a
>>>> common
>>>> arch/arm init for DT clock providers. Currently, the call to
>>>> of_clk_init(NULL)
>>>> to initialize DT clock providers is spread among several mach-dirs.
>>>> Since most
>>>> machs require DT clocks initialized before timers, no initcall can be
>>>> used.
>> [...]
>>> Could you pick up the following patch for mach-bcm/ into this series?
>>>
>>> Thanks,
>>> Matt
>>>
>>> From f65d048b3453447bb3e693cb21701c4d0c6375ed Mon Sep 17 00:00:00 2001
>>> From: Matt Porter <[email protected]>
>>> Date: Fri, 20 Sep 2013 13:41:06 -0400
>>> Subject: [PATCH] ARM: bcm: Remove custom .time_init hook
>>>
>>> With arch/arm calling of_clk_init(NULL) and clocksource_of_init()
>>> this is no longer needed. The former is useful because we can make
>>> use of dummy fixed clocks for drivers until the bcm281xx common
>>> clock driver is ready.
>>>
>>> Signed-off-by: Matt Porter <[email protected]>
>>> Reviewed-by: Markus Mayer <[email protected]>
>>> Reviewed-by: Christian Daudt <[email protected]>
>>
>> As a v2 is required due to calling of_clk_init() breaks non-DT builds,
>> I will include this _if_ Christian actually gives his Acked-By.
>
> Understood. Ccing Christian's new email as it just changed.
Old one still works for this week :)
Acked-by: Christian Daudt <[email protected]>

Thanks,
csd


2013-09-25 20:03:54

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 06/26] clk: sunxi: declare OF clock provider

Hi Sebastian,

On Wed, Sep 18, 2013 at 07:53:39PM +0200, Sebastian Hesselbarth wrote:
> Common clock framework allows to register clock providers to get called
> on of_clk_init() by using CLK_OF_DECLARE. This converts sunxi clock
> providers to make use of it and get rid of the mach specific clk init
> call. As sunxi has a bunch of independent clk provider nodes, we hook
> current clock init to board compatible to make it called once.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>

Acked-by: Maxime Ripard <[email protected]>

Thanks!

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


Attachments:
(No filename) (692.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-09-25 20:07:35

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 23/26] ARM: sunxi: remove custom .init_time hook

On Wed, Sep 18, 2013 at 07:53:56PM +0200, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>

Acked-by: Maxime Ripard <[email protected]>

How do you want us to merge this? Every maintainer takes the patches he
handles, or will Kevin and Olof merge the whole thing?

Thanks!
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


Attachments:
(No filename) (564.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-09-26 06:12:59

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 05/26] ARM: socfgpa: prepare for arch-wide .init_time callback

On 09/18/2013 07:53 PM, Sebastian Hesselbarth wrote:
> Current socfpga board init calls of_clk_init() from .machine_init. To
> allow consolidation of DT driven .time_init, move of_clock_init() to
> a temporary .time_init that will be removed when arch-wide callback is
> available.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>

Ping,

Dinh can you please comment on this and patch 21/26?

Thanks!

> ---
> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Dinh Nguyen <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-socfpga/socfpga.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
> index bfce964..6df7bb9 100644
> --- a/arch/arm/mach-socfpga/socfpga.c
> +++ b/arch/arm/mach-socfpga/socfpga.c
> @@ -15,6 +15,7 @@
> * along with this program. If not, see <http://www.gnu.org/licenses/>.
> */
> #include <linux/clk-provider.h>
> +#include <linux/clocksource.h>
> #include <linux/irqchip.h>
> #include <linux/of_address.h>
> #include <linux/of_irq.h>
> @@ -90,6 +91,12 @@ static void __init socfpga_init_irq(void)
> socfpga_sysmgr_init();
> }
>
> +static void __init socfpga_init_time(void)
> +{
> + of_clk_init(NULL);
> + clocksource_of_init();
> +}
> +
> static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
> {
> u32 temp;
> @@ -107,7 +114,6 @@ static void __init socfpga_cyclone5_init(void)
> {
> l2x0_of_init(0, ~0UL);
> of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> - of_clk_init(NULL);
> socfpga_init_clocks();
> }
>
> @@ -120,6 +126,7 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
> .smp = smp_ops(socfpga_smp_ops),
> .map_io = socfpga_map_io,
> .init_irq = socfpga_init_irq,
> + .init_time = socfpga_init_time,
> .init_machine = socfpga_cyclone5_init,
> .restart = socfpga_cyclone5_restart,
> .dt_compat = altera_dt_match,
>

2013-09-26 06:16:11

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 23/26] ARM: sunxi: remove custom .init_time hook

On 09/25/2013 10:07 PM, Maxime Ripard wrote:
> On Wed, Sep 18, 2013 at 07:53:56PM +0200, Sebastian Hesselbarth wrote:
>> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
>> remove custom .init_time hooks.
>>
>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>
> Acked-by: Maxime Ripard <[email protected]>
>
> How do you want us to merge this? Every maintainer takes the patches he
> handles, or will Kevin and Olof merge the whole thing?

Maxime,

I am still waiting for some ACKs (nomadik, prima2, socfpga, nspire) and
possibly Mike's on the clock changes.

My current idea is to prepare a branch for Olof to pull in as whole.

Sebastian

2013-09-26 06:21:42

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 12/26] ARM: exynos: remove custom .init_time hook

On 09/18/2013 07:53 PM, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks. While at it, also remove some now
> redundant includes.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---

Ping,

Kukjin can you please comment on this patch?

Thanks!

> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Kukjin Kim <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-exynos/common.c | 8 --------
> arch/arm/mach-exynos/common.h | 1 -
> arch/arm/mach-exynos/mach-exynos4-dt.c | 2 --
> arch/arm/mach-exynos/mach-exynos5-dt.c | 2 --
> 4 files changed, 13 deletions(-)
>
> diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
> index ba95e5d..a4e7ba8 100644
> --- a/arch/arm/mach-exynos/common.c
> +++ b/arch/arm/mach-exynos/common.c
> @@ -26,8 +26,6 @@
> #include <linux/export.h>
> #include <linux/irqdomain.h>
> #include <linux/of_address.h>
> -#include <linux/clocksource.h>
> -#include <linux/clk-provider.h>
> #include <linux/irqchip/arm-gic.h>
> #include <linux/irqchip/chained_irq.h>
>
> @@ -367,12 +365,6 @@ static void __init exynos5_map_io(void)
> iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
> }
>
> -void __init exynos_init_time(void)
> -{
> - of_clk_init(NULL);
> - clocksource_of_init();
> -}
> -
> struct bus_type exynos_subsys = {
> .name = "exynos-core",
> .dev_name = "exynos-core",
> diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
> index 8646a14..f0fa205 100644
> --- a/arch/arm/mach-exynos/common.h
> +++ b/arch/arm/mach-exynos/common.h
> @@ -16,7 +16,6 @@
> #include <linux/of.h>
>
> void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
> -void exynos_init_time(void);
>
> struct map_desc;
> void exynos_init_io(void);
> diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
> index 0099c6c..6858d73 100644
> --- a/arch/arm/mach-exynos/mach-exynos4-dt.c
> +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
> @@ -16,7 +16,6 @@
> #include <linux/of_fdt.h>
> #include <linux/serial_core.h>
> #include <linux/memblock.h>
> -#include <linux/clocksource.h>
>
> #include <asm/mach/arch.h>
> #include <plat/mfc.h>
> @@ -54,7 +53,6 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
> .init_early = exynos_firmware_init,
> .init_machine = exynos4_dt_machine_init,
> .init_late = exynos_init_late,
> - .init_time = exynos_init_time,
> .dt_compat = exynos4_dt_compat,
> .restart = exynos4_restart,
> .reserve = exynos4_reserve,
> diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
> index f874b77..bac2105 100644
> --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
> +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
> @@ -13,7 +13,6 @@
> #include <linux/of_fdt.h>
> #include <linux/memblock.h>
> #include <linux/io.h>
> -#include <linux/clocksource.h>
>
> #include <asm/mach/arch.h>
> #include <mach/regs-pmu.h>
> @@ -76,7 +75,6 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
> .map_io = exynos_init_io,
> .init_machine = exynos5_dt_machine_init,
> .init_late = exynos_init_late,
> - .init_time = exynos_init_time,
> .dt_compat = exynos5_dt_compat,
> .restart = exynos5_restart,
> .reserve = exynos5_reserve,
>

2013-09-26 08:08:13

by Tomasz Figa

[permalink] [raw]
Subject: Re: [PATCH 12/26] ARM: exynos: remove custom .init_time hook

Hi Sebastian,

On Thursday 26 of September 2013 08:21:27 Sebastian Hesselbarth wrote:
> On 09/18/2013 07:53 PM, Sebastian Hesselbarth wrote:
> > With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> > remove custom .init_time hooks. While at it, also remove some now
> > redundant includes.
> >
> > Signed-off-by: Sebastian Hesselbarth <[email protected]>
> > ---
>
> Ping,

This patch looks fine to me (as the whole series).

Reviewed-by: Tomasz Figa <[email protected]>

I don't see any reason why this series could introduce a regression on
Exynos SoCs, but just in case let me test it on selected Exynos4 and
Exynos5 boards.

Best regards,
Tomasz

2013-09-26 13:06:40

by Dinh Nguyen

[permalink] [raw]
Subject: Re: [PATCH 05/26] ARM: socfgpa: prepare for arch-wide .init_time callback

On Wed, 2013-09-18 at 19:53 +0200, Sebastian Hesselbarth wrote:
> Current socfpga board init calls of_clk_init() from .machine_init. To
> allow consolidation of DT driven .time_init, move of_clock_init() to
> a temporary .time_init that will be removed when arch-wide callback is
> available.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Dinh Nguyen <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-socfpga/socfpga.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>

Acked-by: Dinh Nguyen <[email protected]>

Thanks,
Dinh

2013-09-26 13:07:34

by Dinh Nguyen

[permalink] [raw]
Subject: Re: [PATCH 21/26] ARM: socfpga: remove custom .init_time hook

On Wed, 2013-09-18 at 19:53 +0200, Sebastian Hesselbarth wrote:
> With arch/arm calling of_clk_init(NULL) from time_init(), we can now
> remove custom .init_time hooks.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Cc: Olof Johansson <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Dinh Nguyen <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-socfpga/socfpga.c | 9 ---------
> 1 file changed, 9 deletions(-)
>

Acked-by: Dinh Nguyen <[email protected]>

Thanks,
Dinh

2013-09-27 17:02:31

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 23/26] ARM: sunxi: remove custom .init_time hook

Hi Sebastian,

On Thu, Sep 26, 2013 at 08:15:54AM +0200, Sebastian Hesselbarth wrote:
> I am still waiting for some ACKs (nomadik, prima2, socfpga, nspire) and
> possibly Mike's on the clock changes.
>
> My current idea is to prepare a branch for Olof to pull in as whole.

Ok. That works for me. Tell me if the plan changes.

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


Attachments:
(No filename) (443.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-09-27 18:22:03

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 04/26] clk: prima2: declare OF clock provider

On 09/22/2013 12:37 PM, Barry Song wrote:
> 2013/9/22 Sebastian Hesselbarth <[email protected]>:
>> On 09/19/2013 10:48 AM, Sebastian Hesselbarth wrote:
>>>
>>> On 09/19/13 10:45, Barry Song wrote:
>>>>>
>>>>> @@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)
>>>>>
>>>>> of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
>>>>> }
>>>>> +CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
>>>>
>>>>
>>>> hi Sebastian,
>>>> what if the driver is compatible with multiple clk controllers and we
>>>> want to add another compatible string here except "sirf,prima2-clkc"?
>>>>
>>>> -barry
>>>>
>>>
>>> Just add
>>> CLK_OF_DECLARE(other_fancy_clk, "sirf,different-compatible",
>>> sirfsoc_clk_init);
>>
>>
>> Barry, BTW, do I get your Acked-By for this and the corresponding
>> removal patch?
>
> Sebastian, would you wait for a while as i need to merge them and make a test.

Sure, take your time.
I now have almost all Acked-by's for the other patches, would be
great if you find some time to test this on prima2 anytime soon.

Sebastian

2013-09-29 04:49:43

by Barry Song

[permalink] [raw]
Subject: Re: [PATCH 04/26] clk: prima2: declare OF clock provider

2013/9/28 Sebastian Hesselbarth <[email protected]>:
> On 09/22/2013 12:37 PM, Barry Song wrote:
>>
>> 2013/9/22 Sebastian Hesselbarth <[email protected]>:
>>>
>>> On 09/19/2013 10:48 AM, Sebastian Hesselbarth wrote:
>>>>
>>>>
>>>> On 09/19/13 10:45, Barry Song wrote:
>>>>>>
>>>>>>
>>>>>> @@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)
>>>>>>
>>>>>> of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
>>>>>> }
>>>>>> +CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
>>>>>
>>>>>
>>>>>
>>>>> hi Sebastian,
>>>>> what if the driver is compatible with multiple clk controllers and we
>>>>> want to add another compatible string here except "sirf,prima2-clkc"?
>>>>>
>>>>> -barry
>>>>>
>>>>
>>>> Just add
>>>> CLK_OF_DECLARE(other_fancy_clk, "sirf,different-compatible",
>>>> sirfsoc_clk_init);
>>>
>>>
>>>
>>> Barry, BTW, do I get your Acked-By for this and the corresponding
>>> removal patch?
>>
>>
>> Sebastian, would you wait for a while as i need to merge them and make a
>> test.
>
>
> Sure, take your time.
> I now have almost all Acked-by's for the other patches, would be
> great if you find some time to test this on prima2 anytime soon.

Acked-by: Barry Song <[email protected]>

i have another clock
patchset:http://permalink.gmane.org/gmane.linux.ports.arm.kernel/268241

i will rebase mine against your this one.

>
> Sebastian

-barry