Skip to contentSkip to conversation

clk: convert ARM RealView to common clk

PATCH New Linus Walleij 4 participants 10 messages Aug 6, 2012 – Aug 30, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

From: Linus Walleij <[email protected]>

This converts the ARM RealView machine over to using the common clock. The approach is similar to the one used for the Integrator, and we're reusing the ICST wrapper code.

We have to put the clock intialization in the timer init function for the clocks to be available when initializing the timer, keeping them in early_init() is too early for the common clk.

Since we now have to go down and compile drivers/clk/versatile a CONFIG_COMMON_CLK_VERSATILE symbol has been added so the proper code gets compiled into the kernel for either machine. A leftover CLK_VERSATILE in the Integrator Kconfig was fixed up to use the new symbol as well.

Tested on ARM RealView PB1176.

---
 arch/arm/Kconfig                             |   7 +-
 arch/arm/mach-realview/core.c                | 106 -------------------------
 arch/arm/mach-realview/include/mach/clkdev.h |  16 ----
 arch/arm/mach-realview/realview_eb.c         |   2 +
 arch/arm/mach-realview/realview_pb1176.c     |   2 +
 arch/arm/mach-realview/realview_pb11mp.c     |   2 +
 arch/arm/mach-realview/realview_pba8.c       |   2 +
 arch/arm/mach-realview/realview_pbx.c        |   2 +
 drivers/clk/Kconfig                          |   7 ++
 drivers/clk/Makefile                         |   2 +-
 drivers/clk/versatile/Makefile               |   1 +
 drivers/clk/versatile/clk-realview.c         | 114 +++++++++++++++++++++++++++
 include/linux/platform_data/clk-realview.h   |   1 +
 13 files changed, 137 insertions(+), 127 deletions(-)
 delete mode 100644 arch/arm/mach-realview/include/mach/clkdev.h
 create mode 100644 drivers/clk/versatile/clk-realview.c
 create mode 100644 include/linux/platform_data/clk-realview.h
arch/arm/Kconfig +3 -4
index e91c7cd..530630c 100644
@@ -279,7 +279,7 @@ config ARCH_INTEGRATOR
 	select ARM_AMBA
 	select ARCH_HAS_CPUFREQ
 	select COMMON_CLK
-	select CLK_VERSATILE
+	select COMMON_CLK_VERSATILE
 	select HAVE_TCM
 	select ICST
 	select GENERIC_CLOCKEVENTS
@@ -295,13 +295,12 @@ config ARCH_INTEGRATOR
 config ARCH_REALVIEW
 	bool "ARM Ltd. RealView family"
 	select ARM_AMBA
-	select CLKDEV_LOOKUP
-	select HAVE_MACH_CLKDEV
+	select COMMON_CLK
+	select COMMON_CLK_VERSATILE
 	select ICST
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select PLAT_VERSATILE
-	select PLAT_VERSATILE_CLOCK
 	select PLAT_VERSATILE_CLCD
 	select ARM_TIMER_SP804
 	select GPIO_PL061 if GPIOLIB
arch/arm/mach-realview/core.c +0 -106

122 lines not on this page · raw message

arch/arm/mach-realview/include/mach/clkdev.h deleted +0 -16
deleted file mode 100644
index e58d077..0000000
@@ -1,16 +0,0 @@
-#ifndef __ASM_MACH_CLKDEV_H
-#define __ASM_MACH_CLKDEV_H
-
-#include <plat/clock.h>
-
-struct clk {
-	unsigned long		rate;
-	const struct clk_ops	*ops;
-	const struct icst_params *params;
-	void __iomem		*vcoreg;
-};
-
-#define __clk_get(clk) ({ 1; })
-#define __clk_put(clk) do { } while (0)
-
-#endif
arch/arm/mach-realview/realview_eb.c +2 -0
index baf382c..a33e33b 100644
@@ -27,6 +27,7 @@
 #include <linux/amba/mmci.h>
 #include <linux/amba/pl022.h>
 #include <linux/io.h>
+#include <linux/platform_data/clk-realview.h>
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -414,6 +415,7 @@ static void __init realview_eb_timer_init(void)
 	else
 		timer_irq = IRQ_EB_TIMER0_1;
 
+	realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);
 	realview_timer_init(timer_irq);
 	realview_eb_twd_init();
 }
arch/arm/mach-realview/realview_pb1176.c +2 -0
index b1d7caf..f0298cb 100644
@@ -29,6 +29,7 @@
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/partitions.h>
 #include <linux/io.h>
+#include <linux/platform_data/clk-realview.h>
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -326,6 +327,7 @@ static void __init realview_pb1176_timer_init(void)
 	timer2_va_base = __io_address(REALVIEW_PB1176_TIMER2_3_BASE);
 	timer3_va_base = __io_address(REALVIEW_PB1176_TIMER2_3_BASE) + 0x20;
 
+	realview_clk_init(__io_address(REALVIEW_SYS_BASE), true);
 	realview_timer_init(IRQ_DC1176_TIMER0);
 }
 
arch/arm/mach-realview/realview_pb11mp.c +2 -0
index a98c536..1f019f7 100644
@@ -27,6 +27,7 @@
 #include <linux/amba/mmci.h>
 #include <linux/amba/pl022.h>
 #include <linux/io.h>
+#include <linux/platform_data/clk-realview.h>
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -312,6 +313,7 @@ static void __init realview_pb11mp_timer_init(void)
 	timer2_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE);
 	timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20;
 
+	realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);
 	realview_timer_init(IRQ_TC11MP_TIMER0_1);
 	realview_pb11mp_twd_init();
 }
arch/arm/mach-realview/realview_pba8.c +2 -0
index 5965017..5032775 100644
@@ -27,6 +27,7 @@
 #include <linux/amba/mmci.h>
 #include <linux/amba/pl022.h>
 #include <linux/io.h>
+#include <linux/platform_data/clk-realview.h>
 
 #include <asm/irq.h>
 #include <asm/leds.h>
@@ -261,6 +262,7 @@ static void __init realview_pba8_timer_init(void)
 	timer2_va_base = __io_address(REALVIEW_PBA8_TIMER2_3_BASE);
 	timer3_va_base = __io_address(REALVIEW_PBA8_TIMER2_3_BASE) + 0x20;
 
+	realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);
 	realview_timer_init(IRQ_PBA8_TIMER0_1);
 }
 
arch/arm/mach-realview/realview_pbx.c +2 -0
index 3f2f605..de64ba0 100644
@@ -26,6 +26,7 @@
 #include <linux/amba/mmci.h>
 #include <linux/amba/pl022.h>
 #include <linux/io.h>
+#include <linux/platform_data/clk-realview.h>
 
 #include <asm/irq.h>
 #include <asm/leds.h>
@@ -320,6 +321,7 @@ static void __init realview_pbx_timer_init(void)
 	timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE);
 	timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20;
 
+	realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);
 	realview_timer_init(IRQ_PBX_TIMER0_1);
 	realview_pbx_twd_init();
 }
drivers/clk/Kconfig +7 -0
index 7f0b5ca..89b726d 100644
@@ -40,4 +40,11 @@ config COMMON_CLK_WM831X
           Supports the clocking subsystem of the WM831x/2x series of
 	  PMICs from Wolfson Microlectronics.
 
+config COMMON_CLK_VERSATILE
+	tristate "Clock driver for ARM Reference designs"
+	depends on ARCH_INTEGRATOR || ARCH_REALVIEW
+	---help---
+          Supports clocking on ARM Reference designs Integrator/AP,
+	  Integrator/CP, RealView PB1176, EB, PB11MP and PBX.
+
 endmenu
