Skip to contentSkip to conversation

ARM: S5P6440: CPU initialization

PATCH Superseded Kukjin Kim 4 participants 9 messages Dec 11, 2009 – Dec 14, 2009

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH 2/7 ARM: S5P6440: CPU initialization

This patch adds S5P6440 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        |   79 ++++++++++++++
 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         |   33 ++++++
 arch/arm/plat-s5p/s5p6440-init.c                 |   23 ++++
 arch/arm/plat-s5p/setup-i2c0.c                   |   23 ++++
 16 files changed, 693 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..6aab6d2
@@ -0,0 +1,120 @@
+/* linux/arch/arm/mach-s5p6440/cpu.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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("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..2947407
@@ -0,0 +1,37 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/debug-macro.S
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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..054d982
@@ -0,0 +1,19 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/gpio-core.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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 +79 -0

79 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..9d3f9eb
@@ -0,0 +1,18 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/hardware.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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..1d012a1
@@ -0,0 +1,23 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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..f0666a3
@@ -0,0 +1,22 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/memory.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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..2ec9618
@@ -0,0 +1,40 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/system.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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..42e6694
@@ -0,0 +1,24 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/uncompress.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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 +33 -0
new file mode 100644
index 0000000..dfda4b2
@@ -0,0 +1,33 @@
+/* arch/arm/plat-s5p/include/plat/s5p6440.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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
arch/arm/plat-s5p/s5p6440-init.c new file +23 -0
new file mode 100644
index 0000000..36f004e
@@ -0,0 +1,23 @@
+/* linux/arch/arm/plat-s5p/s5p6440-init.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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 +23 -0
new file mode 100644
index 0000000..c913377
@@ -0,0 +1,23 @@
+/* linux/arch/arm/plat-s5p/setup-i2c0.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		http://www.samsung.com/
+ *
+ * I2C0 GPIO configuration.
+ *
+ * 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
#1 lore raw
Quoted 353 lines · On Fri, 11 Dec 2009 18:54:10 +0900 Kukjin Kim <[email protected]> wrote:

This patch adds S5P6440 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        |   79 ++++++++++++++
 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         |   33 ++++++
 arch/arm/plat-s5p/s5p6440-init.c                 |   23 ++++
 arch/arm/plat-s5p/setup-i2c0.c                   |   23 ++++
 16 files changed, 693 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..6aab6d2
@@ -0,0 +1,120 @@
+/* linux/arch/arm/mach-s5p6440/cpu.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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("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..2947407
@@ -0,0 +1,37 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/debug-macro.S
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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
new file mode 100644
index 0000000..ded1e1f
@@ -0,0 +1,42 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/entry-macro.S
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		http://www.samsung.com/
+ *
+ * Low-level IRQ helper macros for the Samsung S5P6440
+ *
+ * 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 <asm/hardware/vic.h>
+#include <mach/map.h>
+#include <plat/irqs.h>
+
+	.macro	disable_fiq
+	.endm
+
+	.macro	get_irqnr_preamble, base, tmp
+	ldr	\base, =S5P_VA_VIC0
+	.endm
+
+	.macro	arch_ret_to_user, tmp1, tmp2
+	.endm
+
+	.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
+
+	@ check the vic0
+	mov	\irqnr, # S5P_IRQ_OFFSET + 31
+	ldr	\irqstat, [ \base, # VIC_IRQ_STATUS ]
+	teq	\irqstat, #0
+
+	@ otherwise try vic1
+	addeq	\tmp, \base, #(S5P_VA_VIC1 - S5P_VA_VIC0)
+	addeq	\irqnr, \irqnr, #32
+	ldreq	\irqstat, [ \tmp, # VIC_IRQ_STATUS ]
+	teqeq	\irqstat, #0
+
+	clzne	\irqstat, \irqstat
+	subne	\irqnr, \irqnr, \irqstat
+	.endm
arch/arm/mach-s5p6440/include/mach/gpio-core.h new file +19 -0
new file mode 100644
index 0000000..054d982
@@ -0,0 +1,19 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/gpio-core.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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 +65 -0
new file mode 100644
index 0000000..35e7e29
@@ -0,0 +1,79 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/gpio.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		http://www.samsung.com/
+ *
+ * S5P6440 - GPIO lib 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_H
+#define __ASM_ARCH_GPIO_H __FILE__
+
+#define gpio_get_value	__gpio_get_value
+#define gpio_set_value	__gpio_set_value
+#define gpio_cansleep	__gpio_cansleep
+#define gpio_to_irq	__gpio_to_irq
+
+/* GPIO bank sizes */
+#define S5P6440_GPIO_A_NR	(6)
+#define S5P6440_GPIO_B_NR	(7)
+#define S5P6440_GPIO_C_NR	(8)
+#define S5P6440_GPIO_F_NR	(2)
+#define S5P6440_GPIO_G_NR	(7)
+#define S5P6440_GPIO_H_NR	(10)
+#define S5P6440_GPIO_I_NR	(16)
+#define S5P6440_GPIO_J_NR	(12)
+#define S5P6440_GPIO_N_NR	(16)
+#define S5P6440_GPIO_P_NR	(8)
+#define S5P6440_GPIO_R_NR	(15)
+
+/* GPIO bank numbers */
+
+/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
+ * space for debugging purposes so that any accidental
+ * change from one gpio bank to another can be caught.
+*/
+#define S5P6440_GPIO_NEXT(__gpio) \
+	((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
+
+enum s5p_gpio_number {
+	S5P6440_GPIO_A_START = 0,
+	S5P6440_GPIO_B_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_A),
+	S5P6440_GPIO_C_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_B),
+	S5P6440_GPIO_F_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_C),
+	S5P6440_GPIO_G_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_F),
+	S5P6440_GPIO_H_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_G),
+	S5P6440_GPIO_I_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_H),
+	S5P6440_GPIO_J_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_I),
+	S5P6440_GPIO_N_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_J),
+	S5P6440_GPIO_P_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_N),
+	S5P6440_GPIO_R_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_P),
+};
+
+/* S5P6440 GPIO number definitions. */
+#define S5P6440_GPA(_nr)	(S5P6440_GPIO_A_START + (_nr))
+#define S5P6440_GPB(_nr)	(S5P6440_GPIO_B_START + (_nr))
+#define S5P6440_GPC(_nr)	(S5P6440_GPIO_C_START + (_nr))
+#define S5P6440_GPF(_nr)	(S5P6440_GPIO_F_START + (_nr))
+#define S5P6440_GPG(_nr)	(S5P6440_GPIO_G_START + (_nr))
+#define S5P6440_GPH(_nr)	(S5P6440_GPIO_H_START + (_nr))
+#define S5P6440_GPI(_nr)	(S5P6440_GPIO_I_START + (_nr))
+#define S5P6440_GPJ(_nr)	(S5P6440_GPIO_J_START + (_nr))

