Skip to contentSkip to conversation

ARM: S5P6440: Add new CPU initialization support

PATCH Superseded Kukjin Kim 1 participant 1 message Dec 16, 2009

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH v2 1/7 ARM: S5P6440: Add new CPU initialization support

This patch adds Samsung's S5P6440 CPU support.

---
 arch/arm/mach-s5p6440/cpu.c                      |  120 ++++++++++++++++++++++
 arch/arm/mach-s5p6440/include/mach/debug-macro.S |   37 +++++++
 arch/arm/mach-s5p6440/include/mach/entry-macro.S |   42 ++++++++
 arch/arm/mach-s5p6440/include/mach/gpio-core.h   |   19 ++++
 arch/arm/mach-s5p6440/include/mach/gpio.h        |   80 ++++++++++++++
 arch/arm/mach-s5p6440/include/mach/hardware.h    |   18 ++++
 arch/arm/mach-s5p6440/include/mach/idle.h        |   23 ++++
 arch/arm/mach-s5p6440/include/mach/map.h         |  100 ++++++++++++++++++
 arch/arm/mach-s5p6440/include/mach/memory.h      |   22 ++++
 arch/arm/mach-s5p6440/include/mach/system.h      |   40 +++++++
 arch/arm/mach-s5p6440/include/mach/uncompress.h  |   24 +++++
 arch/arm/plat-s3c/include/plat/cpu.h             |    2 +
 arch/arm/plat-s5p/cpu.c                          |   88 ++++++++++++++++
 arch/arm/plat-s5p/include/plat/s5p6440.h         |   37 +++++++
 arch/arm/plat-s5p/s5p6440-init.c                 |   23 ++++
 arch/arm/plat-s5p/setup-i2c0.c                   |   25 +++++
 16 files changed, 700 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5p6440/cpu.c
 create mode 100644 arch/arm/mach-s5p6440/include/mach/debug-macro.S
 create mode 100644 arch/arm/mach-s5p6440/include/mach/entry-macro.S
 create mode 100644 arch/arm/mach-s5p6440/include/mach/gpio-core.h
 create mode 100644 arch/arm/mach-s5p6440/include/mach/gpio.h
 create mode 100644 arch/arm/mach-s5p6440/include/mach/hardware.h
 create mode 100644 arch/arm/mach-s5p6440/include/mach/idle.h
 create mode 100644 arch/arm/mach-s5p6440/include/mach/map.h
 create mode 100644 arch/arm/mach-s5p6440/include/mach/memory.h
 create mode 100644 arch/arm/mach-s5p6440/include/mach/system.h
 create mode 100644 arch/arm/mach-s5p6440/include/mach/uncompress.h
 create mode 100644 arch/arm/plat-s5p/cpu.c
 create mode 100644 arch/arm/plat-s5p/include/plat/s5p6440.h
 create mode 100644 arch/arm/plat-s5p/s5p6440-init.c
 create mode 100644 arch/arm/plat-s5p/setup-i2c0.c
