Skip to contentSkip to conversation

mmp: support marvell ARMADA610

PATCH New Haojian Zhuang 1 participant 1 message Dec 4, 2009

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

PATCH 1/1 mmp: support marvell ARMADA610

Marvell ARMADA610 is a SoC based on PJ4 core. It's ARMv6 compatible. Support basic interrupt handler and timer.

---
 arch/arm/Kconfig                             |    4 +-
 arch/arm/mach-mmp/Kconfig                    |   20 +++-
 arch/arm/mach-mmp/common.h                   |    2 +
 arch/arm/mach-mmp/include/mach/cputype.h     |   17 ++-
 arch/arm/mach-mmp/include/mach/entry-macro.S |   34 ++++-
 arch/arm/mach-mmp/include/mach/irqs.h        |  107 ++++++++++++-
 arch/arm/mach-mmp/include/mach/regs-apbc.h   |   41 +++++
 arch/arm/mach-mmp/include/mach/regs-icu.h    |   32 ++++-
 arch/arm/mach-mmp/include/mach/timex.h       |    4 +
 arch/arm/mach-mmp/irq.c                      |  225 ++++++++++++++++++++++++++
 arch/arm/mach-mmp/time.c                     |   29 ++++-
 11 files changed, 499 insertions(+), 16 deletions(-)
arch/arm/Kconfig +2 -2
index 1c4119c..e4495ce 100644
@@ -484,7 +484,7 @@ config ARCH_ORION5X
 	  Orion-2 (5281), Orion-1-90 (6183).
 
 config ARCH_MMP
-	bool "Marvell PXA168/910"
+	bool "Marvell PXA168/910 & ARMADA610"
 	depends on MMU
 	select GENERIC_GPIO
 	select ARCH_REQUIRE_GPIOLIB
@@ -495,7 +495,7 @@ config ARCH_MMP
 	select TICK_ONESHOT
 	select PLAT_PXA
 	help
-	  Support for Marvell's PXA168/910 processor line.
+	  Support for Marvell's PXA168/910 & ARMADA610 processor line.
 
 config ARCH_KS8695
 	bool "Micrel/Kendin KS8695"
arch/arm/mach-mmp/Kconfig +19 -1
index c6a564f..2ed130d 100644
@@ -1,6 +1,6 @@
 if ARCH_MMP
 
-menu "Marvell PXA168/910 Implmentations"
+menu "Marvell PXA168/910 & ARMADA610 Implmentations"
 
 config MACH_ASPENITE
 	bool "Marvell's PXA168 Aspenite Development Board"
@@ -30,6 +30,16 @@ config MACH_TTC_DKB
 	  Say 'Y' here if you want to support the Marvell PXA910-based
 	  TTC_DKB Development Board.
 
+config MACH_FLINT
+	bool "Marvell's Flint Development Platform"
+	select CPU_ARMADA610
+	help
+	  Say 'Y' here if you want to support the Marvell ARMADA610-based
+	  Flint Development Platform.
+	  ARMADA610-based board can't be co-existed with PXA168-based &
+	  PXA910-based development board. Since ARMADA610 is compatible to
+	  ARMv6 architecture.
+
 endmenu
 
 config CPU_PXA168
@@ -44,4 +54,12 @@ config CPU_PXA910
 	help
 	  Select code specific to PXA910
 
+config CPU_ARMADA610
+	bool
+	select CPU_V6
+	select CPU_32v6K
+	select PLAT_PXA
+	help
+	  Select code specific to ARMADA610
+	  ARMADA610 is ARMv6 compatible.
 endif
arch/arm/mach-mmp/common.h +2 -0
index c33fbbc..f929d61 100644
@@ -6,8 +6,10 @@ extern void timer_init(int irq);
 
 extern struct sys_timer pxa168_timer;
 extern struct sys_timer pxa910_timer;
+extern struct sys_timer armada610_timer;
 extern void __init pxa168_init_irq(void);
 extern void __init pxa910_init_irq(void);
+extern void __init armada610_init_irq(void);
 
 extern void __init icu_init_irq(void);
 extern void __init pxa_map_io(void);