arch/arm/mach-s5p6440/include/mach/gpio.h line 75

Quoted 10 lines
arch/arm/mach-s5p6440/include/mach/gpio.h new file +10 -0
+#define S5P6440_GPN(_nr)	(S5P6440_GPIO_N_START + (_nr))
+#define S5P6440_GPP(_nr)	(S5P6440_GPIO_P_START + (_nr))
+#define S5P6440_GPR(_nr)	(S5P6440_GPIO_R_START + (_nr))
+
+/* the end of the S5P6440 specific gpios */
+#define S5P6440_GPIO_END	(S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
+#define S3C_GPIO_END		S5P6440_GPIO_END
+
+/* define the number of gpios we need to the one after the GPR() range */
+#define ARCH_NR_GPIOS		(S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)

Doing so prevents the use of GPIO expanders. Either provide a config option to provide additional GPIO space, or just get rid of the #define.

Quoted 473 lines
arch/arm/mach-s5p6440/include/mach/gpio.h new file +3 -0
+#include <asm-generic/gpio.h>
+
+#endif /* __ASM_ARCH_GPIO_H */
arch/arm/mach-s5p6440/include/mach/hardware.h new file +18 -0
new file mode 100644
index 0000000..9d3f9eb
@@ -0,0 +1,18 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/hardware.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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..1d012a1
@@ -0,0 +1,23 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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
new file mode 100644
index 0000000..ac6b07c
@@ -0,0 +1,100 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/map.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		http://www.samsung.com/
+ *
+ * S5P6440 - Memory map 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_MAP_H
+#define __ASM_ARCH_MAP_H __FILE__
+
+#include <plat/map-base.h>
+
+/* SYSCON */
+#define S5P6440_PA_SYSCON	(0xE0100000)
+#define S5P_PA_SYSCON		S5P6440_PA_SYSCON
+#define S5P_VA_SYSCON		S3C_VA_SYS
+
+#define S5P6440_PA_CLK		(S5P6440_PA_SYSCON + 0x0)
+#define S5P_PA_CLK		S5P6440_PA_CLK
+#define S5P_VA_CLK		(S5P_VA_SYSCON + 0x0)
+
+#define S5P6440_PA_OTHER	(S5P6440_PA_SYSCON + 0x100)
+#define S5P_PA_OTHER		S5P6440_PA_OTHER
+#define S5P_VA_OTHER		(S5P_VA_SYSCON + 0x100)
+
+#define S5P6440_PA_PWR		(S5P6440_PA_SYSCON + 0x800)
+#define S5P_PA_PWR		S5P6440_PA_PWR
+#define S5P_VA_PWR		(S5P_VA_SYSCON + 0x800)
+
+/* GPIO */
+#define S5P6440_PA_GPIO		(0xE0308000)
+#define S5P_PA_GPIO		S5P6440_PA_GPIO
+#define S5P_VA_GPIO		S3C_ADDR(0x00500000)
+
+/* VIC0 */
+#define S5P6440_PA_VIC0		(0xE4000000)
+#define S5P_PA_VIC0		S5P6440_PA_VIC0
+#define S5P_VA_VIC0		(S3C_VA_IRQ + 0x0)
+
+/* VIC1 */
+#define S5P6440_PA_VIC1		(0xE4100000)
+#define S5P_PA_VIC1		S5P6440_PA_VIC1
+#define S5P_VA_VIC1		(S3C_VA_IRQ + 0x10000)
+
+/* Timer */
+#define S5P6440_PA_TIMER	(0xEA000000)
+#define S5P_PA_TIMER		S5P6440_PA_TIMER
+#define S5P_VA_TIMER		S3C_VA_TIMER
+
+/* RTC */
+#define S5P6440_PA_RTC		(0xEA100000)
+#define S5P_PA_RTC		S5P6440_PA_RTC
+#define S5P_VA_RTC		S3C_ADDR(0x00600000)
+
+/* WDT */
+#define S5P6440_PA_WDT		(0xEA200000)
+#define S5P_PA_WDT		S5P6440_PA_WDT
+#define S5p_VA_WDT		S3C_VA_WATCHDOG
+
+/* UART */
+#define S5P6440_PA_UART		(0xEC000000)
+#define S5P_PA_UART		S5P6440_PA_UART
+#define S5P_VA_UART		S3C_VA_UART
+
+#define S5P_PA_UART0		(S5P_PA_UART + 0x0)
+#define S5P_PA_UART1		(S5P_PA_UART + 0x400)
+#define S5P_PA_UART2		(S5P_PA_UART + 0x800)
+#define S5P_PA_UART3		(S5P_PA_UART + 0xC00)
+#define S5P_UART_OFFSET		(0x400)
+
+#define S5P_VA_UARTx(x)		(S5P_VA_UART + (S5P_PA_UART & 0xfffff) \
+				+ ((x) * S5P_UART_OFFSET))
+
+#define S5P_VA_UART0		S5P_VA_UARTx(0)
+#define S5P_VA_UART1		S5P_VA_UARTx(1)
+#define S5P_VA_UART2		S5P_VA_UARTx(2)
+#define S5P_VA_UART3		S5P_VA_UARTx(3)
+#define S5P_SZ_UART		SZ_256
+
+/* I2C */
+#define S5P6440_PA_IIC0		(0xEC104000)
+#define S5P_PA_IIC0		S5P6440_PA_IIC0
+#define S5p_VA_IIC0		S3C_ADDR(0x00700000)
+
+/* SDRAM */
+#define S5P6440_PA_SDRAM	(0x20000000)
+#define S5P_PA_SDRAM		S5P6440_PA_SDRAM
+
+/* compatibiltiy defines. */
+#define S3C_PA_UART		S5P_PA_UART
+#define S3C_UART_OFFSET		S5P_UART_OFFSET
+#define S3C_PA_TIMER		S5P_PA_TIMER
+#define S3C_PA_IIC		S5P_PA_IIC0
+
+#endif /* __ASM_ARCH_MAP_H */
arch/arm/mach-s5p6440/include/mach/memory.h new file +22 -0
new file mode 100644
index 0000000..f0666a3
@@ -0,0 +1,22 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/memory.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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..2ec9618
@@ -0,0 +1,40 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/system.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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..42e6694
@@ -0,0 +1,24 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/uncompress.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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
new file mode 100644
index 0000000..007d1a5
@@ -0,0 +1,88 @@
+/* linux/arch/arm/plat-s5p/cpu.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		http://www.samsung.com/
+ *
+ * S5P 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.
+*/
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <mach/map.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <mach/regs-clock.h>
+#include <plat/cpu.h>
+#include <plat/s5p6440.h>
+
+/* table of supported CPUs */
+
+static const char name_s5p6440[] = "S5P6440";
+
+static struct cpu_table cpu_ids[] __initdata = {
+	{
+		.idcode		= 0x56440100,
+		.idmask		= 0xffffff00,
+		.map_io		= s5p6440_map_io,
+		.init_clocks	= s5p6440_init_clocks,
+		.init_uarts	= s5p6440_init_uarts,
+		.init		= s5p6440_init,
+		.name		= name_s5p6440,
+	},
+};
+
+/* minimal IO mapping */
+
+#define UART_OFFS (S5P_PA_UART & 0xfffff)
+
+static struct map_desc s5p_iodesc[] __initdata = {
+	{
+		.virtual	= (unsigned long)S5P_VA_SYSCON,
+		.pfn		= __phys_to_pfn(S5P_PA_SYSCON),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)(S5P_VA_UART + UART_OFFS),
+		.pfn		= __phys_to_pfn(S5P_PA_UART),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_VIC0,
+		.pfn		= __phys_to_pfn(S5P_PA_VIC0),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_VIC1,
+		.pfn		= __phys_to_pfn(S5P_PA_VIC1),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_TIMER,
+		.pfn		= __phys_to_pfn(S5P_PA_TIMER),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_GPIO,
+		.pfn		= __phys_to_pfn(S5P_PA_GPIO),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	},
+};
+
+/* read cpu identification code */
+
+void __init s5p_init_io(struct map_desc *mach_desc, int size)
+{
+	unsigned long idcode;
+
+	/* initialize the io descriptors we need for initialization */
+	iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
+	iotable_init(mach_desc, size);
+
+	idcode = __raw_readl(S5P_SYS_ID);
+	s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
+}
arch/arm/plat-s5p/include/plat/s5p6440.h new file +33 -0
new file mode 100644
index 0000000..dfda4b2
@@ -0,0 +1,33 @@
+/* arch/arm/plat-s5p/include/plat/s5p6440.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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
arch/arm/plat-s5p/s5p6440-init.c new file +23 -0
new file mode 100644
index 0000000..36f004e
@@ -0,0 +1,23 @@
+/* linux/arch/arm/plat-s5p/s5p6440-init.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		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 +23 -0
new file mode 100644
index 0000000..c913377
@@ -0,0 +1,23 @@
+/* linux/arch/arm/plat-s5p/setup-i2c0.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *		http://www.samsung.com/
+ *
+ * I2C0 GPIO configuration.
+ *
+ * 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
Fast. Cheap. Reliable. Pick two.
#2 lore raw
Quoted 7 lines · Marc Zyngier

arch/arm/mach-s5p6440/include/mach/gpio.h line 75

Quoted 2 lines · Kukjin Kim
arch/arm/mach-s5p6440/include/mach/gpio.h new file +2 -0
+/* define the number of gpios we need to the one after the GPR() range */
+#define ARCH_NR_GPIOS		(S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)

