ARM: PRIMA2: rstc: enable the support for Marco
Subsystems (4)
PATCH v3 5/9 ARM: PRIMA2: rstc: enable the support for Marco
From: Barry Song <[email protected]>
marco has SET/CLEAR registers pair for rstc to avoid read-modify-write, this patch detects the mach typer and access registers based on SoC.
--- arch/arm/mach-prima2/rstc.c | 45 ++++++++++++++++++++++++++---------------- 1 files changed, 28 insertions(+), 17 deletions(-)
arch/arm/mach-prima2/rstc.c +28 -17
@@ -19,6 +19,7 @@ static DEFINE_MUTEX(rstc_lock);static struct of_device_id rstc_ids[] = { { .compatible ="sirf,prima2-rstc" }, + { .compatible ="sirf,marco-rstc" }, {}, };
@@ -42,27 +43,37 @@ early_initcall(sirfsoc_of_rstc_init);int sirfsoc_reset_device (struct device *dev) { -const unsigned int *prop =of_get_property (dev->of_node,"reset-bit" ,NULL ); -unsigned int reset_bit; +u32 reset_bit; -if (!prop) -return -ENODEV ; - - reset_bit =be32_to_cpup (prop); +if (of_property_read_u32 (dev->of_node,"reset-bit" , &reset_bit)) +return -EINVAL ;mutex_lock (&rstc_lock); -/* -* Writing 1 to this bit resets corresponding block. Writing 0 to this -* bit de-asserts reset signal of the corresponding block. -* datasheet doesn't require explicit delay between the set and clear -* of reset bit. it could be shorter if tests pass. -*/ -writel (readl (sirfsoc_rstc_base + (reset_bit /32 ) *4 ) | reset_bit, - sirfsoc_rstc_base + (reset_bit /32 ) *4 ); -msleep (10 ); -writel (readl (sirfsoc_rstc_base + (reset_bit /32 ) *4 ) & ~reset_bit, - sirfsoc_rstc_base + (reset_bit /32 ) *4 ); +if (of_device_is_compatible (dev->of_node,"sirf,prima2-rstc" )) { +/* +* Writing 1 to this bit resets corresponding block. Writing 0 to this +* bit de-asserts reset signal of the corresponding block. +* datasheet doesn't require explicit delay between the set and clear +* of reset bit. it could be shorter if tests pass. +*/ +writel (readl (sirfsoc_rstc_base + (reset_bit /32 ) *4 ) | reset_bit, + sirfsoc_rstc_base + (reset_bit /32 ) *4 ); +msleep (10 ); +writel (readl (sirfsoc_rstc_base + (reset_bit /32 ) *4 ) & ~reset_bit, + sirfsoc_rstc_base + (reset_bit /32 ) *4 ); + }else { +/* +* For MARCO and POLO +* Writing 1 to SET register resets corresponding block. Writing 1 to CLEAR +* register de-asserts reset signal of the corresponding block. +* datasheet doesn't require explicit delay between the set and clear +* of reset bit. it could be shorter if tests pass. +*/ +writel (reset_bit, sirfsoc_rstc_base + (reset_bit /32 ) *8 ); +msleep (10 ); +writel (reset_bit, sirfsoc_rstc_base + (reset_bit /32 ) *8 +4 ); + }mutex_unlock (&rstc_lock);
Signature · 6 lines
1.7.5.4 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
PATCH v3 6/9 ARM: PRIMA2: rtciobg: it is also compatible with marco
From: Barry Song <[email protected]>
--- arch/arm/mach-prima2/rtciobrg.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-prima2/rtciobrg.c +1 -0
@@ -104,6 +104,7 @@ EXPORT_SYMBOL_GPL(sirfsoc_rtc_iobrg_writel);static const struct of_device_id rtciobrg_ids[] = { { .compatible ="sirf,prima2-rtciobg" }, + { .compatible ="sirf,marco-rtciobg" }, {} };
Signature · 6 lines
1.7.5.4 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
PATCH v3 7/9 ARM: PRIMA2: irq: make prima2 irq can work even we enable GIC for Marco
In reply to Barry SongFrom: Barry Song <[email protected]>
in Marco, we will use GIC. this patch prepares the handle_irq for prima2 to avoid the compiling errors since we want only one defconfig and zImage for both prima2 and marco that means we will need handle_irq for both.
--- arch/arm/mach-prima2/common.c | 3 +++ arch/arm/mach-prima2/common.h | 2 ++ arch/arm/mach-prima2/include/mach/irqs.h | 4 ++-- arch/arm/mach-prima2/irq.c | 16 ++++++++++++++-- 4 files changed, 21 insertions(+), 4 deletions(-)
arch/arm/mach-prima2/common.c +3 -0
@@ -41,6 +41,9 @@ DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)") .map_io = sirfsoc_map_lluart, .init_irq = sirfsoc_of_irq_init, .init_time = sirfsoc_prima2_timer_init, +#ifdef CONFIG_MULTI_IRQ_HANDLER + .handle_irq = sirfsoc_handle_irq, +#endif .dma_zone_size =SZ_256M , .init_machine = sirfsoc_mach_init, .init_late = sirfsoc_init_late,
arch/arm/mach-prima2/common.h +2 -0
@@ -11,12 +11,14 @@#include <linux/init.h> #include <asm/mach/time.h> +#include <asm/exception.h> extern void sirfsoc_prima2_timer_init (void );extern void __init sirfsoc_of_irq_init (void );extern void __init sirfsoc_of_clk_init (void );extern void sirfsoc_restart (char ,const char *); +extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs);#ifndef CONFIG_DEBUG_LL static inline void sirfsoc_map_lluart (void ) {}
arch/arm/mach-prima2/include/mach/irqs.h +2 -2
@@ -10,8 +10,8 @@#define __ASM_ARCH_IRQS_H#define SIRFSOC_INTENAL_IRQ_START 0 -#define SIRFSOC_INTENAL_IRQ_END 59 +#define SIRFSOC_INTENAL_IRQ_END 127#define SIRFSOC_GPIO_IRQ_START (SIRFSOC_INTENAL_IRQ_END + 1) -#define NR_IRQS 220 +#define NR_IRQS 288#endif
arch/arm/mach-prima2/irq.c +14 -2
@@ -9,17 +9,19 @@#include <linux/init.h> #include <linux/io.h> #include <linux/irq.h> -#include <mach/hardware.h> -#include <asm/mach/irq.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/irqdomain.h> #include <linux/syscore_ops.h> +#include <asm/mach/irq.h> +#include <asm/exception.h> +#include <mach/hardware.h> #define SIRFSOC_INT_RISC_MASK0 0x0018#define SIRFSOC_INT_RISC_MASK1 0x001C#define SIRFSOC_INT_RISC_LEVEL0 0x0020#define SIRFSOC_INT_RISC_LEVEL1 0x0024 +#define SIRFSOC_INIT_IRQ_ID 0x0038void __iomem *sirfsoc_intc_base;
@@ -52,6 +54,16 @@ static __init void sirfsoc_irq_init(void)writel_relaxed (0 , sirfsoc_intc_base +SIRFSOC_INT_RISC_MASK1 ); } +asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs) +{ +u32 irqstat, irqnr; + + irqstat =readl_relaxed (sirfsoc_intc_base +SIRFSOC_INIT_IRQ_ID ); + irqnr = irqstat &0xff ; + +handle_IRQ (irqnr, regs); +} +static struct of_device_id intc_ids[] = { { .compatible ="sirf,prima2-intc" }, {},
Signature · 6 lines
1.7.5.4 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
PATCH v3 8/9 ARM: PRIMA2: add new SiRFmarco SMP SoC infrastructures
In reply to Barry SongFrom: Barry Song <[email protected]>
this patch adds tick timer, smp entries and generic DT machine for SiRFmarco dual-core SMP chips.
with the added marco, we change the defconfig, using the same defconfig, we get a zImage which can work on both prima2 and marco.
--- arch/arm/boot/dts/Makefile | 1 + arch/arm/configs/prima2_defconfig | 3 + arch/arm/mach-prima2/Kconfig | 10 ++ arch/arm/mach-prima2/Makefile | 3 + arch/arm/mach-prima2/common.c | 40 +++++- arch/arm/mach-prima2/common.h | 11 ++ arch/arm/mach-prima2/headsmp.S | 79 +++++++++ arch/arm/mach-prima2/hotplug.c | 41 +++++ arch/arm/mach-prima2/platsmp.c | 163 +++++++++++++++++++ arch/arm/mach-prima2/timer-marco.c | 316 ++++++++++++++++++++++++++++++++++++ 10 files changed, 666 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-prima2/headsmp.S create mode 100644 arch/arm/mach-prima2/hotplug.c create mode 100644 arch/arm/mach-prima2/platsmp.c create mode 100644 arch/arm/mach-prima2/timer-marco.c
arch/arm/boot/dts/Makefile +1 -0
@@ -73,6 +73,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \ kirkwood-ts219-6281.dtb \ kirkwood-ts219-6282.dtb \ kirkwood-openblocks_a6.dtb +dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \ msm8960-cdp.dtb dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
arch/arm/configs/prima2_defconfig +3 -0
@@ -11,6 +11,9 @@ CONFIG_PARTITION_ADVANCED=y CONFIG_BSD_DISKLABEL=y CONFIG_SOLARIS_X86_PARTITION=y CONFIG_ARCH_SIRF=y +# CONFIG_SWP_EMULATE is not set +CONFIG_SMP=y +CONFIG_SCHED_MC=y CONFIG_PREEMPT=y CONFIG_AEABI=y CONFIG_KEXEC=y
arch/arm/mach-prima2/Kconfig +10 -0
@@ -11,6 +11,16 @@ config ARCH_PRIMA2 help Support for CSR SiRFSoC ARM Cortex A9 Platform +config ARCH_MARCO + bool "CSR SiRFSoC MARCO ARM Cortex A9 Platform" + default y + select ARM_GIC + select CPU_V7 + select HAVE_SMP + select SMP_ON_UP + help + Support for CSR SiRFSoC ARM Cortex A9 Platform + endmenu config SIRF_IRQ
arch/arm/mach-prima2/Makefile +3 -0
@@ -5,4 +5,7 @@ obj-$(CONFIG_DEBUG_LL) += lluart.o obj-$(CONFIG_CACHE_L2X0) += l2x0.o obj-$(CONFIG_SUSPEND) += pm.o sleep.o obj-$(CONFIG_SIRF_IRQ) += irq.o +obj-$(CONFIG_SMP) += platsmp.o headsmp.o +obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o +obj-$(CONFIG_ARCH_MARCO) += timer-marco.o
arch/arm/mach-prima2/common.c +39 -1
@@ -8,9 +8,11 @@#include <linux/init.h> #include <linux/kernel.h> +#include <linux/of_irq.h> #include <asm/sizes.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> +#include <asm/hardware/gic.h> #include <linux/of.h> #include <linux/of_platform.h> #include "common.h"
@@ -30,6 +32,12 @@ void __init sirfsoc_init_late(void)sirfsoc_pm_init (); } +static __init void sirfsoc_map_io (void ) +{ +sirfsoc_map_lluart (); +sirfsoc_map_scu (); +} +#ifdef CONFIG_ARCH_PRIMA2 static const char *prima2_dt_match[]__initdata = { "sirf,prima2",
@@ -38,7 +46,7 @@ static const char *prima2_dt_match[] __initdata = {DT_MACHINE_START (PRIMA2_DT ,"Generic PRIMA2 (Flattened Device Tree)" )/* Maintainer: Barry Song <[email protected]> */ - .map_io = sirfsoc_map_lluart, + .map_io = sirfsoc_map_io, .init_irq = sirfsoc_of_irq_init, .init_time = sirfsoc_prima2_timer_init, #ifdef CONFIG_MULTI_IRQ_HANDLER
@@ -51,3 +59,33 @@ DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)") .restart = sirfsoc_restart, MACHINE_END#endif + +#ifdef CONFIG_ARCH_MARCO +static const struct of_device_id marco_irq_match[]__initconst = { + { .compatible ="arm,cortex-a9-gic" , .data = gic_of_init, }, + {/* sentinel */ } +}; + +static void __init marco_init_irq (void ) +{ +of_irq_init (marco_irq_match); +} + +static const char *marco_dt_match[]__initdata = { +"sirf,marco" , +NULL +}; + +DT_MACHINE_START (MARCO_DT ,"Generic MARCO (Flattened Device Tree)" ) +/* Maintainer: Barry Song <[email protected]> */ + .smp = smp_ops(sirfsoc_smp_ops), + .map_io = sirfsoc_map_io, + .init_irq = marco_init_irq, + .init_time = sirfsoc_marco_timer_init, + .handle_irq = gic_handle_irq, + .init_machine = sirfsoc_mach_init, + .init_late = sirfsoc_init_late, + .dt_compat = marco_dt_match, + .restart = sirfsoc_restart, +MACHINE_END +#endif
arch/arm/mach-prima2/common.h +11 -0
@@ -14,6 +14,11 @@#include <asm/exception.h> extern void sirfsoc_prima2_timer_init (void ); +extern void sirfsoc_marco_timer_init (void ); + +extern struct smp_operations sirfsoc_smp_ops; +extern void sirfsoc_secondary_startup (void ); +extern void sirfsoc_cpu_die (unsigned int cpu);extern void __init sirfsoc_of_irq_init (void );extern void __init sirfsoc_of_clk_init (void );
@@ -26,6 +31,12 @@ static inline void sirfsoc_map_lluart(void) {}extern void __init sirfsoc_map_lluart (void );#endif +#ifndef CONFIG_SMP +static inline void sirfsoc_map_scu (void ) {} +#else +extern void sirfsoc_map_scu (void ); +#endif +#ifdef CONFIG_SUSPEND extern int sirfsoc_pm_init (void );#else
arch/arm/mach-prima2/headsmp.S new file +79 -0
79 lines not on this page · raw message
arch/arm/mach-prima2/hotplug.c new file +41 -0
41 lines not on this page · raw message
arch/arm/mach-prima2/platsmp.c new file +163 -0
163 lines not on this page · raw message
arch/arm/mach-prima2/timer-marco.c new file +316 -0
316 lines not on this page · raw message
Signature · 6 lines
1.7.5.4 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our [email protected]/blog
PATCH v3 9/9 ARM: PRIMA2: provide two DEBUG_LL ports for prima2 and marco
In reply to Barry SongFrom: Barry Song <[email protected]>
prima2 and marco has different memory base, the old code will fail if we enable DEBUG_LL in marco.
this patch adds two debuf port, while debugging, we select one of PRIMA2 and MARCO debug ports, in the products, we disable DEBUG_LL.
--- arch/arm/Kconfig.debug | 14 ++++++++++++++ arch/arm/mach-prima2/include/mach/uart.h | 6 ++++++ arch/arm/mach-prima2/include/mach/uncompress.h | 3 +++ 3 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/Kconfig.debug +14 -0
@@ -386,6 +386,20 @@ choice Say Y here if you want kernel low-level debugging support on Tegra based platforms. + config DEBUG_SIRFPRIMA2_UART1 + bool "Kernel low-level debugging messages via SiRFprimaII UART1" + depends on ARCH_PRIMA2 + help + Say Y here if you want the debug print routines to direct + their output to the uart1 port on SiRFprimaII devices. + + config DEBUG_SIRFMARCO_UART1 + bool "Kernel low-level debugging messages via SiRFmarco UART1" + depends on ARCH_MARCO + help + Say Y here if you want the debug print routines to direct + their output to the uart1 port on SiRFmarco devices. + config DEBUG_VEXPRESS_UART0_DETECT bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" depends on ARCH_VEXPRESS && CPU_CP15_MMU
arch/arm/mach-prima2/include/mach/uart.h +6 -0
@@ -10,7 +10,13 @@#define __MACH_PRIMA2_SIRFSOC_UART_H/* UART-1: used as serial debug port */ +#if defined(CONFIG_DEBUG_SIRFPRIMA2_UART1 )#define SIRFSOC_UART1_PA_BASE 0xb0060000 +#elif defined(CONFIG_DEBUG_SIRFMARCO_UART1 ) +#define SIRFSOC_UART1_PA_BASE 0xcc060000 +#else +#define SIRFSOC_UART1_PA_BASE 0 +#endif #define SIRFSOC_UART1_VA_BASE SIRFSOC_VA(0x060000)#define SIRFSOC_UART1_SIZE SZ_4K
arch/arm/mach-prima2/include/mach/uncompress.h +3 -0
@@ -25,6 +25,9 @@ static __inline__ void putc(char c)* during kernel decompression, all mappings are flat: * virt_addr == phys_addr */ +if (!SIRFSOC_UART1_PA_BASE ) +return ; +while (__raw_readl ((void __iomem *)SIRFSOC_UART1_PA_BASE +SIRFSOC_UART_TXFIFO_STATUS ) &SIRFSOC_UART1_TXFIFO_FULL )barrier ();
Signature · 6 lines
1.7.5.4 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog