Skip to contentSkip to conversation

: U8500 core machine support

PATCH New srinidhi kasagar 2 participants 3 messages Sep 21, 2009 – Sep 24, 2009

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

PATCH 1/3 : U8500 core machine support

From: srinidhi kasagar <[email protected]>

This adds core support for the ST-Ericsson's U8500 platform, MOP500. The baseport supports target memory map, binds to the existing modules GIC, SCU, Local timers to enable SMP, Multitimer unit as system timer (clocksource and clockevents), PL011 uart, pl022 ssp device. This is just the basic infrastructure as starting point, more patches to follow.

---
 arch/arm/Kconfig                                   |   22 ++-
 arch/arm/Makefile                                  |    1 +
 arch/arm/mach-ux500/Kconfig                        |   15 ++
 arch/arm/mach-ux500/Makefile                       |    8 +
 .../{mach-footbridge => mach-ux500}/Makefile.boot  |    0
 arch/arm/mach-ux500/board-mop500.c                 |  147 ++++++++++++++++
 arch/arm/mach-ux500/clock.c                        |   87 ++++++++++
 arch/arm/mach-ux500/clock.h                        |   13 ++
 arch/arm/mach-ux500/cpu-u8500.c                    |   78 +++++++++
 arch/arm/mach-ux500/headsmp.S                      |   38 ++++
 .../include/mach/clkdev.h                          |    0
 arch/arm/mach-ux500/include/mach/debug-macro.S     |   22 +++
 arch/arm/mach-ux500/include/mach/entry-macro.S     |   80 +++++++++
 arch/arm/mach-ux500/include/mach/hardware.h        |  129 ++++++++++++++
 arch/arm/mach-ux500/include/mach/io.h              |   22 +++
 arch/arm/mach-ux500/include/mach/irqs.h            |   71 ++++++++
 arch/arm/mach-ux500/include/mach/memory.h          |   18 ++
 arch/arm/mach-ux500/include/mach/mtu.h             |   53 ++++++
 arch/arm/mach-ux500/include/mach/setup.h           |   22 +++
 arch/arm/mach-ux500/include/mach/smp.h             |   29 +++
 arch/arm/mach-ux500/include/mach/system.h          |   25 +++
 arch/arm/mach-ux500/include/mach/timex.h           |    6 +
 arch/arm/mach-ux500/include/mach/uncompress.h      |   58 +++++++
 arch/arm/mach-ux500/include/mach/vmalloc.h         |   18 ++
 arch/arm/mach-ux500/localtimer.c                   |   28 +++
 arch/arm/mach-ux500/platsmp.c                      |  181 ++++++++++++++++++++
 arch/arm/mach-ux500/timer.c                        |  167 ++++++++++++++++++
 27 files changed, 1334 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-ux500/Kconfig
 create mode 100644 arch/arm/mach-ux500/Makefile
 copy arch/arm/{mach-footbridge => mach-ux500}/Makefile.boot (100%)
 create mode 100644 arch/arm/mach-ux500/board-mop500.c
 create mode 100644 arch/arm/mach-ux500/clock.c
 create mode 100644 arch/arm/mach-ux500/clock.h
 create mode 100644 arch/arm/mach-ux500/cpu-u8500.c
 create mode 100644 arch/arm/mach-ux500/headsmp.S
 copy arch/arm/{mach-ep93xx => mach-ux500}/include/mach/clkdev.h (100%)
 create mode 100644 arch/arm/mach-ux500/include/mach/debug-macro.S
 create mode 100644 arch/arm/mach-ux500/include/mach/entry-macro.S
 create mode 100644 arch/arm/mach-ux500/include/mach/hardware.h
 create mode 100644 arch/arm/mach-ux500/include/mach/io.h
 create mode 100644 arch/arm/mach-ux500/include/mach/irqs.h
 create mode 100644 arch/arm/mach-ux500/include/mach/memory.h
 create mode 100644 arch/arm/mach-ux500/include/mach/mtu.h
 create mode 100644 arch/arm/mach-ux500/include/mach/setup.h
 create mode 100644 arch/arm/mach-ux500/include/mach/smp.h
 create mode 100644 arch/arm/mach-ux500/include/mach/system.h
 create mode 100644 arch/arm/mach-ux500/include/mach/timex.h
 create mode 100644 arch/arm/mach-ux500/include/mach/uncompress.h
 create mode 100644 arch/arm/mach-ux500/include/mach/vmalloc.h
 create mode 100644 arch/arm/mach-ux500/localtimer.c
 create mode 100644 arch/arm/mach-ux500/platsmp.c
 create mode 100644 arch/arm/mach-ux500/timer.c
