From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/7] clocksource: time-armada-370-xp converted to clk framework
Date: Thu, 15 Nov 2012 22:49:06 +0100 [thread overview]
Message-ID: <20121115224906.5a5eb7cf@skate> (raw)
In-Reply-To: <1353014906-31566-5-git-send-email-andrew@lunn.ch>
Dear Andrew Lunn,
Title should be "clocksource: convert time-armada-370-xp to the clk
framework".
On Thu, 15 Nov 2012 22:28:23 +0100, Andrew Lunn wrote:
> diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
> index 4674f94..a4605fd 100644
> --- a/drivers/clocksource/time-armada-370-xp.c
> +++ b/drivers/clocksource/time-armada-370-xp.c
> @@ -18,6 +18,7 @@
> #include <linux/init.h>
> #include <linux/platform_device.h>
> #include <linux/kernel.h>
> +#include <linux/clk.h>
> #include <linux/timer.h>
> #include <linux/clockchips.h>
> #include <linux/interrupt.h>
> @@ -167,7 +168,6 @@ void __init armada_370_xp_timer_init(void)
> u32 u;
> struct device_node *np;
> unsigned int timer_clk;
> - int ret;
> np = of_find_compatible_node(NULL, NULL, "marvell,armada-370-xp-timer");
> timer_base = of_iomap(np, 0);
> WARN_ON(!timer_base);
> @@ -179,13 +179,14 @@ void __init armada_370_xp_timer_init(void)
> timer_base + TIMER_CTRL_OFF);
> timer_clk = 25000000;
> } else {
> - u32 clk = 0;
> - ret = of_property_read_u32(np, "clock-frequency", &clk);
> - WARN_ON(!clk || ret < 0);
> + unsigned long rate = 0;
> + struct clk *clk = of_clk_get(np, 0);
> + WARN_ON(IS_ERR(clk));
> + rate = clk_get_rate(clk);
> u = readl(timer_base + TIMER_CTRL_OFF);
> writel(u & ~(TIMER0_25MHZ | TIMER1_25MHZ),
> timer_base + TIMER_CTRL_OFF);
> - timer_clk = clk / TIMER_DIVIDER;
> + timer_clk = rate / TIMER_DIVIDER;
> }
>
> /* We use timer 0 as clocksource, and timer 1 for
This change requires an update to
Documentation/devicetree/bindings/arm/armada-370-xp-timer.txt. The
previous clock-frequency property was not documented, but maybe the new
clocks property should.
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
Cc: mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
John Stultz <johnstul-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux ARM
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH 4/7] clocksource: time-armada-370-xp converted to clk framework
Date: Thu, 15 Nov 2012 22:49:06 +0100 [thread overview]
Message-ID: <20121115224906.5a5eb7cf@skate> (raw)
In-Reply-To: <1353014906-31566-5-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
Dear Andrew Lunn,
Title should be "clocksource: convert time-armada-370-xp to the clk
framework".
On Thu, 15 Nov 2012 22:28:23 +0100, Andrew Lunn wrote:
> diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
> index 4674f94..a4605fd 100644
> --- a/drivers/clocksource/time-armada-370-xp.c
> +++ b/drivers/clocksource/time-armada-370-xp.c
> @@ -18,6 +18,7 @@
> #include <linux/init.h>
> #include <linux/platform_device.h>
> #include <linux/kernel.h>
> +#include <linux/clk.h>
> #include <linux/timer.h>
> #include <linux/clockchips.h>
> #include <linux/interrupt.h>
> @@ -167,7 +168,6 @@ void __init armada_370_xp_timer_init(void)
> u32 u;
> struct device_node *np;
> unsigned int timer_clk;
> - int ret;
> np = of_find_compatible_node(NULL, NULL, "marvell,armada-370-xp-timer");
> timer_base = of_iomap(np, 0);
> WARN_ON(!timer_base);
> @@ -179,13 +179,14 @@ void __init armada_370_xp_timer_init(void)
> timer_base + TIMER_CTRL_OFF);
> timer_clk = 25000000;
> } else {
> - u32 clk = 0;
> - ret = of_property_read_u32(np, "clock-frequency", &clk);
> - WARN_ON(!clk || ret < 0);
> + unsigned long rate = 0;
> + struct clk *clk = of_clk_get(np, 0);
> + WARN_ON(IS_ERR(clk));
> + rate = clk_get_rate(clk);
> u = readl(timer_base + TIMER_CTRL_OFF);
> writel(u & ~(TIMER0_25MHZ | TIMER1_25MHZ),
> timer_base + TIMER_CTRL_OFF);
> - timer_clk = clk / TIMER_DIVIDER;
> + timer_clk = rate / TIMER_DIVIDER;
> }
>
> /* We use timer 0 as clocksource, and timer 1 for
This change requires an update to
Documentation/devicetree/bindings/arm/armada-370-xp-timer.txt. The
previous clock-frequency property was not documented, but maybe the new
clocks property should.
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2012-11-15 21:49 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-15 21:28 [PATCH 0/7] core, cpu and gated clocks for mvebu Andrew Lunn
2012-11-15 21:28 ` Andrew Lunn
2012-11-15 21:28 ` [PATCH 1/7] clk: mvebu: add mvebu core clocks Andrew Lunn
2012-11-15 21:28 ` Andrew Lunn
2012-11-16 12:52 ` Gregory CLEMENT
2012-11-16 12:52 ` Gregory CLEMENT
2012-11-15 21:28 ` [PATCH 2/7] clk: mvebu: add armada-370-xp CPU specific clocks Andrew Lunn
2012-11-15 21:28 ` Andrew Lunn
2012-11-15 21:44 ` Thomas Petazzoni
2012-11-15 21:44 ` Thomas Petazzoni
2012-11-15 21:28 ` [PATCH 3/7] clk: armada-370-xp: add support for clock framework Andrew Lunn
2012-11-15 21:28 ` Andrew Lunn
2012-11-15 21:46 ` Thomas Petazzoni
2012-11-15 21:46 ` Thomas Petazzoni
2012-11-15 21:28 ` [PATCH 4/7] clocksource: time-armada-370-xp converted to clk framework Andrew Lunn
2012-11-15 21:28 ` Andrew Lunn
2012-11-15 21:49 ` Thomas Petazzoni [this message]
2012-11-15 21:49 ` Thomas Petazzoni
2012-11-15 21:28 ` [PATCH 5/7] clk: mvebu: add clock gating control provider for DT Andrew Lunn
2012-11-15 21:28 ` Andrew Lunn
2012-11-16 18:01 ` [PATCH 0/2] Add clock gating support for Armada 370/XP Gregory CLEMENT
2012-11-16 18:01 ` Gregory CLEMENT
2012-11-16 18:01 ` [PATCH 1/2] clk: mvebu: armada 370/XP add clock gating control provider for DT Gregory CLEMENT
2012-11-16 18:01 ` Gregory CLEMENT
2012-11-17 8:26 ` Andrew Lunn
2012-11-17 8:26 ` Andrew Lunn
2012-11-17 9:41 ` Gregory CLEMENT
2012-11-17 9:41 ` Gregory CLEMENT
2012-11-17 13:54 ` Andrew Lunn
2012-11-17 13:54 ` Andrew Lunn
2012-11-19 4:30 ` Mike Turquette
2012-11-19 4:30 ` Mike Turquette
2012-11-19 15:46 ` Thomas Petazzoni
2012-11-19 15:46 ` Thomas Petazzoni
2012-11-19 15:58 ` Andrew Lunn
2012-11-19 15:58 ` Andrew Lunn
2012-11-19 16:43 ` Thomas Petazzoni
2012-11-19 16:43 ` Thomas Petazzoni
2012-11-19 16:01 ` Sebastian Hesselbarth
2012-11-19 16:01 ` Sebastian Hesselbarth
2012-11-16 18:02 ` [PATCH 2/2] arm: mvebu: armada 370/XP adding clock gating support: dt binding Gregory CLEMENT
2012-11-16 18:02 ` Gregory CLEMENT
2012-11-15 21:28 ` [PATCH 6/7] ARM: dove: switch to DT clock providers Andrew Lunn
2012-11-15 21:28 ` Andrew Lunn
2012-11-15 21:52 ` Thomas Petazzoni
2012-11-15 21:52 ` Thomas Petazzoni
2012-11-15 21:28 ` [PATCH 7/7] ARM: Kirkwood: " Andrew Lunn
2012-11-15 21:28 ` Andrew Lunn
2012-11-16 17:33 ` Gregory CLEMENT
2012-11-16 17:33 ` Gregory CLEMENT
2012-11-15 21:54 ` [PATCH 0/7] core, cpu and gated clocks for mvebu Thomas Petazzoni
2012-11-15 21:54 ` Thomas Petazzoni
2012-11-16 7:32 ` Andrew Lunn
2012-11-16 7:32 ` Andrew Lunn
2012-11-16 12:51 ` Gregory CLEMENT
2012-11-16 12:51 ` Gregory CLEMENT
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=20121115224906.5a5eb7cf@skate \
--to=thomas.petazzoni@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is 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.