(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/cputype.h
index 25e797b..3071ba9 100644

arch/arm/mach-mmp/include/mach/cputype.h +13 -4
@@ -8,23 +8,32 @@
  *
  * PXA168    A0    0x41159263   0x56158400   0x00A0A333
  * PXA910    Y0    0x41159262   0x56158000   0x00F0C910
+ * ARMADA610 Z0			0x560f5811
  */
 
 #ifdef CONFIG_CPU_PXA168
-#  define __cpu_is_pxa168(id)	\
+#define __cpu_is_pxa168(id)	\
 	({ unsigned int _id = ((id) >> 8) & 0xff; _id == 0x84; })
 #else
-#  define __cpu_is_pxa168(id)	(0)
+#define __cpu_is_pxa168(id)	(0)
 #endif
 
 #ifdef CONFIG_CPU_PXA910
-#  define __cpu_is_pxa910(id)	\
+#define __cpu_is_pxa910(id)	\
 	({ unsigned int _id = ((id) >> 8) & 0xff; _id == 0x80; })
 #else
-#  define __cpu_is_pxa910(id)	(0)
+#define __cpu_is_pxa910(id)	(0)
+#endif
+
+#ifdef CONFIG_CPU_ARMADA610
+#define __cpu_is_armada610(id)	\
+	({ unsigned int _id = ((id) >> 4) & 0xfff; _id == 0x581; })
+#else
+#define __cpu_is_armada610(id)	(0)
 #endif
 
 #define cpu_is_pxa168()		({ __cpu_is_pxa168(read_cpuid_id()); })
 #define cpu_is_pxa910()		({ __cpu_is_pxa910(read_cpuid_id()); })
+#define cpu_is_armada610()	({ __cpu_is_armada610(read_cpuid_id()); })
 
 #endif /* __ASM_MACH_CPUTYPE_H */
(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/entry-macro.S
index 6d3cd35..cfaa4b2 100644

arch/arm/mach-mmp/include/mach/entry-macro.S +29 -5
@@ -11,15 +11,39 @@
 	.macro	disable_fiq
 	.endm
 
-	.macro	arch_ret_to_user, tmp1, tmp2
+	.macro	get_irqnr_preamble, base, tmp
 	.endm
 
-	.macro	get_irqnr_preamble, base, tmp
-	ldr	\base, =ICU_AP_IRQ_SEL_INT_NUM
+	.macro	arch_ret_to_user, tmp1, tmp2
 	.endm
 
 	.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
-	ldr	\tmp, [\base, #0]
+	ldr	\base, =ICU_VIRT_BASE		@ ICU register base
+	mrc	p15, 0, \tmp, c0, c0, 0		@ CPUID
+	mov	\tmp, \tmp, lsr #4
+	ldr	\irqstat, =0xfff
+	and	\irqstat, \tmp, \irqstat	@ Core G
+
+	@ Core Sheeva PJ1 (PXA168/910)
+	ldr	\tmp, =0x800			@ PXA910
+	cmp	\irqstat, \tmp
+	beq	1001f
+	ldr	\tmp, =0x840			@ PXA168
+	cmp	\irqstat, \tmp
+	bne	1002f
+1001:
+	ldr	\tmp, [\base, #0x10c]		@ AP INT SEL register
+	tst	\tmp, #0x40
+	and	\irqnr, \tmp, #0x3f
+	b	1003f
+
+1002:
+	@ Core Sheeva PJ4 (PXA688)
+	ldr	\tmp, =0x581
+	cmp	\irqstat, \tmp
+	bne	1003f
+	ldr	\tmp, [\base, #0x104]		@ PJ4 IRQ SEL register
+	tst	\tmp, #0x40
 	and	\irqnr, \tmp, #0x3f
-	tst	\tmp, #(1 << 6)
+1003:
 	.endm
(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/irqs.h
index d68871b..3c246c6 100644

arch/arm/mach-mmp/include/mach/irqs.h +105 -2

113 lines not on this page · raw message

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/regs-apbc.h
index 98ccbee..6ed1b9b 100644

arch/arm/mach-mmp/include/mach/regs-apbc.h +41 -0

47 lines not on this page · raw message

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/regs-icu.h
index e5f0872..ae7f97f 100644

arch/arm/mach-mmp/include/mach/regs-icu.h +31 -1
@@ -17,15 +17,45 @@
 #define ICU_REG(x)	(ICU_VIRT_BASE + (x))
 
 #define ICU_INT_CONF(n)		ICU_REG((n) << 2)
+#define ICU_INT_CONF_MASK	(0xf)
+
+#if defined(CONFIG_CPU_PXA168) || defined(CONFIG_CPU_PXA910)
 #define ICU_INT_CONF_AP_INT	(1 << 6)
 #define ICU_INT_CONF_CP_INT	(1 << 5)
 #define ICU_INT_CONF_IRQ	(1 << 4)
-#define ICU_INT_CONF_MASK	(0xf)
 
 #define ICU_AP_FIQ_SEL_INT_NUM	ICU_REG(0x108)	/* AP FIQ Selected Interrupt */
 #define ICU_AP_IRQ_SEL_INT_NUM	ICU_REG(0x10C)	/* AP IRQ Selected Interrupt */
 #define ICU_AP_GBL_IRQ_MSK	ICU_REG(0x114)	/* AP Global Interrupt Mask */
 #define ICU_INT_STATUS_0	ICU_REG(0x128)	/* Interrupt Stuats 0 */
 #define ICU_INT_STATUS_1	ICU_REG(0x12C)	/* Interrupt Status 1 */
+#endif	/* CONFIG_CPU_PXA168 || CONFIG_CPU_PXA910 */
+
+#ifdef CONFIG_CPU_ARMADA610
+/*
+ * IRQ0/FIQ0 is routed to SP IRQ/FIQ.
+ * IRQ1 is routed to PJ4 IRQ, and IRQ2 is routes to PJ4 FIQ.
+ */
+#define ICU_INT_ROUTE_SP_IRQ		(1 << 4)
+#define ICU_INT_ROUTE_PJ4_IRQ		(1 << 5)
+#define ICU_INT_ROUTE_PJ4_FIQ		(1 << 6)
+
+#define ARMADA610_ICU_INT4_STATUS	ICU_REG(0x150)
+#define ARMADA610_ICU_INT5_STATUS	ICU_REG(0x154)
+#define ARMADA610_ICU_INT17_STATUS	ICU_REG(0x158)
+#define ARMADA610_ICU_INT35_STATUS	ICU_REG(0x15c)
+#define ARMADA610_ICU_INT51_STATUS	ICU_REG(0x160)
+
+#define ARMADA610_ICU_INT4_MASK		ICU_REG(0x168)
+#define ARMADA610_ICU_INT5_MASK		ICU_REG(0x16C)
+#define ARMADA610_ICU_INT17_MASK	ICU_REG(0x170)
+#define ARMADA610_ICU_INT35_MASK	ICU_REG(0x174)
+#define ARMADA610_ICU_INT51_MASK	ICU_REG(0x178)
+
+#define ARMADA610_ICU_SP_IRQ_SEL	ICU_REG(0x100)
+#define ARMADA610_ICU_PJ4_IRQ_SEL	ICU_REG(0x104)
+#define ARMADA610_ICU_PJ4_FIQ_SEL	ICU_REG(0x108)
+
+#endif	/* CONFIG_CPU_ARMADA610 */
 
 #endif /* __ASM_MACH_ICU_H */
(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/timex.h
index 6cebbd0..9255e48 100644

arch/arm/mach-mmp/include/mach/timex.h +4 -0
@@ -6,4 +6,8 @@
  * published by the Free Software Foundation.
  */
 
+#ifdef CONFIG_CPU_PXA688
+#define CLOCK_TICK_RATE		6500000
+#else
 #define CLOCK_TICK_RATE		3250000
+#endif
arch/arm/mach-mmp/irq.c +127 -0

136 lines not on this page · raw message

irq_desc *desc)
+{
+ DECLARE_BITMAP(irq_status, 32);
+ unsigned int status, mask, irq_nr;
+
+ switch (irq) {
+ case IRQ_ARMADA610_PMIC_BASE:
+ status = __raw_readl(ARMADA610_ICU_INT4_STATUS);
+ mask = __raw_readl(ARMADA610_ICU_INT4_MASK);
+ status &= (~mask & 0x3);
+ break;
+ case IRQ_ARMADA610_RTC_BASE:
+ status = __raw_readl(ARMADA610_ICU_INT5_STATUS);
+ mask = __raw_readl(ARMADA610_ICU_INT5_MASK);
+ status &= (~mask & 0x3);
+ break;
+ case IRQ_ARMADA610_TWSI_BASE:
+ status = __raw_readl(ARMADA610_ICU_INT17_STATUS);
+ mask = __raw_readl(ARMADA610_ICU_INT17_MASK);
+ status &= (~mask & 0x1f);
+ break;
+ case IRQ_ARMADA610_MISC_BASE:
+ status = __raw_readl(ARMADA610_ICU_INT35_STATUS);
+ mask = __raw_readl(ARMADA610_ICU_INT35_MASK);
+ status &= (~mask & 0x7fff);
+ break;
+ case IRQ_ARMADA610_SSP_BASE:
+ status = __raw_readl(ARMADA610_ICU_INT51_STATUS);
+ mask = __raw_readl(ARMADA610_ICU_INT51_MASK);
+ status &= (~mask & 0x3);
+ break;
+ default:
+ return;
+ }
+
+ irq_status[0] = status;
+ while (!bitmap_empty(irq_status, 32)) {
+ irq_nr = find_first_bit(irq_status, 32);
+ clear_bit(irq_nr, irq_status);
+ switch (irq) {
+ case IRQ_ARMADA610_PMIC_BASE:
+ irq_nr += ARMADA610_BASE_INT4;
+ break;
+ case IRQ_ARMADA610_RTC_BASE:
+ irq_nr += ARMADA610_BASE_INT5;
+ break;
+ case IRQ_ARMADA610_TWSI_BASE:
+ irq_nr += ARMADA610_BASE_INT17;
+ break;
+ case IRQ_ARMADA610_MISC_BASE:
+ irq_nr += ARMADA610_BASE_INT35;
+ break;
+ case IRQ_ARMADA610_SSP_BASE:
+ irq_nr += ARMADA610_BASE_INT51;
+ break;
+ }
+ generic_handle_irq(irq_nr);
+ }
+}
+
+static struct irq_chip armada610_irq_chip = {
+ .name = "icu_irq",
+ .ack = armada610_ack_irq,
+ .mask = armada610_mask_irq,
+ .unmask = armada610_unmask_irq,
+};
+
+void __init armada610_init_irq(void)
+{
+ int irq;
+
+ for (irq = 0; irq < ARMADA610_BASE_INT4; irq++) {
+ armada610_mask_irq(irq);
+ set_irq_chip(irq, &armada610_irq_chip);
+ set_irq_flags(irq, IRQF_VALID);
+
+ switch (irq) {
+ case IRQ_ARMADA610_PMIC_BASE:
+ case IRQ_ARMADA610_RTC_BASE:
+ case IRQ_ARMADA610_TWSI_BASE:
+ case IRQ_ARMADA610_MISC_BASE:
+ case IRQ_ARMADA610_SSP_BASE:
+ set_irq_chained_handler(irq, armada610_irq_demux_handler);
+ break;
+ default:
+ set_irq_handler(irq, handle_level_irq);
+ break;
+ }
+ }
+
+ /* add secondary interrupt handler */
+ for (irq = ARMADA610_BASE_INT4; irq < ARMADA610_BASE_INT_END; irq++) {
+ armada610_mask_irq(irq);
+ set_irq_chip(irq, &armada610_irq_chip);
+ set_irq_flags(irq, IRQF_VALID);
+ set_irq_handler(irq, handle_level_irq);
+ }
+}
+#endif /* CONFIG_CPU_ARMADA610 */

arch/arm/mach-mmp/time.c +28 -1
index a8400bb..d5f4874 100644
@@ -30,7 +30,10 @@
 
 #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>
 
 #include "clock.h"
 
@@ -158,7 +161,10 @@ static void __init timer_config(void)
 
 	__raw_writel(cer & ~0x1, TIMERS_VIRT_BASE + TMR_CER); /* disable */
 
-	ccr &= TMR_CCR_CS_0(0x3);
+	if (cpu_is_armada610())
+		ccr &= TMR_CCR_CS_0(0);
+	else
+		ccr &= TMR_CCR_CS_0(0x3);
 	__raw_writel(ccr, TIMERS_VIRT_BASE + TMR_CCR);
 
 	/* free-running mode */
@@ -197,3 +203,24 @@ void __init timer_init(int irq)
 	clocksource_register(&cksrc);
 	clockevents_register_device(&ckevt);
 }
+
+static void __init armada610_timer_init(void)
+{
+	unsigned long clk_rst;
+
+	__raw_writel(APBC_APBCLK | APBC_RST, APBC_ARMADA610_TIMERS);
+
+	/*
+	 * enable bus/functional clock, enable 6.5MHz (divider 4),
+	 * release reset
+	 */
+	clk_rst = APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(1);
+	__raw_writel(clk_rst, APBC_ARMADA610_TIMERS);
+
+	timer_init(IRQ_ARMADA610_TIMER1);
+}
+
+struct sys_timer armada610_timer = {
+	.init	= armada610_timer_init,
+};
+
Signature · 1 line
1.5.6.5