Doing so prevents the use of GPIO expanders. Either provide a config option to provide additional GPIO space, or just get rid of the #define.

It also prevents the use of external devices with interrupt controllers (eg, most PMICs these days). See the S3C24xx and S3C64xx code for examples of how to avoid this limit.

author
#3 lore raw
Quoted 2 lines · Mark Brown
Quoted 1 line · Marc Zyngier

Kukjin Kim <[email protected]> wrote:

Hi Mark Brown and Marc Zyngier,

Quoted 1 line
Quoted 1 line
Quoted 1 line

+/* define the number of gpios we need to the one after the GPR() range

*/

Quoted 5 lines
Quoted 1 line
Quoted 1 line

+#define ARCH_NR_GPIOS (S5P6440_GPR(S5P6440_GPIO_R_NR)

+ 1)

Quoted 2 lines

Doing so prevents the use of GPIO expanders. Either provide a config option to provide additional GPIO space, or just get rid of the #define.

To satisfy your request, I know what to do. However, I don't know well the reason. Please explain the reason why need the use of GPIO expanders. As you know, the number of hardware GPIO pin is fixed and limited. And the limit value is ARCH_NR_GPIOS.

Quoted 3 lines

It also prevents the use of external devices with interrupt controllers (eg, most PMICs these days). See the S3C24xx and S3C64xx code for examples of how to avoid this limit.

