ARM: PRIMA2: rstc: enable the support for Marco
Subsystems (2)
PATCH 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.
Signed-off-by Barry Song <[email protected]>
--- 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 6/9 ARM: PRIMA2: rtciobg: it is also compatible with marco
From: Barry Song <[email protected]>
Signed-off-by 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 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.
Signed-off-by Baohua Song <[email protected]>
--- 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
@@ -40,6 +40,9 @@ DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)")/* Maintainer: Barry Song <[email protected]> */ .map_io = sirfsoc_map_lluart, .init_irq = sirfsoc_of_irq_init, +#ifdef CONFIG_MULTI_IRQ_HANDLER + .handle_irq = sirfsoc_handle_irq, +#endif .timer = &sirfsoc_prima2_timer, .dma_zone_size = SZ_256M, .init_machine = sirfsoc_mach_init,
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 struct sys_timer sirfsoc_prima2_timer;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