drivers/clk/Makefile +1 -1
index 5869ea3..cfa7eeb 100644
@@ -9,7 +9,7 @@ obj-$(CONFIG_ARCH_MXS)		+= mxs/
 obj-$(CONFIG_ARCH_SOCFPGA)	+= socfpga/
 obj-$(CONFIG_PLAT_SPEAR)	+= spear/
 obj-$(CONFIG_ARCH_U300)		+= clk-u300.o
-obj-$(CONFIG_ARCH_INTEGRATOR)	+= versatile/
+obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/
 
 # Chip specific
 obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
drivers/clk/versatile/Makefile +1 -0
index 50cf6a2..c0a0f64 100644
@@ -1,3 +1,4 @@
 # Makefile for Versatile-specific clocks
 obj-$(CONFIG_ICST)		+= clk-icst.o
 obj-$(CONFIG_ARCH_INTEGRATOR)	+= clk-integrator.o
+obj-$(CONFIG_ARCH_REALVIEW)	+= clk-realview.o
drivers/clk/versatile/clk-realview.c new file +114 -0

114 lines not on this page · raw message

include/linux/platform_data/clk-realview.h new file +1 -0
new file mode 100644
index 0000000..2e426a7
@@ -0,0 +1 @@
+void realview_clk_init(void __iomem *sysbase, bool is_pb1176);
Signature · 1 line
1.7.11.3
#1 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

Quoted 3 lines · Linus Walleij

This converts the ARM RealView machine over to using the common clock. The approach is similar to the one used for the Integrator, and we're reusing the ICST wrapper code.

I've just tried it with v3.6-rc1 and an EB Model and I get this:

------------[ cut here ]------------
WARNING: at /home/pawmol01/src/kernel.org/linux/kernel/timer.c:1076 del_timer_sync+0x34/0x5c()
Modules linked in:
[<c0014054>] (unwind_backtrace+0x0/0xe0) from [<c001ca3c>] (warn_slowpath_common+0x4c/0x64)
[<c001ca3c>] (warn_slowpath_common+0x4c/0x64) from [<c001ca6c>] (warn_slowpath_null+0x18/0x1c)
[<c001ca6c>] (warn_slowpath_null+0x18/0x1c) from [<c00285b8>] (del_timer_sync+0x34/0x5c)
[<c00285b8>] (del_timer_sync+0x34/0x5c) from [<c01d57e4>] (led_set_brightness+0x14/0x4c)
[<c01d57e4>] (led_set_brightness+0x14/0x4c) from [<c01d6270>] (led_trigger_event+0x30/0x70)
[<c01d6270>] (led_trigger_event+0x30/0x70) from [<c01c7ee8>] (mmc_request_done+0x68/0x90)
[<c01c7ee8>] (mmc_request_done+0x68/0x90) from [<c01d5770>] (mmci_irq+0x274/0x2d4)
[<c01d5770>] (mmci_irq+0x274/0x2d4) from [<c005a090>] (handle_irq_event_percpu+0x2c/0x170)
[<c005a090>] (handle_irq_event_percpu+0x2c/0x170) from [<c005a22c>] (handle_irq_event+0x58/0x78)
[<c005a22c>] (handle_irq_event+0x58/0x78) from [<c005ce68>] (handle_fasteoi_irq+0xcc/0x13c)
[<c005ce68>] (handle_fasteoi_irq+0xcc/0x13c) from [<c0059ae8>] (generic_handle_irq+0x20/0x30)
[<c0059ae8>] (generic_handle_irq+0x20/0x30) from [<c000eafc>] (handle_IRQ+0x78/0xb8)
[<c000eafc>] (handle_IRQ+0x78/0xb8) from [<c0008468>] (gic_handle_irq+0x3c/0x60)
[<c0008468>] (gic_handle_irq+0x3c/0x60) from [<c000d820>] (__irq_svc+0x40/0x54)
Exception stack(0xcf83be20 to 0xcf83be68)