As you mentioned, I can find the code in the S3C24XX, but I can't in the S3C64XX. The S3C64XX codes are as follows:

/* from arch/arm/mach-s3c6400/include/mach/gpio.h */
93 /* define the number of gpios we need to the one after the GPQ() range */
94 #define ARCH_NR_GPIOS (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)

Anyway, if the definition like my patch becomes problem, please let me know the reason.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, System LSI Division, SAMSUNG ELECTRONICS CO., LTD.

#4 lore raw
Quoted 9 lines · On Mon, 14 Dec 2009 19:27:06 +0900 Kukjin Kim <[email protected]> wrote:
Quoted 2 lines · Mark Brown
Quoted 1 line · Marc Zyngier

Kukjin Kim <[email protected]> wrote:

Hi Mark Brown and Marc Zyngier,

Quoted 1 line
Quoted 1 line
Quoted 1 line

+/* define the number of gpios we need to the one after the GPR() range

*/

Quoted 1 line
Quoted 1 line
Quoted 1 line

+#define ARCH_NR_GPIOS (S5P6440_GPR(S5P6440_GPIO_R_NR)

Quoted 8 lines
Quoted 4 lines

+ 1)

Quoted 2 lines

Doing so prevents the use of GPIO expanders. Either provide a config option to provide additional GPIO space, or just get rid of the #define.

To satisfy your request, I know what to do. However, I don't know well the reason. Please explain the reason why need the use of GPIO expanders. As you know, the number of hardware GPIO pin is fixed and limited. And the limit value is ARCH_NR_GPIOS.

Exactly because the number of GPIOs is limited (and in the case of 6440, it is actually *very* limited), you may want to connect a GPIO expander over I2C or SPI.

