add hisilicon soc support
Subsystems (9)
v2 cover add hisilicon soc support
Changelog:
v2:
1. Rename mach-hs to mach-hi3xxx.
2. Remove CONFIG_MACH_HS_DT.
3. Move sp804 dual timer driver into drivers/clocksource.
4. Make sp804 driver to support DT. Append CLOCKSOURCE_OF_DECLARE() in sp804 driver.
5. Update hisilicon,hi3620-clkgate & hisilicon,hi3620-clkrst property in clk-hi3xxx driver.
PATCH v2 1/14 clocksource: move sp timer driver
Move ARM SP804 timer driver from arch/arm directory into drivers/clocksource directory.
--- arch/arm/Kconfig | 5 - arch/arm/common/Makefile | 1 - arch/arm/common/timer-sp.c | 191 ----------------------------- arch/arm/include/asm/hardware/arm_timer.h | 35 ------ arch/arm/include/asm/hardware/timer-sp.h | 15 --- arch/arm/mach-highbank/highbank.c | 4 +- arch/arm/mach-integrator/integrator_ap.c | 2 +- arch/arm/mach-integrator/integrator_cp.c | 4 +- arch/arm/mach-realview/core.c | 4 +- arch/arm/mach-versatile/core.c | 4 +- arch/arm/mach-vexpress/ct-ca9x4.c | 5 +- arch/arm/mach-vexpress/v2m.c | 4 +- drivers/clocksource/Kconfig | 5 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-sp.c | 191 +++++++++++++++++++++++++++++ include/clocksource/arm_timer.h | 35 ++++++ include/clocksource/timer-sp.h | 19 +++ 17 files changed, 264 insertions(+), 261 deletions(-) delete mode 100644 arch/arm/common/timer-sp.c delete mode 100644 arch/arm/include/asm/hardware/arm_timer.h delete mode 100644 arch/arm/include/asm/hardware/timer-sp.h create mode 100644 drivers/clocksource/timer-sp.c create mode 100644 include/clocksource/arm_timer.h create mode 100644 include/clocksource/timer-sp.h
arch/arm/Kconfig +0 -5
@@ -1177,11 +1177,6 @@ config PLAT_PXA config PLAT_VERSATILE bool -config ARM_TIMER_SP804 - bool - select CLKSRC_MMIO - select HAVE_SCHED_CLOCK - source arch/arm/mm/Kconfig config ARM_NR_BANKS
arch/arm/common/Makefile +0 -1
@@ -12,4 +12,3 @@ obj-$(CONFIG_SHARP_LOCOMO) += locomo.o obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o -obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
arch/arm/common/timer-sp.c deleted +0 -191
191 lines not on this page · raw message
arch/arm/include/asm/hardware/arm_timer.h deleted +0 -35
@@ -1,35 +0,0 @@ -#ifndef __ASM_ARM_HARDWARE_ARM_TIMER_H -#define __ASM_ARM_HARDWARE_ARM_TIMER_H - -/* -* ARM timer implementation, found in Integrator, Versatile and Realview -* platforms. Not all platforms support all registers and bits in these -* registers, so we mark them with A for Integrator AP, C for Integrator -* CP, V for Versatile and R for Realview. -* -* Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview -* can have 16-bit or 32-bit selectable via a bit in the control register. -* -* Every SP804 contains two identical timers. -*/ -#define TIMER_1_BASE 0x00 -#define TIMER_2_BASE 0x20 - -#define TIMER_LOAD 0x00/* ACVR rw */ -#define TIMER_VALUE 0x04/* ACVR ro */ -#define TIMER_CTRL 0x08/* ACVR rw */ -#define TIMER_CTRL_ONESHOT (1 << 0)/* CVR */ -#define TIMER_CTRL_32BIT (1 << 1)/* CVR */ -#define TIMER_CTRL_DIV1 (0 << 2)/* ACVR */ -#define TIMER_CTRL_DIV16 (1 << 2)/* ACVR */ -#define TIMER_CTRL_DIV256 (2 << 2)/* ACVR */ -#define TIMER_CTRL_IE (1 << 5)/* VR */ -#define TIMER_CTRL_PERIODIC (1 << 6)/* ACVR */ -#define TIMER_CTRL_ENABLE (1 << 7)/* ACVR */ - -#define TIMER_INTCLR 0x0c/* ACVR wo */ -#define TIMER_RIS 0x10/* CVR ro */ -#define TIMER_MIS 0x14/* CVR ro */ -#define TIMER_BGLOAD 0x18/* CVR rw */ - -#endif
arch/arm/include/asm/hardware/timer-sp.h deleted +0 -15
@@ -1,15 +0,0 @@ -void __sp804_clocksource_and_sched_clock_init (void __iomem *, -const char *,int ); - -static inline void sp804_clocksource_init (void __iomem *base,const char *name) -{ -__sp804_clocksource_and_sched_clock_init (base, name,0 ); -} - -static inline void sp804_clocksource_and_sched_clock_init (void __iomem *base, -const char *name) -{ -__sp804_clocksource_and_sched_clock_init (base, name,1 ); -} - -void sp804_clockevents_init (void __iomem *,unsigned int ,const char *);
arch/arm/mach-highbank/highbank.c +2 -2
@@ -27,14 +27,14 @@#include <linux/smp.h> #include <linux/amba/bus.h> #include <linux/clk-provider.h> +#include <clocksource/arm_timer.h> +#include <clocksource/timer-sp.h> #include <asm/arch_timer.h> #include <asm/cacheflush.h> #include <asm/cputype.h> #include <asm/smp_plat.h> #include <asm/smp_twd.h> -#include <asm/hardware/arm_timer.h> -#include <asm/hardware/timer-sp.h> #include <asm/hardware/cache-l2x0.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
arch/arm/mach-integrator/integrator_ap.c +1 -1
@@ -41,11 +41,11 @@#include <linux/stat.h> #include <linux/sys_soc.h> #include <linux/termios.h> +#include <clocksource/arm_timer.h> #include <video/vga.h> #include <mach/hardware.h> #include <mach/platform.h> -#include <asm/hardware/arm_timer.h> #include <asm/setup.h> #include <asm/param.h> /* HZ */ #include <asm/mach-types.h>
arch/arm/mach-integrator/integrator_cp.c +2 -2
@@ -28,12 +28,13 @@#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/sys_soc.h> +#include <clocksource/arm_timer.h> +#include <clocksource/timer-sp.h> #include <mach/hardware.h> #include <mach/platform.h> #include <asm/setup.h> #include <asm/mach-types.h> -#include <asm/hardware/arm_timer.h> #include <asm/hardware/icst.h> #include <mach/cm.h>
@@ -45,7 +46,6 @@#include <asm/mach/map.h> #include <asm/mach/time.h> -#include <asm/hardware/timer-sp.h> #include <plat/clcd.h> #include <plat/sched_clock.h>
arch/arm/mach-realview/core.c +2 -2
@@ -31,11 +31,12 @@#include <linux/amba/mmci.h> #include <linux/gfp.h> #include <linux/mtd/physmap.h> +#include <clocksource/arm_timer.h> +#include <clocksource/timer-sp.h> #include <mach/hardware.h> #include <asm/irq.h> #include <asm/mach-types.h> -#include <asm/hardware/arm_timer.h> #include <asm/hardware/icst.h> #include <asm/mach/arch.h>
@@ -45,7 +46,6 @@#include <mach/platform.h> #include <mach/irqs.h> -#include <asm/hardware/timer-sp.h> #include <plat/clcd.h> #include <plat/sched_clock.h>
arch/arm/mach-versatile/core.c +2 -2
@@ -38,9 +38,10 @@#include <linux/clkdev.h> #include <linux/mtd/physmap.h> #include <linux/bitops.h> +#include <clocksource/arm_timer.h> +#include <clocksource/timer-sp.h> #include <asm/irq.h> -#include <asm/hardware/arm_timer.h> #include <asm/hardware/icst.h> #include <asm/mach-types.h>
@@ -50,7 +51,6 @@#include <asm/mach/map.h> #include <mach/hardware.h> #include <mach/platform.h> -#include <asm/hardware/timer-sp.h> #include <plat/clcd.h> #include <plat/sched_clock.h>
arch/arm/mach-vexpress/ct-ca9x4.c +2 -3
@@ -11,16 +11,15 @@#include <linux/clkdev.h> #include <linux/vexpress.h> #include <linux/irqchip/arm-gic.h> +#include <clocksource/arm_timer.h> +#include <clocksource/timer-sp.h> -#include <asm/hardware/arm_timer.h> #include <asm/hardware/cache-l2x0.h> #include <asm/smp_scu.h> #include <asm/smp_twd.h> #include <mach/ct-ca9x4.h> -#include <asm/hardware/timer-sp.h> -#include <asm/mach/map.h> #include <asm/mach/time.h>
arch/arm/mach-vexpress/v2m.c +2 -2
@@ -21,6 +21,8 @@#include <linux/regulator/fixed.h> #include <linux/regulator/machine.h> #include <linux/vexpress.h> +#include <clocksource/arm_timer.h> +#include <clocksource/timer-sp.h> #include <asm/arch_timer.h> #include <asm/mach-types.h>
@@ -29,9 +31,7 @@#include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/mach/time.h> -#include <asm/hardware/arm_timer.h> #include <asm/hardware/cache-l2x0.h> -#include <asm/hardware/timer-sp.h> #include <mach/ct-ca9x4.h> #include <mach/motherboard.h>
drivers/clocksource/Kconfig +5 -0
@@ -63,6 +63,11 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK config ARM_ARCH_TIMER bool +config ARM_TIMER_SP804 + bool + select CLKSRC_MMIO + select HAVE_SCHED_CLOCK + config CLKSRC_METAG_GENERIC def_bool y if METAG help
drivers/clocksource/Makefile +1 -0
@@ -22,4 +22,5 @@ obj-$(CONFIG_VT8500_TIMER) += vt8500_timer.o obj-$(CONFIG_CLKSRC_EXYNOS_MCT) += exynos_mct.o obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o +obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o
drivers/clocksource/timer-sp.c new file +191 -0
191 lines not on this page · raw message
include/clocksource/arm_timer.h new file +35 -0
@@ -0,0 +1,35 @@ +#ifndef __CLOCKSOURCE_ARM_TIMER_H +#define __CLOCKSOURCE_ARM_TIMER_H + +/* +* ARM timer implementation, found in Integrator, Versatile and Realview +* platforms. Not all platforms support all registers and bits in these +* registers, so we mark them with A for Integrator AP, C for Integrator +* CP, V for Versatile and R for Realview. +* +* Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview +* can have 16-bit or 32-bit selectable via a bit in the control register. +* +* Every SP804 contains two identical timers. +*/ +#define TIMER_1_BASE 0x00 +#define TIMER_2_BASE 0x20 + +#define TIMER_LOAD 0x00/* ACVR rw */ +#define TIMER_VALUE 0x04/* ACVR ro */ +#define TIMER_CTRL 0x08/* ACVR rw */ +#define TIMER_CTRL_ONESHOT (1 << 0)/* CVR */ +#define TIMER_CTRL_32BIT (1 << 1)/* CVR */ +#define TIMER_CTRL_DIV1 (0 << 2)/* ACVR */ +#define TIMER_CTRL_DIV16 (1 << 2)/* ACVR */ +#define TIMER_CTRL_DIV256 (2 << 2)/* ACVR */ +#define TIMER_CTRL_IE (1 << 5)/* VR */ +#define TIMER_CTRL_PERIODIC (1 << 6)/* ACVR */ +#define TIMER_CTRL_ENABLE (1 << 7)/* ACVR */ + +#define TIMER_INTCLR 0x0c/* ACVR wo */ +#define TIMER_RIS 0x10/* CVR ro */ +#define TIMER_MIS 0x14/* CVR ro */ +#define TIMER_BGLOAD 0x18/* CVR rw */ + +#endif
include/clocksource/timer-sp.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef __TIMER_SP_H +#define __TIMER_SP_H + +void __sp804_clocksource_and_sched_clock_init (void __iomem *, +const char *,int ); + +static inline void sp804_clocksource_init (void __iomem *base,const char *name) +{ +__sp804_clocksource_and_sched_clock_init (base, name,0 ); +} + +static inline void sp804_clocksource_and_sched_clock_init (void __iomem *base, +const char *name) +{ +__sp804_clocksource_and_sched_clock_init (base, name,1 ); +} + +void sp804_clockevents_init (void __iomem *,unsigned int ,const char *); +#endif /* __TIMER_SP_H */
Signature · 1 line
1.7.10.4
Arnd Bergmann
maintainerPATCH v2 1/14 clocksource: move sp timer driver
Hi Haojian,
The patch looks good in principle, but I have two comments:
Quoted 2 lines · Haojian Zhuang
Move ARM SP804 timer driver from
arch/armdirectory intodrivers/clocksourcedirectory.
The patch description should always explain why we do it, not what is being done in here. Something like "all clocksource drivers should get moved there, and this is needed for integrating into the clocksource_of infrastructure.
'
Quoted 9 lines
arch/arm/Kconfig | 5 - arch/arm/common/Makefile | 1 - arch/arm/common/timer-sp.c | 191 ----------------------------- arch/arm/include/asm/hardware/arm_timer.h | 35 ------ arch/arm/include/asm/hardware/timer-sp.h | 15 --- arch/arm/mach-highbank/highbank.c | 4 +- arch/arm/mach-integrator/integrator_ap.c | 2 +- arch/arm/mach-integrator/integrator_cp.c | 4 +- arch/arm/mach-realview/core.c | 4 +-
Quoted 8 lines
arch/arm/mach-versatile/core.c | 4 +- arch/arm/mach-vexpress/ct-ca9x4.c | 5 +- arch/arm/mach-vexpress/v2m.c | 4 +- drivers/clocksource/Kconfig | 5 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-sp.c | 191 +++++++++++++++++++++++++++++ include/clocksource/arm_timer.h | 35 ++++++ include/clocksource/timer-sp.h | 19 +++
Please use 'git format-patch -M' to generate the patches. I just realized I forgot it myself in the spear series.
I have now set 'git config diff.renames true' and would recommend to everybody to do the same.
Arnd
PATCH v2 1/14 clocksource: move sp timer driver
Quoted 31 lines · Arnd Bergmann
Hi Haojian,
The patch looks good in principle, but I have two comments:
Quoted 2 lines · Haojian Zhuang
Move ARM SP804 timer driver from
arch/armdirectory intodrivers/clocksourcedirectory.The patch description should always explain why we do it, not what is being done in here. Something like "all clocksource drivers should get moved there, and this is needed for integrating into the
clocksource_ofinfrastructure.
'Quoted 9 lines
arch/arm/Kconfig | 5 - arch/arm/common/Makefile | 1 - arch/arm/common/timer-sp.c | 191 ----------------------------- arch/arm/include/asm/hardware/arm_timer.h | 35 ------ arch/arm/include/asm/hardware/timer-sp.h | 15 --- arch/arm/mach-highbank/highbank.c | 4 +- arch/arm/mach-integrator/integrator_ap.c | 2 +- arch/arm/mach-integrator/integrator_cp.c | 4 +- arch/arm/mach-realview/core.c | 4 +-Quoted 8 lines
arch/arm/mach-versatile/core.c | 4 +- arch/arm/mach-vexpress/ct-ca9x4.c | 5 +- arch/arm/mach-vexpress/v2m.c | 4 +- drivers/clocksource/Kconfig | 5 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-sp.c | 191 +++++++++++++++++++++++++++++ include/clocksource/arm_timer.h | 35 ++++++ include/clocksource/timer-sp.h | 19 +++
Quoted 7 lines
Please use 'git format-patch -M' to generate the patches. I just realized I forgot it myself in the spear series.
I have now set 'git config diff.renames true' and would recommend to everybody to do the same.
Arnd
This configuration is so good. Thanks a lot.
Regards
Haojian
PATCH v2 1/14 clocksource: move sp timer driver
In reply to Haojian ZhuangYou really should use git diff -M for patches like this..
PATCH v2 2/14 clocksource: sp804: add device tree support
In reply to Haojian ZhuangParse clock & irq from device tree for sp804.
--- drivers/clocksource/timer-sp.c | 105 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+)
drivers/clocksource/timer-sp.c +105 -0
@@ -19,16 +19,23 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/clk.h> +#include <linux/clkdev.h> #include <linux/clocksource.h> #include <linux/clockchips.h> #include <linux/err.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> #include <clocksource/arm_timer.h> +#include <clocksource/timer-sp.h> #include <asm/sched_clock.h> +#define SP804_CLKSRC "sp804 source" +#define SP804_CLKEVT "sp804 event" +static long __init sp804_get_clock_rate (const char *name) {struct clk *clk;
@@ -189,3 +196,101 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,setup_irq (irq, &sp804_timer_irq);clockevents_config_and_register (evt, rate,0xf ,0xffffffff ); } + +static struct device_node *from =NULL ; + +static struct of_device_id sp804_timer_match[]__initdata = { + { .compatible ="arm,sp804" , }, + {} +}; + +static struct clk __init *sp804_dt_init_clk (struct device_node *np,int i, +const char *name) +{ +struct clk_lookup *lookup =NULL ; +struct clk *clk; + + clk =of_clk_get (np, i); +if (IS_ERR (clk)) +return clk; + lookup =clkdev_alloc (clk, name,"sp804" ); +if (!lookup) { +clk_put (clk); +return ERR_PTR (-EINVAL ); + } +clkdev_add (lookup); +return clk; +} + +static void __init sp804_dt_init (void ) +{ +struct device_node *np =NULL ; +struct clk *clksrc =NULL , *clkevt =NULL ; +void __iomem *base; +int retsrc, retevt, i =0 , irq =0 ; +u32 srcoffs =0 , evtoffs =0 ; + + np =of_find_matching_node (from, sp804_timer_match); +WARN_ON (!np); +if (!np) { +pr_err ("Failed to find sp804 timer\n" ); +return ; + } + from = np; +/* check whether timer node is available */ +if (!of_device_is_available (np)) +return ; + + base =of_iomap (np,0 ); +WARN_ON (!base); +if (!base) +return ; + + retsrc =of_property_read_u32 (np,"arm,sp804-clocksource" , &srcoffs); + retevt =of_property_read_u32 (np,"arm,sp804-clockevent" , &evtoffs); +if (retsrc <0 && retevt <0 ) + goto err; + +if (!retsrc) { +if (srcoffs) { +/* TIMER2 is clock source */ + i =1 ; + srcoffs =TIMER_2_BASE ; + }else { +/* TIMER1 is clock source */ + i =0 ; + srcoffs =TIMER_1_BASE ; + } + clksrc =sp804_dt_init_clk (np, i,SP804_CLKSRC ); +if (IS_ERR (clksrc)) + goto err; +sp804_clocksource_and_sched_clock_init (base + srcoffs, +SP804_CLKSRC ); + } +if (!retevt) { +if (evtoffs) { +/* TIMER2 is clock event */ + i =1 ; + evtoffs =TIMER_2_BASE ; + }else { +/* TIMER1 is clock event */ + i =0 ; + evtoffs =TIMER_1_BASE ; + } + irq =irq_of_parse_and_map (np, i); +if (irq <0 ) + goto err_evt; + clkevt =sp804_dt_init_clk (np, i,SP804_CLKEVT ); +if (IS_ERR (clkevt)) + goto err_evt; +sp804_clockevents_init (base + evtoffs, irq,SP804_CLKEVT ); + } + +return ; +err_evt: +if (clksrc) +clk_put (clksrc); +err: +iounmap (base); +} +CLOCKSOURCE_OF_DECLARE (sp804,"arm,sp804" , sp804_dt_init);
Signature · 1 line
1.7.10.4
Arnd Bergmann
maintainerPATCH v2 2/14 clocksource: sp804: add device tree support
Quoted 7 lines · Haojian Zhuang
Parse clock & irq from device tree for sp804.
Signed-off-by Haojian Zhuang <[email protected]>--- drivers/clocksource/timer-sp.c | 105 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+)
The patch looks ok to me, but it need a binding document in Documentation/devicetree/bindings/
Arnd
Arnd Bergmann
maintainerPATCH v2 2/14 clocksource: sp804: add device tree support
In reply to Haojian ZhuangQuoted 2 lines · Haojian Zhuang
drivers/clocksource/timer-sp.c +2
-0+static void __init sp804_dt_init (void ) +{
...
Quoted 2 lines
(quoted diff) +2
-0+ + np = of_find_matching_node(from, sp804_timer_match);
...
Review
Quoted 2 lines
(quoted diff) +2
-0+} +CLOCKSOURCE_OF_DECLARE(sp804, "arm,sp804", sp804_dt_init);
On second thought, I guess it would be nice if we could change the calling conventions for CLOCKSOURCE_OF_DECLARE init functions to always pass the device along. It is a bit silly if we already have the node in clocksource_of_init and then require the init function to call of_find_matching_node(). That change would also make patch 3 in this series unnecessary.
Arnd
PATCH v2 2/14 clocksource: sp804: add device tree support
Quoted 7 lines · Arnd Bergmann
Quoted 2 lines · Haojian Zhuang
drivers/clocksource/timer-sp.c +2
-0+static void __init sp804_dt_init (void ) +{...
Quoted 2 lines
(quoted diff) +2
-0+ + np = of_find_matching_node(from, sp804_timer_match);...
Quoted 10 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+} +CLOCKSOURCE_OF_DECLARE(sp804, "arm,sp804", sp804_dt_init);On second thought, I guess it would be nice if we could change the calling conventions for
CLOCKSOURCE_OF_DECLAREinit functions to always pass the device along. It is a bit silly if we already have the node inclocksource_of_initand then require the init function to callof_find_matching_node(). That change would also make patch 3 in this series unnecessary.
My pull request to you yesterday does this. And I also have similar sp804 patches I'm working on...
Rob
PATCH v2 3/14 clocksource: sp804: append CONFIG_OF
In reply to Haojian Zhuangof_find_matching_node() & of_device_is_available() are depend on CONFIG_OF macro. If CONFIG_OF isn't defined for non-DT mode, the build error occurs.
So add CONFIG_OF for those DT functions.
--- drivers/clocksource/timer-sp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clocksource/timer-sp.c +2 -0
@@ -197,6 +197,7 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,clockevents_config_and_register (evt, rate,0xf ,0xffffffff ); } +#ifdef CONFIG_OF static struct device_node *from =NULL ; static struct of_device_id sp804_timer_match[] __initdata = {
@@ -294,3 +295,4 @@ err: iounmap(base); }CLOCKSOURCE_OF_DECLARE (sp804,"arm,sp804" , sp804_dt_init); +#endif
Signature · 1 line
1.7.10.4
Arnd Bergmann
maintainerPATCH v2 3/14 clocksource: sp804: append CONFIG_OF
(resending this email as I got a few rejects from mailing lists when I accidentally had an invalid email address for Mike)
Quoted 5 lines · Haojian Zhuang
of_find_matching_node()&of_device_is_available()are depend onCONFIG_OFmacro. IfCONFIG_OFisn't defined for non-DT mode, the build error occurs.So add
CONFIG_OFfor those DT functions.
I don't like this patch too much:
We should be able to do this without the #ifdef. The problem is really that the declarations are also hidden behind an #ifdef. I think we should change the linux/of.h header file to either provide alternative empty inline functions or at least leave the declarations visible so we can compile the code as long as the call gets discarded.
drivers/clocksource/timer-sp.c err: · line 298
Quoted 10 lines
drivers/clocksource/timer-sp.c +2
-0+#ifdef CONFIG_OF static struct device_node *from =NULL ; static struct of_device_id sp804_timer_match[] __initdata = {@@ -294,3 +295,4 @@ err: iounmap(base); }CLOCKSOURCE_OF_DECLARE (sp804,"arm,sp804" , sp804_dt_init); +#endif
There is actually an empty definition for CLOCKSOURCE_OF_DECLARE(), but I think it would be better to still define it the same way as with CONFIG_OF enabled but attribute((__unused__)), like:
#ifdef CONFIG_CLKSRC_OF
extern void clocksource_of_init(void);
#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
static const struct of_device_id __clksrc_of_table_##name \
__used __section(__clksrc_of_table) \
= { .compatible = compat, .data = fn };
#else
static inline void clocksource_of_init(void) {}
#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
static const struct of_device_id __clksrc_of_table_##name \
__unused = { .compatible = compat, .data = fn };#endif
This way, all the code still gets built, but since there is nothing pointing to __clksrc_of_table_##name and it is marked __unused, it gets dropped along with all other symbols that are only referenced from it.
Arnd
PATCH v2 3/14 clocksource: sp804: append CONFIG_OF
Quoted 44 lines · Arnd Bergmann
(resending this email as I got a few rejects from mailing lists when I accidentally had an invalid email address for Mike)
Quoted 5 lines · Haojian Zhuang
of_find_matching_node()&of_device_is_available()are depend onCONFIG_OFmacro. IfCONFIG_OFisn't defined for non-DT mode, the build error occurs.So add
CONFIG_OFfor those DT functions.I don't like this patch too much:
We should be able to do this without the #ifdef. The problem is really that the declarations are also hidden behind an #ifdef. I think we should change the
linux/of.hheader file to either provide alternative empty inline functions or at least leave the declarations visible so we can compile the code as long as the call gets discarded.drivers/clocksource/timer-sp.c err: · line 298
Quoted 10 lines
drivers/clocksource/timer-sp.c +2
-0+#ifdef CONFIG_OF static struct device_node *from =NULL ; static struct of_device_id sp804_timer_match[] __initdata = {@@ -294,3 +295,4 @@ err: iounmap(base); }CLOCKSOURCE_OF_DECLARE (sp804,"arm,sp804" , sp804_dt_init); +#endif There is actually an empty definition for
CLOCKSOURCE_OF_DECLARE(), but I think it would be better to still define it the same way as withCONFIG_OFenabled but attribute((__unused__)), like:#ifdef
CONFIG_CLKSRC_OF
extern voidclocksource_of_init(void);#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ static const struct of_device_id __clksrc_of_table_##name \ __used __section(__clksrc_of_table) \ = { .compatible = compat, .data = fn }; #else static inline void clocksource_of_init(void) {} #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ static const struct of_device_id __clksrc_of_table_##name \ __unused = { .compatible = compat, .data = fn };
Quoted 9 lines
#endif
This way, all the code still gets built, but since there is nothing pointing to __clksrc_of_table_##name and it is marked
__unused, it gets dropped along with all other symbols that are only referenced from it.Arnd
If CONFIG_CLKSRC_OF is depend on CONFIG_USEOF, I think that we can resolve all these issue. We don't need to define CLOCKSOURCE_OF_DECLARE() for non-DT mode, and we also don't need to define of_device_is_available(), ... in non-DT mode.
We only need to add "depends on USE_OF" for CLKSRC_OF configuration. It's simpler. What's your opinion?
Regards
Haojian
Arnd Bergmann
maintainerPATCH v2 3/14 clocksource: sp804: append CONFIG_OF
Quoted 8 lines · Haojian Zhuang
If
CONFIG_CLKSRC_OFis depend onCONFIG_USEOF, I think that we can resolve all these issue. We don't need to defineCLOCKSOURCE_OF_DECLARE()for non-DT mode, and we also don't need to defineof_device_is_available(), ... in non-DT mode.We only need to add "depends on
USE_OF" forCLKSRC_OFconfiguration. It's simpler. What's your opinion?
I think that is not the right symbol. USE_OF is an ARM specific symbol that should not get selected from common code. Also I think 'depends on' is much better than 'select', because it has fewer side-effects.
Right now, CLKSRC_OF is only selected by platforms that also select USE_OF on ARM, which seems appropriate for now, but if we want to make CLKSRC_OF a generally visible option, it should use 'depends on OF'.
What I don't understand is how that relates to my comment on your code. My goal was to support drivers that can contain all the code needed for CLKSRC_OF without any #ifdef but that still work if CONFIG_OF and CONFIG_CLKSRC_OF are both disabled.
Arnd
PATCH v2 4/14 ARM: highbank: use clocksource_of_init for sp804
In reply to Haojian ZhuangSince sp804 hardware information could be stored in DTS file, remove those ioremap operations. Use clocksource_of_init() instead.
--- arch/arm/boot/dts/ecx-common.dtsi | 4 +++- arch/arm/mach-highbank/highbank.c | 19 +------------------ 2 files changed, 4 insertions(+), 19 deletions(-)
arch/arm/boot/dts/ecx-common.dtsi +3 -1
@@ -105,8 +105,10 @@ compatible = "arm,sp804", "arm,primecell"; reg = <0xfff34000 0x1000>; interrupts = <0 18 4>; - clocks = <&pclk>; + clocks = <&pclk &pclk>; clock-names = "apb_pclk"; + arm,sp804-clocksource = <0x20>; + arm,sp804-clockevent = <0>; }; rtc at fff35000 {
arch/arm/mach-highbank/highbank.c +1 -18
@@ -91,33 +91,16 @@ static void __init highbank_init_irq(void)#endif } -static struct clk_lookup lookup = { - .dev_id ="sp804" , - .con_id =NULL , -}; -static void __init highbank_timer_init (void ) { -int irq;struct device_node *np; -void __iomem *timer_base;/* Map system registers */ np =of_find_compatible_node (NULL ,NULL ,"calxeda,hb-sregs" ); sregs_base =of_iomap (np,0 );WARN_ON (!sregs_base); - np =of_find_compatible_node (NULL ,NULL ,"arm,sp804" ); - timer_base =of_iomap (np,0 ); -WARN_ON (!timer_base); - irq =irq_of_parse_and_map (np,0 ); - -of_clk_init (NULL ); - lookup.clk =of_clk_get (np,0 ); -clkdev_add (&lookup); - -sp804_clocksource_and_sched_clock_init (timer_base +0x20 ,"timer1" ); -sp804_clockevents_init (timer_base, irq,"timer0" ); +clocksource_of_init ();twd_local_timer_of_register ();
Signature · 1 line
1.7.10.4
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
In reply to Haojian ZhuangRemove all code to parse sp804 in integrator platform driver. Use clocksource_of_init() instead since these code are implemented in sp804 driver already.
--- arch/arm/boot/dts/integrator.dtsi | 3 +++ arch/arm/boot/dts/integratorap.dts | 15 +++++------ arch/arm/boot/dts/integratorcp.dts | 9 +++---- arch/arm/mach-integrator/Kconfig | 3 +++ arch/arm/mach-integrator/integrator_ap.c | 41 +----------------------------- arch/arm/mach-integrator/integrator_cp.c | 35 ++----------------------- 6 files changed, 20 insertions(+), 86 deletions(-)
arch/arm/boot/dts/integrator.dtsi +3 -0
@@ -9,18 +9,21 @@ reg = <0x13000000 0x100>; interrupt-parent = <&pic>; interrupts = <5>; + status = "disabled"; }; timer at 13000100 { reg = <0x13000100 0x100>; interrupt-parent = <&pic>; interrupts = <6>; + status = "disabled"; }; timer at 13000200 { reg = <0x13000200 0x100>; interrupt-parent = <&pic>; interrupts = <7>; + status = "disabled"; }; pic at 14000000 {
arch/arm/boot/dts/integratorap.dts +7 -8
@@ -9,11 +9,6 @@ model = "ARM Integrator/AP"; compatible = "arm,integrator-ap"; - aliases { - arm,timer-primary = &timer2; - arm,timer-secondary = &timer1; - }; - chosen { bootargs = "root=/dev/ram0 console=ttyAM0,38400n8 earlyprintk"; };
@@ -24,15 +19,19 @@ }; timer0: timer at 13000000 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; }; timer1: timer at 13000100 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clockevent = <0>; + status = "ok"; }; timer2: timer at 13000200 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clocksource = <0>; + status = "ok"; }; pic: pic at 14000000 {
arch/arm/boot/dts/integratorcp.dts +4 -5
@@ -9,11 +9,6 @@ model = "ARM Integrator/CP"; compatible = "arm,integrator-cp"; - aliases { - arm,timer-primary = &timer2; - arm,timer-secondary = &timer1; - }; - chosen { bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk"; };
@@ -29,10 +24,14 @@ timer1: timer at 13000100 { compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clockevent = <0>; + status = "ok"; }; timer2: timer at 13000200 { compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clocksource = <0>; + status = "ok"; }; pic: pic at 14000000 {
arch/arm/mach-integrator/Kconfig +3 -0
@@ -5,6 +5,7 @@ menu "Integrator Options" config ARCH_INTEGRATOR_AP bool "Support Integrator/AP and Integrator/PP2 platforms" select CLKSRC_MMIO + select CLKSRC_OF select MIGHT_HAVE_PCI select SERIAL_AMBA_PL010 select SERIAL_AMBA_PL010_CONSOLE
@@ -15,6 +16,8 @@ config ARCH_INTEGRATOR_AP config ARCH_INTEGRATOR_CP bool "Support Integrator/CP platform" + select CLKSRC_MMIO + select CLKSRC_OF select ARCH_CINTEGRATOR select ARM_TIMER_SP804 select PLAT_VERSATILE_CLCD
arch/arm/mach-integrator/integrator_ap.c +1 -40
53 lines not on this page · raw message
arch/arm/mach-integrator/integrator_cp.c +2 -33
@@ -28,6 +28,7 @@#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/sys_soc.h> +#include <linux/clocksource.h> #include <clocksource/arm_timer.h> #include <clocksource/timer-sp.h>
@@ -251,38 +252,6 @@ static void __init intcp_init_early(void)#ifdef CONFIG_OF -static void __init cp_of_timer_init (void ) -{ -struct device_node *node; -const char *path; -void __iomem *base; -int err; -int irq; - - err =of_property_read_string (of_aliases, -"arm,timer-primary" , &path); -if (WARN_ON (err)) -return ; - node =of_find_node_by_path (path); - base =of_iomap (node,0 ); -if (WARN_ON (!base)) -return ; -writel (0 , base +TIMER_CTRL ); -sp804_clocksource_init (base, node->name); - - err =of_property_read_string (of_aliases, -"arm,timer-secondary" , &path); -if (WARN_ON (err)) -return ; - node =of_find_node_by_path (path); - base =of_iomap (node,0 ); -if (WARN_ON (!base)) -return ; - irq =irq_of_parse_and_map (node,0 ); -writel (0 , base +TIMER_CTRL ); -sp804_clockevents_init (base, irq, node->name); -} -static const struct of_device_id fpga_irq_of_match[]__initconst = { { .compatible ="arm,versatile-fpga-irq" , .data = fpga_irq_of_init, }, { /* Sentinel */ }
@@ -386,7 +355,7 @@ DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)") .init_early = intcp_init_early, .init_irq = intcp_init_irq_of, .handle_irq = fpga_handle_irq, - .init_time = cp_of_timer_init, + .init_time = clocksource_of_init, .init_machine = intcp_init_of, .restart = integrator_restart, .dt_compat = intcp_dt_board_compat,
Signature · 1 line
1.7.10.4
Arnd Bergmann
maintainerPATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 10 lines · Haojian Zhuang
arch/arm/boot/dts/integratorcp.dts +0
-5- aliases { - arm,timer-primary = &timer2; - arm,timer-secondary = &timer1; - }; - chosen { bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk"; };
arch/arm/boot/dts/integratorcp.dts line 29
Quoted 6 lines
arch/arm/boot/dts/integratorcp.dts +2
-0@@ -29,10 +24,14 @@ timer1: timer at 13000100 { compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clockevent = <0>; + status = "ok"; };
I would prefer to keep the old way of doing this. The "aliases" node is meant for configuration, while the timer device itself should not care whether it is used as a clockevent or clocksource or some other device.
We could probably change the identifiers in the aliases to "linux,clocksource" and "linux,clockevents" instead of "arm,timer-primary" and "arm,timer-secondary".
Arnd
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 22 lines · Arnd Bergmann
Quoted 10 lines · Haojian Zhuang
arch/arm/boot/dts/integratorcp.dts +0
-5- aliases { - arm,timer-primary = &timer2; - arm,timer-secondary = &timer1; - }; - chosen { bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk"; };arch/arm/boot/dts/integratorcp.dts line 29
Quoted 6 lines
arch/arm/boot/dts/integratorcp.dts +2
-0@@ -29,10 +24,14 @@ timer1: timer at 13000100 { compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clockevent = <0>; + status = "ok"; };I would prefer to keep the old way of doing this. The "aliases" node is meant for configuration, while the timer device itself should not care whether it is used as a clockevent or clocksource or some other device.
Quoted 5 lines
We could probably change the identifiers in the aliases to "linux,clocksource" and "linux,clockevents" instead of "arm,timer-primary" and "arm,timer-secondary".
Arnd
SP804 is a dual timer. Either TIMER1 or TIMER2 in the same SP804 could be configured as clock source. And either TIMER1 or TIMER2 in the same SP804 could be configured as clock event.
Integratorap/cp is always using TIMER1 of SP804-A as clocksource, and TIMER1 of SP804-B as clockevent. This usage case always drop TIMER2 usage.
I tried to add arm,sp804-clocksource to specify whether TIMER1 or TIMER2 is configured as clocksource. For example, realview is using TIMER2 of SP804-B as clockevent and TIMER1 of SP804-A as clocksource.
If we decide to support the property like "arm,sp804-clocksource", we could get the TIMER offset & clock source information at the same time. Then alias configuration is duplicated.
If we decide to support alais configuration like "linux,clocksource", we could get clock source/event information. But we don't know which TIMER is used in the same SP804. We still need one property to identify it. And people are also using both TIMERs in the same SP804, like vexpress v2m.
Which method do we choose?
Regards
Haojian
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
In reply to Arnd BergmannQuoted 8 lines · Arnd Bergmann
arch/arm/boot/dts/integratorap.dts line 29
Quoted 5 lines · Haojian Zhuang
timer1: timer at 13000100 { compatible = "arm,sp804", "arm,primecell";arch/arm/boot/dts/integratorap.dts +2
-0+ arm,sp804-clockevent = <0>; + status = "ok"; };
Quoted 7 lines
I would prefer to keep the old way of doing this. The "aliases" node is meant for configuration, while the timer device itself should not care whether it is used as a clockevent or clocksource or some other device.
We could probably change the identifiers in the aliases to "linux,clocksource" and "linux,clockevents" instead of "arm,timer-primary" and "arm,timer-secondary".
I named it like that exactly to be OS-neutral.
The idea is that what timer is to be used for primary and secondary may have implications on things like power consumption and one timer may be broken in the HW etc. That is not a Linux-specific thing.
A bit hard to do things right here :-/
Yours,
Linus Walleij
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
In reply to Haojian ZhuangQuoted 32 lines · Haojian Zhuang
Remove all code to parse sp804 in integrator platform driver. Use
clocksource_of_init()instead since these code are implemented in sp804 driver already.Signed-off-by Haojian Zhuang <[email protected]>--- arch/arm/boot/dts/integrator.dtsi | 3 +++ arch/arm/boot/dts/integratorap.dts | 15 +++++------ arch/arm/boot/dts/integratorcp.dts | 9 +++---- arch/arm/mach-integrator/Kconfig | 3 +++ arch/arm/mach-integrator/integrator_ap.c | 41 +----------------------------- arch/arm/mach-integrator/integrator_cp.c | 35 ++----------------------- 6 files changed, 20 insertions(+), 86 deletions(-)arch/arm/boot/dts/integratorap.dts +0
-5@@ -9,11 +9,6 @@ model = "ARM Integrator/AP"; compatible = "arm,integrator-ap"; - aliases { - arm,timer-primary = &timer2; - arm,timer-secondary = &timer1; - }; - chosen { bootargs = "root=/dev/ram0 console=ttyAM0,38400n8 earlyprintk"; };
arch/arm/boot/dts/integratorap.dts line 22
Quoted 5 lines
arch/arm/boot/dts/integratorap.dts +1
-1@@ -24,15 +19,19 @@ }; timer0: timer at 13000000 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell";
You are breaking existing dtb's changing this, but this is wrong for other reasons. The integrator does not have an SP804. It is the same programming model, but is a single timer and not the dual timer. So having a different compatible string is the correct way. I doubt it has the primecell ID registers which is what "arm,primecell" indicates.
arch/arm/boot/dts/integratorap.dts line 27
Quoted 6 lines
arch/arm/boot/dts/integratorap.dts +2
-1}; timer1: timer at 13000100 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clockevent = <0>;
I don't like this nor the old way with aliases. We should describe the h/w features of the timer to determine what to use it for. AFAICT, all 3 timers are identical on integrator and it does not matter which one Linux picks for clocksource vs. clockevent.
Rob
Arnd Bergmann
maintainerPATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 7 lines · Rob Herring
On 03/12/2013 12:08 PM, Haojian Zhuang wrote:
You are breaking existing dtb's changing this, but this is wrong for other reasons. The integrator does not have an SP804. It is the same programming model, but is a single timer and not the dual timer. So having a different compatible string is the correct way. I doubt it has the primecell ID registers which is what "arm,primecell" indicates.
At least the qemu model has the primecell ID only for actual sp804 but not for the integrator, see http://git.qemu.org/?p=qemu.git;a=blob;f=hw/arm_timer.c
Quoted 11 lines
arch/arm/boot/dts/integratorap.dts line 27
Quoted 6 lines
arch/arm/boot/dts/integratorap.dts +2
-1}; timer1: timer at 13000100 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clockevent = <0>;I don't like this nor the old way with aliases. We should describe the h/w features of the timer to determine what to use it for. AFAICT, all 3 timers are identical on integrator and it does not matter which one Linux picks for clocksource vs. clockevent.
Interesting point. I remember we had a discussion about this when the initial binding integrator code was merged, but I don't remember what the intent was for doing it like this. Probably just minimizing the changes to the existing code.
Arnd
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 11 lines · Arnd Bergmann
Quoted 7 lines · Rob Herring
On 03/12/2013 12:08 PM, Haojian Zhuang wrote:
You are breaking existing dtb's changing this, but this is wrong for other reasons. The integrator does not have an SP804. It is the same programming model, but is a single timer and not the dual timer. So having a different compatible string is the correct way. I doubt it has the primecell ID registers which is what "arm,primecell" indicates.
At least the qemu model has the primecell ID only for actual sp804 but not for the integrator, see http://git.qemu.org/?p=qemu.git;a=blob;f=hw/arm_timer.c
Right. I think I added that to qemu...
Since the primecell ID registers are defined to be at 0xFF? offset, it is quite impossible for the integrator timers to have the ID registers within their 0x100 address space.
Quoted 13 lines
Quoted 12 lines
arch/arm/boot/dts/integratorap.dts line 27
Quoted 7 lines
arch/arm/boot/dts/integratorap.dts +2
-1}; timer1: timer at 13000100 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clockevent = <0>;I don't like this nor the old way with aliases. We should describe the h/w features of the timer to determine what to use it for. AFAICT, all 3 timers are identical on integrator and it does not matter which one Linux picks for clocksource vs. clockevent.
Quoted 4 lines
Interesting point. I remember we had a discussion about this when the initial binding integrator code was merged, but I don't remember what the intent was for doing it like this. Probably just minimizing the changes to the existing code.
Re-reading the thread on this for Integrator, I don't think any conclusion was really made, but it got merged. I don't think we should
a) change the existing alias names or b) expand their usage. OMAP is a good example of lots of timers and using h/w properties to select particular instances based on properties. I think on the ARM boards the selection has been pretty arbitrary. I traced the commit history back for the timer code and could not find any evidence to the contrary except on VExpress which has broken sp804 on the core tile.
Another part is sched_clock selection. I use the sp804 on highbank, but the ARM boards have their 24MHz counter. Also, if I'm on midway, then I want to use the arch timers even though the sp804 is still there. My sched_clock patches yesterday attempt to address that. Any comments on what characteristics should be used to select timer would be helpful. Higher frequency and/or bits is better, but to what limit in frequency?
Rob
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 8 lines · Rob Herring
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Rob Herring
On 03/12/2013 12:08 PM, Haojian Zhuang wrote:
Since the primecell ID registers are defined to be at
0xFF? offset, it is quite impossible for the integrator timers to have the ID registers within their0x100address space.
I'm sorry that I don't know this. I can add "arm,integrator-timer" into compatible table of sp804 driver. I think that we could resolve this issue. What's your opinion?
Quoted 36 lines
Quoted 13 lines
Quoted 8 lines
arch/arm/boot/dts/integratorap.dts line 27
Quoted 7 lines
}; timer1: timer at 13000100 {arch/arm/boot/dts/integratorap.dts +2
-1- compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clockevent = <0>;Quoted 4 lines
I don't like this nor the old way with aliases. We should describe the h/w features of the timer to determine what to use it for. AFAICT, all 3 timers are identical on integrator and it does not matter which one Linux picks for clocksource vs. clockevent.
Quoted 4 lines
Interesting point. I remember we had a discussion about this when the initial binding integrator code was merged, but I don't remember what the intent was for doing it like this. Probably just minimizing the changes to the existing code.
Re-reading the thread on this for Integrator, I don't think any conclusion was really made, but it got merged. I don't think we should
a) change the existing alias names or b) expand their usage. OMAP is a good example of lots of timers and using h/w properties to select particular instances based on properties. I think on the ARM boards the selection has been pretty arbitrary. I traced the commit history back for the timer code and could not find any evidence to the contrary except on VExpress which has broken sp804 on the core tile.Another part is
sched_clockselection. I use the sp804 on highbank, but the ARM boards have their 24MHz counter. Also, if I'm on midway, then I want to use the arch timers even though the sp804 is still there. Mysched_clockpatches yesterday attempt to address that. Any comments on what characteristics should be used to select timer would be helpful. Higher frequency and/or bits is better, but to what limit in frequency?Rob
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 5 lines · Haojian Zhuang
Quoted 4 lines · Rob Herring
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Rob Herring
On 03/12/2013 12:08 PM, Haojian Zhuang wrote:
Quoted 7 lines
Quoted 4 lines
Since the primecell ID registers are defined to be at
0xFF? offset, it is quite impossible for the integrator timers to have the ID registers within their0x100address space.I'm sorry that I don't know this. I can add "arm,integrator-timer" into compatible table of sp804 driver. I think that we could resolve this issue. What's your opinion?
As per the other discussion:
The Integrator/AP has a timer which is different from the SP804.
The Integrator/CP has an SP804.
Please restrict the patch set to Integrator/CP.
Yours,
Linus Walleij
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 17 lines · Linus Walleij
Quoted 5 lines · Haojian Zhuang
Quoted 4 lines · Rob Herring
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Rob Herring
On 03/12/2013 12:08 PM, Haojian Zhuang wrote:
Quoted 7 lines
Quoted 4 lines
Since the primecell ID registers are defined to be at
0xFF? offset, it is quite impossible for the integrator timers to have the ID registers within their0x100address space.I'm sorry that I don't know this. I can add "arm,integrator-timer" into compatible table of sp804 driver. I think that we could resolve this issue. What's your opinion?
As per the other discussion:
Quoted 8 lines
The Integrator/AP has a timer which is different from the SP804.
The Integrator/CP has an SP804.
Please restrict the patch set to Integrator/CP.
Yours,
Linus Walleij
According to Rob's comment, I thought that only prime-cell ID registers are not contained in integrator-timer controller.
Yes, I missed to include lookup to handle integrator-ap timer. I think that we can use a string name that are binded to different compatible name. Code is in below.
#define SP804_TIMER 0
#define INTEGRATOR_TIMER 1
#define ID_BUF_SIZE 16
match table:
{.compatible = "arm,sp804", .data = SP804_TIMER, }, {.compaitlbe = "arm,integrator-timer", .data = INTEGRATOR_TIMER, },
sp804_get_clock_rate():
char dev_id_buf[ID_BUF_SIZE];
if (match->data)
snprintf(dev_id_buf, ID_BUF_SIZE, "ap_timer");
else
snprintf(dev_id_buf, ID_BUF_SIZE, "sp804");
clk = clk_get_sys(dev_id_buf, name);sp804_dt_init_clk():
char dev_id_buf[ID_BUF_SIZE];
if (match->data)
snprintf(dev_id_buf, ID_BUF_SIZE, "ap_timer");
else
snprintf(dev_id_buf, ID_BUF_SIZE, "sp804");
lookup = clkdev_alloc(clk, name, dev_id_buf);I think it won't break out code any more. Since most code are same, we could handle it in the same driver.
Regards
Haojian
Arnd Bergmann
maintainerPATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 20 lines · Haojian Zhuang
match table:
{.compatible = "arm,sp804", .data =SP804_TIMER, }, {.compaitlbe = "arm,integrator-timer", .data =INTEGRATOR_TIMER, },
sp804_get_clock_rate():char dev_id_buf[ID_BUF_SIZE]; if (match->data) snprintf(dev_id_buf, ID_BUF_SIZE, "ap_timer"); else snprintf(dev_id_buf, ID_BUF_SIZE, "sp804"); clk = clk_get_sys(dev_id_buf, name);
sp804_dt_init_clk():char dev_id_buf[ID_BUF_SIZE]; if (match->data) snprintf(dev_id_buf, ID_BUF_SIZE, "ap_timer"); else snprintf(dev_id_buf, ID_BUF_SIZE, "sp804"); lookup = clkdev_alloc(clk, name, dev_id_buf);
Quoted 3 lines
I think it won't break out code any more. Since most code are same, we could handle it in the same driver.
The data member of struct of_device_id is a pointer, you could point that directly to a const string containing the name, if that is the only difference, or to another structure that describes the other parameters.
Arnd
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
In reply to Haojian ZhuangQuoted 6 lines · Haojian Zhuang
Quoted 1 line · Linus Walleij
Please restrict the patch set to Integrator/CP.
According to Rob's comment, I thought that only prime-cell ID registers are not contained in integrator-timer controller.
No, you have missed the most important aspect of all.
The Integrator/AP timer is only 16 bit. Look:
static void integrator_clocksource_init(unsigned long inrate,
void __iomem *base)
{
(...)
clocksource_mmio_init(base + TIMER_VALUE, "timer2", rate, 200, 16, clocksource_mmio_readl_down);
(...)
}
Compare:
void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
const char *name, int use_sched_clock)
{
(...)
clocksource_mmio_init(base + TIMER_VALUE, name, rate, 200, 32, clocksource_mmio_readl_down);
(...)
}
I had the idea of merging the drivers in the past so I'm positive to the change from a larger perspective. But then you also have to take the bit-width precision into account.
If you apply the patch, the Integrator/AP will appear to work, then if you leave it dormant until the counter wraps around it will hang or screw up the timeline.
Another part of the problem I see is that the code in the SP804 driver is lacking features found in the code for the driver inside integrator_ap.c, I detail these below...
Quoted 3 lines
Yes, I missed to include lookup to handle integrator-ap timer. I think that we can use a string name that are binded to different compatible name. Code is in below.
(...)
Quoted 8 lines
sp804_get_clock_rate():char dev_id_buf[ID_BUF_SIZE]; if (match->data) snprintf(dev_id_buf, ID_BUF_SIZE, "ap_timer"); else snprintf(dev_id_buf, ID_BUF_SIZE, "sp804"); clk = clk_get_sys(dev_id_buf, name);
Quoted 7 lines
sp804_dt_init_clk():char dev_id_buf[ID_BUF_SIZE]; if (match->data) snprintf(dev_id_buf, ID_BUF_SIZE, "ap_timer"); else snprintf(dev_id_buf, ID_BUF_SIZE, "sp804"); lookup = clkdev_alloc(clk, name, dev_id_buf);
If this is what you want to attain, I think it would be better to just patch the clock lookups in drivers/clk/clk-integrator.c and rename the "ap_timer" lookup to "sp804" and skip all the above.
Quoted 2 lines
I think it won't break out code any more. Since most code are same, we could handle it in the same driver.
So it will definately break stuff. Being 16bit is not all, here are other differences:
static u32 notrace integrator_read_sched_clock(void)
{
return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE);
}static void integrator_clocksource_init(unsigned long inrate,
void __iomem *base)
{
(...)
setup_sched_clock(integrator_read_sched_clock, 16, rate); }
Since you do not call even integrator_clocksource_init() anymore after this, you are breaking sched_clock() for the Integrator/AP. The SP804 doesn't even have a sched_clock option.
You make it fall back to using jiffies.
So you would have to add this to the SP804 driver, and make sure sched_clock() is registered for the "arm,integrator" compatible string.
Then the Integrator/AP timer has this code in theintegrator_clockevent_init() function:
clkevt_base = base;
/* Calculate and program a divisor */
if (rate > 0x100000 * HZ) {
rate /= 256;
ctrl |= TIMER_CTRL_DIV256;
} else if (rate > 0x10000 * HZ) {
rate /= 16;
ctrl |= TIMER_CTRL_DIV16;
}It appears the SP804 has no code to handle this divisor/prescaler at all. Which means that you regress the Integrator/AP again.
It appears (from arm_timer.h) that the SP804 actually has this prescaler, but then first make a separate patch to make the SP804 driver use that divisor (like above) so you don't degrade the quality of the AP timer. The prescaler make it possible to let the system sleep for longer times when using NO_HZ so it's *pretty* important (and it will increas the quality of all SP804-based machines as well).
As you surely understand, since the counter on the Integrator/AP is only 16 bit this is very important, since we don't want it to wake up too often.
Then the clocksource init function has this:
if (rate >= 1500000) {
rate /= 16;
ctrl |= TIMER_CTRL_DIV16;
}Here I'm more uncertain. As I know from extensive discussions with John and Thomas, there are many many factors to decide the clocksource. Basically the above lines limits the precision of the clocksource in exchange for a longer time until wrap-around. Again, the 16bit nature of the Integrator/AP timer is a factor here.
Yours,
Linus Walleij
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 36 lines · Linus Walleij
Then the Integrator/AP timer has this code in the
integrator_clockevent_init()function:clkevt_base = base; /* Calculate and program a divisor */ if (rate > 0x100000 * HZ) { rate /= 256; ctrl |= TIMER_CTRL_DIV256; } else if (rate > 0x10000 * HZ) { rate /= 16; ctrl |= TIMER_CTRL_DIV16; }It appears the SP804 has no code to handle this divisor/prescaler at all. Which means that you regress the Integrator/AP again.
It appears (from
arm_timer.h) that the SP804 actually has this prescaler, but then first make a separate patch to make the SP804 driver use that divisor (like above) so you don't degrade the quality of the AP timer. The prescaler make it possible to let the system sleep for longer times when usingNO_HZso it's *pretty* important (and it will increas the quality of all SP804-based machines as well).As you surely understand, since the counter on the Integrator/AP is only 16 bit this is very important, since we don't want it to wake up too often.
Then the clocksource init function has this:
if (rate >= 1500000) { rate /= 16; ctrl |= TIMER_CTRL_DIV16; }
Quoted 6 lines
Here I'm more uncertain. As I know from extensive discussions with John and Thomas, there are many many factors to decide the clocksource. Basically the above lines limits the precision of the clocksource in exchange for a longer time until wrap-around. Again, the 16bit nature of the Integrator/AP timer is a factor here.
Integrator/AP selects the prescaler based on the fact that it is only a 16-bit counter, which has to be clocked at a rate which gives us our desired periodic tick interval.
SP804 does not do this because, being a 32-bit counter, it is completely unnecessary to use the prescaler - and using the prescaler will result in loss of fine-grained timing accuracy. Making use of the prescaler there is absurd - the timer will run to 4000 odd seconds before wrapping with a prescaler of 1.
You end up needing 64-bit arithmetic if you try to apply the Integrator/AP logic to SP804 - it becomes this:
if (rate > 0x1000000000 * HZ) {
rate /= 256;
ctrl |= TIMER_CTRL_DIV256;
} else if (rate > 0x100000000 * HZ) {
rate /= 16;
ctrl |= TIMER_CTRL_DIV16;
}
or more precisely:
if (rate > HZ * 0x100 * ((unsigned long long)wrap + 1)) {...
} else if (rate > HZ * 0x10 * ((unsigned long long)wrap + 1)) {
...
You need that wrap value anyway for clockevents_config_and_register.
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
Quoted 3 lines · Russell King - ARM Linux
Integrator/AP selects the prescaler based on the fact that it is only a 16-bit counter, which has to be clocked at a rate which gives us our desired periodic tick interval.
Ah! I knew there was some simple explanation behind this.
Thanks Russell!
Linus Walleij
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
In reply to Linus WalleijQuoted 15 lines · Linus Walleij
Quoted 5 lines · Haojian Zhuang
Quoted 4 lines · Rob Herring
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Rob Herring
On 03/12/2013 12:08 PM, Haojian Zhuang wrote:
Quoted 7 lines
Quoted 4 lines
Since the primecell ID registers are defined to be at
0xFF? offset, it is quite impossible for the integrator timers to have the ID registers within their0x100address space.I'm sorry that I don't know this. I can add "arm,integrator-timer" into compatible table of sp804 driver. I think that we could resolve this issue. What's your opinion?
Quoted 5 lines
As per the other discussion:
The Integrator/AP has a timer which is different from the SP804.
The Integrator/CP has an SP804.
Not quite. I was wrong that they are the same, The AP has 16-bit timers and the CP has 32-bit timers. While the individual timer on the AP is the same programming model as the sp804, it is still not the sp804 block.
Rob
Quoted 6 lines
Please restrict the patch set to Integrator/CP.
Yours,
Linus Walleij
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
In reply to Arnd BergmannQuoted 11 lines · Arnd Bergmann
Quoted 7 lines · Rob Herring
On 03/12/2013 12:08 PM, Haojian Zhuang wrote:
You are breaking existing dtb's changing this, but this is wrong for other reasons. The integrator does not have an SP804. It is the same programming model, but is a single timer and not the dual timer. So having a different compatible string is the correct way. I doubt it has the primecell ID registers which is what "arm,primecell" indicates.
At least the qemu model has the primecell ID only for actual sp804 but not for the integrator, see http://git.qemu.org/?p=qemu.git;a=blob;f=hw/arm_timer.c
That is the for the Integrator/CP model right?
Part of the problem with the current patch series is assuming similarity between the Integrator/AP and Integrator/CP.
The hardware (VHDL code) for the Integrator/CP SP804 block is certainly based on the Integrator/AP (unnamed "integrator timer") but many changes were made, the most drastic extending the counters from 16 to 32 bits.
Yours,
Linus Walleij
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
In reply to Rob HerringQuoted 3 lines · Rob Herring
You are breaking existing dtb's changing this, but this is wrong for other reasons. The integrator does not have an SP804. It is the same programming model,
No, it is not the same programming model. It is a subset of the model. Integrator/AP is only 16-bit, and needs to have a prescaler configured according to the clockrate. Integrator/CP and later platforms have SP804, which looks the same, but is 32-bit instead.
If you look at arch/arm/include/asm/hardware/arm_timer.h, you will see that I fully documented what registers and bits are present on each platform of AP, CP, Versatile/AB,PB and Realview.
Note that even through the CP and Versatile platforms are both called SP804, there are subtle differences between the implementations.
PATCH v2 5/14 ARM: integrator: use clocksource_of_init for sp804
In reply to Haojian ZhuangQuoted 3 lines · Haojian Zhuang
Remove all code to parse sp804 in integrator platform driver. Use
clocksource_of_init()instead since these code are implemented in sp804 driver already.
(...)
Quoted 10 lines
arch/arm/boot/dts/integratorap.dts +2
-2timer0: timer at 13000000 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; }; timer1: timer at 13000100 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell";
arch/arm/boot/dts/integratorap.dts line 35
Quoted 10 lines
arch/arm/boot/dts/integratorap.dts +5
-1+ arm,sp804-clockevent = <0>; + status = "ok"; }; timer2: timer at 13000200 { - compatible = "arm,integrator-timer"; + compatible = "arm,sp804", "arm,primecell"; + arm,sp804-clocksource = <0>; + status = "ok"; };
This is wrong. The Integrator/AP timer is not an SP804. It may look similar but it's a totally different kind of beast.
What is needed is to break out the timer code from integrator_ap.c and move it to drivers/clocksource, but wait with that until you fixed the SP804 in the Integrator/CP, which is probably what you want to prioritize.
(...)
Quoted 2 lines
arch/arm/mach-integrator/Kconfig +0
-0
(...)
arch/arm/mach-integrator/Kconfig
Quoted 11 lines
arch/arm/mach-integrator/Kconfig +0
-11-static void __init ap_of_timer_init(void) -{ - struct device_node *node; - const char *path; - void __iomem *base; - int err; - int irq; - struct clk *clk; - unsigned long rate; - - clk = clk_get_sys("ap_timer", NULL);
As you see you are not changing this clock lookup either, which will never work.
Please restrict the patch to altering Integrator/CP.
Yours,
Linus Walleij
PATCH v2 6/14 ARM: vexpress: use clocksource_of_init for sp804
In reply to Haojian ZhuangRemove all code to parse sp804. Use clocksource_of_init() instead since all these code are implemented in sp804 driver already.
--- arch/arm/boot/dts/vexpress-v2m-rs1.dtsi | 2 ++ arch/arm/boot/dts/vexpress-v2m.dtsi | 2 ++ arch/arm/boot/dts/vexpress-v2p-ca9.dts | 2 ++ arch/arm/mach-vexpress/Kconfig | 1 + arch/arm/mach-vexpress/v2m.c | 13 ++----------- 5 files changed, 9 insertions(+), 11 deletions(-)
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +2 -0
@@ -183,6 +183,8 @@ interrupts = <2>; clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&smbclk>; clock-names = "timclken1", "timclken2", "apb_pclk"; + arm,sp804-clocksource = <0x20>; + arm,sp804-clockevent = <0>; }; v2m_timer23: timer at 120000 {
arch/arm/boot/dts/vexpress-v2m.dtsi +2 -0
@@ -182,6 +182,8 @@ interrupts = <2>; clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&smbclk>; clock-names = "timclken1", "timclken2", "apb_pclk"; + arm,sp804-clocksource = <0x20>; + arm,sp804-clockevent = <0>; }; v2m_timer23: timer at 12000 {
arch/arm/boot/dts/vexpress-v2p-ca9.dts +2 -0
@@ -98,6 +98,8 @@ <0 49 4>; clocks = <&oscclk2>, <&oscclk2>; clock-names = "timclk", "apb_pclk"; + arm,sp804-clocksource = <0x20>; + arm,sp804-clockevent = <0>; }; watchdog at 100e5000 {
arch/arm/mach-vexpress/Kconfig +1 -0
@@ -5,6 +5,7 @@ config ARCH_VEXPRESS select ARM_GIC select ARM_TIMER_SP804 select CLKDEV_LOOKUP + select CLKSRC_OF select COMMON_CLK select COMMON_CLK_VERSATILE select CPU_V7
arch/arm/mach-vexpress/v2m.c +2 -11
@@ -21,6 +21,7 @@#include <linux/regulator/fixed.h> #include <linux/regulator/machine.h> #include <linux/vexpress.h> +#include <linux/clocksource.h> #include <clocksource/arm_timer.h> #include <clocksource/timer-sp.h>
@@ -431,19 +432,9 @@ void __init v2m_dt_init_early(void)static void __init v2m_dt_timer_init (void ) { -struct device_node *node =NULL ; -vexpress_clk_of_init (); -do { - node =of_find_compatible_node (node,NULL ,"arm,sp804" ); - }while (node &&vexpress_get_site_by_node (node) !=VEXPRESS_SITE_MB ); -if (node) { -pr_info ("Using SP804 '%s' as a clock & events source\n" , - node->full_name); -v2m_sp804_init (of_iomap (node,0 ), -irq_of_parse_and_map (node,0 )); - } +clocksource_of_init ();if (arch_timer_of_register () !=0 )twd_local_timer_of_register ();
Signature · 1 line
1.7.10.4
PATCH v2 7/14 ARM: debug: support debug ll on hisilicon soc
In reply to Haojian ZhuangSupport UART0 debug ll on hisilicon Hi3620 SoC.
--- arch/arm/Kconfig.debug | 15 +++++++++++++++ arch/arm/include/debug/hisilicon.S | 30 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 arch/arm/include/debug/hisilicon.S
arch/arm/Kconfig.debug +15 -0
@@ -240,6 +240,20 @@ choice Say Y here if you want kernel low-level debugging support on i.MX6Q. + config DEBUG_HI3620_UART + bool "Hisilicon HI3620 Debug UART" + depends on ARCH_HI3xxx + help + Say Y here if you want kernel low-level debugging support + on HI3620 UART. + + config DEBUG_HI3716_UART + bool "Hisilicon Hi3716 Debug UART" + depends on ARCH_HI3xxx + help + Say Y here if you want kernel low-level debugging support + on HI3716 UART. + config DEBUG_MMP_UART2 bool "Kernel low-level debugging message via MMP UART2" depends on ARCH_MMP
@@ -589,6 +603,7 @@ config DEBUG_LL_INCLUDE DEBUG_IMX53_UART ||\ DEBUG_IMX6Q_UART default "debug/highbank.S" if DEBUG_HIGHBANK_UART + default "debug/hisilicon.S" if DEBUG_HI3620_UART || DEBUG_HI3716_UART default "debug/mvebu.S" if DEBUG_MVEBU_UART default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
arch/arm/include/debug/hisilicon.S new file +30 -0
@@ -0,0 +1,30 @@ +/* + * Early serial output macro for Hisilicon SoC + * + * Copyright (C) 2012-2013 Hisilicon Technologies Co., Ltd. + * Copyright (C) 2012-2013 Linaro Ltd. + * + * Author: Haojian Zhuang <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#if defined(CONFIG_DEBUG_HI3620_UART) +#define HS_UART_PHYS_BASE 0xfcb00000 +#define HS_UART_VIRT_BASE 0xfeb00000 +#elif defined(CONFIG_DEBUG_HI3716_UART) +#define HS_UART_PHYS_BASE 0xf8b00000 +#define HS_UART_VIRT_BASE 0xfeb00000 +#endif + +#if defined(CONFIG_DEBUG_HI3620_UART) || defined(CONFIG_DEBUG_HI3716_UART) + .macro addruart,rp,rv,tmp + ldr \rp, =HS_UART_PHYS_BASE + ldr \rv, =HS_UART_VIRT_BASE + .endm + +#include <asm/hardware/debug-pl01x.S> + +#endif
Signature · 1 line
1.7.10.4
PATCH v2 8/14 clk: hs: add clock support
In reply to Haojian ZhuangAdd clock support with device tree on Hisilicon SoC.
--- drivers/clk/Makefile | 1 + drivers/clk/clk-hi3xxx.c | 650 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 651 insertions(+) create mode 100644 drivers/clk/clk-hi3xxx.c
drivers/clk/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_COMMON_CLK) += clk-mux.o # SoCs specific obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o +obj-$(CONFIG_ARCH_HI3xxx) += clk-hi3xxx.o obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o obj-$(CONFIG_ARCH_MXS) += mxs/ obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/
drivers/clk/clk-hi3xxx.c new file +650 -0
650 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Arnd Bergmann
maintainerPATCH v2 8/14 clk: hs: add clock support
Quoted 4 lines · Haojian Zhuang
drivers/clk/clk-hi3xxx.c new file +4
-0+void __init hs_init_clocks (void ) +{ +struct device_node *node; +
drivers/clk/clk-hi3xxx.c line 650
Quoted 10 lines
drivers/clk/clk-hi3xxx.c new file +10
-0+/* map pmctrl registers */ + node =of_find_compatible_node (NULL ,NULL ,"hisilicon,pmctrl" ); + hs_clk.pmctrl =of_iomap (node,0 ); +WARN_ON (!hs_clk.pmctrl); + + node =of_find_compatible_node (NULL ,NULL ,"hisilicon,sctrl" ); + hs_clk.sctrl =of_iomap (node,0 ); + +of_clk_init (hs_clk_match); +}
You should be able to just use CLK_OF_DECLARE() with each member of hs_clk_match[] now and call of_clk_init(NULL) from platform code.
This requires moving the of_iomap() calls somewhere else, but it could be a function that gets called by whichever setup function gets run first.
Arnd
PATCH v2 8/14 clk: hs: add clock support
Quoted 19 lines · Arnd Bergmann
Quoted 4 lines · Haojian Zhuang
drivers/clk/clk-hi3xxx.c new file +4
-0+void __init hs_init_clocks (void ) +{ +struct device_node *node; +drivers/clk/clk-hi3xxx.c line 650
Quoted 10 lines
drivers/clk/clk-hi3xxx.c new file +10
-0+/* map pmctrl registers */ + node =of_find_compatible_node (NULL ,NULL ,"hisilicon,pmctrl" ); + hs_clk.pmctrl =of_iomap (node,0 ); +WARN_ON (!hs_clk.pmctrl); + + node =of_find_compatible_node (NULL ,NULL ,"hisilicon,sctrl" ); + hs_clk.sctrl =of_iomap (node,0 ); + +of_clk_init (hs_clk_match); +}You should be able to just use
CLK_OF_DECLARE()with each member of hs_clk_match[] now and callof_clk_init(NULL)from platform code.
Quoted 5 lines
This requires moving the
of_iomap()calls somewhere else, but it could be a function that gets called by whichever setup function gets run first.Arnd
Yes, it's better. I'll update it.
Regards
Haojian
PATCH v2 9/14 ARM: hs: add board support with device tree
In reply to Haojian ZhuangAdd board support with device tree for Hisilicon Hi36xx/Hi37xx platform.
--- arch/arm/Kconfig | 2 ++ arch/arm/Makefile | 1 + arch/arm/mach-hi3xxx/Kconfig | 13 ++++++++++++ arch/arm/mach-hi3xxx/Makefile | 5 +++++ arch/arm/mach-hi3xxx/hi3xxx.c | 45 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 arch/arm/mach-hi3xxx/Kconfig create mode 100644 arch/arm/mach-hi3xxx/Makefile create mode 100644 arch/arm/mach-hi3xxx/hi3xxx.c
arch/arm/Kconfig +2 -0
@@ -1060,6 +1060,8 @@ source "arch/arm/mach-gemini/Kconfig" source "arch/arm/mach-h720x/Kconfig" +source "arch/arm/mach-hi3xxx/Kconfig" + source "arch/arm/mach-highbank/Kconfig" source "arch/arm/mach-integrator/Kconfig"
arch/arm/Makefile +1 -0
@@ -148,6 +148,7 @@ machine-$(CONFIG_ARCH_EBSA110) += ebsa110 machine-$(CONFIG_ARCH_EP93XX) += ep93xx machine-$(CONFIG_ARCH_GEMINI) += gemini machine-$(CONFIG_ARCH_H720X) += h720x +machine-$(CONFIG_ARCH_HI3xxx) += hi3xxx machine-$(CONFIG_ARCH_HIGHBANK) += highbank machine-$(CONFIG_ARCH_INTEGRATOR) += integrator machine-$(CONFIG_ARCH_IOP13XX) += iop13xx
arch/arm/mach-hi3xxx/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +config ARCH_HI3xxx + bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7 + select ARM_AMBA + select ARM_GIC + select CACHE_L2X0 + select CACHE_PL310 + select CLKSRC_OF + select PINCTRL + select PINCTRL_SINGLE + select SERIAL_AMBA_PL011 + select SERIAL_AMBA_PL011_CONSOLE + help + Support for Hisilicon Hi36xx/Hi37xx processor family
arch/arm/mach-hi3xxx/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile for Hisilicon Hi36xx/Hi37xx processors line +# + +obj-y += hi3xxx.o
arch/arm/mach-hi3xxx/hi3xxx.c new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v2 10/14 ARM: hs: enable hi4511 with device tree
In reply to Haojian ZhuangEnable Hisilicon Hi4511 development platform with device tree support.
--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/hi3620.dtsi | 1155 +++++++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/hi4511.dts | 743 ++++++++++++++++++++++++++ 3 files changed, 1899 insertions(+) create mode 100644 arch/arm/boot/dts/hi3620.dtsi create mode 100644 arch/arm/boot/dts/hi4511.dts
arch/arm/boot/dts/Makefile +1 -0
@@ -49,6 +49,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ exynos5250-smdk5250.dtb \ exynos5250-snow.dtb \ exynos5440-ssdk5440.dtb +dtb-$(CONFIG_ARCH_HI3xxx) += hi4511.dtb dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ ecx-2000.dtb dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
arch/arm/boot/dts/hi3620.dtsi new file +1155 -0
1,155 lines not on this page · raw message
arch/arm/boot/dts/hi4511.dts new file +743 -0
743 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v2 11/14 ARM: config: append arch hs into multi defconfig
In reply to Haojian ZhuangAppend ARCH_HI3xxx (Hisilicon SoC) into multi_v7_defconfig.
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -5,6 +5,7 @@ CONFIG_ARCH_MVEBU=y CONFIG_MACH_ARMADA_370=y CONFIG_MACH_ARMADA_XP=y CONFIG_ARCH_HIGHBANK=y +CONFIG_ARCH_HI3xxx=y CONFIG_ARCH_SOCFPGA=y CONFIG_ARCH_SUNXI=y # CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set
Signature · 1 line
1.7.10.4
PATCH v2 12/14 Document: append hisilicon clock binding
In reply to Haojian ZhuangAdd hisilicon clock binding document for device tree.
--- .../devicetree/bindings/clock/hisilicon.txt | 73 ++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/hisilicon.txt
Documentation/devicetree/bindings/clock/hisilicon.txt new file +73 -0
@@ -0,0 +1,73 @@ +Device Tree Clock bindings for arch-vt8500 + +This binding uses the common clock binding[1]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties for mux clocks: + - compatible : Shall be "hisilicon,hi3620-clk-mux". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - hisilicon,hi3620-mux : array of mux register offset & mask bits + +Required properties for Hi3620 gate clocks: + - compatible : Shall be "hisilicon,hi3620-clk-gate". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - hisilicon,hi3620-clkgate : array of enable register offset & enable bits + - hisilicon,hi3620-clkreset : array of reset register offset & enable bits + +Required properties for clock divider: + - compatible : Shall be "hisilicon,hi3620-clk-div". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - #hisilicon,clkdiv-table-cells : the number of parameters after phandle in + hisilicon,clkdiv-table property. + - hisilicon,clkdiv-table : list of value that are used to configure clock + divider. They're value of phandle, index & divider value. + - hisilicon,clkdiv : array of divider register offset & mask bits. + +Required properties for gate clocks: + - compatible : Shall be "hisilicon,clk-gate". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - hisilicon,clkgate-inverted : bool value. True means that set-to-disable. + +Required properties for clock fixed factor divider: + - compatible : Shall be "hisilicon,fixed-factor". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - hisilicon,fixed-factor : array of multiplier & divider. + +For example: + timclk1: clkgate at 38 { + compatible = "hisilicon,clk-gate"; + #clock-cells = <0>; + clocks = <&refclk_timer1>; + clock-output-names = "timclk1"; + hisilicon,clkgate-inverted; + hisilicon,clkgate = <0 18>; + }; + + dtable: clkdiv at 0 { + #hisilicon,clkdiv-table-cells = <2>; + }; + + div_cfgaxi: clkdiv at 2 { + compatible = "hisilicon,hi3620-clk-div"; + #clock-cells = <0>; + clocks = <&div_shareaxi>; + clock-output-names = "cfgAXI_div"; + hisilicon,clkdiv-table = <&dtable 0x01 2>; + hisilicon,clkdiv = <0x100 0x60>; + };
Signature · 1 line
1.7.10.4
PATCH v2 13/14 Document: dts: create hisilicon document
In reply to Haojian ZhuangAppend the illustration on two boards from hisilicon.
--- .../devicetree/bindings/arm/hisilicon/hisilicon.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt new file +10 -0
@@ -0,0 +1,10 @@ +Hisilicon Platforms Device Tree Bindings +---------------------------------------------------- + +Hi3716 Development Board +Required root node properties: + - compatible = "hisilicon,hi3716-dkb"; + +Hi4511 Board +Required root node properties: + - compatible = "hisilicon,hi3620-hi4511";
Signature · 1 line
1.7.10.4
PATCH v2 14/14 Document: add device tree binding file for sp804
In reply to Haojian ZhuangAdd binding document for sp804 dual timer.
--- .../devicetree/bindings/timer/arm,sp804.txt | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/arm,sp804.txt
Documentation/devicetree/bindings/timer/arm,sp804.txt new file +27 -0
@@ -0,0 +1,27 @@ +ARM sp804 Dual Timers +--------------------------------------- + +Required properties: +- compatible: Should be "arm,sp804" & "arm,primecell" +- interrupts: Should contain the list of Dual Timer interrupts + interrupts = <0 0 4>, <0 1 4>; +- reg: Should contain location and length for dual timer register. +- clocks: clock driving the dual timer hardware + clocks = <&timclk0 &timclk1>; + +Optional properties: +- arm,sp804-clocksource: Should contain the register offset of TIMER1 or + TIMER2 in Dual Timer Controller. + arm,sp804-clocksource = <0x20>; + +Example: + + timer0: timer at fc800000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0xfc800000 0x1000>; + /* timer00 & timer01 */ + interrupts = <0 0 4>, <0 1 4>; + clocks = <&timclk0 &timclk1>; + clock-names = "apb_pclk"; + status = "disabled"; + };
Signature · 1 line
1.7.10.4
Arnd Bergmann
maintainerPATCH v2 14/14 Document: add device tree binding file for sp804
Quoted 3 lines · Haojian Zhuang
Add binding document for sp804 dual timer.
Signed-off-by Haojian Zhuang <[email protected]>
Ah, I was missing this one earlier when looking at patch 2. I would actually suggest combining both into a single patch.
Arnd
PATCH v2 14/14 Document: add device tree binding file for sp804
Quoted 9 lines · Arnd Bergmann
Quoted 3 lines · Haojian Zhuang
Add binding document for sp804 dual timer.
Signed-off-by Haojian Zhuang <[email protected]>Ah, I was missing this one earlier when looking at patch 2. I would actually suggest combining both into a single patch.
Arnd
OK. I'll merge it into the patch #2.