be20: cfbfd26c 60000013 00130013 00000000 cf83be84 cfbfd000 00000000 cf83be94
be40: cf83beb8 c01c989c 00000000 00000000 00000000 cf83be68 c01c7f80 c02aaac0
be60: 40000013 ffffffff
[<c000d820>] (__irq_svc+0x40/0x54) from [<c02aaac0>] (_raw_spin_unlock_irqrestore+0x2c/0x30) [<c02aaac0>] (_raw_spin_unlock_irqrestore+0x2c/0x30) from [<c01c7f80>] (mmc_wait_for_req_done+0x70/0x74) [<c01c7f80>] (mmc_wait_for_req_done+0x70/0x74) from [<c01c83b8>] (mmc_wait_for_cmd+0x64/0x74) [<c01c83b8>] (mmc_wait_for_cmd+0x64/0x74) from [<c01cfcfc>] (mmc_send_io_op_cond+0x58/0xc4) [<c01cfcfc>] (mmc_send_io_op_cond+0x58/0xc4) from [<c01cf8b0>] (mmc_attach_sdio+0x3c/0x304) [<c01cf8b0>] (mmc_attach_sdio+0x3c/0x304) from [<c01c9ab0>] (mmc_rescan+0x214/0x290) [<c01c9ab0>] (mmc_rescan+0x214/0x290) from [<c00328f4>] (process_one_work+0x240/0x3b8) [<c00328f4>] (process_one_work+0x240/0x3b8) from [<c0032d70>] (worker_thread+0x2d8/0x434) [<c0032d70>] (worker_thread+0x2d8/0x434) from [<c00373b0>] (kthread+0x84/0x94) [<c00373b0>] (kthread+0x84/0x94) from [<c000ed44>] (kernel_thread_exit+0x0/0x8)

---[ end trace 93fc2bf490575317 ]---

I'm not sure who's fault it is (may be mine), will try to figure out what is going on...

Cheers!

Pawe?

#2 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

Quoted 9 lines · Pawel Moll
Quoted 3 lines · Linus Walleij

This converts the ARM RealView machine over to using the common clock. The approach is similar to the one used for the Integrator, and we're reusing the ICST wrapper code.

I've just tried it with v3.6-rc1 and an EB Model and I get this:

------------[ cut here ]------------
WARNING: at /home/pawmol01/src/kernel.org/linux/kernel/timer.c:1076 del_timer_sync+0x34/0x5c()

Err. Ignore that. The same happens without your patch :-)

Will try with 3.5.

Pawe?

#3 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

Quoted 6 lines · Pawel Moll
Quoted 2 lines
------------[ cut here ]------------
WARNING: at /home/pawmol01/src/kernel.org/linux/kernel/timer.c:1076 del_timer_sync+0x34/0x5c()

Err. Ignore that. The same happens without your patch :-)

Will try with 3.5.

Hm it boots like a charm on PB1176, what's so very different about the EB?

Oh well. Are you maintaining RealView EB, BTW?

Yours,
Linus Walleij

#4 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

Quoted 10 lines · Linus Walleij
Quoted 6 lines · Pawel Moll
Quoted 2 lines
------------[ cut here ]------------
WARNING: at /home/pawmol01/src/kernel.org/linux/kernel/timer.c:1076 del_timer_sync+0x34/0x5c()

Err. Ignore that. The same happens without your patch :-)

Will try with 3.5.

Hm it boots like a charm on PB1176, what's so very different about the EB?

It's configuration difference, I guess. You may try enabling CONFIG_LEDS_TRIGGERS (not that it makes much sense on Realview) if you want to see the same effect :-)

It seems that a0193cbee0809d65362a0767b2d50306b145b2f5 "leds: use led_set_brightness in led_trigger_event" causes a problem when led_trigger_event() is called from an interrupt context. I'll let the LEDS people know.

Quoted 1 line