By setting ARCH_NR_GPIOS to the number of GPIOs the SoC provides, you're actually preventing any use of such hardware by giving a hard limit to the gpiolib. The ARCH_NR_GPIO limit is actually, and despite its name, a platform dependent value.

I'm actually using a platform that has this exact requirement (6440 + pca9539).

Quoted 9 lines
Quoted 3 lines

It also prevents the use of external devices with interrupt controllers (eg, most PMICs these days). See the S3C24xx and S3C64xx code for examples of how to avoid this limit.

As you mentioned, I can find the code in the S3C24XX, but I can't in the S3C64XX. The S3C64XX codes are as follows:

/* from arch/arm/mach-s3c6400/include/mach/gpio.h */
93 /* define the number of gpios we need to the one after the GPQ() range */
94 #define ARCH_NR_GPIOS (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)

Then it needs to be fixed as well.

Quoted 2 lines

Anyway, if the definition like my patch becomes problem, please let me know the reason.

	M.
Signature · 1 line
Fast. Cheap. Reliable. Pick two.
author
#5 lore raw
Quoted 10 lines · On Mon, 14 Dec 2009 19:39 +0900 Marc Zyngier wrote:
Quoted 7 lines · On Mon, 14 Dec 2009 19:27:06 +0900 Kukjin Kim <[email protected]> wrote:
Quoted 2 lines · Mark Brown
Quoted 1 line · Marc Zyngier

Kukjin Kim <[email protected]> wrote:

Hi Mark Brown and Marc Zyngier,

Quoted 1 line
Quoted 1 line
Quoted 1 line

+/* define the number of gpios we need to the one after the GPR()

range

Quoted 7 lines
Quoted 2 lines

*/

Quoted 1 line
Quoted 1 line
Quoted 1 line

+#define ARCH_NR_GPIOS

	(S5P6440_GPR(S5P6440_GPIO_R_NR)
Quoted 4 lines
Quoted 4 lines

+ 1)

Quoted 2 lines

Doing so prevents the use of GPIO expanders. Either provide a config option to provide additional GPIO space, or just get rid of the

#define.

Quoted 1 line
Quoted 1 line

To satisfy your request, I know what to do. However, I don't know well

the

Quoted 1 line
Quoted 1 line

reason. Please explain the reason why need the use of GPIO expanders. As

you

Quoted 7 lines
Quoted 2 lines

know, the number of hardware GPIO pin is fixed and limited. And the limit value is ARCH_NR_GPIOS.

Exactly because the number of GPIOs is limited (and in the case of 6440, it is actually *very* limited), you may want to connect a GPIO expander over I2C or SPI.

Quoted 7 lines

By setting ARCH_NR_GPIOS to the number of GPIOs the SoC provides, you're actually preventing any use of such hardware by giving a hard limit to the gpiolib. The ARCH_NR_GPIO limit is actually, and despite its name, a platform dependent value.

I'm actually using a platform that has this exact requirement (6440 + pca9539).

Hi Marc Zyngier,

Thanks for your detailed explain.
Let me check and change it.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

It also prevents the use of external devices with interrupt controllers (eg, most PMICs these days). See the S3C24xx and S3C64xx code for examples of how to avoid this limit.

As you mentioned, I can find the code in the S3C24XX, but I can't in the S3C64XX. The S3C64XX codes are as follows:

/* from arch/arm/mach-s3c6400/include/mach/gpio.h */
93 /* define the number of gpios we need to the one after the GPQ() range

*/

Quoted 3 lines
Quoted 1 line

94 #define ARCH_NR_GPIOS (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)

Then it needs to be fixed as well.

Ok.

Quoted 1 line
Quoted 1 line

Anyway, if the definition like my patch becomes problem, please let me

know

Quoted 1 line
Quoted 1 line

the reason.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, System LSI Division, SAMSUNG ELECTRONICS CO., LTD.

#6 lore raw
In reply to Kukjin Kim
Quoted 827 lines · Kukjin Kim

This patch adds S5P6440 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        |   79 ++++++++++++++ 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         |   33 ++++++ arch/arm/plat-s5p/s5p6440-init.c                 |   23 ++++ arch/arm/plat-s5p/setup-i2c0.c                   |   23 ++++

 16 files changed, 693 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..6aab6d2
