From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Cc: Olof Johansson <olof@lixom.net>, Arnd Bergmann <arnd@arndb.de>, Tony Prisk <linux@prisktech.co.nz>, Mike Turquette <mturquette@linaro.org>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/26] clk: vt8500: parse pmc_base from clock driver Date: Fri, 20 Sep 2013 08:22:33 +0200 [thread overview] Message-ID: <1379658153-28070-1-git-send-email-sebastian.hesselbarth@gmail.com> (raw) In-Reply-To: <1379526839-14798-8-git-send-email-sebastian.hesselbarth@gmail.com> 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 <sebastian.hesselbarth@gmail.com> Acked-by: Tony Prisk <linux@prisktech.co.nz> --- 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 <olof@lixom.net> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Tony Prisk <linux@prisktech.co.nz> Cc: Mike Turquette <mturquette@linaro.org> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- 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", ®); if (WARN_ON(rc)) return; -- 1.7.10.4
WARNING: multiple messages have this Message-ID (diff)
From: sebastian.hesselbarth@gmail.com (Sebastian Hesselbarth) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 07/26] clk: vt8500: parse pmc_base from clock driver Date: Fri, 20 Sep 2013 08:22:33 +0200 [thread overview] Message-ID: <1379658153-28070-1-git-send-email-sebastian.hesselbarth@gmail.com> (raw) In-Reply-To: <1379526839-14798-8-git-send-email-sebastian.hesselbarth@gmail.com> 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 <sebastian.hesselbarth@gmail.com> Acked-by: Tony Prisk <linux@prisktech.co.nz> --- 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 <olof@lixom.net> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Tony Prisk <linux@prisktech.co.nz> Cc: Mike Turquette <mturquette@linaro.org> Cc: linux-arm-kernel at lists.infradead.org Cc: linux-kernel at vger.kernel.org --- 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", ®); if (WARN_ON(rc)) return; -- 1.7.10.4
next prev parent reply other threads:[~2013-09-20 6:22 UTC|newest] Thread overview: 178+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-09-18 17:53 [PATCH 00/26] ARM: provide common arch init for DT clocks Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 01/26] ARM: nomadik: move mtu setup to clocksource init Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-20 20:49 ` Linus Walleij 2013-09-20 20:49 ` Linus Walleij 2013-09-20 20:51 ` Linus Walleij 2013-09-20 20:51 ` Linus Walleij 2013-09-20 21:08 ` Sebastian Hesselbarth 2013-09-20 21:08 ` Sebastian Hesselbarth 2013-09-20 21:11 ` Linus Walleij 2013-09-20 21:11 ` Linus Walleij 2013-09-20 21:13 ` Sebastian Hesselbarth 2013-09-20 21:13 ` Sebastian Hesselbarth 2013-09-20 21:22 ` Linus Walleij 2013-09-20 21:22 ` Linus Walleij 2013-09-22 12:18 ` Sebastian Hesselbarth 2013-09-22 12:18 ` Sebastian Hesselbarth 2013-09-20 21:37 ` [PATCH v2 01/26] ARM: nomadik: remove mtu initalization from .init_time Sebastian Hesselbarth 2013-09-20 21:37 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 02/26] clk: nomadik: move src init out of nomadik_clk_init Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-20 20:54 ` Linus Walleij 2013-09-20 20:54 ` Linus Walleij 2013-09-22 16:45 ` [PATCH v2 " Sebastian Hesselbarth 2013-09-22 16:45 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 03/26] clk: nomadik: declare OF clock provider Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-20 20:55 ` Linus Walleij 2013-09-20 20:55 ` Linus Walleij 2013-09-22 16:46 ` [PATCH v2 " Sebastian Hesselbarth 2013-09-22 16:46 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 04/26] clk: prima2: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-19 8:45 ` Barry Song 2013-09-19 8:45 ` Barry Song 2013-09-19 8:48 ` Sebastian Hesselbarth 2013-09-19 8:48 ` Sebastian Hesselbarth 2013-09-22 12:12 ` Sebastian Hesselbarth 2013-09-22 12:12 ` Sebastian Hesselbarth 2013-09-22 10:37 ` Barry Song 2013-09-22 10:37 ` Barry Song 2013-09-27 18:21 ` Sebastian Hesselbarth 2013-09-27 18:21 ` Sebastian Hesselbarth 2013-09-29 4:49 ` Barry Song 2013-09-29 4:49 ` Barry Song 2013-09-18 17:53 ` [PATCH 05/26] ARM: socfgpa: prepare for arch-wide .init_time callback Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-26 6:12 ` Sebastian Hesselbarth 2013-09-26 6:12 ` Sebastian Hesselbarth 2013-09-26 13:06 ` Dinh Nguyen 2013-09-26 13:06 ` Dinh Nguyen 2013-09-18 17:53 ` [PATCH 06/26] clk: sunxi: declare OF clock provider Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-25 20:03 ` Maxime Ripard 2013-09-25 20:03 ` Maxime Ripard 2013-09-18 17:53 ` [PATCH 07/26] clk: vt8500: parse pmc_base from clock driver Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-19 19:02 ` Tony Prisk 2013-09-19 19:02 ` Tony Prisk 2013-09-19 19:12 ` Sebastian Hesselbarth 2013-09-19 19:12 ` Sebastian Hesselbarth 2013-09-20 4:51 ` Tony Prisk 2013-09-20 4:51 ` Tony Prisk 2013-09-20 6:23 ` Sebastian Hesselbarth 2013-09-20 6:23 ` Sebastian Hesselbarth 2013-09-20 18:23 ` Tony Prisk 2013-09-20 18:23 ` Tony Prisk 2013-09-20 6:22 ` Sebastian Hesselbarth [this message] 2013-09-20 6:22 ` [PATCH v2 " Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 08/26] ARM: vt8500: prepare for arch-wide .init_time callback Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 09/26] ARM: call of_clk_init from default time_init handler Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth [not found] ` <1379526839-14798-10-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2013-09-23 7:54 ` [PATCH v2 " Sebastian Hesselbarth 2013-09-23 7:54 ` Sebastian Hesselbarth 2013-09-23 7:54 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 10/26] ARM: bcm2835: remove custom .init_time hook Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 19:37 ` Stephen Warren 2013-09-18 19:37 ` Stephen Warren 2013-09-18 17:53 ` [PATCH 11/26] ARM: dove: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-21 12:22 ` Andrew Lunn 2013-09-21 12:22 ` Andrew Lunn 2013-09-22 12:20 ` Sebastian Hesselbarth 2013-09-22 12:20 ` Sebastian Hesselbarth 2013-09-23 9:10 ` Andrew Lunn 2013-09-23 9:10 ` Andrew Lunn 2013-09-23 13:32 ` Jason Cooper 2013-09-23 13:32 ` Jason Cooper 2013-09-23 17:46 ` Sebastian Hesselbarth 2013-09-23 17:46 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 12/26] ARM: exynos: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-26 6:21 ` Sebastian Hesselbarth 2013-09-26 6:21 ` Sebastian Hesselbarth 2013-09-26 6:21 ` Sebastian Hesselbarth 2013-09-26 8:08 ` Tomasz Figa 2013-09-26 8:08 ` Tomasz Figa 2013-09-18 17:53 ` [PATCH 13/26] ARM: highbank: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 14/26] ARM: imx: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 15/26] ARM: kirkwood: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-21 20:27 ` Andrew Lunn 2013-09-21 20:27 ` Andrew Lunn 2013-09-23 13:32 ` Jason Cooper 2013-09-23 13:32 ` Jason Cooper 2013-09-18 17:53 ` [PATCH 16/26] ARM: mxs: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-20 8:57 ` Shawn Guo 2013-09-20 8:57 ` Shawn Guo 2013-09-18 17:53 ` [PATCH 17/26] ARM: nomadik: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-20 20:56 ` Linus Walleij 2013-09-20 20:56 ` Linus Walleij 2013-09-18 17:53 ` [PATCH 18/26] ARM: nspire: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 19/26] ARM: prima2: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 20/26] ARM: rockchip: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-19 8:40 ` Heiko Stübner 2013-09-19 8:40 ` Heiko Stübner 2013-09-18 17:53 ` [PATCH 21/26] ARM: socfpga: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-26 13:07 ` Dinh Nguyen 2013-09-26 13:07 ` Dinh Nguyen 2013-09-18 17:53 ` [PATCH 22/26] ARM: sti: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 23/26] ARM: sunxi: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-25 20:07 ` Maxime Ripard 2013-09-25 20:07 ` Maxime Ripard 2013-09-26 6:15 ` Sebastian Hesselbarth 2013-09-26 6:15 ` Sebastian Hesselbarth 2013-09-27 17:02 ` Maxime Ripard 2013-09-27 17:02 ` Maxime Ripard [not found] ` <1379526839-14798-1-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2013-09-18 17:53 ` [PATCH 24/26] ARM: tegra: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth [not found] ` <1379526839-14798-25-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2013-09-18 19:38 ` Stephen Warren 2013-09-18 19:38 ` Stephen Warren 2013-09-18 19:38 ` Stephen Warren 2013-09-18 19:47 ` [PATCH 00/26] ARM: provide common arch init for DT clocks Jason Cooper 2013-09-18 19:47 ` Jason Cooper 2013-09-18 19:47 ` Jason Cooper [not found] ` <20130918194711.GR19937-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org> 2013-09-18 19:52 ` Sebastian Hesselbarth 2013-09-18 19:52 ` Sebastian Hesselbarth 2013-09-18 19:52 ` Sebastian Hesselbarth 2013-09-18 20:45 ` Stephen Warren 2013-09-18 20:45 ` Stephen Warren 2013-09-18 20:48 ` Olof Johansson 2013-09-18 20:48 ` Olof Johansson 2013-09-18 20:48 ` Olof Johansson 2013-09-18 21:04 ` Sebastian Hesselbarth 2013-09-18 21:04 ` Sebastian Hesselbarth 2013-09-18 21:04 ` Sebastian Hesselbarth 2013-09-18 17:53 ` [PATCH 25/26] ARM: vexpress: remove custom .init_time hook Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-19 13:34 ` Pawel Moll 2013-09-19 13:34 ` Pawel Moll 2013-09-18 17:53 ` [PATCH 26/26] ARM: vt8500: " Sebastian Hesselbarth 2013-09-18 17:53 ` Sebastian Hesselbarth 2013-09-20 19:16 ` [PATCH 00/26] ARM: provide common arch init for DT clocks Matt Porter 2013-09-20 19:16 ` Matt Porter 2013-09-20 19:16 ` Matt Porter 2013-09-22 12:14 ` Sebastian Hesselbarth 2013-09-22 12:14 ` Sebastian Hesselbarth [not found] ` <523EDF16.10102-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2013-09-23 17:45 ` Matt Porter 2013-09-23 17:45 ` Matt Porter 2013-09-23 17:45 ` Matt Porter [not found] ` <52407E2A.7030001-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2013-09-23 18:41 ` Christian Daudt 2013-09-23 18:41 ` Christian Daudt 2013-09-23 18:41 ` Christian Daudt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1379658153-28070-1-git-send-email-sebastian.hesselbarth@gmail.com \ --to=sebastian.hesselbarth@gmail.com \ --cc=arnd@arndb.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@prisktech.co.nz \ --cc=mturquette@linaro.org \ --cc=olof@lixom.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.