arch/arm/Kconfig +18 -4
index aef63c8..6edb1ed 100644
@@ -637,6 +637,18 @@ config ARCH_OMAP
 	help
 	  Support for TI's OMAP platform (OMAP1 and OMAP2).
 
+config ARCH_U8500
+	bool "ST-Ericsson U8500 Series"
+	select ARM_AMBA
+	select GENERIC_TIME
+	select GENERIC_CLOCKEVENTS
+	select COMMON_CLKDEV
+	help
+	  Include support for ST-Ericsson's Cortex-A9 Platform.
+	  This architecture has 2 ARM A9 cores, a SCU, a GIC,
+	  unified PL310 L2 cache controller and many other rich
+	  multimedia and non-multimedia features.
+
 endchoice
 
 source "arch/arm/mach-clps711x/Kconfig"
@@ -728,6 +740,8 @@ source "arch/arm/mach-msm/Kconfig"
 
 source "arch/arm/mach-u300/Kconfig"
 
+source "arch/arm/mach-ux500/Kconfig"
+
 source "arch/arm/mach-w90x900/Kconfig"
 
 # Definitions to make life easier
@@ -881,10 +895,10 @@ source "kernel/time/Kconfig"
 config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
-		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4)
+		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || ARCH_U8500)
 	depends on GENERIC_CLOCKEVENTS
 	select USE_GENERIC_SMP_HELPERS
-	select HAVE_ARM_SCU if (ARCH_REALVIEW || ARCH_OMAP4)
+	select HAVE_ARM_SCU if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500)
 	help
 	  This enables support for systems with more than one CPU. If you have
 	  a system with only one CPU, like most personal computers, say N. If
@@ -953,9 +967,9 @@ config HOTPLUG_CPU
 config LOCAL_TIMERS
 	bool "Use local timer interrupts"
 	depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || \
-		REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4)
+		REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || ARCH_U8500)
 	default y
-	select HAVE_ARM_TWD if (ARCH_REALVIEW || ARCH_OMAP4)
+	select HAVE_ARM_TWD if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500)
 	help
 	  Enable support for local timers on SMP platforms, rather then the
 	  legacy IPI broadcast method.  Local timers allows the system
arch/arm/Makefile +1 -0
index c877d6d..948a8d9 100644
@@ -155,6 +155,7 @@ machine-$(CONFIG_ARCH_SHARK)		:= shark
 machine-$(CONFIG_ARCH_STMP378X)		:= stmp378x
 machine-$(CONFIG_ARCH_STMP37XX)		:= stmp37xx
 machine-$(CONFIG_ARCH_U300)		:= u300
+machine-$(CONFIG_ARCH_U8500)		:= ux500
 machine-$(CONFIG_ARCH_VERSATILE)	:= versatile
 machine-$(CONFIG_ARCH_W90X900)		:= w90x900
 machine-$(CONFIG_FOOTBRIDGE)		:= footbridge