@@ -0,0 +1,120 @@
+/* linux/arch/arm/mach-s5p6440/cpu.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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("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..2947407
@@ -0,0 +1,37 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/debug-macro.S
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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
new file mode 100644
index 0000000..ded1e1f
@@ -0,0 +1,42 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/entry-macro.S
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             http://www.samsung.com/
+ *
+ * Low-level IRQ helper macros for the Samsung S5P6440
+ *
+ * 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 <asm/hardware/vic.h>
+#include <mach/map.h>
+#include <plat/irqs.h>
+
+       .macro  disable_fiq
+       .endm
+
+       .macro  get_irqnr_preamble, base, tmp
+       ldr     \base, =S5P_VA_VIC0
+       .endm
+
+       .macro  arch_ret_to_user, tmp1, tmp2
+       .endm
+
+       .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
+
+       @ check the vic0
+       mov     \irqnr, # S5P_IRQ_OFFSET + 31
+       ldr     \irqstat, [ \base, # VIC_IRQ_STATUS ]
+       teq     \irqstat, #0
+
+       @ otherwise try vic1
+       addeq   \tmp, \base, #(S5P_VA_VIC1 - S5P_VA_VIC0)
+       addeq   \irqnr, \irqnr, #32
+       ldreq   \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
+       teqeq   \irqstat, #0
+
+       clzne   \irqstat, \irqstat
+       subne   \irqnr, \irqnr, \irqstat
+       .endm
arch/arm/mach-s5p6440/include/mach/gpio-core.h new file +19 -0
new file mode 100644
index 0000000..054d982
@@ -0,0 +1,19 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/gpio-core.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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 +79 -0
new file mode 100644
index 0000000..35e7e29
@@ -0,0 +1,79 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/gpio.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             http://www.samsung.com/
+ *
+ * S5P6440 - GPIO lib 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_H
+#define __ASM_ARCH_GPIO_H __FILE__
+
+#define gpio_get_value __gpio_get_value
+#define gpio_set_value __gpio_set_value
+#define gpio_cansleep  __gpio_cansleep
+#define gpio_to_irq    __gpio_to_irq
+
+/* GPIO bank sizes */
+#define S5P6440_GPIO_A_NR      (6)
+#define S5P6440_GPIO_B_NR      (7)
+#define S5P6440_GPIO_C_NR      (8)
+#define S5P6440_GPIO_F_NR      (2)
+#define S5P6440_GPIO_G_NR      (7)
+#define S5P6440_GPIO_H_NR      (10)
+#define S5P6440_GPIO_I_NR      (16)
+#define S5P6440_GPIO_J_NR      (12)
+#define S5P6440_GPIO_N_NR      (16)
+#define S5P6440_GPIO_P_NR      (8)
+#define S5P6440_GPIO_R_NR      (15)
+
+/* GPIO bank numbers */
+
+/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
+ * space for debugging purposes so that any accidental
+ * change from one gpio bank to another can be caught.
+*/
+#define S5P6440_GPIO_NEXT(__gpio) \
+       ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
+
+enum s5p_gpio_number {
+       S5P6440_GPIO_A_START = 0,
+       S5P6440_GPIO_B_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_A),
+       S5P6440_GPIO_C_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_B),
+       S5P6440_GPIO_F_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_C),
+       S5P6440_GPIO_G_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_F),
+       S5P6440_GPIO_H_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_G),
+       S5P6440_GPIO_I_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_H),
+       S5P6440_GPIO_J_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_I),
+       S5P6440_GPIO_N_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_J),
+       S5P6440_GPIO_P_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_N),
+       S5P6440_GPIO_R_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_P),
+};
+
+/* S5P6440 GPIO number definitions. */
+#define S5P6440_GPA(_nr)       (S5P6440_GPIO_A_START + (_nr))
+#define S5P6440_GPB(_nr)       (S5P6440_GPIO_B_START + (_nr))
+#define S5P6440_GPC(_nr)       (S5P6440_GPIO_C_START + (_nr))
+#define S5P6440_GPF(_nr)       (S5P6440_GPIO_F_START + (_nr))
+#define S5P6440_GPG(_nr)       (S5P6440_GPIO_G_START + (_nr))
+#define S5P6440_GPH(_nr)       (S5P6440_GPIO_H_START + (_nr))
+#define S5P6440_GPI(_nr)       (S5P6440_GPIO_I_START + (_nr))
+#define S5P6440_GPJ(_nr)       (S5P6440_GPIO_J_START + (_nr))
+#define S5P6440_GPN(_nr)       (S5P6440_GPIO_N_START + (_nr))
+#define S5P6440_GPP(_nr)       (S5P6440_GPIO_P_START + (_nr))
+#define S5P6440_GPR(_nr)       (S5P6440_GPIO_R_START + (_nr))
+
+/* the end of the S5P6440 specific gpios */
+#define S5P6440_GPIO_END       (S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
+#define S3C_GPIO_END           S5P6440_GPIO_END
+
+/* define the number of gpios we need to the one after the GPR() range */
+#define ARCH_NR_GPIOS          (S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
+
+#include <asm-generic/gpio.h>
+
+#endif /* __ASM_ARCH_GPIO_H */
arch/arm/mach-s5p6440/include/mach/hardware.h new file +18 -0
new file mode 100644
index 0000000..9d3f9eb
@@ -0,0 +1,18 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/hardware.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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..1d012a1
@@ -0,0 +1,23 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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
new file mode 100644
index 0000000..ac6b07c
@@ -0,0 +1,100 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/map.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             http://www.samsung.com/
+ *
+ * S5P6440 - Memory map 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_MAP_H
+#define __ASM_ARCH_MAP_H __FILE__
+
+#include <plat/map-base.h>
+
+/* SYSCON */
+#define S5P6440_PA_SYSCON      (0xE0100000)
+#define S5P_PA_SYSCON          S5P6440_PA_SYSCON
+#define S5P_VA_SYSCON          S3C_VA_SYS
+
+#define S5P6440_PA_CLK         (S5P6440_PA_SYSCON + 0x0)
+#define S5P_PA_CLK             S5P6440_PA_CLK
+#define S5P_VA_CLK             (S5P_VA_SYSCON + 0x0)
+
+#define S5P6440_PA_OTHER       (S5P6440_PA_SYSCON + 0x100)
+#define S5P_PA_OTHER           S5P6440_PA_OTHER
+#define S5P_VA_OTHER           (S5P_VA_SYSCON + 0x100)
+
+#define S5P6440_PA_PWR         (S5P6440_PA_SYSCON + 0x800)
+#define S5P_PA_PWR             S5P6440_PA_PWR
+#define S5P_VA_PWR             (S5P_VA_SYSCON + 0x800)
+
+/* GPIO */
+#define S5P6440_PA_GPIO                (0xE0308000)
+#define S5P_PA_GPIO            S5P6440_PA_GPIO
+#define S5P_VA_GPIO            S3C_ADDR(0x00500000)
+
+/* VIC0 */
+#define S5P6440_PA_VIC0                (0xE4000000)
+#define S5P_PA_VIC0            S5P6440_PA_VIC0
+#define S5P_VA_VIC0            (S3C_VA_IRQ + 0x0)
+
+/* VIC1 */
+#define S5P6440_PA_VIC1                (0xE4100000)
+#define S5P_PA_VIC1            S5P6440_PA_VIC1
+#define S5P_VA_VIC1            (S3C_VA_IRQ + 0x10000)
+
+/* Timer */
+#define S5P6440_PA_TIMER       (0xEA000000)
+#define S5P_PA_TIMER           S5P6440_PA_TIMER
+#define S5P_VA_TIMER           S3C_VA_TIMER
+
+/* RTC */
+#define S5P6440_PA_RTC         (0xEA100000)
+#define S5P_PA_RTC             S5P6440_PA_RTC
+#define S5P_VA_RTC             S3C_ADDR(0x00600000)
+
+/* WDT */
+#define S5P6440_PA_WDT         (0xEA200000)
+#define S5P_PA_WDT             S5P6440_PA_WDT
+#define S5p_VA_WDT             S3C_VA_WATCHDOG
+
+/* UART */
+#define S5P6440_PA_UART                (0xEC000000)
+#define S5P_PA_UART            S5P6440_PA_UART
+#define S5P_VA_UART            S3C_VA_UART
+
+#define S5P_PA_UART0           (S5P_PA_UART + 0x0)
+#define S5P_PA_UART1           (S5P_PA_UART + 0x400)
+#define S5P_PA_UART2           (S5P_PA_UART + 0x800)
+#define S5P_PA_UART3           (S5P_PA_UART + 0xC00)
+#define S5P_UART_OFFSET                (0x400)
+
+#define S5P_VA_UARTx(x)                (S5P_VA_UART + (S5P_PA_UART & 0xfffff) \
+                               + ((x) * S5P_UART_OFFSET))
+
+#define S5P_VA_UART0           S5P_VA_UARTx(0)
+#define S5P_VA_UART1           S5P_VA_UARTx(1)
+#define S5P_VA_UART2           S5P_VA_UARTx(2)
+#define S5P_VA_UART3           S5P_VA_UARTx(3)
+#define S5P_SZ_UART            SZ_256
+
+/* I2C */
+#define S5P6440_PA_IIC0                (0xEC104000)
+#define S5P_PA_IIC0            S5P6440_PA_IIC0
+#define S5p_VA_IIC0            S3C_ADDR(0x00700000)
+
+/* SDRAM */
+#define S5P6440_PA_SDRAM       (0x20000000)
+#define S5P_PA_SDRAM           S5P6440_PA_SDRAM
+
+/* compatibiltiy defines. */
+#define S3C_PA_UART            S5P_PA_UART
+#define S3C_UART_OFFSET                S5P_UART_OFFSET
+#define S3C_PA_TIMER           S5P_PA_TIMER
+#define S3C_PA_IIC             S5P_PA_IIC0
+
+#endif /* __ASM_ARCH_MAP_H */
arch/arm/mach-s5p6440/include/mach/memory.h new file +22 -0
new file mode 100644
index 0000000..f0666a3
@@ -0,0 +1,22 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/memory.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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..2ec9618
@@ -0,0 +1,40 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/system.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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..42e6694
@@ -0,0 +1,24 @@
+/* linux/arch/arm/mach-s5p6440/include/mach/uncompress.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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
new file mode 100644
index 0000000..007d1a5
@@ -0,0 +1,88 @@
+/* linux/arch/arm/plat-s5p/cpu.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             http://www.samsung.com/
+ *
+ * S5P 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.
+*/
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <mach/map.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <mach/regs-clock.h>
+#include <plat/cpu.h>
+#include <plat/s5p6440.h>
+
+/* table of supported CPUs */
+
+static const char name_s5p6440[] = "S5P6440";
+
+static struct cpu_table cpu_ids[] __initdata = {
+       {
+               .idcode         = 0x56440100,
+               .idmask         = 0xffffff00,
+               .map_io         = s5p6440_map_io,
+               .init_clocks    = s5p6440_init_clocks,
+               .init_uarts     = s5p6440_init_uarts,
+               .init           = s5p6440_init,
+               .name           = name_s5p6440,
+       },
+};
+
+/* minimal IO mapping */
+
+#define UART_OFFS (S5P_PA_UART & 0xfffff)
+
+static struct map_desc s5p_iodesc[] __initdata = {
+       {
+               .virtual        = (unsigned long)S5P_VA_SYSCON,
+               .pfn            = __phys_to_pfn(S5P_PA_SYSCON),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)(S5P_VA_UART + UART_OFFS),
+               .pfn            = __phys_to_pfn(S5P_PA_UART),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S5P_VA_VIC0,
+               .pfn            = __phys_to_pfn(S5P_PA_VIC0),
+               .length         = SZ_16K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S5P_VA_VIC1,
+               .pfn            = __phys_to_pfn(S5P_PA_VIC1),
+               .length         = SZ_16K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S5P_VA_TIMER,
+               .pfn            = __phys_to_pfn(S5P_PA_TIMER),
+               .length         = SZ_16K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S5P_VA_GPIO,
+               .pfn            = __phys_to_pfn(S5P_PA_GPIO),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       },
+};
+
+/* read cpu identification code */
+
+void __init s5p_init_io(struct map_desc *mach_desc, int size)
+{
+       unsigned long idcode;
+
+       /* initialize the io descriptors we need for initialization */
+       iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
+       iotable_init(mach_desc, size);
+
+       idcode = __raw_readl(S5P_SYS_ID);
+       s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
+}
arch/arm/plat-s5p/include/plat/s5p6440.h new file +33 -0
new file mode 100644
index 0000000..dfda4b2
@@ -0,0 +1,33 @@
+/* arch/arm/plat-s5p/include/plat/s5p6440.h
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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
arch/arm/plat-s5p/s5p6440-init.c new file +23 -0
new file mode 100644
index 0000000..36f004e
@@ -0,0 +1,23 @@
+/* linux/arch/arm/plat-s5p/s5p6440-init.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             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 +13 -0
new file mode 100644
index 0000000..c913377
@@ -0,0 +1,23 @@
+/* linux/arch/arm/plat-s5p/setup-i2c0.c
+ *
+ * Copyright (c) 2009 Samsung Electronics
+ *             http://www.samsung.com/
+ *
+ * I2C0 GPIO configuration.
+ *
+ * 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>

arch/arm/plat-s5p/setup-i2c0.c line 23

Quoted 10 lines
arch/arm/plat-s5p/setup-i2c0.c new file +10 -0
+#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 */
+}