arch/arm/mach-s5p6440/cpu.c new file +120 -0
new file mode 100644
index 0000000..1bfc748
@@ -0,0 +1,120 @@
+/* linux/arch/arm/mach-s5p6440/cpu.c
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * 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/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/sysdev.h>
+#include <linux/serial_core.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/proc-fns.h>
+#include <mach/idle.h>
+
+#include <mach/hardware.h>
+#include <mach/map.h>
+#include <asm/irq.h>
+
+#include <plat/regs-serial.h>
+#include <mach/regs-clock.h>
+
+#include <plat/cpu.h>
+#include <plat/devs.h>
+#include <plat/clock.h>
+#include <plat/s5p6440.h>
+
+/* Initial IO mappings */
+
+static struct map_desc s5p6440_iodesc[] __initdata = {
+};
+
+static void s5p6440_idle(void)
+{
+	unsigned long val;
+
+	val = __raw_readl(S5P_PWR_CFG);
+	val &= ~(0x3<<5);
+	val |= (0x1<<5);
+	__raw_writel(val, S5P_PWR_CFG);
+
+	cpu_do_idle();
+}
+
+/* s5p6440_map_io
+ *
+ * register the standard cpu IO areas
+*/
+
+void __init s5p6440_map_io(void)
+{
+	iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
+
+	/* set idle function */
+	s5p6440_idle_fn = s5p6440_idle;
+
+	/* initialize device information early */
+}
+
+void __init s5p6440_init_clocks(int xtal)
+{
+	printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
+
+	s3c24xx_register_baseclocks(xtal);
+	s5p_register_clocks(xtal);
+	s5p6440_register_clocks();
+	s5p6440_setup_clocks();
+}
+
+void __init s5p6440_init_irq(void)
+{
+	/* S5P6440 supports only 2 VIC */
+	int num_vic = 2;
+	u32 vic[num_vic];
+
+	/*
+	 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
+	 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
+	 */
+	vic[0] = 0xff800ae7;
+	vic[1] = 0xffbf23e5;
+
+	s5p_init_irq(vic, num_vic);
+}
+
+struct sysdev_class s5p6440_sysclass = {
+	.name	= "s5p6440-core",
+};
+
+static struct sys_device s5p6440_sysdev = {
+	.cls	= &s5p6440_sysclass,
+};
+
+static int __init s5p6440_core_init(void)
+{
+	return sysdev_class_register(&s5p6440_sysclass);
+}
+
+core_initcall(s5p6440_core_init);
+
+int __init s5p6440_init(void)
+{
+	printk(KERN_INFO "S5P6440: Initializing architecture\n");
+
+	return sysdev_register(&s5p6440_sysdev);
+}
arch/arm/mach-s5p6440/include/mach/debug-macro.S new file +37 -0
new file mode 100644
index 0000000..f3a5d16
@@ -0,0 +1,37 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/debug-macro.S
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * 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.
+*/
+
+/* pull in the relevant register and map files. */
+
+#include <mach/map.h>
+#include <plat/regs-serial.h>
+
+	/* note, for the boot process to work we have to keep the UART
+	 * virtual address aligned to an 1MiB boundary for the L1
+	 * mapping the head code makes. We keep the UART virtual address
+	 * aligned and add in the offset when we load the value here.
+	 */
+
+	.macro addruart, rx
+		mrc	p15, 0, \rx, c1, c0
+		tst	\rx, #1
+		ldreq	\rx, = S5P_PA_UART
+		ldrne	\rx, = (S5P_VA_UART + S5P_PA_UART & 0xfffff)
+#if CONFIG_DEBUG_S3C_UART != 0
+		add	\rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART)
+#endif
+	.endm
+
+/* include the reset of the code which will do the work, we're only
+ * compiling for a single cpu processor type so the default of s3c2440
+ * will be fine with us.
+ */
+
+#include <plat/debug-macro.S>
arch/arm/mach-s5p6440/include/mach/entry-macro.S new file +42 -0

42 lines not on this page · raw message

arch/arm/mach-s5p6440/include/mach/gpio-core.h new file +19 -0
new file mode 100644
index 0000000..ff7fb30
@@ -0,0 +1,19 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/gpio-core.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5P6440 - GPIO core support
+ *
+ * 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_ARCH_GPIO_CORE_H
+#define __ASM_ARCH_GPIO_CORE_H __FILE__
+
+/* currently we just include the platform support */
+#include <plat/gpio-core.h>
+
+#endif /* __ASM_ARCH_GPIO_CORE_H */
arch/arm/mach-s5p6440/include/mach/gpio.h new file +80 -0

80 lines not on this page · raw message

arch/arm/mach-s5p6440/include/mach/hardware.h new file +18 -0
new file mode 100644
index 0000000..be8b26e
@@ -0,0 +1,18 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/hardware.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5P6440 - Hardware support
+ *
+ * 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_ARCH_HARDWARE_H
+#define __ASM_ARCH_HARDWARE_H __FILE__
+
+/* currently nothing here, placeholder */
+
+#endif /* __ASM_ARCH_HARDWARE_H */
arch/arm/mach-s5p6440/include/mach/idle.h new file +23 -0
new file mode 100644
index 0000000..72c5cac
@@ -0,0 +1,23 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5P6440 - Idle support
+ *
+ * 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_ARCH_IDLE_H
+#define __ASM_ARCH_IDLE_H __FILE__
+
+/*
+ * This allows the over-ride of the default idle code, in case there
+ * is any other things to be done over idle (like DVS)
+*/
+extern void (*s5p6440_idle_fn)(void);
+extern void s5p6440_default_idle(void);
+
+#endif /* __ASM_ARCH_IDLE_H */
arch/arm/mach-s5p6440/include/mach/map.h new file +100 -0

100 lines not on this page · raw message