arch/arm/mach-ux500/Kconfig new file +15 -0
new file mode 100644
index 0000000..612b0b7
@@ -0,0 +1,15 @@
+menu "ST-Ericsson platform type"
+	depends on ARCH_U8500
+
+comment "ST-Ericsson Multicore Mobile Platforms"
+
+config MACH_U8500_MOP
+	bool "U8500 Development platform"
+	default y
+	select CPU_V7
+	select ARM_GIC
+	help
+	  Include support for mop500 development platform
+	  based on U8500 architecture. The platform is based
+	  on early drop silicon version of 8500.
+endmenu
arch/arm/mach-ux500/Makefile new file +8 -0
new file mode 100644
index 0000000..e71431c
@@ -0,0 +1,8 @@
+#
+# Makefile for the linux kernel, U8500 machine.
+#
+
+obj-y				:= clock.o timer.o
+obj-$(CONFIG_ARCH_U8500)	+= cpu-u8500.o
+obj-$(CONFIG_MACH_U8500_MOP)	+= board-mop500.o
+obj-$(CONFIG_SMP)		+= platsmp.o headsmp.o localtimer.o
arch/arm/mach-ux500/Makefile.boot renamed from arch/arm/mach-footbridge/Makefile.boot +0 -0
similarity index 100%
copy from arch/arm/mach-footbridge/Makefile.boot
copy to arch/arm/mach-ux500/Makefile.boot
arch/arm/mach-ux500/board-mop500.c new file +147 -0

147 lines not on this page · raw message

arch/arm/mach-ux500/clock.c new file +87 -0

87 lines not on this page · raw message

arch/arm/mach-ux500/clock.h new file +13 -0
new file mode 100644
index 0000000..191df73
@@ -0,0 +1,13 @@
+/*
+ *  Copyright (C) 2009 ST-Ericsson
+ *
+ * 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.
+ */
+struct clk {
+	unsigned long		rate;
+};
+
+int clk_register(struct clk *clk);
+void clk_unregister(struct clk *clk);
arch/arm/mach-ux500/cpu-u8500.c new file +78 -0

78 lines not on this page · raw message

arch/arm/mach-ux500/headsmp.S new file +38 -0
new file mode 100644
index 0000000..a6be2cd
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2009 ST-Ericsson
+ *	This file is based  ARM Realview platform
+ *  Copyright (c) 2003 ARM Limited
+ *  All Rights Reserved
+ *
+ * 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 <linux/linkage.h>
+#include <linux/init.h>
+
+	__INIT
+
+/*
+ * U8500 specific entry point for secondary CPUs.
+ */
+ENTRY(u8500_secondary_startup)
+	mrc	p15, 0, r0, c0, c0, 5
+	and	r0, r0, #15
+	adr	r4, 1f
+	ldmia	r4, {r5, r6}
+	sub	r4, r4, r5
+	add	r6, r6, r4
+	dsb
+pen:	ldr	r7, [r6]
+	cmp	r7, r0
+	bne	pen
+
+	/*
+	 * we've been released from the holding pen: secondary_stack
+	 * should now contain the SVC stack for this core
+	 */
+	b	secondary_startup
+
+1:	.long	.
+	.long	pen_release
arch/arm/mach-ux500/include/mach/clkdev.h renamed from arch/arm/mach-ep93xx/include/mach/clkdev.h +0 -0
similarity index 100%
copy from arch/arm/mach-ep93xx/include/mach/clkdev.h
copy to arch/arm/mach-ux500/include/mach/clkdev.h
arch/arm/mach-ux500/include/mach/debug-macro.S new file +22 -0
new file mode 100644
index 0000000..8dfa54f
@@ -0,0 +1,22 @@
+/* arch/arm/mach-u8500/include/mach/debug-macro.S
+ *
+ * Debugging macro include header
+ *
+ *  Copyright (C) 1994-1999 Russell King
+ *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
+ *
+ * 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 <linux/amba/serial.h>
+		.macro	addruart,rx
+		mrc	p15, 0, \rx, c1, c0
+		tst	\rx, #1			@MMU enabled?
+		moveq	\rx, #0x80007000	@MMU off, Physical address
+		movne	\rx, #0xF0007000	@MMU on, Virtual address
+		.endm
+
+#include <asm/hardware/debug-pl01x.S>
arch/arm/mach-ux500/include/mach/entry-macro.S new file +80 -0

80 lines not on this page · raw message

arch/arm/mach-ux500/include/mach/hardware.h new file +129 -0

129 lines not on this page · raw message

arch/arm/mach-ux500/include/mach/io.h new file +22 -0
new file mode 100644
index 0000000..1cf3f44
@@ -0,0 +1,22 @@
+/*
+ * arch/arm/mach-u8500/include/mach/io.h
+ *
+ * Copyright (C) 1997-1999 Russell King
+ *
+ * Modifications:
+ *  06-12-1997	RMK	Created.
+ *  07-04-1999	RMK	Major cleanup
+ */
+#ifndef __ASM_ARM_ARCH_IO_H
+#define __ASM_ARM_ARCH_IO_H
+
+#define IO_SPACE_LIMIT 0xffffffff
+
+/*
+ * We don't actually have real ISA nor PCI buses, but there is so many
+ * drivers out there that might just work if we fake them...
+ */
+#define __io(a)		__typesafe_io(a)
+#define __mem_pci(a)	(a)
+
+#endif
arch/arm/mach-ux500/include/mach/irqs.h new file +71 -0