Oh well. Are you maintaining RealView EB, BTW?

Not really. At least I didn't have any reason to do this so far. And the only Realview platforms I'm really interested in are the EB models. DT for Realview is on my todo list, but with really low priority (around "most likely will never happen").

Anyway, after testing your change on EB model:

Cheers!

Pawe?

#5 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

In reply to Linus Walleij
Quoted 3 lines · Linus Walleij

This converts the ARM RealView machine over to using the common clock. The approach is similar to the one used for the Integrator, and we're reusing the ICST wrapper code.

Mike have you had time to look at this? I got Pawel's ACK in the thread.

Yours,
Linus Walleij

#6 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

Quoted 8 lines · Linus Walleij
Quoted 3 lines · Linus Walleij

This converts the ARM RealView machine over to using the common clock. The approach is similar to the one used for the Integrator, and we're reusing the ICST wrapper code.

Mike have you had time to look at this? I got Pawel's ACK in the thread.

Ping again on this, if it's OK it would be great to get some rotation in -next for this patch.

Yours,
Linus Walleij

#7 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

Quoting Linus Walleij (2012-08-22 05:09:30)

Quoted 13 lines · Linus Walleij
Quoted 8 lines
Quoted 3 lines · Linus Walleij

This converts the ARM RealView machine over to using the common clock. The approach is similar to the one used for the Integrator, and we're reusing the ICST wrapper code.

Mike have you had time to look at this? I got Pawel's ACK in the thread.

Ping again on this, if it's OK it would be great to get some rotation in -next for this patch.

Hi Linus,

Apologies for the delayed response. I've been AWOL on clk patches since the 3.5 release.

I've taken this into clk-next which will be published (based on 3.6-rc3) this evening.

Regards,
Mike

Quoted 2 lines

Yours,
Linus Walleij

#8 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

In reply to Linus Walleij

Hi Linus,

I'm working on moving the VE clocking into driver/clk on top of your Realview change, and just spotted one minor issue...

Quoted 5 lines · Linus Walleij

From: Linus Walleij <[email protected]>

This converts the ARM RealView machine over to using the common clock. The approach is similar to the one used for the Integrator, and we're reusing the ICST wrapper code.

[...]

drivers/clk/Kconfig config COMMON_CLK_WM831X · line 44

Quoted 10 lines
drivers/clk/Kconfig +2 -0
index 7f0b5ca..89b726d 100644
@@ -40,4 +40,11 @@ config COMMON_CLK_WM831X
           Supports the clocking subsystem of the WM831x/2x series of
          PMICs from Wolfson Microlectronics.
 
+config COMMON_CLK_VERSATILE
+       tristate "Clock driver for ARM Reference designs"

It can't really be a "tristate", can it? To my mind there is no way of making it a module, so a "bool" seems more appropriate?

drivers/clk/Kconfig config COMMON_CLK_WM831X · line 50

Quoted 6 lines
drivers/clk/Kconfig +5 -0
+       depends on ARCH_INTEGRATOR || ARCH_REALVIEW
+       ---help---
+          Supports clocking on ARM Reference designs Integrator/AP,
+         Integrator/CP, RealView PB1176, EB, PB11MP and PBX.
+
 endmenu

Cheers!

Pawe?

#9 lore raw

PATCH 1/1 clk: convert ARM RealView to common clk

On Thu, Aug 30, 2012 at 5:33 AM, Pawel Moll <[email protected]> wrote:
[Me]

Quoted 5 lines

drivers/clk/Kconfig config COMMON_CLK_WM831X · line 44

Quoted 2 lines
drivers/clk/Kconfig +2 -0
+config COMMON_CLK_VERSATILE
+       tristate "Clock driver for ARM Reference designs"

It can't really be a "tristate", can it? To my mind there is no way of making it a module, so a "bool" seems more appropriate?

You're right, I'll send a small fixup patch to Mike.

Yours,
Linus Walleij