arch/arm/mach-s5p6440/include/mach/memory.h new file +22 -0
new file mode 100644
index 0000000..1a475f5
@@ -0,0 +1,22 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/memory.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5P6440 - Memory definitions
+ *
+ * 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_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
+
+#define PHYS_OFFSET     	UL(0x20000000)
+#define CONSISTENT_DMA_SIZE	SZ_8M
+
+#define __virt_to_bus(x) 	__virt_to_phys(x)
+#define __bus_to_virt(x) 	__phys_to_virt(x)
+
+#endif /* __ASM_ARCH_MEMORY_H */
arch/arm/mach-s5p6440/include/mach/system.h new file +40 -0
new file mode 100644
index 0000000..ae12eb6
@@ -0,0 +1,40 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/system.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5P6440 - system implementation
+ *
+ * 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_ARCH_SYSTEM_H
+#define __ASM_ARCH_SYSTEM_H __FILE__
+
+#include <linux/io.h>
+#include <mach/map.h>
+
+void (*s5p6440_idle_fn)(void);
+void (*s5p6440_reset_hook_fn)(void);
+
+void s5p6440_default_idle(void)
+{
+	/* nothing here yet */
+}
+
+static void arch_idle(void)
+{
+	if (s5p6440_idle_fn != NULL)
+		(s5p6440_idle_fn)();
+	else
+		s5p6440_default_idle();
+}
+
+static void arch_reset(char mode, const char *cmd)
+{
+	/* nothing here yet */
+}
+
+#endif /* __ASM_ARCH_SYSTEM_H */
arch/arm/mach-s5p6440/include/mach/uncompress.h new file +24 -0
new file mode 100644
index 0000000..7c1f600
@@ -0,0 +1,24 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/uncompress.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5P6440 - uncompress code
+ *
+ * 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_ARCH_UNCOMPRESS_H
+#define __ASM_ARCH_UNCOMPRESS_H
+
+#include <mach/map.h>
+#include <plat/uncompress.h>
+
+static void arch_detect_cpu(void)
+{
+	/* we do not need to do any cpu detection here at the moment. */
+}
+
+#endif /* __ASM_ARCH_UNCOMPRESS_H */
arch/arm/plat-s3c/include/plat/cpu.h +2 -0
index fbc3d49..3aa53f0 100644
@@ -45,9 +45,11 @@ extern void s3c_init_cpu(unsigned long idcode,
 
 extern void s3c24xx_init_irq(void);
 extern void s3c64xx_init_irq(u32 vic0, u32 vic1);
+extern void s5p_init_irq(u32 *vic, u32 num_vic);
 
 extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
 extern void s3c64xx_init_io(struct map_desc *mach_desc, int size);
+extern void s5p_init_io(struct map_desc *mach_desc, int size);
 
 extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
 
arch/arm/plat-s5p/cpu.c new file +88 -0

88 lines not on this page · raw message

arch/arm/plat-s5p/include/plat/s5p6440.h new file +37 -0
new file mode 100644
index 0000000..a4cd75a
@@ -0,0 +1,37 @@
+/* arch/arm/plat-s5p/include/plat/s5p6440.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Header file for s5p6440 cpu support
+ *
+ * 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.
+*/
+
+ /* Common init code for S5P6440 related SoCs */
+
+extern void s5p6440_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);
+extern void s5p6440_register_clocks(void);
+extern void s5p6440_setup_clocks(void);
+
+#ifdef CONFIG_CPU_S5P6440
+
+extern  int s5p6440_init(void);
+extern void s5p6440_init_irq(void);
+extern void s5p6440_map_io(void);
+extern void s5p6440_init_clocks(int xtal);
+
+#define s5p6440_init_uarts s5p6440_common_init_uarts
+
+#else
+#define s5p6440_init_clocks NULL
+#define s5p6440_init_uarts NULL
+#define s5p6440_map_io NULL
+#define s5p6440_init NULL
+#endif
+
+/* S5P6440 timer */
+
+extern struct sys_timer s5p6440_timer;
arch/arm/plat-s5p/s5p6440-init.c new file +23 -0
new file mode 100644
index 0000000..02abfdc
@@ -0,0 +1,23 @@
+/* linux/arch/arm/plat-s5p/s5p6440-init.c
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * 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/kernel.h>
+#include <linux/types.h>
+#include <linux/init.h>
+
+#include <plat/cpu.h>
+#include <plat/devs.h>
+#include <plat/s5p6440.h>
+
+/* uart registration process */
+void __init s5p6440_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+	s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
+}
arch/arm/plat-s5p/setup-i2c0.c new file +25 -0
new file mode 100644
index 0000000..67a66e0
@@ -0,0 +1,25 @@
+/* linux/arch/arm/plat-s5p/setup-i2c0.c
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * I2C0 GPIO configuration.
+ *
+ * Based on plat-s3c64xx/setup-i2c0.c
+ *
+ * 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/kernel.h>
+#include <linux/types.h>
+
+struct platform_device; /* don't need the contents */
+
+#include <plat/iic.h>
+
+void s3c_i2c0_cfg_gpio(struct platform_device *dev)
+{
+	/* Will be populated later */
+}
Signature · 1 line
1.6.2.5