71 lines not on this page · raw message

arch/arm/mach-ux500/include/mach/memory.h new file +18 -0
new file mode 100644
index 0000000..510571a
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2009 ST-Ericsson
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
+
+/*
+ * Physical DRAM offset.
+ */
+#define PHYS_OFFSET	UL(0x00000000)
+#define BUS_OFFSET	UL(0x00000000)
+
+#endif
arch/arm/mach-ux500/include/mach/mtu.h new file +53 -0

53 lines not on this page · raw message

arch/arm/mach-ux500/include/mach/setup.h new file +22 -0
new file mode 100644
index 0000000..0807e4f
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2009 ST-Ericsson.
+ *
+ * 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.
+ *
+ * These symbols are needed for board-specific files to call their
+ * own cpu-specific files
+ */
+#ifndef __ASM_ARCH_SETUP_H
+#define __ASM_ARCH_SETUP_H
+
+#include <asm/mach/time.h>
+#include <linux/init.h>
+
+extern void u8500_map_io(void);
+extern void u8500_init_devices(void);
+extern void u8500_init_irq(void);
+extern struct sys_timer u8500_timer;
+
+#endif /*  __ASM_ARCH_SETUP_H */
arch/arm/mach-ux500/include/mach/smp.h new file +29 -0
new file mode 100644
index 0000000..43ec7ad
@@ -0,0 +1,29 @@
+/*
+ * This file is based ARM realview platform.
+ * Copyright (C) ARM Limited.
+ *
+ * This file is licensed under  the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#ifndef ASMARM_ARCH_SMP_H
+#define ASMARM_ARCH_SMP_H
+
+#include <asm/hardware/gic.h>
+
+#define hard_smp_processor_id()				\
+	({						\
+		unsigned int cpunum;			\
+		__asm__("mrc p15, 0, %0, c0, c0, 5"	\
+			: "=r" (cpunum));		\
+		cpunum &= 0x0F;				\
+	})
+
+/*
+ * We use IRQ1 as the IPI
+ */
+static inline void smp_cross_call(const struct cpumask *mask)
+{
+	gic_raise_softirq(mask, 1);
+}
+#endif
arch/arm/mach-ux500/include/mach/system.h new file +25 -0
new file mode 100644
index 0000000..c0cd800
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2009 ST-Ericsson.
+ *
+ * This file is licensed under  the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#ifndef __ASM_ARCH_SYSTEM_H
+#define __ASM_ARCH_SYSTEM_H
+
+static inline void arch_idle(void)
+{
+	/*
+	 * This should do all the clock switching
+	 * and wait for interrupt tricks
+	 */
+	cpu_do_idle();
+}
+
+static inline void arch_reset(char mode, const char *cmd)
+{
+	/* yet to be implemented - TODO */
+}
+
+#endif
arch/arm/mach-ux500/include/mach/timex.h new file +6 -0
new file mode 100644
index 0000000..d0942c1
@@ -0,0 +1,6 @@
+#ifndef __ASM_ARCH_TIMEX_H
+#define __ASM_ARCH_TIMEX_H
+
+#define CLOCK_TICK_RATE		110000000
+
+#endif
arch/arm/mach-ux500/include/mach/uncompress.h new file +58 -0

