* [PATCH 0/2] ARM: OMAP2+: Add device-tree support for 32kHz counter
@ 2012-10-17 18:33 Jon Hunter
2012-10-17 18:33 ` [PATCH 1/2] ARM: dts: OMAP: Add counter-32k nodes Jon Hunter
2012-10-17 18:33 ` [PATCH 2/2] ARM: OMAP2+: Add device-tree support for 32kHz counter Jon Hunter
0 siblings, 2 replies; 5+ messages in thread
From: Jon Hunter @ 2012-10-17 18:33 UTC (permalink / raw)
To: Benoit Cousson, Tony Lindgren, Rob Herring, Grant Likely
Cc: device-tree, linux-omap, linux-arm, Jon Hunter
This series adds device-tree support for the 32kHz counter on OMAP2+ devices,
which is used as the default kernel clock-source for OMAP devices.
Boot tested on OMAP2420 H4, OMAP3430 Beagle Board and OMAP4430 Panda Board
with and without device-tree present.
Based and dependent upon OMAP2+ series that adds device-tree support for
DMTIMERs [1].
[1] http://marc.info/?l=linux-omap&m=135049690119218&w=2
Jon Hunter (2):
ARM: dts: OMAP: Add counter-32k nodes
ARM: OMAP2+: Add device-tree support for 32kHz counter
.../devicetree/bindings/arm/omap/counter32k.txt | 15 +++++++++++
arch/arm/boot/dts/omap2420.dtsi | 6 +++++
arch/arm/boot/dts/omap2430.dtsi | 6 +++++
arch/arm/boot/dts/omap3.dtsi | 6 +++++
arch/arm/boot/dts/omap4.dtsi | 6 +++++
arch/arm/mach-omap2/timer.c | 28 +++++++++++++++++++-
6 files changed, 66 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/arm/omap/counter32k.txt
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ARM: dts: OMAP: Add counter-32k nodes
2012-10-17 18:33 [PATCH 0/2] ARM: OMAP2+: Add device-tree support for 32kHz counter Jon Hunter
@ 2012-10-17 18:33 ` Jon Hunter
2012-10-18 14:23 ` Benoit Cousson
2012-10-17 18:33 ` [PATCH 2/2] ARM: OMAP2+: Add device-tree support for 32kHz counter Jon Hunter
1 sibling, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2012-10-17 18:33 UTC (permalink / raw)
To: Benoit Cousson, Tony Lindgren, Rob Herring, Grant Likely
Cc: device-tree, linux-omap, linux-arm, Jon Hunter
Adds the counter-32k timers nodes present in OMAP2/3/4 devices and
device-tree binding documentation for OMAP counter-32k.
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
.../devicetree/bindings/arm/omap/counter32k.txt | 15 +++++++++++++++
arch/arm/boot/dts/omap2420.dtsi | 6 ++++++
arch/arm/boot/dts/omap2430.dtsi | 6 ++++++
arch/arm/boot/dts/omap3.dtsi | 6 ++++++
arch/arm/boot/dts/omap4.dtsi | 6 ++++++
5 files changed, 39 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/omap/counter32k.txt
diff --git a/Documentation/devicetree/bindings/arm/omap/counter32k.txt b/Documentation/devicetree/bindings/arm/omap/counter32k.txt
new file mode 100644
index 0000000..1983fae
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/counter32k.txt
@@ -0,0 +1,15 @@
+OMAP Counter-32K bindings
+
+Required properties:
+- compatible: Must be "ti,omap-counter32k" for OMAP controllers
+- reg: Contains timer register address range (base address and length)
+- ti,hwmods: Name of the hwmod associated to the counter, which is typically
+ "counter_32k"
+
+Example:
+
+counter32k: counter32k@4a304000 {
+ compatible = "ti,omap-counter32k";
+ reg = <0x4a304000 0x001f>;
+ ti,hwmods = "counter_32k";
+};
diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
index 5f68a70..082193f 100644
--- a/arch/arm/boot/dts/omap2420.dtsi
+++ b/arch/arm/boot/dts/omap2420.dtsi
@@ -14,6 +14,12 @@
compatible = "ti,omap2420", "ti,omap2";
ocp {
+ counter32k: counter32k@48004000 {
+ compatible = "ti,omap-counter32k";
+ reg = <0x48004000 0x001f>;
+ ti,hwmods = "counter_32k";
+ };
+
omap2420_pmx: pinmux@48000030 {
compatible = "ti,omap2420-padconf", "pinctrl-single";
reg = <0x48000030 0x0113>;
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index 7439987..2e568cf 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -14,6 +14,12 @@
compatible = "ti,omap2430", "ti,omap2";
ocp {
+ counter32k: counter32k@49020000 {
+ compatible = "ti,omap-counter32k";
+ reg = <0x49020000 0x001f>;
+ ti,hwmods = "counter_32k";
+ };
+
omap2430_pmx: pinmux@49002030 {
compatible = "ti,omap2430-padconf", "pinctrl-single";
reg = <0x49002030 0x0154>;
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 3fb910f..aa775b2 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -61,6 +61,12 @@
ranges;
ti,hwmods = "l3_main";
+ counter32k: counter32k@48320000 {
+ compatible = "ti,omap-counter32k";
+ reg = <0x48320000 0x001f>;
+ ti,hwmods = "counter_32k";
+ };
+
intc: interrupt-controller@48200000 {
compatible = "ti,omap2-intc";
interrupt-controller;
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index f6ac2b7..3eb66ee 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -95,6 +95,12 @@
ranges;
ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
+ counter32k: counter32k@4a304000 {
+ compatible = "ti,omap-counter32k";
+ reg = <0x4a304000 0x001f>;
+ ti,hwmods = "counter_32k";
+ };
+
omap4_pmx_core: pinmux@4a100040 {
compatible = "ti,omap4-padconf", "pinctrl-single";
reg = <0x4a100040 0x0196>;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] ARM: OMAP2+: Add device-tree support for 32kHz counter
2012-10-17 18:33 [PATCH 0/2] ARM: OMAP2+: Add device-tree support for 32kHz counter Jon Hunter
2012-10-17 18:33 ` [PATCH 1/2] ARM: dts: OMAP: Add counter-32k nodes Jon Hunter
@ 2012-10-17 18:33 ` Jon Hunter
1 sibling, 0 replies; 5+ messages in thread
From: Jon Hunter @ 2012-10-17 18:33 UTC (permalink / raw)
To: Benoit Cousson, Tony Lindgren, Rob Herring, Grant Likely
Cc: device-tree, linux-omap, linux-arm, Jon Hunter
For OMAP devices, the 32kHz counter is the default clock-source for the kernel.
However, this is not the only possible clock-source the kernel can use for OMAP
devices.
When booting with device-tree, if the 32kHz counter is the desired clock-source
for the kernel, then parse the device-tree blob to ensure that the counter is
present and if so map memory for the counter using the device-tree of_iomap()
function so we are no longer reliant on the OMAP HWMOD framework to do this for
us.
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
arch/arm/mach-omap2/timer.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index d064afd..a67688f 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -159,6 +159,11 @@ static struct of_device_id omap_timer_match[] __initdata = {
{ }
};
+static struct of_device_id omap_counter_match[] __initdata = {
+ { .compatible = "ti,omap-counter32k", },
+ { }
+};
+
/**
* omap_get_timer_dt - get a timer using device-tree
* @match - device-tree match structure for matching a device type
@@ -378,11 +383,26 @@ static u32 notrace dmtimer_read_sched_clock(void)
static int __init omap2_sync32k_clocksource_init(void)
{
int ret;
+ struct device_node *np = NULL;
struct omap_hwmod *oh;
void __iomem *vbase;
const char *oh_name = "counter_32k";
/*
+ * If device-tree is present, then search the DT blob
+ * to see if the 32kHz counter is supported.
+ */
+ if (of_have_populated_dt()) {
+ np = omap_get_timer_dt(omap_counter_match, NULL);
+ if (!np)
+ return -ENODEV;
+
+ of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
+ if (!oh_name)
+ return -ENODEV;
+ }
+
+ /*
* First check hwmod data is available for sync32k counter
*/
oh = omap_hwmod_lookup(oh_name);
@@ -391,7 +411,13 @@ static int __init omap2_sync32k_clocksource_init(void)
omap_hwmod_setup_one(oh_name);
- vbase = omap_hwmod_get_mpu_rt_va(oh);
+ if (of_have_populated_dt()) {
+ vbase = of_iomap(np, 0);
+ of_node_put(np);
+ } else {
+ vbase = omap_hwmod_get_mpu_rt_va(oh);
+ }
+
if (!vbase) {
pr_warn("%s: failed to get counter_32k resource\n", __func__);
return -ENXIO;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ARM: dts: OMAP: Add counter-32k nodes
2012-10-17 18:33 ` [PATCH 1/2] ARM: dts: OMAP: Add counter-32k nodes Jon Hunter
@ 2012-10-18 14:23 ` Benoit Cousson
[not found] ` <508010E1.6010102-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Benoit Cousson @ 2012-10-18 14:23 UTC (permalink / raw)
To: Jon Hunter
Cc: Tony Lindgren, Rob Herring, Grant Likely, device-tree, linux-omap,
linux-arm
Hi Jon,
This looks good to me, I just have a minor nit comment.
On 10/17/2012 08:33 PM, Jon Hunter wrote:
> Adds the counter-32k timers nodes present in OMAP2/3/4 devices and
> device-tree binding documentation for OMAP counter-32k.
>
> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
> ---
> .../devicetree/bindings/arm/omap/counter32k.txt | 15 +++++++++++++++
> arch/arm/boot/dts/omap2420.dtsi | 6 ++++++
> arch/arm/boot/dts/omap2430.dtsi | 6 ++++++
> arch/arm/boot/dts/omap3.dtsi | 6 ++++++
> arch/arm/boot/dts/omap4.dtsi | 6 ++++++
> 5 files changed, 39 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/arm/omap/counter32k.txt
>
> diff --git a/Documentation/devicetree/bindings/arm/omap/counter32k.txt b/Documentation/devicetree/bindings/arm/omap/counter32k.txt
> new file mode 100644
> index 0000000..1983fae
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/omap/counter32k.txt
> @@ -0,0 +1,15 @@
> +OMAP Counter-32K bindings
> +
> +Required properties:
> +- compatible: Must be "ti,omap-counter32k" for OMAP controllers
> +- reg: Contains timer register address range (base address and length)
> +- ti,hwmods: Name of the hwmod associated to the counter, which is typically
> + "counter_32k"
> +
> +Example:
> +
> +counter32k: counter32k@4a304000 {
> + compatible = "ti,omap-counter32k";
> + reg = <0x4a304000 0x001f>;
> + ti,hwmods = "counter_32k";
> +};
> diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
> index 5f68a70..082193f 100644
> --- a/arch/arm/boot/dts/omap2420.dtsi
> +++ b/arch/arm/boot/dts/omap2420.dtsi
> @@ -14,6 +14,12 @@
> compatible = "ti,omap2420", "ti,omap2";
>
> ocp {
> + counter32k: counter32k@48004000 {
I'd rather use "counter" as generic type to be consistent with the timer
type we are already using.
+ counter32k: counter@48004000 {
Regards,
Benoit
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ARM: dts: OMAP: Add counter-32k nodes
[not found] ` <508010E1.6010102-l0cyMroinI0@public.gmane.org>
@ 2012-10-18 14:27 ` Jon Hunter
0 siblings, 0 replies; 5+ messages in thread
From: Jon Hunter @ 2012-10-18 14:27 UTC (permalink / raw)
To: Benoit Cousson; +Cc: device-tree, Rob Herring, linux-omap, linux-arm
On 10/18/2012 09:23 AM, Benoit Cousson wrote:
> Hi Jon,
>
> This looks good to me, I just have a minor nit comment.
>
> On 10/17/2012 08:33 PM, Jon Hunter wrote:
>> Adds the counter-32k timers nodes present in OMAP2/3/4 devices and
>> device-tree binding documentation for OMAP counter-32k.
>>
>> Signed-off-by: Jon Hunter <jon-hunter-l0cyMroinI0@public.gmane.org>
>> ---
>> .../devicetree/bindings/arm/omap/counter32k.txt | 15 +++++++++++++++
>> arch/arm/boot/dts/omap2420.dtsi | 6 ++++++
>> arch/arm/boot/dts/omap2430.dtsi | 6 ++++++
>> arch/arm/boot/dts/omap3.dtsi | 6 ++++++
>> arch/arm/boot/dts/omap4.dtsi | 6 ++++++
>> 5 files changed, 39 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/arm/omap/counter32k.txt
>>
>> diff --git a/Documentation/devicetree/bindings/arm/omap/counter32k.txt b/Documentation/devicetree/bindings/arm/omap/counter32k.txt
>> new file mode 100644
>> index 0000000..1983fae
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/arm/omap/counter32k.txt
>> @@ -0,0 +1,15 @@
>> +OMAP Counter-32K bindings
>> +
>> +Required properties:
>> +- compatible: Must be "ti,omap-counter32k" for OMAP controllers
>> +- reg: Contains timer register address range (base address and length)
>> +- ti,hwmods: Name of the hwmod associated to the counter, which is typically
>> + "counter_32k"
>> +
>> +Example:
>> +
>> +counter32k: counter32k@4a304000 {
>> + compatible = "ti,omap-counter32k";
>> + reg = <0x4a304000 0x001f>;
>> + ti,hwmods = "counter_32k";
>> +};
>> diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
>> index 5f68a70..082193f 100644
>> --- a/arch/arm/boot/dts/omap2420.dtsi
>> +++ b/arch/arm/boot/dts/omap2420.dtsi
>> @@ -14,6 +14,12 @@
>> compatible = "ti,omap2420", "ti,omap2";
>>
>> ocp {
>> + counter32k: counter32k@48004000 {
>
> I'd rather use "counter" as generic type to be consistent with the timer
> type we are already using.
>
> + counter32k: counter@48004000 {
Sounds good. Will update.
Cheers
Jon
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-18 14:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 18:33 [PATCH 0/2] ARM: OMAP2+: Add device-tree support for 32kHz counter Jon Hunter
2012-10-17 18:33 ` [PATCH 1/2] ARM: dts: OMAP: Add counter-32k nodes Jon Hunter
2012-10-18 14:23 ` Benoit Cousson
[not found] ` <508010E1.6010102-l0cyMroinI0@public.gmane.org>
2012-10-18 14:27 ` Jon Hunter
2012-10-17 18:33 ` [PATCH 2/2] ARM: OMAP2+: Add device-tree support for 32kHz counter Jon Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).