Perhaps arch/arm/plat-s5p/Makefile shud be in this patch, rather than the first one.
Otherwise, you enable compilation before having the code.

Also, we need to look at the order of defining and using functions in patches in wrong order.
Though, it wud be okay if we don't consider patch atomicity.

author
#7 lore raw
Quoted 42 lines · jassi brar
Quoted 8 lines · Kukjin Kim

This patch adds S5P6440 support.

---
 arch/arm/mach-s5p6440/cpu.c                      |  120

++++++++++++++++++++++

Quoted 7 lines
 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        |   79 ++++++++++++++
 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

++++++++++++++++++

Quoted 24 lines
 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         |   33 ++++++
 arch/arm/plat-s5p/s5p6440-init.c                 |   23 ++++
 arch/arm/plat-s5p/setup-i2c0.c                   |   23 ++++
 16 files changed, 693 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

(snip)

Quoted 7 lines

Perhaps arch/arm/plat-s5p/Makefile shud be in this patch, rather than the first one.
Otherwise, you enable compilation before having the code.

Also, we need to look at the order of defining and using functions in patches in wrong order.
Though, it wud be okay if we don't consider patch atomicity.

Ok, as I already reply another posting, I couldn't consider patch atomicity. And all(almost?) my patches need so that can support s5p6440. Of course they can be modified.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, System LSI Division, SAMSUNG ELECTRONICS CO., LTD.

#8 lore raw
Quoted 3 lines · Kukjin Kim

Ok, as I already reply another posting, I couldn't consider patch atomicity. And all(almost?) my patches need so that can support s5p6440. Of course they can be modified.

Normally what's done for things like that is to arrange to put the Makefile and Kconfig patches in a separate patch at the end of the series, that way it doesn't matter if the code in the earlier part of the series won't build since it won't get picked up by the build system.