update irqchip, clocksource, clk in mmp
Subsystems (7)
v3 cover update irqchip, clocksource, clk in mmp
Changelog:
v3:
1. Don't use include/linux/irqchip/mmp.h since we don't need to move <mach/irqs.h> to <include/linux/irqchip/mmp.h>.
2. Move timer-mmp driver into clocksource directory & support clocksource.
3. Support clksrc in mmp & parse all clock from DTS.
v2:
1. Avoid to include <mach/irqs.h>. Move the head file into include/linux/irqchip directory.
2. Avoid to include <mach/pm-pxa910.h> & <mach/pm-mmp2.h>.
PATCH v3 1/11 irqchip: move mmp irq driver
Move irq-mmp driver from mach-mmp directory into irqchip directory.
--- arch/arm/mach-mmp/Makefile | 2 +- arch/arm/mach-mmp/common.h | 1 - arch/arm/mach-mmp/include/mach/pxa168.h | 1 + arch/arm/mach-mmp/include/mach/pxa910.h | 1 + arch/arm/mach-mmp/pxa910.c | 1 + drivers/irqchip/Makefile | 1 + arch/arm/mach-mmp/irq.c => drivers/irqchip/irq-mmp.c | 2 -- 7 files changed, 5 insertions(+), 4 deletions(-) rename arch/arm/mach-mmp/irq.c => drivers/irqchip/irq-mmp.c (99%)
arch/arm/mach-mmp/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for Marvell's PXA168 processors line # -obj-y += common.o devices.o time.o irq.o +obj-y += common.o devices.o time.o # SoC support obj-$(CONFIG_CPU_PXA168) += pxa168.o
arch/arm/mach-mmp/common.h +0 -1
@@ -2,7 +2,6 @@extern void timer_init (int irq); -extern void __init icu_init_irq (void );extern void __init mmp_map_io (void );extern void mmp_restart (char ,const char *);extern void __init pxa168_clk_init (void );
arch/arm/mach-mmp/include/mach/pxa168.h +1 -0
@@ -2,6 +2,7 @@#define __ASM_MACH_PXA168_Hextern void pxa168_timer_init (void ); +extern void __init icu_init_irq (void );extern void __init pxa168_init_irq (void );extern void pxa168_restart (char ,const char *);extern void pxa168_clear_keypad_wakeup (void );
arch/arm/mach-mmp/include/mach/pxa910.h +1 -0
@@ -2,6 +2,7 @@#define __ASM_MACH_PXA910_Hextern void pxa910_timer_init (void ); +extern void __init icu_init_irq (void );extern void __init pxa910_init_irq (void );#include <linux/i2c.h>
arch/arm/mach-mmp/pxa910.c +1 -0
@@ -23,6 +23,7 @@#include <mach/dma.h> #include <mach/mfp.h> #include <mach/devices.h> +#include <mach/pxa910.h> #include "common.h"
drivers/irqchip/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_ARCH_MXS) += irq-mxs.o obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o obj-$(CONFIG_METAG) += irq-metag-ext.o obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o +obj-$(CONFIG_ARCH_MMP) += irq-mmp.o obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o obj-$(CONFIG_ARM_GIC) += irq-gic.o
drivers/irqchip/irq-mmp.c renamed from arch/arm/mach-mmp/irq.c +0 -2
@@ -30,8 +30,6 @@#include <mach/pm-pxa910.h> #endif -#include "common.h" -#define MAX_ICU_NR 16struct icu_chip_data {
Signature · 1 line
1.8.1.2
PATCH v3 2/11 irqchip: mmp: support irqchip
In reply to Haojian ZhuangSupport IRQCHIP on irq-mmp driver.
--- arch/arm/mach-mmp/mmp-dt.c | 10 +- arch/arm/mach-mmp/mmp2-dt.c | 9 +- drivers/irqchip/irq-mmp.c | 238 +++++++++++++++++++++++--------------------- 3 files changed, 129 insertions(+), 128 deletions(-)
arch/arm/mach-mmp/mmp-dt.c +3 -7
@@ -9,17 +9,13 @@* publishhed by the Free Software Foundation. */ -#include <linux/irq.h> -#include <linux/irqdomain.h> -#include <linux/of_irq.h> +#include <linux/irqchip.h> #include <linux/of_platform.h> #include <asm/mach/arch.h> #include <asm/mach/time.h> -#include <mach/irqs.h> #include "common.h" -extern void __init mmp_dt_irq_init (void );extern void __init mmp_dt_init_timer (void );static const struct of_dev_auxdata pxa168_auxdata_lookup[]__initconst = {
@@ -64,7 +60,7 @@ static const char *mmp_dt_board_compat[] __initdata = {DT_MACHINE_START (PXA168_DT ,"Marvell PXA168 (Device Tree Support)" ) .map_io = mmp_map_io, - .init_irq = mmp_dt_irq_init, + .init_irq = irqchip_init, .init_time = mmp_dt_init_timer, .init_machine = pxa168_dt_init, .dt_compat = mmp_dt_board_compat,
@@ -72,7 +68,7 @@ MACHINE_ENDDT_MACHINE_START (PXA910_DT ,"Marvell PXA910 (Device Tree Support)" ) .map_io = mmp_map_io, - .init_irq = mmp_dt_irq_init, + .init_irq = irqchip_init, .init_time = mmp_dt_init_timer, .init_machine = pxa910_dt_init, .dt_compat = mmp_dt_board_compat,
arch/arm/mach-mmp/mmp2-dt.c +2 -7
@@ -10,18 +10,13 @@*/ #include <linux/io.h> -#include <linux/irq.h> -#include <linux/irqdomain.h> -#include <linux/of_irq.h> +#include <linux/irqchip.h> #include <linux/of_platform.h> #include <asm/mach/arch.h> #include <asm/mach/time.h> -#include <mach/irqs.h> -#include <mach/regs-apbc.h> #include "common.h" -extern void __init mmp_dt_irq_init (void );extern void __init mmp_dt_init_timer (void );static const struct of_dev_auxdata mmp2_auxdata_lookup[]__initconst = {
@@ -49,7 +44,7 @@ static const char *mmp2_dt_board_compat[] __initdata = {DT_MACHINE_START (MMP2_DT ,"Marvell MMP2 (Device Tree Support)" ) .map_io = mmp_map_io, - .init_irq = mmp_dt_irq_init, + .init_irq = irqchip_init, .init_time = mmp_dt_init_timer, .init_machine = mmp2_dt_init, .dt_compat = mmp2_dt_board_compat,
drivers/irqchip/irq-mmp.c +124 -114
268 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH v3 2/11 irqchip: mmp: support irqchip
Quoted 10 lines · Haojian Zhuang
arch/arm/mach-mmp/mmp-dt.c +1
-1@@ -64,7 +60,7 @@ static const char *mmp_dt_board_compat[] __initdata = {DT_MACHINE_START (PXA168_DT ,"Marvell PXA168 (Device Tree Support)" ) .map_io = mmp_map_io, - .init_irq = mmp_dt_irq_init, + .init_irq = irqchip_init, .init_time = mmp_dt_init_timer, .init_machine = pxa168_dt_init, .dt_compat = mmp_dt_board_compat,
arch/arm/mach-mmp/mmp-dt.c MACHINE_END · line 71
Quoted 5 lines
arch/arm/mach-mmp/mmp-dt.c +1
-1@@ -72,7 +68,7 @@ MACHINE_ENDDT_MACHINE_START (PXA910_DT ,"Marvell PXA910 (Device Tree Support)" ) .map_io = mmp_map_io, - .init_irq = mmp_dt_irq_init, + .init_irq = irqchip_init,
This is what's in linux-next:
void __init init_IRQ(void)
{
if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq)
irqchip_init();
else
machine_desc->init_irq();
}So just set your .init_irq to NULL after basing your patchset on ebafed7ab9b637656b685f1dc1ee528c77241a0d (ARM: irq: Call irqchip_init if no init_irq function is specified).
PATCH v3 2/11 irqchip: mmp: support irqchip
Quoted 27 lines · Russell King - ARM Linux
Quoted 10 lines · Haojian Zhuang
arch/arm/mach-mmp/mmp-dt.c +1
-1@@ -64,7 +60,7 @@ static const char *mmp_dt_board_compat[] __initdata = {DT_MACHINE_START (PXA168_DT ,"Marvell PXA168 (Device Tree Support)" ) .map_io = mmp_map_io, - .init_irq = mmp_dt_irq_init, + .init_irq = irqchip_init, .init_time = mmp_dt_init_timer, .init_machine = pxa168_dt_init, .dt_compat = mmp_dt_board_compat,arch/arm/mach-mmp/mmp-dt.c MACHINE_END · line 71
Quoted 5 lines
arch/arm/mach-mmp/mmp-dt.c +1
-1@@ -72,7 +68,7 @@ MACHINE_ENDDT_MACHINE_START (PXA910_DT ,"Marvell PXA910 (Device Tree Support)" ) .map_io = mmp_map_io, - .init_irq = mmp_dt_irq_init, + .init_irq = irqchip_init,This is what's in linux-next:
void
__initinit_IRQ(void){ if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq) irqchip_init(); else machine_desc->init_irq(); }
Quoted 3 lines
So just set your .init_irq to NULL after basing your patchset on
ebafed7ab9b637656b685f1dc1ee528c77241a0d(ARM: irq: Callirqchip_initif noinit_irqfunction is specified).
OK. I'll update it.
Regards
Haojian
PATCH v3 3/11 irqchip: mmp: support MULTI_IRQ_HANDLER
In reply to Haojian ZhuangSupport CONFIG_MULTI_IRQ_HANDLER in ARCH_MMP. So remove entry-macro.S.
--- arch/arm/Kconfig | 1 + arch/arm/mach-mmp/include/mach/entry-macro.S | 26 ----------------- drivers/irqchip/irq-mmp.c | 42 +++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 27 deletions(-) delete mode 100644 arch/arm/mach-mmp/include/mach/entry-macro.S
arch/arm/Kconfig +1 -0
@@ -549,6 +549,7 @@ config ARCH_MMP select GENERIC_CLOCKEVENTS select GPIO_PXA select IRQ_DOMAIN + select MULTI_IRQ_HANDLER select NEED_MACH_GPIO_H select PINCTRL select PLAT_PXA
arch/arm/mach-mmp/include/mach/entry-macro.S deleted +0 -26
@@ -1,26 +0,0 @@ -/* - * linux/arch/arm/mach-mmp/include/mach/entry-macro.S - * - * 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. - */ - -#include <asm/irq.h> -#include <mach/regs-icu.h> - - .macro get_irqnr_preamble, base, tmp - mrc p15, 0, \tmp, c0, c0, 0 @ CPUID - and \tmp, \tmp, #0xff00 - cmp \tmp, #0x5800 - ldr \base, =mmp_icu_base - ldr \base, [\base, #0] - addne \base, \base, #0x10c @ PJ1 AP INT SEL register - addeq \base, \base, #0x104 @ PJ4 IRQ SEL register - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \tmp, [\base, #0] - and \irqnr, \tmp, #0x3f - tst \tmp, #(1 << 6) - .endm
drivers/irqchip/irq-mmp.c +41 -1
90 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH v3 4/11 ARM: mmp: avoid to include head file in mach-mmp
In reply to Haojian Zhuangpxa910_set_wake() & mmp2_set_wake() are both declared in head files of arch/arm/mach-mmp/include/mach directory. If we include these head files in irq-mmp driver, it blocks the multiplatform build. So adjust the code.
--- arch/arm/mach-mmp/mmp2.c | 4 ++++ arch/arm/mach-mmp/pxa910.c | 4 ++++ drivers/irqchip/irq-mmp.c | 15 +-------------- 3 files changed, 9 insertions(+), 14 deletions(-)
arch/arm/mach-mmp/mmp2.c +4 -0
@@ -13,6 +13,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/irq.h> #include <linux/platform_device.h> #include <asm/hardware/cache-tauros2.h>
@@ -26,6 +27,7 @@#include <mach/mfp.h> #include <mach/devices.h> #include <mach/mmp2.h> +#include <mach/pm-mmp2.h> #include "common.h"
@@ -91,9 +93,11 @@ void mmp2_clear_pmic_int(void)__raw_writel (data, mfpr_pmic); } +extern struct irq_chip icu_irq_chip;void __init mmp2_init_irq (void ) {mmp2_init_icu (); + icu_irq_chip.irq_set_wake = mmp2_set_wake; }static int __init mmp2_init (void )
arch/arm/mach-mmp/pxa910.c +4 -0
@@ -12,6 +12,7 @@#include <linux/init.h> #include <linux/list.h> #include <linux/io.h> +#include <linux/irq.h> #include <linux/platform_device.h> #include <asm/hardware/cache-tauros2.h>
@@ -23,6 +24,7 @@#include <mach/dma.h> #include <mach/mfp.h> #include <mach/devices.h> +#include <mach/pm-pxa910.h> #include <mach/pxa910.h> #include "common.h"
@@ -77,9 +79,11 @@ static struct mfp_addr_map pxa910_mfp_addr_map[] __initdata = MFP_ADDR_END, }; +extern struct irq_chip icu_irq_chip;void __init pxa910_init_irq (void ) {icu_init_irq (); + icu_irq_chip.irq_set_wake = pxa910_set_wake; }static int __init pxa910_init (void )
drivers/irqchip/irq-mmp.c +1 -14
@@ -26,13 +26,6 @@#include <mach/irqs.h> -#ifdef CONFIG_CPU_MMP2 -#include <mach/pm-mmp2.h> -#endif -#ifdef CONFIG_CPU_PXA910 -#include <mach/pm-pxa910.h> -#endif -#include "irqchip.h" #define MAX_ICU_NR 16
@@ -132,7 +125,7 @@ static void icu_unmask_irq(struct irq_data *d) } } -static struct irq_chip icu_irq_chip = { +struct irq_chip icu_irq_chip = { .name ="icu_irq" , .irq_mask = icu_mask_irq, .irq_mask_ack = icu_mask_ack_irq,
@@ -251,9 +244,6 @@ void __init icu_init_irq(void) }irq_set_default_host (icu_data[0 ].domain);set_handle_irq (mmp_handle_irq); -#ifdef CONFIG_CPU_PXA910 - icu_irq_chip.irq_set_wake = pxa910_set_wake; -#endif }/* MMP2 (ARMv7) */
@@ -358,9 +348,6 @@ void __init mmp2_init_icu(void) }irq_set_default_host (icu_data[0 ].domain);set_handle_irq (mmp2_handle_irq); -#ifdef CONFIG_CPU_MMP2 - icu_irq_chip.irq_set_wake = mmp2_set_wake; -#endif }#ifdef CONFIG_OF
Signature · 1 line
1.8.1.2
PATCH v3 4/11 ARM: mmp: avoid to include head file in mach-mmp
arch/arm/mach-mmp/mmp2.c void mmp2_clear_pmic_int(void) · line 101
Quoted 7 lines · Haojian Zhuang
arch/arm/mach-mmp/mmp2.c +2
-0+extern struct irq_chip icu_irq_chip;void __init mmp2_init_irq (void ) {mmp2_init_icu (); + icu_irq_chip.irq_set_wake = mmp2_set_wake; }
I think it's better to put the declaration into a header file in include/linux/irqchip/. Extern declarations in .c files are always fragile.
Arnd
PATCH v3 5/11 irqchip: mmp: avoid to include irqs head file
In reply to Haojian ZhuangSince <mach/irqs.h> in irq-mmp.c blocks the multiplatform build, remove it instead.
--- drivers/irqchip/irq-mmp.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-)
drivers/irqchip/irq-mmp.c +21 -24
@@ -24,8 +24,6 @@#include <asm/exception.h> #include <asm/mach/irq.h> -#include <mach/irqs.h> -#include "irqchip.h" #define MAX_ICU_NR 16
@@ -249,7 +247,7 @@ void __init icu_init_irq(void)/* MMP2 (ARMv7) */ void __init mmp2_init_icu (void ) { -int irq; +int irq, end; max_icu_nr =8 ; mmp_icu_base =ioremap (0xd4282000 ,0x1000 );
@@ -263,11 +261,12 @@ void __init mmp2_init_icu(void) &icu_data[0]); icu_data[1 ].reg_status = mmp_icu_base +0x150 ; icu_data[1 ].reg_mask = mmp_icu_base +0x168 ; - icu_data[1 ].clr_mfp_irq_base =IRQ_MMP2_PMIC_BASE ; - icu_data[1 ].clr_mfp_hwirq =IRQ_MMP2_PMIC -IRQ_MMP2_PMIC_BASE ; + icu_data[1 ].clr_mfp_irq_base = icu_data[0 ].virq_base + + icu_data[0 ].nr_irqs; + icu_data[1 ].clr_mfp_hwirq =1 ;/* offset to IRQ_MMP2_PMIC_BASE */ icu_data[1 ].nr_irqs =2 ; icu_data[1 ].cascade_irq =4 ; - icu_data[1 ].virq_base =IRQ_MMP2_PMIC_BASE ; + icu_data[1 ].virq_base = icu_data[0 ].virq_base + icu_data[0 ].nr_irqs; icu_data[1].domain = irq_domain_add_legacy(NULL, icu_data[1].nr_irqs, icu_data[1].virq_base, 0, &irq_domain_simple_ops,
@@ -276,7 +275,7 @@ void __init mmp2_init_icu(void) icu_data[2 ].reg_mask = mmp_icu_base +0x16c ; icu_data[2 ].nr_irqs =2 ; icu_data[2 ].cascade_irq =5 ; - icu_data[2 ].virq_base =IRQ_MMP2_RTC_BASE ; + icu_data[2 ].virq_base = icu_data[1 ].virq_base + icu_data[1 ].nr_irqs; icu_data[2].domain = irq_domain_add_legacy(NULL, icu_data[2].nr_irqs, icu_data[2].virq_base, 0, &irq_domain_simple_ops,
@@ -285,7 +284,7 @@ void __init mmp2_init_icu(void) icu_data[3 ].reg_mask = mmp_icu_base +0x17c ; icu_data[3 ].nr_irqs =3 ; icu_data[3 ].cascade_irq =9 ; - icu_data[3 ].virq_base =IRQ_MMP2_KEYPAD_BASE ; + icu_data[3 ].virq_base = icu_data[2 ].virq_base + icu_data[2 ].nr_irqs; icu_data[3].domain = irq_domain_add_legacy(NULL, icu_data[3].nr_irqs, icu_data[3].virq_base, 0, &irq_domain_simple_ops,
@@ -294,7 +293,7 @@ void __init mmp2_init_icu(void) icu_data[4 ].reg_mask = mmp_icu_base +0x170 ; icu_data[4 ].nr_irqs =5 ; icu_data[4 ].cascade_irq =17 ; - icu_data[4 ].virq_base =IRQ_MMP2_TWSI_BASE ; + icu_data[4 ].virq_base = icu_data[3 ].virq_base + icu_data[3 ].nr_irqs; icu_data[4].domain = irq_domain_add_legacy(NULL, icu_data[4].nr_irqs, icu_data[4].virq_base, 0, &irq_domain_simple_ops,
@@ -303,7 +302,7 @@ void __init mmp2_init_icu(void) icu_data[5 ].reg_mask = mmp_icu_base +0x174 ; icu_data[5 ].nr_irqs =15 ; icu_data[5 ].cascade_irq =35 ; - icu_data[5 ].virq_base =IRQ_MMP2_MISC_BASE ; + icu_data[5 ].virq_base = icu_data[4 ].virq_base + icu_data[4 ].nr_irqs; icu_data[5].domain = irq_domain_add_legacy(NULL, icu_data[5].nr_irqs, icu_data[5].virq_base, 0, &irq_domain_simple_ops,
@@ -312,7 +311,7 @@ void __init mmp2_init_icu(void) icu_data[6 ].reg_mask = mmp_icu_base +0x178 ; icu_data[6 ].nr_irqs =2 ; icu_data[6 ].cascade_irq =51 ; - icu_data[6 ].virq_base =IRQ_MMP2_MIPI_HSI1_BASE ; + icu_data[6 ].virq_base = icu_data[5 ].virq_base + icu_data[5 ].nr_irqs; icu_data[6].domain = irq_domain_add_legacy(NULL, icu_data[6].nr_irqs, icu_data[6].virq_base, 0, &irq_domain_simple_ops,
@@ -321,28 +320,26 @@ void __init mmp2_init_icu(void) icu_data[7 ].reg_mask = mmp_icu_base +0x184 ; icu_data[7 ].nr_irqs =2 ; icu_data[7 ].cascade_irq =55 ; - icu_data[7 ].virq_base =IRQ_MMP2_MIPI_HSI0_BASE ; + icu_data[7 ].virq_base = icu_data[6 ].virq_base + icu_data[6 ].nr_irqs; icu_data[7 ].domain =irq_domain_add_legacy (NULL , icu_data[7 ].nr_irqs, icu_data[7 ].virq_base,0 , &irq_domain_simple_ops, &icu_data[7 ]); -for (irq =0 ; irq <IRQ_MMP2_MUX_END ; irq++) { + end = icu_data[7 ].virq_base + icu_data[7 ].nr_irqs; +for (irq =0 ; irq < end; irq++) {icu_mask_irq (irq_get_irq_data (irq)); -switch (irq) { -case IRQ_MMP2_PMIC_MUX : -case IRQ_MMP2_RTC_MUX : -case IRQ_MMP2_KEYPAD_MUX : -case IRQ_MMP2_TWSI_MUX : -case IRQ_MMP2_MISC_MUX : -case IRQ_MMP2_MIPI_HSI1_MUX : -case IRQ_MMP2_MIPI_HSI0_MUX : +if (irq == icu_data[1 ].cascade_irq || + irq == icu_data[2 ].cascade_irq || + irq == icu_data[3 ].cascade_irq || + irq == icu_data[4 ].cascade_irq || + irq == icu_data[5 ].cascade_irq || + irq == icu_data[6 ].cascade_irq || + irq == icu_data[7 ].cascade_irq) {irq_set_chip (irq, &icu_irq_chip);irq_set_chained_handler (irq, icu_mux_irq_demux); -break ; -default : + }else {irq_set_chip_and_handler (irq, &icu_irq_chip, handle_level_irq); -break ; }set_irq_flags (irq,IRQF_VALID ); }
Signature · 1 line
1.8.1.2
PATCH v3 6/11 clocksource: mmp: move mmp timer driver
In reply to Haojian ZhuangMove timer-mmp driver from mach-mmp to clocksource directory.
--- arch/arm/mach-mmp/Makefile | 2 +- drivers/clocksource/Makefile | 1 + arch/arm/mach-mmp/time.c => drivers/clocksource/timer-mmp.c | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) rename arch/arm/mach-mmp/time.c => drivers/clocksource/timer-mmp.c (99%)
arch/arm/mach-mmp/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for Marvell's PXA168 processors line # -obj-y += common.o devices.o time.o +obj-y += common.o devices.o # SoC support obj-$(CONFIG_CPU_PXA168) += pxa168.o
drivers/clocksource/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o obj-$(CONFIG_ARCH_MARCO) += timer-marco.o +obj-$(CONFIG_ARCH_MMP) += timer-mmp.o obj-$(CONFIG_ARCH_MXS) += mxs_timer.o obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o
drivers/clocksource/timer-mmp.c renamed from arch/arm/mach-mmp/time.c +0 -2
@@ -37,8 +37,6 @@#include <mach/cputype.h> #include <asm/mach/time.h> -#include "clock.h" -#define TIMERS_VIRT_BASE TIMERS1_VIRT_BASE#define MAX_DELTA (0xfffffffe)
Signature · 1 line
1.8.1.2
PATCH v3 7/11 ARM: mmp: move timer registers into driver
In reply to Haojian ZhuangMove the definition of timer registers into timer-mmp driver. And map timer registers in driver.
--- arch/arm/mach-mmp/include/mach/regs-timers.h | 44 ---------------------------- drivers/clocksource/timer-mmp.c | 38 ++++++++++++++++++++---- 2 files changed, 33 insertions(+), 49 deletions(-) delete mode 100644 arch/arm/mach-mmp/include/mach/regs-timers.h
arch/arm/mach-mmp/include/mach/regs-timers.h deleted +0 -44
@@ -1,44 +0,0 @@ -/* -* linux/arch/arm/mach-mmp/include/mach/regs-timers.h -* -* Timers Module -* -* 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. -*/ - -#ifndef __ASM_MACH_REGS_TIMERS_H -#define __ASM_MACH_REGS_TIMERS_H - -#include <mach/addr-map.h> - -#define TIMERS1_VIRT_BASE (APB_VIRT_BASE + 0x14000) -#define TIMERS2_VIRT_BASE (APB_VIRT_BASE + 0x16000) - -#define TMR_CCR (0x0000) -#define TMR_TN_MM (n, m) (0x0004 + ((n) << 3) + (((n) + (m)) << 2)) -#define TMR_CR (n) (0x0028 + ((n) << 2)) -#define TMR_SR (n) (0x0034 + ((n) << 2)) -#define TMR_IER (n) (0x0040 + ((n) << 2)) -#define TMR_PLVR (n) (0x004c + ((n) << 2)) -#define TMR_PLCR (n) (0x0058 + ((n) << 2)) -#define TMR_WMER (0x0064) -#define TMR_WMR (0x0068) -#define TMR_WVR (0x006c) -#define TMR_WSR (0x0070) -#define TMR_ICR (n) (0x0074 + ((n) << 2)) -#define TMR_WICR (0x0080) -#define TMR_CER (0x0084) -#define TMR_CMR (0x0088) -#define TMR_ILR (n) (0x008c + ((n) << 2)) -#define TMR_WCR (0x0098) -#define TMR_WFAR (0x009c) -#define TMR_WSAR (0x00A0) -#define TMR_CVWR (n) (0x00A4 + ((n) << 2)) - -#define TMR_CCR_CS_0 (x) (((x) & 0x3) << 0) -#define TMR_CCR_CS_1 (x) (((x) & 0x7) << 2) -#define TMR_CCR_CS_2 (x) (((x) & 0x3) << 5) - -#endif /* __ASM_MACH_REGS_TIMERS_H */
drivers/clocksource/timer-mmp.c +33 -5
@@ -30,19 +30,44 @@#include <linux/of_irq.h> #include <asm/sched_clock.h> -#include <mach/addr-map.h> -#include <mach/regs-timers.h> -#include <mach/regs-apbc.h> #include <mach/irqs.h> #include <mach/cputype.h> #include <asm/mach/time.h> -#define TIMERS_VIRT_BASE TIMERS1_VIRT_BASE +#define TMR_CCR (0x0000) +#define TMR_TN_MM (n, m) (0x0004 + ((n) << 3) + (((n) + (m)) << 2)) +#define TMR_CR (n) (0x0028 + ((n) << 2)) +#define TMR_SR (n) (0x0034 + ((n) << 2)) +#define TMR_IER (n) (0x0040 + ((n) << 2)) +#define TMR_PLVR (n) (0x004c + ((n) << 2)) +#define TMR_PLCR (n) (0x0058 + ((n) << 2)) +#define TMR_WMER (0x0064) +#define TMR_WMR (0x0068) +#define TMR_WVR (0x006c) +#define TMR_WSR (0x0070) +#define TMR_ICR (n) (0x0074 + ((n) << 2)) +#define TMR_WICR (0x0080) +#define TMR_CER (0x0084) +#define TMR_CMR (0x0088) +#define TMR_ILR (n) (0x008c + ((n) << 2)) +#define TMR_WCR (0x0098) +#define TMR_WFAR (0x009c) +#define TMR_WSAR (0x00A0) +#define TMR_CVWR (n) (0x00A4 + ((n) << 2)) + +#define TMR_CCR_CS_0 (x) (((x) & 0x3) << 0) +#define TMR_CCR_CS_1 (x) (((x) & 0x7) << 2) +#define TMR_CCR_CS_2 (x) (((x) & 0x3) << 5) + +#define TIMERS1_PHY_BASE (0xd4000000 + 0x14000) +#define TIMERS2_PHY_BASE (0xd4000000 + 0x16000) + +#define TIMERS_PHY_BASE TIMERS1_PHY_BASE#define MAX_DELTA (0xfffffffe)#define MIN_DELTA (16) -static void __iomem *mmp_timer_base =TIMERS_VIRT_BASE ; +static void __iomem *mmp_timer_base;/* * FIXME: the timer needs some delay to stablize the counter capture
@@ -191,6 +216,9 @@ static struct irqaction timer_irq = {void __init timer_init (int irq) { + mmp_timer_base =ioremap (TIMERS_PHY_BASE ,PAGE_SIZE ); +BUG_ON (!mmp_timer_base); +timer_config ();setup_sched_clock (mmp_read_sched_clock,32 ,CLOCK_TICK_RATE );
Signature · 1 line
1.8.1.2
PATCH v3 7/11 ARM: mmp: move timer registers into driver
drivers/clocksource/timer-mmp.c static struct irqaction timer_irq = { · line 221
Quoted 5 lines · Haojian Zhuang
void
__inittimer_init(int irq)
{drivers/clocksource/timer-mmp.c +3
-0+ mmp_timer_base =ioremap (TIMERS_PHY_BASE ,PAGE_SIZE ); +BUG_ON (!mmp_timer_base); +
Here I would pass TIMERS_PHY_BASE as another argument, and move the definition of that macro back into platform code. Device drivers should be written not to care about physical addresses.
Arnd
PATCH v3 8/11 ARM: pxa: init dma debugfs in late level
In reply to Haojian ZhuangRemove pxa_init_dma() from core_initcall level since it's unncecssary for DT mode. But dma debugfs is also included in pxa_init_dma(). So only initiliaze dma debugfs in late_initcall level.
--- arch/arm/mach-mmp/mmp2.c | 2 +- arch/arm/mach-mmp/pxa168.c | 2 +- arch/arm/mach-mmp/pxa910.c | 2 +- arch/arm/plat-pxa/dma.c | 30 ++++++++++++++++++++---------- 4 files changed, 23 insertions(+), 13 deletions(-)
arch/arm/mach-mmp/mmp2.c +1 -1
@@ -114,7 +114,6 @@ static int __init mmp2_init(void)return 0 ; } -postcore_initcall (mmp2_init);#define APBC_TIMERS APBC_REG(0x024)
@@ -122,6 +121,7 @@ void __init mmp2_timer_init(void) {unsigned long clk_rst; +mmp2_init ();__raw_writel (APBC_APBCLK |APBC_RST ,APBC_TIMERS );/*
arch/arm/mach-mmp/pxa168.c +1 -1
@@ -61,7 +61,6 @@ static int __init pxa168_init(void)return 0 ; } -postcore_initcall (pxa168_init);/* system timer - clock enabled, 3.25MHz */ #define TIMER_CLK_RST (APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(3))
@@ -69,6 +68,7 @@ postcore_initcall(pxa168_init);void __init pxa168_timer_init (void ) { +pxa168_init ();/* this is early, we have to initialize the CCU registers by * ourselves instead of using clk_* API. Clock rate is defined * by APBC_TIMERS_CLK_RST (3.25MHz) and enabled free-running
arch/arm/mach-mmp/pxa910.c +1 -1
@@ -100,7 +100,6 @@ static int __init pxa910_init(void)return 0 ; } -postcore_initcall (pxa910_init);/* system timer - clock enabled, 3.25MHz */ #define TIMER_CLK_RST (APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(3))
@@ -108,6 +107,7 @@ postcore_initcall(pxa910_init);void __init pxa910_timer_init (void ) { +pxa910_init ();/* reset and configure */ __raw_writel (APBC_APBCLK |APBC_RST ,APBC_TIMERS );__raw_writel (TIMER_CLK_RST ,APBC_TIMERS );
arch/arm/plat-pxa/dma.c +20 -10
@@ -228,36 +228,46 @@ err_state:return NULL ; } -static void pxa_dma_init_debugfs (void ) +static int __init pxa_dma_init_debugfs (void ) { -int i; +int i, ret;struct dentry *chandir; dbgfs_root =debugfs_create_dir (DMA_DEBUG_NAME ,NULL ); -if (IS_ERR (dbgfs_root) || !dbgfs_root) +if (IS_ERR (dbgfs_root) || !dbgfs_root) { + ret = -EINVAL ; goto err_root; + } dbgfs_state =debugfs_create_file ("state" ,0400 , dbgfs_root,NULL , &dbg_fops_state); -if (!dbgfs_state) +if (!dbgfs_state) { + ret = -EINVAL ; goto err_state; + } dbgfs_chan =kmalloc (sizeof (*dbgfs_state) * num_dma_channels,GFP_KERNEL ); -if (!dbgfs_chan) +if (!dbgfs_chan) { + ret = -ENOMEM ; goto err_alloc; + } chandir =debugfs_create_dir ("channels" , dbgfs_root); -if (!chandir) +if (!chandir) { + ret = -EINVAL ; goto err_chandir; + }for (i =0 ; i < num_dma_channels; i++) { dbgfs_chan[i] =pxa_dma_dbg_alloc_chan (i, chandir); -if (!dbgfs_chan[i]) +if (!dbgfs_chan[i]) { + ret = -EINVAL ; goto err_chans; + } } -return ; +return 0 ; err_chans: err_chandir:kfree (dbgfs_chan);
@@ -266,7 +276,9 @@ err_state:debugfs_remove_recursive (dbgfs_root); err_root:pr_err ("pxa_dma: debugfs is not available\n" ); +return ret; } +late_initcall (pxa_dma_init_debugfs); static void __exit pxa_dma_cleanup_debugfs(void) {
@@ -385,7 +397,5 @@ int __init pxa_init_dma(int irq, int num_ch) } num_dma_channels = num_ch; -pxa_dma_init_debugfs (); -return 0 ; }
Signature · 1 line
1.8.1.2
PATCH v3 9/11 clk: mmp: parse clock from dts
In reply to Haojian ZhuangParse clock information from DTS file for mach-mmp.
--- arch/arm/boot/dts/pxa168-aspenite.dts | 3 + arch/arm/boot/dts/pxa168-clk.dtsi | 304 ++++++++++++++++++ arch/arm/boot/dts/pxa168.dtsi | 10 + arch/arm/boot/dts/pxa910-clk.dtsi | 569 ++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/pxa910-dkb.dts | 11 + arch/arm/boot/dts/pxa910.dtsi | 12 +- arch/arm/mach-mmp/mmp-dt.c | 2 + drivers/clk/mmp/Makefile | 2 +- drivers/clk/mmp/clk-mmp.c | 363 ++++++++++++++++++++++ 9 files changed, 1274 insertions(+), 2 deletions(-) create mode 100644 arch/arm/boot/dts/pxa168-clk.dtsi create mode 100644 arch/arm/boot/dts/pxa910-clk.dtsi create mode 100644 drivers/clk/mmp/clk-mmp.c
arch/arm/boot/dts/pxa168-aspenite.dts +3 -0
@@ -24,6 +24,9 @@ soc { apb at d4000000 { + timer0: timer at d4014000 { + status = "okay"; + }; uart1: uart at d4017000 { status = "okay"; };
arch/arm/boot/dts/pxa168-clk.dtsi new file +304 -0
304 lines not on this page · raw message
arch/arm/boot/dts/pxa168.dtsi +10 -0
@@ -8,6 +8,7 @@ */ /include/ "skeleton.dtsi" +/include/ "pxa910-clk.dtsi" / { aliases {
@@ -53,12 +54,15 @@ compatible = "mrvl,mmp-timer"; reg = <0xd4014000 0x100>; interrupts = <13>; + clocks = <&apbc_timer0_clk>; + status = "disabled"; }; uart1: uart at d4017000 { compatible = "mrvl,mmp-uart"; reg = <0xd4017000 0x1000>; interrupts = <27>; + clocks = <&apbc_uart1_clk>; status = "disabled"; };
@@ -66,6 +70,7 @@ compatible = "mrvl,mmp-uart"; reg = <0xd4018000 0x1000>; interrupts = <28>; + clocks = <&apbc_uart2_clk>; status = "disabled"; };
@@ -73,6 +78,7 @@ compatible = "mrvl,mmp-uart"; reg = <0xd4026000 0x1000>; interrupts = <29>; + clocks = <&apbc_uart3_clk>; status = "disabled"; };
@@ -87,6 +93,7 @@ interrupt-names = "gpio_mux"; interrupt-controller; #interrupt-cells = <1>; + clocks = <&apbc_gpio_clk>; ranges; gcb0: gpio at d4019000 {
@@ -111,6 +118,7 @@ reg = <0xd4011000 0x1000>; interrupts = <7>; mrvl,i2c-fast-mode; + clocks = <&apbc_twsi1_clk>; status = "disabled"; };
@@ -118,6 +126,7 @@ compatible = "mrvl,mmp-twsi"; reg = <0xd4025000 0x1000>; interrupts = <58>; + clocks = <&apbc_twsi2_clk>; status = "disabled"; };
@@ -126,6 +135,7 @@ reg = <0xd4010000 0x1000>; interrupts = <5 6>; interrupt-names = "rtc 1Hz", "rtc alarm"; + clocks = <&apbc_rtc_clk>; status = "disabled"; }; };
arch/arm/boot/dts/pxa910-clk.dtsi new file +569 -0
569 lines not on this page · raw message
arch/arm/boot/dts/pxa910-dkb.dts +11 -0
@@ -24,6 +24,17 @@ soc { apb at d4000000 { + pll2: refclk1001mhz { + /* Reference clock for internal PLL2 */ + compatible = "marvell,mmp-fixed-clkrate"; + #clock-cells = <0>; + clocks = <&osc_26m>; + clock-frequency = <1001000000>; + clock-output-names = "refclk1001mhz"; + }; + timer0: timer at d4014000 { + status = "okay"; + }; uart1: uart at d4017000 { status = "okay"; };
arch/arm/boot/dts/pxa910.dtsi +11 -1
@@ -8,6 +8,7 @@ */ /include/ "skeleton.dtsi" +/include/ "pxa910-clk.dtsi" / { aliases {
@@ -44,7 +45,6 @@ reg = <0xd4282000 0x1000>; mrvl,intc-nr-irqs = <64>; }; - }; apb at d4000000 { /* APB */
@@ -58,12 +58,15 @@ compatible = "mrvl,mmp-timer"; reg = <0xd4014000 0x100>; interrupts = <13>; + clocks = <&apbc_timer0_clk>; + status = "disabled"; }; timer1: timer at d4016000 { compatible = "mrvl,mmp-timer"; reg = <0xd4016000 0x100>; interrupts = <29>; + clocks = <&apbc_timer1_clk>; status = "disabled"; };
@@ -71,6 +74,7 @@ compatible = "mrvl,mmp-uart"; reg = <0xd4017000 0x1000>; interrupts = <27>; + clocks = <&apbc_uart1_clk>; status = "disabled"; };
@@ -78,6 +82,7 @@ compatible = "mrvl,mmp-uart"; reg = <0xd4018000 0x1000>; interrupts = <28>; + clocks = <&apbc_uart2_clk>; status = "disabled"; };
@@ -85,6 +90,7 @@ compatible = "mrvl,mmp-uart"; reg = <0xd4036000 0x1000>; interrupts = <59>; + clocks = <&apbcp_uart3_clk>; status = "disabled"; };
@@ -99,6 +105,7 @@ interrupt-names = "gpio_mux"; interrupt-controller; #interrupt-cells = <1>; + clocks = <&apbc_gpio_clk>; ranges; gcb0: gpio at d4019000 {
@@ -124,6 +131,7 @@ #size-cells = <0>; reg = <0xd4011000 0x1000>; interrupts = <7>; + clocks = <&apbc_twsi1_clk>; mrvl,i2c-fast-mode; status = "disabled"; };
@@ -134,6 +142,7 @@ #size-cells = <0>; reg = <0xd4037000 0x1000>; interrupts = <54>; + clocks = <&apbcp_twsi2_clk>; status = "disabled"; };
@@ -142,6 +151,7 @@ reg = <0xd4010000 0x1000>; interrupts = <5 6>; interrupt-names = "rtc 1Hz", "rtc alarm"; + clocks = <&apbc_rtc_clk>; status = "disabled"; }; };
arch/arm/mach-mmp/mmp-dt.c +2 -0
@@ -9,6 +9,7 @@* publishhed by the Free Software Foundation. */ +#include <linux/clk-provider.h> #include <linux/irqchip.h> #include <linux/of_platform.h> #include <asm/mach/arch.h>
@@ -48,6 +49,7 @@ static void __init pxa168_dt_init(void)static void __init pxa910_dt_init (void ) { +of_clk_init (NULL );of_platform_populate (NULL , of_default_bus_match_table, pxa910_auxdata_lookup,NULL ); }
drivers/clk/mmp/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for mmp specific clk # -obj-y += clk-apbc.o clk-apmu.o clk-frac.o +obj-y += clk-apbc.o clk-apmu.o clk-frac.o clk-mmp.o obj-$(CONFIG_CPU_PXA168) += clk-pxa168.o obj-$(CONFIG_CPU_PXA910) += clk-pxa910.o
drivers/clk/mmp/clk-mmp.c new file +363 -0
363 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH v3 10/11 ARM: mmp: avoid to use cpu_is_xxx in timer
In reply to Haojian ZhuangAvoid to use cpu_is_xxx() in timer-mmp driver, since it blocks the multiplatform build. Now add mmp2_mode variable for legacy mode. In DT mode, set the right clock rate in DTS file.
--- arch/arm/boot/dts/mmp2-brownstone.dts | 4 +++ arch/arm/boot/dts/pxa168-aspenite.dts | 1 + arch/arm/boot/dts/pxa910-dkb.dts | 1 + arch/arm/mach-mmp/common.h | 2 +- arch/arm/mach-mmp/mmp-dt.c | 12 ++++++-- arch/arm/mach-mmp/mmp2-dt.c | 12 ++++++-- arch/arm/mach-mmp/mmp2.c | 2 +- arch/arm/mach-mmp/pxa168.c | 2 +- arch/arm/mach-mmp/pxa910.c | 2 +- drivers/clocksource/timer-mmp.c | 58 +++++++++++++++++++++++++---------- 10 files changed, 69 insertions(+), 27 deletions(-)
arch/arm/boot/dts/mmp2-brownstone.dts +4 -0
@@ -24,6 +24,10 @@ soc { apb at d4000000 { + timer0: timer at d4014000 { + clock-frequency = <6500000>; + status = "okay"; + }; uart3: uart at d4018000 { status = "okay"; };
arch/arm/boot/dts/pxa168-aspenite.dts +1 -0
@@ -25,6 +25,7 @@ soc { apb at d4000000 { timer0: timer at d4014000 { + clock-frequency = <3250000>; status = "okay"; }; uart1: uart at d4017000 {
arch/arm/boot/dts/pxa910-dkb.dts +1 -0
@@ -33,6 +33,7 @@ clock-output-names = "refclk1001mhz"; }; timer0: timer at d4014000 { + clock-frequency = <3250000>; status = "okay"; }; uart1: uart at d4017000 {
arch/arm/mach-mmp/common.h +1 -1
@@ -1,6 +1,6 @@#define ARRAY_AND_SIZE (x) (x), ARRAY_SIZE(x) -extern void timer_init (int irq); +extern void timer_init (int irq,int mmp2_mode);extern void __init mmp_map_io (void );extern void mmp_restart (char ,const char *);
arch/arm/mach-mmp/mmp-dt.c +9 -3
@@ -10,6 +10,7 @@*/ #include <linux/clk-provider.h> +#include <linux/clocksource.h> #include <linux/irqchip.h> #include <linux/of_platform.h> #include <asm/mach/arch.h>
@@ -49,7 +50,6 @@ static void __init pxa168_dt_init(void)static void __init pxa910_dt_init (void ) { -of_clk_init (NULL );of_platform_populate (NULL , of_default_bus_match_table, pxa910_auxdata_lookup,NULL ); }
@@ -60,10 +60,16 @@ static const char *mmp_dt_board_compat[] __initdata = { NULL, }; +static void __init mmp_init_timer (void ) +{ +of_clk_init (NULL ); +mmp_dt_init_timer (); +} +DT_MACHINE_START (PXA168_DT ,"Marvell PXA168 (Device Tree Support)" ) .map_io = mmp_map_io, .init_irq = irqchip_init, - .init_time = mmp_dt_init_timer, + .init_time = mmp_init_timer, .init_machine = pxa168_dt_init, .dt_compat = mmp_dt_board_compat,MACHINE_END
@@ -71,7 +77,7 @@ MACHINE_ENDDT_MACHINE_START (PXA910_DT ,"Marvell PXA910 (Device Tree Support)" ) .map_io = mmp_map_io, .init_irq = irqchip_init, - .init_time = mmp_dt_init_timer, + .init_time = mmp_init_timer, .init_machine = pxa910_dt_init, .dt_compat = mmp_dt_board_compat,MACHINE_END
arch/arm/mach-mmp/mmp2-dt.c +9 -3
@@ -9,6 +9,8 @@* publishhed by the Free Software Foundation. */ +#include <linux/clk-provider.h> +#include <linux/clocksource.h> #include <linux/io.h> #include <linux/irqchip.h> #include <linux/of_platform.h>
@@ -17,8 +19,6 @@#include "common.h" -extern void __init mmp_dt_init_timer (void ); -static const struct of_dev_auxdata mmp2_auxdata_lookup[]__initconst = {OF_DEV_AUXDATA ("mrvl,mmp-uart" ,0xd4030000 ,"pxa2xx-uart.0" ,NULL ),OF_DEV_AUXDATA ("mrvl,mmp-uart" ,0xd4017000 ,"pxa2xx-uart.1" ,NULL ),
@@ -37,6 +37,12 @@ static void __init mmp2_dt_init(void) mmp2_auxdata_lookup, NULL); } +static void __init mmp2_init_timer (void ) +{ +of_clk_init (NULL ); +mmp_dt_init_timer (); +} +static const char *mmp2_dt_board_compat[]__initdata = {"mrvl,mmp2-brownstone" ,NULL ,
@@ -45,7 +51,7 @@ static const char *mmp2_dt_board_compat[] __initdata = {DT_MACHINE_START (MMP2_DT ,"Marvell MMP2 (Device Tree Support)" ) .map_io = mmp_map_io, .init_irq = irqchip_init, - .init_time = mmp_dt_init_timer, + .init_time = mmp2_init_timer, .init_machine = mmp2_dt_init, .dt_compat = mmp2_dt_board_compat,MACHINE_END
arch/arm/mach-mmp/mmp2.c +1 -1
@@ -131,7 +131,7 @@ void __init mmp2_timer_init(void) clk_rst =APBC_APBCLK |APBC_FNCLK |APBC_FNCLKSEL (1 );__raw_writel (clk_rst,APBC_TIMERS ); -timer_init (IRQ_MMP2_TIMER1 ); +timer_init (IRQ_MMP2_TIMER1 ,1 ); }/* on-chip devices */
arch/arm/mach-mmp/pxa168.c +1 -1
@@ -78,7 +78,7 @@ void __init pxa168_timer_init(void)/* 3.25MHz, bus/functional clock enabled, release reset */ __raw_writel (TIMER_CLK_RST ,APBC_TIMERS ); -timer_init (IRQ_PXA168_TIMER1 ); +timer_init (IRQ_PXA168_TIMER1 ,0 ); }void pxa168_clear_keypad_wakeup (void )
arch/arm/mach-mmp/pxa910.c +1 -1
@@ -112,7 +112,7 @@ void __init pxa910_timer_init(void)__raw_writel (APBC_APBCLK |APBC_RST ,APBC_TIMERS );__raw_writel (TIMER_CLK_RST ,APBC_TIMERS ); -timer_init (IRQ_PXA910_AP1_TIMER1 ); +timer_init (IRQ_PXA910_AP1_TIMER1 ,0 ); }/* on-chip devices */
drivers/clocksource/timer-mmp.c +41 -17
109 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH v3 10/11 ARM: mmp: avoid to use cpu_is_xxx in timer
drivers/clocksource/timer-mmp.c static struct of_device_id mmp_timer_dt_ids[] = { · line 249
Quoted 11 lines · Haojian Zhuang
void
__initmmp_dt_init_timer(void){ struct device_node *np;drivers/clocksource/timer-mmp.c +2
-3+struct clk *clk;int irq, ret; +u32 rate =0 ; np =of_find_matching_node (NULL , mmp_timer_dt_ids); -if (!np) { - ret = -ENODEV ; - goto out;
Please use CLOCKSOURCE_OF_DECLARE() here and call clocksource_of_init() in the platform code, rather than calling mmp_dt_init_timer directly.
Arnd
PATCH v3 10/11 ARM: mmp: avoid to use cpu_is_xxx in timer
Quoted 13 lines · Arnd Bergmann
drivers/clocksource/timer-mmp.c static struct of_device_id mmp_timer_dt_ids[] = { · line 249
Quoted 11 lines · Haojian Zhuang
void
__initmmp_dt_init_timer(void){ struct device_node *np;drivers/clocksource/timer-mmp.c +2
-3+struct clk *clk;int irq, ret; +u32 rate =0 ; np =of_find_matching_node (NULL , mmp_timer_dt_ids); -if (!np) { - ret = -ENODEV ; - goto out;
Quoted 4 lines
Please use
CLOCKSOURCE_OF_DECLARE()here and callclocksource_of_init()in the platform code, rather than callingmmp_dt_init_timerdirectly.Arnd
CLOCKSOURCE_OF_DECLARE() is in the 11th patch. And mmp_dt_init_timer() won't be called in 11th patch.
I split it into 10th & 11th. Since I just want 10th patch to remove cpu_is_xxx().
Regards
Haojian
PATCH v3 11/11 ARCH: mmp: support clocksource in timer
In reply to Haojian ZhuangSupport clocksource in timer-mmp driver.
--- arch/arm/mach-mmp/mmp-dt.c | 4 +--- arch/arm/mach-mmp/mmp2-dt.c | 2 +- drivers/clocksource/Kconfig | 6 ++++++ drivers/clocksource/Makefile | 2 +- drivers/clocksource/timer-mmp.c | 16 +++------------- 5 files changed, 12 insertions(+), 18 deletions(-)
arch/arm/mach-mmp/mmp-dt.c +1 -3
@@ -18,8 +18,6 @@#include "common.h" -extern void __init mmp_dt_init_timer (void ); -static const struct of_dev_auxdata pxa168_auxdata_lookup[]__initconst = {OF_DEV_AUXDATA ("mrvl,mmp-uart" ,0xd4017000 ,"pxa2xx-uart.0" ,NULL ),OF_DEV_AUXDATA ("mrvl,mmp-uart" ,0xd4018000 ,"pxa2xx-uart.1" ,NULL ),
@@ -63,7 +61,7 @@ static const char *mmp_dt_board_compat[] __initdata = {static void __init mmp_init_timer (void ) {of_clk_init (NULL ); -mmp_dt_init_timer (); +clocksource_of_init (); }DT_MACHINE_START (PXA168_DT ,"Marvell PXA168 (Device Tree Support)" )
arch/arm/mach-mmp/mmp2-dt.c +1 -1
@@ -40,7 +40,7 @@ static void __init mmp2_dt_init(void)static void __init mmp2_init_timer (void ) {of_clk_init (NULL ); -mmp_dt_init_timer (); +clocksource_of_init (); }static const char *mmp2_dt_board_compat[]__initdata = {
drivers/clocksource/Kconfig +6 -0
@@ -72,6 +72,12 @@ config CLKSRC_METAG_GENERIC help This option enables support for the Meta per-thread timers. +config CLKSRC_MMP + def_bool y if ARCH_MMP + select CLKSRC_OF if OF + help + This option enables support for the MMP timer. + config CLKSRC_EXYNOS_MCT def_bool y if ARCH_EXYNOS help
drivers/clocksource/Makefile +1 -1
@@ -10,6 +10,7 @@ obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o obj-$(CONFIG_EM_TIMER_STI) += em_sti.o obj-$(CONFIG_CLKBLD_I8253) += i8253.o obj-$(CONFIG_CLKSRC_MMIO) += mmio.o +obj-$(CONFIG_CLKSRC_MMP) += timer-mmp.o obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o obj-$(CONFIG_CLKSRC_NOMADIK_MTU) += nomadik-mtu.o
@@ -17,7 +18,6 @@ obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o obj-$(CONFIG_ARCH_MARCO) += timer-marco.o -obj-$(CONFIG_ARCH_MMP) += timer-mmp.o obj-$(CONFIG_ARCH_MXS) += mxs_timer.o obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o
drivers/clocksource/timer-mmp.c +3 -13
@@ -235,22 +235,12 @@ void __init timer_init(int irq, int mmp2_mode) MIN_DELTA, MAX_DELTA); } -#ifdef CONFIG_OF -static struct of_device_id mmp_timer_dt_ids[] = { - { .compatible ="mrvl,mmp-timer" , }, - {} -}; - -void __init mmp_dt_init_timer (void ) +static void __init mmp_dt_init_timer (struct device_node *np) { -struct device_node *np;struct clk *clk; -int irq, ret; +int irq;u32 rate =0 ; - np =of_find_matching_node (NULL , mmp_timer_dt_ids); -if (!np) -return ;if (!of_device_is_available (np))return ;if (of_property_read_u32 (np,"clock-frequency" , &rate)) {
@@ -288,4 +278,4 @@ void __init mmp_dt_init_timer(void) out:clk_put (clk); } -#endif +CLOCKSOURCE_OF_DECLARE (mmp_timer,"mrvl,mmp-timer" , mmp_dt_init_timer);
Signature · 1 line
1.8.1.2
PATCH v3 11/11 ARCH: mmp: support clocksource in timer
Quoted 8 lines · Haojian Zhuang
drivers/clocksource/Kconfig +0
-0@@ -72,6 +72,12 @@ config CLKSRC_METAG_GENERIC help This option enables support for the Meta per-thread timers.
drivers/clocksource/Kconfig config CLKSRC_METAG_GENERIC · line 83
Quoted 10 lines
drivers/clocksource/Kconfig +6
-0+config CLKSRC_MMP + def_bool y if ARCH_MMP + select CLKSRC_OF if OF + help + This option enables support for the MMP timer. + config CLKSRC_EXYNOS_MCT def_bool y if ARCH_EXYNOS help
If I'm reading the above right, CONFIG_CLKSRC_MMP is identical to CONFIG_ARCH_MMP, no?
Why not just use CONFIG_ARCH_MMP for configuration conditional code (and have that config select CLKSRC_OF if appropriate)?
Otherwise we just start adding extra unnecessary config options that really don't add any real meaning to things.
thanks
-john
PATCH v3 11/11 ARCH: mmp: support clocksource in timer
Quoted 23 lines · John Stultz
Quoted 8 lines · Haojian Zhuang
drivers/clocksource/Kconfig +0
-0@@ -72,6 +72,12 @@ config CLKSRC_METAG_GENERIC helpdrivers/clocksource/Kconfig config CLKSRC_METAG_GENERIC · line 82
Quoted 10 lines
drivers/clocksource/Kconfig +5
-0This option enables support for the Meta per-thread timers. +config CLKSRC_MMP + def_bool y if ARCH_MMP + select CLKSRC_OF if OF + help + This option enables support for the MMP timer. + config CLKSRC_EXYNOS_MCT def_bool y if ARCH_EXYNOS helpIf I'm reading the above right,
CONFIG_CLKSRC_MMPis identical toCONFIG_ARCH_MMP, no?
Quoted 11 lines
Why not just use
CONFIG_ARCH_MMPfor configuration conditional code (and have that config selectCLKSRC_OFif appropriate)?Otherwise we just start adding extra unnecessary config options that really don't add any real meaning to things.
thanks
-john
It's also OK. I can remove it.
Regards
Haojian