58 lines not on this page · raw message

arch/arm/mach-ux500/include/mach/vmalloc.h new file +18 -0
new file mode 100644
index 0000000..86cdbbc
@@ -0,0 +1,18 @@
+/*
+ *  Copyright (C) 2009 ST-Ericsson
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#define VMALLOC_END	0xf0000000
arch/arm/mach-ux500/localtimer.c new file +28 -0
new file mode 100644
index 0000000..2288f6a
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2008-2009 ST-Ericsson
+ * Srinidhi Kasagar <[email protected]>
+ *
+ * This file is heavily based on relaview platform, almost a copy.
+ *
+ * Copyright (C) 2002 ARM Ltd.
+ *
+ * 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 <linux/init.h>
+#include <linux/smp.h>
+#include <linux/clockchips.h>
+
+#include <asm/irq.h>
+#include <asm/smp_twd.h>
+#include <asm/localtimer.h>
+
+/*
+ * Setup the local clock events for a CPU.
+ */
+void __cpuinit local_timer_setup(struct clock_event_device *evt)
+{
+	evt->irq = IRQ_LOCALTIMER;
+	twd_timer_setup(evt);
+}
arch/arm/mach-ux500/platsmp.c new file +181 -0

181 lines not on this page · raw message

arch/arm/mach-ux500/timer.c new file +167 -0

167 lines not on this page · raw message

Signature · 1 line
1.6.3.GIT
#1 lore raw

PATCH 1/3 : U8500 core machine support

Some review comments:

arch/arm/mach-ux500/include/mach/debug-macro.S line 21

Quoted 10 lines
arch/arm/mach-ux500/include/mach/debug-macro.S +9 -0
+
+#include <linux/amba/serial.h>
+               .macro  addruart,rx
+               mrc     p15, 0, \rx, c1, c0
+               tst     \rx, #1                 @MMU enabled?
+               moveq   \rx, #0x80007000        @MMU off, Physical address
+               movne   \rx, #0xF0007000        @MMU on, Virtual address
+               .endm
+

It looks like the constants used here will break compilation. You could instead use 0x80000000 and 0xf0000000 and add an 'orr \rx, \rx, #0x7000' after the 'movne' to fix this.

arch/arm/mach-ux500/include/mach/uncompress.h line 29

Quoted 11 lines
arch/arm/mach-ux500/include/mach/uncompress.h +10 -0
+
+#include <asm/setup.h>
+#include <linux/io.h>
+#include <mach/hardware.h>
+
+#define U8500_UART_DR          0x101FB000
+#define U8500_UART_LCRH                0x101FB02c
+#define U8500_UART_CR          0x101FB030
+#define U8500_UART_FR          0x101FB018
+

Just wondering if the UART addresses used here are valid ? since they do not seem to correspond to the ones listed in hardware.h.

Cheers,
surinder

#2 lore raw

PATCH 1/3 : U8500 core machine support

Quoted 17 lines · Surinder P Singh

Some review comments:

arch/arm/mach-ux500/include/mach/debug-macro.S

Quoted 10 lines
arch/arm/mach-ux500/include/mach/debug-macro.S +9 -0
+
+#include <linux/amba/serial.h>
+ ? ? ? ? ? ? ? .macro ?addruart,rx
+ ? ? ? ? ? ? ? mrc ? ? p15, 0, \rx, c1, c0
+ ? ? ? ? ? ? ? tst ? ? \rx, #1 ? ? ? ? ? ? ? ? @MMU enabled?
+ ? ? ? ? ? ? ? moveq ? \rx, #0x80007000 ? ? ? ?@MMU off, Physical address
+ ? ? ? ? ? ? ? movne ? \rx, #0xF0007000 ? ? ? ?@MMU on, Virtual address
+ ? ? ? ? ? ? ? .endm
+

It looks like the constants used here will break compilation. You could instead use 0x80000000 and 0xf0000000 and add an 'orr \rx, \rx, #0x7000' after the 'movne' to fix this.

You can also remove serial.h from here since this is now included in debug-pl01x.S