Skip to contentSkip to conversation

ARM: S5PV310: Add support for Samsung S5PV310 SoC

PATCH Superseded Kukjin Kim 3 participants 14 messages Jun 25, 2010 – Jul 1, 2010

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

cover ARM: S5PV310: Add support for Samsung S5PV310 SoC

This patch set adds support for Samsung S5PV310/S5PC210. The S5PV310 integrates a ARM Cortex A9 microprocessor with several other peripherals to support features such as multimedia, storage, graphics and gaming. The S5PV310 can be used in products such as Netbooks and Mobile devices.

This patch set consists of the following patches.

[PATCH 1/8] ARM: S5P: Remove fixed uart offset dependent code [PATCH 2/8] ARM: S5PV310: Add new CPU initialization support [PATCH 3/8] ARM: S5PV310: Add Clock and PLL support [PATCH 4/8] ARM: S5PV310: Add IRQ support
[PATCH 5/8] ARM: S5PV310: Add Timer support
[PATCH 6/8] ARM: S5PV310: Add new Kconfig and Makefiles [PATCH 7/8] ARM: S5PV310: Add Board support file [PATCH 8/8] ARM: S5PV310: Add serial port support

author
#1 lore raw

PATCH 1/8 ARM: S5P: Remove fixed uart offset dependent code

From: Changhwan Youn <[email protected]>

The uart offset between channels has been 0x400 for all S5P series and to present virtual and physical offsets, both number 0x400 and S3C_UART_OFFSET have been used together.
This patch removes the use of the number 0x400 and expands the virtual mapping size of S3C_VA_UART from 4KB to 512KB to support the CPU with S3C_UART_OFFSET being 0x10000.

---
 arch/arm/plat-s5p/cpu.c                  |    2 +-
 arch/arm/plat-s5p/include/plat/map-s5p.h |   11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)
arch/arm/plat-s5p/cpu.c +1 -1
index 75cb8c3..c478441 100644
@@ -81,7 +81,7 @@ static struct map_desc s5p_iodesc[] __initdata = {
 	}, {
 		.virtual	= (unsigned long)S3C_VA_UART,
 		.pfn		= __phys_to_pfn(S3C_PA_UART),
-		.length		= SZ_4K,
+		.length		= SZ_512K,
 		.type		= MT_DEVICE,
 	}, {
 		.virtual	= (unsigned long)VA_VIC0,
arch/arm/plat-s5p/include/plat/map-s5p.h +7 -4
index 1482852..3d815f4 100644
@@ -18,12 +18,15 @@
 #define S5P_VA_SYSTIMER		S3C_ADDR(0x01200000)
 #define S5P_VA_SROMC		S3C_ADDR(0x01100000)
 
-#define S5P_VA_UART0		(S3C_VA_UART + 0x0)
-#define S5P_VA_UART1		(S3C_VA_UART + 0x400)
-#define S5P_VA_UART2		(S3C_VA_UART + 0x800)
-#define S5P_VA_UART3		(S3C_VA_UART + 0xC00)
+#define S5P_VA_UART(x)		(S3C_VA_UART + ((x) * S3C_UART_OFFSET))
+#define S5P_VA_UART0		S5P_VA_UART(0)
+#define S5P_VA_UART1		S5P_VA_UART(1)
+#define S5P_VA_UART2		S5P_VA_UART(2)
+#define S5P_VA_UART3		S5P_VA_UART(3)
 
+#ifndef S3C_UART_OFFSET
 #define S3C_UART_OFFSET		(0x400)
+#endif
 
 #define VA_VIC(x)		(S3C_VA_IRQ + ((x) * 0x10000))
 #define VA_VIC0			VA_VIC(0)
Signature · 1 line
1.6.2.5
author
#2 lore raw

PATCH 2/8 ARM: S5PV310: Add new CPU initialization support

In reply to Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds Samsung's S5PV310/S5PC210 CPU support. The S5PV310/S5PC210 integrates a ARM Cortex A9 multi-core.

---
 arch/arm/mach-s5pv310/cpu.c                      |  123 +++++++++++++
 arch/arm/mach-s5pv310/headsmp.S                  |   41 ++++
 arch/arm/mach-s5pv310/include/mach/debug-macro.S |   36 ++++
 arch/arm/mach-s5pv310/include/mach/entry-macro.S |   84 +++++++++
 arch/arm/mach-s5pv310/include/mach/gpio.h        |  135 ++++++++++++++
 arch/arm/mach-s5pv310/include/mach/hardware.h    |   18 ++
 arch/arm/mach-s5pv310/include/mach/io.h          |   26 +++
 arch/arm/mach-s5pv310/include/mach/map.h         |   63 +++++++
 arch/arm/mach-s5pv310/include/mach/memory.h      |   22 +++
 arch/arm/mach-s5pv310/include/mach/smp.h         |   29 +++
 arch/arm/mach-s5pv310/include/mach/system.h      |   22 +++
 arch/arm/mach-s5pv310/include/mach/timex.h       |   29 +++
 arch/arm/mach-s5pv310/include/mach/uncompress.h  |   27 +++
 arch/arm/mach-s5pv310/include/mach/vmalloc.h     |   22 +++
 arch/arm/mach-s5pv310/init.c                     |   40 ++++
 arch/arm/mach-s5pv310/platsmp.c                  |  212 ++++++++++++++++++++++
 arch/arm/mach-s5pv310/setup-i2c0.c               |   20 ++
 arch/arm/plat-s5p/cpu.c                          |   12 ++
 arch/arm/plat-s5p/include/plat/map-s5p.h         |   12 ++
 arch/arm/plat-s5p/include/plat/s5pv310.h         |   33 ++++
 20 files changed, 1006 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/cpu.c
 create mode 100644 arch/arm/mach-s5pv310/headsmp.S
 create mode 100644 arch/arm/mach-s5pv310/include/mach/debug-macro.S
 create mode 100644 arch/arm/mach-s5pv310/include/mach/entry-macro.S
 create mode 100644 arch/arm/mach-s5pv310/include/mach/gpio.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/hardware.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/io.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/map.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/memory.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/smp.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/system.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/timex.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/uncompress.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/vmalloc.h
 create mode 100644 arch/arm/mach-s5pv310/init.c
 create mode 100644 arch/arm/mach-s5pv310/platsmp.c
 create mode 100644 arch/arm/mach-s5pv310/setup-i2c0.c
 create mode 100644 arch/arm/plat-s5p/include/plat/s5pv310.h
arch/arm/mach-s5pv310/cpu.c new file +123 -0
new file mode 100644
index 0000000..ac7a5e8
@@ -0,0 +1,123 @@
+/* linux/arch/arm/mach-s5pv310/cpu.c
+ *
+ * Copyright (c) 2010 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/sched.h>
+#include <linux/sysdev.h>
+
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/proc-fns.h>
+
+#include <plat/cpu.h>
+#include <plat/clock.h>
+#include <plat/s5pv310.h>
+
+#include <mach/regs-irq.h>
+
+void __iomem *gic_cpu_base_addr;
+
+extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
+			 unsigned int irq_start);
+extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq);
+
+/* Initial IO mappings */
+static struct map_desc s5pv310_iodesc[] __initdata = {
+	{
+		.virtual	= (unsigned long)S5P_VA_COREPERI_BASE,
+		.pfn		= __phys_to_pfn(S5PV310_PA_COREPERI),
+		.length		= SZ_8K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_COMBINER_BASE,
+		.pfn		= __phys_to_pfn(S5PV310_PA_COMBINER),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_L2CC,
+		.pfn		= __phys_to_pfn(S5PV310_PA_L2CC),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	},
+};
+
+static void s5pv310_idle(void)
+{
+	if (!need_resched())
+		cpu_do_idle();
+
+	local_irq_enable();
+}
+
+/* s5pv310_map_io
+ *
+ * register the standard cpu IO areas
+*/
+void __init s5pv310_map_io(void)
+{
+	iotable_init(s5pv310_iodesc, ARRAY_SIZE(s5pv310_iodesc));
+}
+
+void __init s5pv310_init_clocks(int xtal)
+{
+	printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
+
+	s3c24xx_register_baseclocks(xtal);
+	s5p_register_clocks(xtal);
+	s5pv310_register_clocks();
+	s5pv310_setup_clocks();
+}
+
+void __init s5pv310_init_irq(void)
+{
+	int irq;
+
+	gic_cpu_base_addr = S5P_VA_GIC_CPU;
+	gic_dist_init(0, S5P_VA_GIC_DIST, IRQ_LOCALTIMER);
+	gic_cpu_init(0, S5P_VA_GIC_CPU);
+
+	for (irq = 0; irq < MAX_COMBINER_NR; irq++)
+		combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
+			      COMBINER_IRQ(irq, 0));
+
+	for (irq = 0; irq < MAX_COMBINER_NR; irq++)
+		combiner_cascade_irq(irq, IRQ_SPI(irq));
+
+	/* The parameters of s5p_init_irq() are for VIC init.
+	 * Theses parameters should be NULL and 0 because S5PV310
+	 * uses GIC instead of VIC.
+	 */
+	s5p_init_irq(NULL, 0);
+}
+
+struct sysdev_class s5pv310_sysclass = {
+	.name	= "s5pv310-core",
+};
+
+static struct sys_device s5pv310_sysdev = {
+	.cls	= &s5pv310_sysclass,
+};
+
+static int __init s5pv310_core_init(void)
+{
+	return sysdev_class_register(&s5pv310_sysclass);
+}
+
+core_initcall(s5pv310_core_init);
+
+int __init s5pv310_init(void)
+{
+	printk(KERN_INFO "S5PV310: Initializing architecture\n");
+
+	/* set idle function */
+	pm_idle = s5pv310_idle;
+
+	return sysdev_register(&s5pv310_sysdev);
+}
arch/arm/mach-s5pv310/headsmp.S new file +41 -0

41 lines not on this page · raw message

arch/arm/mach-s5pv310/include/mach/debug-macro.S new file +36 -0
new file mode 100644
index 0000000..6fb3893
@@ -0,0 +1,36 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/debug-macro.S
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S
+ *
+ * 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>
+
+	/* 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, tmp
+		mrc	p15, 0, \rx, c1, c0
+		tst	\rx, #1
+		ldreq	\rx, = S3C_PA_UART
+		ldrne	\rx, = S3C_VA_UART
+#if CONFIG_DEBUG_S3C_UART != 0
+		add	\rx, \rx, #(0x10000 * CONFIG_DEBUG_S3C_UART)
+#endif
+	.endm
+
+#define fifo_full fifo_full_s5pv210
+#define fifo_level fifo_level_s5pv210
+
+#include <plat/debug-macro.S>
arch/arm/mach-s5pv310/include/mach/entry-macro.S new file +84 -0

84 lines not on this page · raw message

arch/arm/mach-s5pv310/include/mach/gpio.h new file +135 -0

135 lines not on this page · raw message

arch/arm/mach-s5pv310/include/mach/hardware.h new file +18 -0
new file mode 100644
index 0000000..28ff988
@@ -0,0 +1,18 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/hardware.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV310 - 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-s5pv310/include/mach/io.h new file +26 -0
new file mode 100644
index 0000000..8a7f912
@@ -0,0 +1,26 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/io.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Copyright 2008-2010 Ben Dooks <[email protected]>
+ *
+ * Based on arch/arm/mach-s5p6442/include/mach/io.h
+ *
+ * Default IO routines for S5PV310
+ *
+ * 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_ARM_ARCH_IO_H
+#define __ASM_ARM_ARCH_IO_H __FILE__
+
+/* No current ISA/PCI bus support. */
+#define __io(a)		__typesafe_io(a)
+#define __mem_pci(a)	(a)
+
+#define IO_SPACE_LIMIT (0xFFFFFFFF)
+
+#endif /* __ASM_ARM_ARCH_IO_H */
arch/arm/mach-s5pv310/include/mach/map.h new file +63 -0

63 lines not on this page · raw message

arch/arm/mach-s5pv310/include/mach/memory.h new file +22 -0
new file mode 100644
index 0000000..1dffb48
@@ -0,0 +1,22 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/memory.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV310 - 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 __FILE__
+
+#define PHYS_OFFSET		UL(0x40000000)
+
+/* Maximum of 256MiB in one bank */
+#define MAX_PHYSMEM_BITS	32
+#define SECTION_SIZE_BITS	28
+
+#endif /* __ASM_ARCH_MEMORY_H */
arch/arm/mach-s5pv310/include/mach/smp.h new file +29 -0
new file mode 100644
index 0000000..990f3ba
@@ -0,0 +1,29 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/smp.h
+ *
+ * Cloned from arch/arm/mach-realview/include/mach/smp.h
+*/
+
+#ifndef ASM_ARCH_SMP_H
+#define ASM_ARCH_SMP_H __FILE__
+
+#include <asm/hardware/gic.h>
+
+extern void __iomem *gic_cpu_base_addr;
+
+#define hard_smp_processor_id()			\
+	({						\
+		unsigned int cpunum;			\
+		__asm__("mrc p15, 0, %0, c0, c0, 5"	\
+			: "=r" (cpunum));		\
+		cpunum &= 0x03;				\
+	})
+
+/*
+ * 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-s5pv310/include/mach/system.h new file +22 -0
new file mode 100644
index 0000000..d10c009
@@ -0,0 +1,22 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/system.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV310 - system support header
+ *
+ * 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 <plat/system-reset.h>
+
+static void arch_idle(void)
+{
+	/* nothing here yet */
+}
+#endif /* __ASM_ARCH_SYSTEM_H */
arch/arm/mach-s5pv310/include/mach/timex.h new file +29 -0
new file mode 100644
index 0000000..bd2359b
@@ -0,0 +1,29 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/timex.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Copyright (c) 2003-2010 Simtec Electronics
+ *	Ben Dooks <[email protected]>
+ *
+ * Based on arch/arm/mach-s5p6442/include/mach/timex.h
+ *
+ * S5PV310 - time parameters
+ *
+ * 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_TIMEX_H
+#define __ASM_ARCH_TIMEX_H __FILE__
+
+/* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it
+ * a variable is useless. It seems as long as we make our timers an
+ * exact multiple of HZ, any value that makes a 1->1 correspondence
+ * for the time conversion functions to/from jiffies is acceptable.
+*/
+
+#define CLOCK_TICK_RATE 12000000
+
+#endif /* __ASM_ARCH_TIMEX_H */
arch/arm/mach-s5pv310/include/mach/uncompress.h new file +27 -0
new file mode 100644
index 0000000..ad88c24
@@ -0,0 +1,27 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/uncompress.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV310 - 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 __FILE__
+
+#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. */
+
+	fifo_mask = S5PV210_UFSTAT_TXMASK;
+	fifo_max = 63 << S5PV210_UFSTAT_TXSHIFT;
+}
+
+#endif /* __ASM_ARCH_UNCOMPRESS_H */
arch/arm/mach-s5pv310/include/mach/vmalloc.h new file +22 -0
new file mode 100644
index 0000000..426d997
@@ -0,0 +1,22 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/vmalloc.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Copyright 2010 Ben Dooks <[email protected]>
+ *
+ * Based on arch/arm/mach-s5p6440/include/mach/vmalloc.h
+ *
+ * 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.
+ *
+ * S5PV310 vmalloc definition
+*/
+
+#ifndef __ASM_ARCH_VMALLOC_H
+#define __ASM_ARCH_VMALLOC_H __FILE__
+
+#define VMALLOC_END	  (0xE0000000)
+
+#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-s5pv310/init.c new file +40 -0
new file mode 100644
index 0000000..6c152c6
@@ -0,0 +1,40 @@
+/* linux/arch/arm/mach-s5pv310/init.c
+ *
+ * Copyright (c) 2010 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/serial_core.h>
+
+#include <plat/cpu.h>
+#include <plat/devs.h>
+#include <plat/regs-serial.h>
+
+static struct s3c24xx_uart_clksrc s5pv310_serial_clocks[] = {
+	[0] = {
+		.name		= "uclk1",
+		.divisor	= 1,
+		.min_baud	= 0,
+		.max_baud	= 0,
+	},
+};
+
+/* uart registration process */
+void __init s5pv310_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+	struct s3c2410_uartcfg *tcfg = cfg;
+	u32 ucnt;
+
+	for (ucnt = 0; ucnt < no; ucnt++, tcfg++) {
+		if (!tcfg->clocks) {
+			tcfg->clocks = s5pv310_serial_clocks;
+			tcfg->clocks_size = ARRAY_SIZE(s5pv310_serial_clocks);
+		}
+	}
+
+	s3c24xx_init_uartdevs("s5pv310-uart", s5p_uart_resources, cfg, no);
+}
arch/arm/mach-s5pv310/platsmp.c new file +212 -0

212 lines not on this page · raw message

arch/arm/mach-s5pv310/setup-i2c0.c new file +20 -0
new file mode 100644
index 0000000..d4f5a81
@@ -0,0 +1,20 @@
+/* linux/arch/arm/mach-s5pv210/setup-i2c0.c
+ *
+ * Copyright (c) 2009-2010 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.
+*/
+
+struct platform_device; /* don't need the contents */
+
+void s3c_i2c0_cfg_gpio(struct platform_device *dev)
+{
+/* will be implemented later */
+}
arch/arm/plat-s5p/cpu.c +12 -0
index c478441..9261a27 100644
@@ -21,6 +21,7 @@
 #include <plat/s5p6442.h>
 #include <plat/s5pc100.h>
 #include <plat/s5pv210.h>
+#include <plat/s5pv310.h>
 
 /* table of supported CPUs */
 
@@ -28,6 +29,7 @@ static const char name_s5p6440[] = "S5P6440";
 static const char name_s5p6442[] = "S5P6442";
 static const char name_s5pc100[] = "S5PC100";
 static const char name_s5pv210[] = "S5PV210/S5PC110";
+static const char name_s5pv310[] = "S5PV310";
 
 static struct cpu_table cpu_ids[] __initdata = {
 	{
@@ -62,6 +64,14 @@ static struct cpu_table cpu_ids[] __initdata = {
 		.init_uarts	= s5pv210_init_uarts,
 		.init		= s5pv210_init,
 		.name		= name_s5pv210,
+	}, {
+		.idcode		= 0x43200000,
+		.idmask		= 0xfffff000,
+		.map_io		= s5pv310_map_io,
+		.init_clocks	= s5pv310_init_clocks,
+		.init_uarts	= s5pv310_init_uarts,
+		.init		= s5pv310_init,
+		.name		= name_s5pv310,
 	},
 };
 
@@ -83,6 +93,7 @@ static struct map_desc s5p_iodesc[] __initdata = {
 		.pfn		= __phys_to_pfn(S3C_PA_UART),
 		.length		= SZ_512K,
 		.type		= MT_DEVICE,
+#ifdef CONFIG_ARM_VIC
 	}, {
 		.virtual	= (unsigned long)VA_VIC0,
 		.pfn		= __phys_to_pfn(S5P_PA_VIC0),
@@ -93,6 +104,7 @@ static struct map_desc s5p_iodesc[] __initdata = {
 		.pfn		= __phys_to_pfn(S5P_PA_VIC1),
 		.length		= SZ_16K,
 		.type		= MT_DEVICE,
+#endif
 	}, {
 		.virtual	= (unsigned long)S3C_VA_TIMER,
 		.pfn		= __phys_to_pfn(S5P_PA_TIMER),
arch/arm/plat-s5p/include/plat/map-s5p.h +12 -0
index 3d815f4..54e9fb9 100644
@@ -18,6 +18,18 @@
 #define S5P_VA_SYSTIMER		S3C_ADDR(0x01200000)
 #define S5P_VA_SROMC		S3C_ADDR(0x01100000)
 
+#define S5P_VA_COMBINER_BASE	S3C_ADDR(0x00600000)
+#define S5P_VA_COMBINER(x)	(S5P_VA_COMBINER_BASE + ((x) >> 2) * 0x10)
+
+#define S5P_VA_COREPERI_BASE	S3C_ADDR(0x00800000)
+#define S5P_VA_COREPERI(x)	(S5P_VA_COREPERI_BASE + (x))
+#define S5P_VA_SCU		S5P_VA_COREPERI(0x0)
+#define S5P_VA_GIC_CPU		S5P_VA_COREPERI(0x100)
+#define S5P_VA_TWD		S5P_VA_COREPERI(0x600)
+#define S5P_VA_GIC_DIST		S5P_VA_COREPERI(0x1000)
+
+#define S5P_VA_L2CC		S3C_ADDR(0x00900000)
+
 #define S5P_VA_UART(x)		(S3C_VA_UART + ((x) * S3C_UART_OFFSET))
 #define S5P_VA_UART0		S5P_VA_UART(0)
 #define S5P_VA_UART1		S5P_VA_UART(1)
arch/arm/plat-s5p/include/plat/s5pv310.h new file +33 -0
new file mode 100644
index 0000000..d2f05e1
@@ -0,0 +1,33 @@
+/* linux/arch/arm/plat-s5p/include/plat/s5pv310.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Header file for s5pv310 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 S5PV310 related SoCs */
+
+extern void s5pv310_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);
+extern void s5pv310_register_clocks(void);
+extern void s5pv310_setup_clocks(void);
+
+#ifdef CONFIG_CPU_S5PV310
+
+extern  int s5pv310_init(void);
+extern void s5pv310_init_irq(void);
+extern void s5pv310_map_io(void);
+extern void s5pv310_init_clocks(int xtal);
+
+#define s5pv310_init_uarts s5pv310_common_init_uarts
+
+#else
+#define s5pv310_init_clocks NULL
+#define s5pv310_init_uarts NULL
+#define s5pv310_map_io NULL
+#define s5pv310_init NULL
+#endif
Signature · 1 line
1.6.2.5
author
#3 lore raw

PATCH 3/8 ARM: S5PV310: Add Clock and PLL support

In reply to Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds clock and pll support for S5PV310.

---
 arch/arm/mach-s5pv310/clock.c                   |  544 +++++++++++++++++++++++
 arch/arm/mach-s5pv310/include/mach/regs-clock.h |   60 +++
 arch/arm/plat-s5p/include/plat/pll.h            |   41 ++
 3 files changed, 645 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/clock.c
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-clock.h
arch/arm/mach-s5pv310/clock.c new file +544 -0
new file mode 100644
index 0000000..bb671d5
@@ -0,0 +1,544 @@
+/* linux/arch/arm/mach-s5pv310/clock.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV310 - Clock 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/kernel.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/cpu-freq.h>
+#include <plat/clock.h>
+#include <plat/cpu.h>
+#include <plat/pll.h>
+#include <plat/s5p-clock.h>
+#include <plat/clock-clksrc.h>
+
+#include <mach/map.h>
+#include <mach/regs-clock.h>
+
+static struct clk clk_sclk_hdmi27m = {
+	.name           = "sclk_hdmi27m",
+	.id             = -1,
+	.rate           = 27000000,
+};
+
+/* Core list of CMU_CPU side */
+
+static struct clksrc_clk clk_mout_apll = {
+	.clk	= {
+		.name		= "mout_apll",
+		.id		= -1,
+	},
+	.sources	= &clk_src_apll,
+	.reg_src	= { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
+	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
+};
+
+static struct clksrc_clk clk_mout_epll = {
+	.clk	= {
+		.name		= "mout_epll",
+		.id		= -1,
+	},
+	.sources	= &clk_src_epll,
+	.reg_src	= { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
+};
+
+static struct clksrc_clk clk_mout_mpll = {
+	.clk = {
+		.name		= "mout_mpll",
+		.id		= -1,
+	},
+	.sources	= &clk_src_mpll,
+	.reg_src	= { .reg = S5P_CLKSRC_CPU, .shift = 4, .size = 1 },
+};
+
+static struct clk *clkset_moutcore_list[] = {
+	[0] = &clk_mout_apll.clk,
+	[1] = &clk_mout_mpll.clk,
+};
+
+static struct clksrc_sources clkset_moutcore = {
+	.sources	= clkset_moutcore_list,
+	.nr_sources	= ARRAY_SIZE(clkset_moutcore_list),
+};
+
+static struct clksrc_clk clk_moutcore = {
+	.clk	= {
+		.name		= "moutcore",
+		.id		= -1,
+	},
+	.sources	= &clkset_moutcore,
+	.reg_src	= { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 },
+};
+
+static struct clksrc_clk clk_coreclk = {
+	.clk	= {
+		.name		= "core_clk",
+		.id		= -1,
+		.parent		= &clk_moutcore.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 },
+};
+
+static struct clksrc_clk clk_armclk = {
+	.clk	= {
+		.name		= "armclk",
+		.id		= -1,
+		.parent		= &clk_coreclk.clk,
+	},
+};
+
+static struct clksrc_clk clk_aclk_corem0 = {
+	.clk	= {
+		.name		= "aclk_corem0",
+		.id		= -1,
+		.parent		= &clk_coreclk.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
+};
+
+static struct clksrc_clk clk_aclk_cores = {
+	.clk	= {
+		.name		= "aclk_cores",
+		.id		= -1,
+		.parent		= &clk_coreclk.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
+};
+
+static struct clksrc_clk clk_aclk_corem1 = {
+	.clk	= {
+		.name		= "aclk_corem1",
+		.id		= -1,
+		.parent		= &clk_coreclk.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 },
+};
+
+static struct clksrc_clk clk_periph = {
+	.clk	= {
+		.name		= "periph",
+		.id		= -1,
+		.parent		= &clk_coreclk.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
+};
+
+static struct clksrc_clk clk_atbout = {
+	.clk	= {
+		.name		= "atbout",
+		.id		= -1,
+		.parent		= &clk_moutcore.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 16, .size = 3 },
+};
+
+static struct clksrc_clk clk_pclk_dbg = {
+	.clk	= {
+		.name		= "pclk_dbg",
+		.id		= -1,
+		.parent		= &clk_atbout.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CPU, .shift = 20, .size = 3 },
+};
+
+/* Core list of CMU_CORE side */
+
+static struct clk *clkset_corebus_list[] = {
+	[0] = &clk_mout_mpll.clk,
+	[1] = &clk_mout_apll.clk,
+};
+
+static struct clksrc_sources clkset_mout_corebus = {
+	.sources	= clkset_corebus_list,
+	.nr_sources	= ARRAY_SIZE(clkset_corebus_list),
+};
+
+static struct clksrc_clk clk_mout_corebus = {
+	.clk	= {
+		.name		= "mout_corebus",
+		.id		= -1,
+	},
+	.sources	= &clkset_mout_corebus,
+	.reg_src	= { .reg = S5P_CLKSRC_CPU, .shift = 4, .size = 1 },
+};
+
+static struct clksrc_clk clk_sclk_dmc = {
+	.clk	= {
+		.name		= "sclk_dmc",
+		.id		= -1,
+		.parent		= &clk_mout_corebus.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CORE0, .shift = 12, .size = 3 },
+};
+
+static struct clksrc_clk clk_aclk_cored = {
+	.clk	= {
+		.name		= "aclk_cored",
+		.id		= -1,
+		.parent		= &clk_sclk_dmc.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CORE0, .shift = 16, .size = 3 },
+};
+
+static struct clksrc_clk clk_aclk_corep = {
+	.clk	= {
+		.name		= "aclk_corep",
+		.id		= -1,
+		.parent		= &clk_aclk_cored.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CORE0, .shift = 20, .size = 3 },
+};
+
+static struct clksrc_clk clk_aclk_acp = {
+	.clk	= {
+		.name		= "aclk_acp",
+		.id		= -1,
+		.parent		= &clk_mout_corebus.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CORE0, .shift = 0, .size = 3 },
+};
+
+static struct clksrc_clk clk_pclk_acp = {
+	.clk	= {
+		.name		= "pclk_acp",
+		.id		= -1,
+		.parent		= &clk_aclk_acp.clk,
+	},
+	.reg_div	= { .reg = S5P_CLKDIV_CORE0, .shift = 4, .size = 3 },
+};
+
+/* Core list of CMU_TOP side */
+
+static struct clk *clkset_aclk_top_list[] = {
+	[0] = &clk_mout_mpll.clk,
+	[1] = &clk_mout_apll.clk,
+};
+
+static struct clksrc_sources clkset_aclk_200 = {
+	.sources        = clkset_aclk_top_list,
+	.nr_sources     = ARRAY_SIZE(clkset_aclk_top_list),
+};
+
+static struct clksrc_clk clk_aclk_200 = {
+	.clk    = {
+		.name           = "aclk_200",
+		.id             = -1,
+	},
+	.sources        = &clkset_aclk_200,
+	.reg_src        = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
+	.reg_div	= { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 },
+};
+
+static struct clksrc_sources clkset_aclk_100 = {
+	.sources        = clkset_aclk_top_list,
+	.nr_sources     = ARRAY_SIZE(clkset_aclk_top_list),
+};
+
+static struct clksrc_clk clk_aclk_100 = {
+	.clk    = {
+		.name           = "aclk_100",
+		.id             = -1,
+	},
+	.sources        = &clkset_aclk_100,
+	.reg_src        = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
+	.reg_div	= { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 },
+};
+
+static struct clksrc_sources clkset_aclk_160 = {
+	.sources        = clkset_aclk_top_list,
+	.nr_sources     = ARRAY_SIZE(clkset_aclk_top_list),
+};
+
+static struct clksrc_clk clk_aclk_160 = {
+	.clk    = {
+		.name           = "aclk_160",
+		.id             = -1,
+	},
+	.sources        = &clkset_aclk_160,
+	.reg_src        = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
+	.reg_div	= { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
+};
+
+static struct clksrc_sources clkset_aclk_133 = {
+	.sources        = clkset_aclk_top_list,
+	.nr_sources     = ARRAY_SIZE(clkset_aclk_top_list),
+};
+
+static struct clksrc_clk clk_aclk_133 = {
+	.clk    = {
+		.name           = "aclk_133",
+		.id             = -1,
+	},
+	.sources        = &clkset_aclk_133,
+	.reg_src        = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
+	.reg_div	= { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 },
+};
+
+static struct clk *clkset_vpllsrc_list[] = {
+	[0] = &clk_fin_vpll,
+	[1] = &clk_sclk_hdmi27m,
+};
+
+static struct clksrc_sources clkset_vpllsrc = {
+	.sources	= clkset_vpllsrc_list,
+	.nr_sources	= ARRAY_SIZE(clkset_vpllsrc_list),
+};
+
+static struct clksrc_clk clk_vpllsrc = {
+	.clk    = {
+		.name           = "vpll_src",
+		.id             = -1,
+	},
+	.sources        = &clkset_vpllsrc,
+	.reg_src        = { .reg = S5P_CLKSRC_TOP0, .shift = 0, .size = 1 },
+};
+
+static struct clk *clkset_sclk_vpll_list[] = {
+	[0] = &clk_vpllsrc.clk,
+	[1] = &clk_fout_vpll,
+};
+
+static struct clksrc_sources clkset_sclk_vpll = {
+	.sources        = clkset_sclk_vpll_list,
+	.nr_sources     = ARRAY_SIZE(clkset_sclk_vpll_list),
+};
+
+static struct clksrc_clk clk_sclk_vpll = {
+	.clk    = {
+		.name           = "sclk_vpll",
+		.id             = -1,
+	},
+	.sources        = &clkset_sclk_vpll,
+	.reg_src        = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
+};
+
+static int s5pv310_clk_ip_peril_ctrl(struct clk *clk, int enable)
+{
+	return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable);
+}
+
+static struct clk init_clocks_disable[] = {
+	{
+		.name		= "timers",
+		.id		= -1,
+		.parent		= &clk_aclk_100.clk,
+		.enable		= s5pv310_clk_ip_peril_ctrl,
+		.ctrlbit	= (1<<24),
+	}
+};
+
+static struct clk init_clocks[] = {
+	/* Nothing here yet */
+};
+
+static struct clk *clkset_group_list[] = {
+	[0] = &clk_ext_xtal_mux,
+	[1] = &clk_xusbxti,
+	[2] = &clk_sclk_hdmi27m,
+	[6] = &clk_mout_mpll.clk,
+	[7] = &clk_mout_epll.clk,
+	[8] = &clk_sclk_vpll.clk,
+};
+
+static struct clksrc_sources clkset_group = {
+	.sources	= clkset_group_list,
+	.nr_sources	= ARRAY_SIZE(clkset_group_list),
+};
+
+static struct clksrc_clk clksrcs[] = {
+	{
+		.clk	= {
+			.name		= "uclk1",
+			.id		= 0,
+			.ctrlbit	= (1 << 0),
+			.enable		= s5pv310_clk_ip_peril_ctrl,
+		},
+		.sources = &clkset_group,
+		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 },
+		.reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 },
+	}, {
+		.clk		= {
+			.name		= "uclk1",
+			.id		= 1,
+			.enable		= s5pv310_clk_ip_peril_ctrl,
+			.ctrlbit	= (1 << 1),
+		},
+		.sources = &clkset_group,
+		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 },
+		.reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 },
+	}, {
+		.clk		= {
+			.name		= "uclk1",
+			.id		= 2,
+			.enable		= s5pv310_clk_ip_peril_ctrl,
+			.ctrlbit	= (1 << 2),
+		},
+		.sources = &clkset_group,
+		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 },
+		.reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 },
+	}, {
+		.clk		= {
+			.name		= "uclk1",
+			.id		= 3,
+			.enable		= s5pv310_clk_ip_peril_ctrl,
+			.ctrlbit	= (1 << 3),
+		},
+		.sources = &clkset_group,
+		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 },
+		.reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 },
+	}, {
+		.clk		= {
+			.name		= "sclk_pwm",
+			.id		= -1,
+			.enable		= s5pv310_clk_ip_peril_ctrl,
+			.ctrlbit	= (1 << 24),
+		},
+		.sources = &clkset_group,
+		.reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 },
+		.reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 },
+	},
+};
+
+/* Clock initialization code */
+static struct clksrc_clk *sysclks[] = {
+	&clk_mout_apll,
+	&clk_mout_epll,
+	&clk_mout_mpll,
+	&clk_moutcore,
+	&clk_coreclk,
+	&clk_armclk,
+	&clk_aclk_corem0,
+	&clk_aclk_cores,
+	&clk_aclk_corem1,
+	&clk_periph,
+	&clk_atbout,
+	&clk_pclk_dbg,
+	&clk_mout_corebus,
+	&clk_sclk_dmc,
+	&clk_aclk_cored,
+	&clk_aclk_corep,
+	&clk_aclk_acp,
+	&clk_pclk_acp,
+	&clk_vpllsrc,
+	&clk_sclk_vpll,
+	&clk_aclk_200,
+	&clk_aclk_100,
+	&clk_aclk_160,
+	&clk_aclk_133,
+};
+
+void __init_or_cpufreq s5pv310_setup_clocks(void)
+{
+	struct clk *xtal_clk;
+	unsigned long apll;
+	unsigned long mpll;
+	unsigned long epll;
+	unsigned long vpll;
+	unsigned long vpllsrc;
+	unsigned long xtal;
+	unsigned long armclk;
+	unsigned long aclk_corem0;
+	unsigned long aclk_cores;
+	unsigned long aclk_corem1;
+	unsigned long periclk;
+	unsigned long sclk_dmc;
+	unsigned long aclk_cored;
+	unsigned long aclk_corep;
+	unsigned long aclk_acp;
+	unsigned long pclk_acp;
+	unsigned int ptr;
+
+	printk(KERN_DEBUG "%s: registering clocks\n", __func__);
+
+	xtal_clk = clk_get(NULL, "xtal");
+	BUG_ON(IS_ERR(xtal_clk));
+
+	xtal = clk_get_rate(xtal_clk);
+	clk_put(xtal_clk);
+
+	printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
+
+	apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), pll_4508);
+	mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), pll_4508);
+	epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0),
+				__raw_readl(S5P_EPLL_CON1), pll_4500);
+
+	vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
+	vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
+				__raw_readl(S5P_VPLL_CON1), pll_4502);
+
+	clk_fout_apll.rate = apll;
+	clk_fout_mpll.rate = mpll;
+	clk_fout_epll.rate = epll;
+	clk_fout_vpll.rate = vpll;
+
+	printk(KERN_INFO "S5PV310: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
+			apll, mpll, epll, vpll);
+
+	armclk = clk_get_rate(&clk_armclk.clk);
+	aclk_corem0 = clk_get_rate(&clk_aclk_corem0.clk);
+	aclk_cores = clk_get_rate(&clk_aclk_cores.clk);
+	aclk_corem1 = clk_get_rate(&clk_aclk_corem1.clk);
+	periclk = clk_get_rate(&clk_periph.clk);
+	sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk);
+	aclk_cored = clk_get_rate(&clk_aclk_cored.clk);
+	aclk_corep = clk_get_rate(&clk_aclk_corep.clk);
+	aclk_acp = clk_get_rate(&clk_aclk_acp.clk);
+	pclk_acp = clk_get_rate(&clk_pclk_acp.clk);
+
+	printk(KERN_INFO "S5PV310: ARMCLK=%ld, COREM0=%ld, CORES=%ld\n"
+			 "COREM1=%ld, PERI=%ld, DMC=%ld, CORED=%ld\n"
+			 "COREP=%ld, ACLK_ACP=%ld, PCLK_ACP=%ld",
+			armclk, aclk_corem0, aclk_cores, aclk_corem1,
+			periclk, sclk_dmc, aclk_cored, aclk_corep,
+			aclk_acp, pclk_acp);
+
+	clk_f.rate = armclk;
+	clk_h.rate = sclk_dmc;
+	clk_p.rate = periclk;
+
+	for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
+		s3c_set_clksrc(&clksrcs[ptr], true);
+}
+
+static struct clk *clks[] __initdata = {
+	/* Nothing here yet */
+};
+
+void __init s5pv310_register_clocks(void)
+{
+	struct clk *clkp;
+	int ret;
+	int ptr;
+
+	ret = s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
+	if (ret > 0)
+		printk(KERN_ERR "Failed to register %u clocks\n", ret);
+
+	for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
+		s3c_register_clksrc(sysclks[ptr], 1);
+
+	s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
+	s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
+
+	clkp = init_clocks_disable;
+	for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
+		ret = s3c24xx_register_clock(clkp);
+		if (ret < 0) {
+			printk(KERN_ERR "Failed to register clock %s (%d)\n",
+			       clkp->name, ret);
+		}
+		(clkp->enable)(clkp, 0);
+	}
+
+	s3c_pwmclk_init();
+}
arch/arm/mach-s5pv310/include/mach/regs-clock.h new file +60 -0

60 lines not on this page · raw message

arch/arm/plat-s5p/include/plat/pll.h +41 -0

47 lines not on this page · raw message

Signature · 1 line
1.6.2.5
author
#4 lore raw

PATCH 4/8 ARM: S5PV310: Add IRQ support

In reply to Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds IRQ support for S5PV310.
ARM GIC is installed in S5PV310 instead of VIC which is in every other CPUs in S5P series. Several irq combiners are used to resolve the lack of irq lines in current implementation.

---
 arch/arm/mach-s5pv310/include/mach/irqs.h     |   74 ++++++++++++++
 arch/arm/mach-s5pv310/include/mach/regs-irq.h |   19 ++++
 arch/arm/mach-s5pv310/irq-combiner.c          |  129 +++++++++++++++++++++++++
 arch/arm/plat-s5p/irq.c                       |    2 +
 4 files changed, 224 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/include/mach/irqs.h
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-irq.h
 create mode 100644 arch/arm/mach-s5pv310/irq-combiner.c
arch/arm/mach-s5pv310/include/mach/irqs.h new file +74 -0
new file mode 100644
index 0000000..56885ca
@@ -0,0 +1,74 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/irqs.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV210 - IRQ 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_IRQS_H
+#define __ASM_ARCH_IRQS_H __FILE__
+
+#include <plat/irqs.h>
+
+/* Private Peripheral Interrupt */
+#define IRQ_PPI(x)		S5P_IRQ(x+16)
+
+#define IRQ_LOCALTIMER		IRQ_PPI(13)
+
+/* Shared Peripheral Interrupt */
+#define IRQ_SPI(x)		S5P_IRQ(x+32)
+
+#define IRQ_EINT0		IRQ_SPI(40)
+#define IRQ_EINT1		IRQ_SPI(41)
+#define IRQ_EINT2		IRQ_SPI(42)
+#define IRQ_EINT3		IRQ_SPI(43)
+#define IRQ_USB_HSOTG		IRQ_SPI(44)
+#define IRQ_USB_HOST		IRQ_SPI(45)
+#define IRQ_MODEM_IF		IRQ_SPI(46)
+#define IRQ_ROTATOR		IRQ_SPI(47)
+#define IRQ_JPEG		IRQ_SPI(48)
+#define IRQ_2D			IRQ_SPI(49)
+#define IRQ_PCIE		IRQ_SPI(50)
+#define IRQ_SYSTEM_TIMER	IRQ_SPI(51)
+#define IRQ_MFC			IRQ_SPI(52)
+#define IRQ_WTD			IRQ_SPI(53)
+#define IRQ_AUDIO_SS		IRQ_SPI(54)
+#define IRQ_AC97		IRQ_SPI(55)
+#define IRQ_SPDIF		IRQ_SPI(56)
+#define IRQ_KEYPAD		IRQ_SPI(57)
+#define IRQ_INTFEEDCTRL_SSS	IRQ_SPI(58)
+#define IRQ_SLIMBUS		IRQ_SPI(59)
+#define IRQ_PMU			IRQ_SPI(60)
+#define IRQ_TSI			IRQ_SPI(61)
+#define IRQ_SATA		IRQ_SPI(62)
+#define IRQ_GPS			IRQ_SPI(63)
+
+#define MAX_IRQ_IN_COMBINER	8
+#define COMBINER_GROUP(x)	((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(64))
+#define COMBINER_IRQ(x, y)	(COMBINER_GROUP(x) + y)
+
+#define IRQ_TIMER0_VIC		COMBINER_IRQ(22, 0)
+#define IRQ_TIMER1_VIC		COMBINER_IRQ(22, 1)
+#define IRQ_TIMER2_VIC		COMBINER_IRQ(22, 2)
+#define IRQ_TIMER3_VIC		COMBINER_IRQ(22, 3)
+#define IRQ_TIMER4_VIC		COMBINER_IRQ(22, 4)
+
+#define IRQ_UART0		COMBINER_IRQ(26, 0)
+#define IRQ_UART1		COMBINER_IRQ(26, 1)
+#define IRQ_UART2		COMBINER_IRQ(26, 2)
+#define IRQ_UART3		COMBINER_IRQ(26, 3)
+#define IRQ_UART4		COMBINER_IRQ(26, 4)
+
+#define IRQ_IIC			COMBINER_IRQ(27, 0)
+
+/* Set the default NR_IRQS */
+#define NR_IRQS			COMBINER_IRQ(MAX_COMBINER_NR, 0)
+
+#define MAX_COMBINER_NR		39
+
+#endif /* ASM_ARCH_IRQS_H */
arch/arm/mach-s5pv310/include/mach/regs-irq.h new file +19 -0
new file mode 100644
index 0000000..c6e09c7
@@ -0,0 +1,19 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/regs-irq.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV310 - IRQ register 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_REGS_IRQ_H
+#define __ASM_ARCH_REGS_IRQ_H __FILE__
+
+#include <asm/hardware/gic.h>
+#include <mach/map.h>
+
+#endif /* __ASM_ARCH_REGS_IRQ_H */
arch/arm/mach-s5pv310/irq-combiner.c new file +129 -0

129 lines not on this page · raw message

arch/arm/plat-s5p/irq.c +2 -0
index 25e1eb6..5560b12 100644
@@ -56,11 +56,13 @@ static struct s3c_uart_irq uart_irqs[] = {
 
 void __init s5p_init_irq(u32 *vic, u32 num_vic)
 {
+#ifdef CONFIG_ARM_VIC
 	int irq;
 
 	/* initialize the VICs */
 	for (irq = 0; irq < num_vic; irq++)
 		vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);
+#endif
 
 	s3c_init_vic_timer_irq(IRQ_TIMER0_VIC, IRQ_TIMER0);
 	s3c_init_vic_timer_irq(IRQ_TIMER1_VIC, IRQ_TIMER1);
Signature · 1 line
1.6.2.5
#5 lore raw

PATCH 4/8 ARM: S5PV310: Add IRQ support

Quoted 1 line · Kukjin Kim

+static DEFINE_SPINLOCK(irq_controller_lock);

Hmm, why is this lock needed? The uses below don't seem like they need locking:

Quoted 20 lines
arch/arm/mach-s5pv310/irq-combiner.c new file +20 -0
+static void combiner_mask_irq(unsigned int irq)
+{
+	u32 mask = 1 << (irq % 32);
+
+	spin_lock(&irq_controller_lock);
+	__raw_writel(mask, combiner_base(irq) + COMBINER_ENABLE_CLEAR);
+	spin_unlock(&irq_controller_lock);
+}
+
+static void combiner_unmask_irq(unsigned int irq)
+{
+	u32 mask = 1 << (irq % 32);
+
+	spin_lock(&irq_controller_lock);
+	__raw_writel(mask, combiner_base(irq) + COMBINER_ENABLE_SET);
+	spin_unlock(&irq_controller_lock);
+}
+
+static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
+{

...

Quoted 3 lines
arch/arm/mach-s5pv310/irq-combiner.c new file +3 -0
+	spin_lock(&irq_controller_lock);
+	status = __raw_readl(chip_data->base + COMBINER_INT_STATUS);
+	spin_unlock(&irq_controller_lock);
author
#6 lore raw

PATCH 5/8 ARM: S5PV310: Add Timer support

In reply to Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds timer support for S5PV310.
Until now, all S5P SoCs use CONFIG_ARCH_USES_GETTIMEOFFSET macro as a default configuration. Instead, S5PV310 implements clocksource and clock_event_device to support the high resolution timer and tickless system.

---
 arch/arm/mach-s5pv310/include/mach/pwm-clock.h |   70 ++++++
 arch/arm/mach-s5pv310/localtimer.c             |   25 ++
 arch/arm/mach-s5pv310/time.c                   |  289 ++++++++++++++++++++++++
 arch/arm/plat-samsung/Makefile                 |    2 +-
 4 files changed, 385 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/include/mach/pwm-clock.h
 create mode 100644 arch/arm/mach-s5pv310/localtimer.c
 create mode 100644 arch/arm/mach-s5pv310/time.c
arch/arm/mach-s5pv310/include/mach/pwm-clock.h new file +70 -0
new file mode 100644
index 0000000..7e6da27
@@ -0,0 +1,70 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/pwm-clock.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <[email protected]>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h
+ *
+ * S5PV310 - pwm clock and timer 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_PWMCLK_H
+#define __ASM_ARCH_PWMCLK_H __FILE__
+
+/**
+ * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
+ * @tcfg: The timer TCFG1 register bits shifted down to 0.
+ *
+ * Return true if the given configuration from TCFG1 is a TCLK instead
+ * any of the TDIV clocks.
+ */
+static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
+{
+	return tcfg == S3C64XX_TCFG1_MUX_TCLK;
+}
+
+/**
+ * tcfg_to_divisor() - convert tcfg1 setting to a divisor
+ * @tcfg1: The tcfg1 setting, shifted down.
+ *
+ * Get the divisor value for the given tcfg1 setting. We assume the
+ * caller has already checked to see if this is not a TCLK source.
+ */
+static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
+{
+	return 1 << tcfg1;
+}
+
+/**
+ * pwm_tdiv_has_div1() - does the tdiv setting have a /1
+ *
+ * Return true if we have a /1 in the tdiv setting.
+ */
+static inline unsigned int pwm_tdiv_has_div1(void)
+{
+	return 1;
+}
+
+/**
+ * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.
+ * @div: The divisor to calculate the bit information for.
+ *
+ * Turn a divisor into the necessary bit field for TCFG1.
+ */
+static inline unsigned long pwm_tdiv_div_bits(unsigned int div)
+{
+	return ilog2(div);
+}
+
+#define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK
+
+#endif /* __ASM_ARCH_PWMCLK_H */
arch/arm/mach-s5pv310/localtimer.c new file +25 -0
new file mode 100644
index 0000000..2784036
@@ -0,0 +1,25 @@
+/* linux/arch/arm/mach-s5pv310/localtimer.c
+ *
+ * Cloned from linux/arch/arm/mach-realview/localtimer.c
+ *
+ *  Copyright (C) 2002 ARM Ltd.
+ *  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/clockchips.h>
+
+#include <asm/irq.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-s5pv310/time.c new file +289 -0

289 lines not on this page · raw message

arch/arm/plat-samsung/Makefile +1 -1
index b1d82cc..0d5bf8a 100644
@@ -12,7 +12,7 @@ obj-				:=
 # Objects we always build independent of SoC choice
 
 obj-y				+= init.o
-obj-y				+= time.o
+obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
 obj-y				+= clock.o
 obj-y				+= pwm-clock.o
 obj-y				+= gpio.o
Signature · 1 line
1.6.2.5
#7 lore raw

PATCH 5/8 ARM: S5PV310: Add Timer support

arch/arm/mach-s5pv310/time.c line 64

Quoted 10 lines · Kukjin Kim
arch/arm/mach-s5pv310/time.c new file +10 -0
+static void s5pv310_pwm_init(unsigned int pwm_id, unsigned long tcnt)
+{
+	unsigned long tcon;
+
+	tcon = __raw_readl(S3C2410_TCON);
+
+	/* timers reload after counting zero, so reduce the count by 1 */
+	tcnt--;
+
+	printk(KERN_DEBUG "timer tcon=%08lx, tcnt %08lx\n", tcon, tcnt);

This function is called from set_event(). Do you really want this printk every time a tick is programmed?

Quoted 12 lines
arch/arm/mach-s5pv310/time.c new file +12 -0
+static void __init s5pv310_clocksource_init(void)
+{
+	unsigned long pclk;
+	unsigned long clock_rate;
+
+	pclk = clk_get_rate(timerclk);
+
+	clk_set_rate(tdiv2, pclk / 2);
+	clk_set_parent(tin2, tdiv2);
+
+	clock_rate = clk_get_rate(tin2);
+

arch/arm/mach-s5pv310/time.c line 241

Quoted 10 lines
arch/arm/mach-s5pv310/time.c new file +10 -0
+	pwm_clocksource.mult =
+		clocksource_khz2mult(clock_rate/1000, pwm_clocksource.shift);
+
+	if (clocksource_register(&pwm_clocksource))
+		panic("%s: can't register clocksource\n", pwm_clocksource.name);
+
+	s5pv310_pwm_init(2, ~0);
+	s5pv310_pwm_start(2, 1);
+}
+

It would probably be prudent to start the clocksource before registering it, rather than after.

author
#8 lore raw

PATCH 5/8 ARM: S5PV310: Add Timer support

Quoted 1 line · Rabin Vincent

Hi Rabin,

Thanks for your comments. :-)

Quoted 6 lines · Kukjin Kim
Quoted 5 lines
arch/arm/mach-s5pv310/time.c new file +5 -0
+static void s5pv310_pwm_init(unsigned int pwm_id, unsigned long tcnt)
+{
+	unsigned long tcon;
+
+	tcon = __raw_readl(S3C2410_TCON);
Quoted 9 lines

arch/arm/mach-s5pv310/time.c line 64

Quoted 5 lines
arch/arm/mach-s5pv310/time.c new file +5 -0
+
+	/* timers reload after counting zero, so reduce the count by 1 */
+	tcnt--;
+
+	printk(KERN_DEBUG "timer tcon=%08lx, tcnt %08lx\n", tcon, tcnt);

This function is called from set_event(). Do you really want this printk every time a tick is programmed?

Yeah, you're right.
Will modify it.

Quoted 6 lines
Quoted 6 lines
arch/arm/mach-s5pv310/time.c new file +6 -0
+static void __init s5pv310_clocksource_init(void)
+{
+	unsigned long pclk;
+	unsigned long clock_rate;
+
+	pclk = clk_get_rate(timerclk);
Quoted 8 lines

arch/arm/mach-s5pv310/time.c

Quoted 8 lines
arch/arm/mach-s5pv310/time.c new file +8 -0
+
+	clk_set_rate(tdiv2, pclk / 2);
+	clk_set_parent(tin2, tdiv2);
+
+	clock_rate = clk_get_rate(tin2);
+
+	pwm_clocksource.mult =
+		clocksource_khz2mult(clock_rate/1000,

pwm_clocksource.shift);

Quoted 4 lines

arch/arm/mach-s5pv310/time.c

Quoted 3 lines
arch/arm/mach-s5pv310/time.c new file +3 -0
+
+	if (clocksource_register(&pwm_clocksource))
+		panic("%s: can't register clocksource\n",

pwm_clocksource.name);

Quoted 8 lines

arch/arm/mach-s5pv310/time.c line 241

Quoted 5 lines
arch/arm/mach-s5pv310/time.c new file +5 -0
+
+	s5pv310_pwm_init(2, ~0);
+	s5pv310_pwm_start(2, 1);
+}
+

It would probably be prudent to start the clocksource before registering it, rather than after.

Oh, yes.
Will change it.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

author
#9 lore raw

PATCH 6/8 ARM: S5PV310: Add new Kconfig and Makefiles

In reply to Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds the Kconfig and Makefile for the new S5PV310 SoC. It also updates arch/arm Kconfig, Makefile and arch/arm/mm/Kconfig to include support for the new S5PV310.

---
 arch/arm/Kconfig                    |   24 +++++++++++++++++++-----
 arch/arm/Makefile                   |    1 +
 arch/arm/mach-s5pv310/Kconfig       |   26 ++++++++++++++++++++++++++
 arch/arm/mach-s5pv310/Makefile      |   20 ++++++++++++++++++++
 arch/arm/mach-s5pv310/Makefile.boot |    2 ++
 arch/arm/mm/Kconfig                 |    3 ++-
 arch/arm/plat-s5p/Kconfig           |    5 +++--
 7 files changed, 73 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/Kconfig
 create mode 100644 arch/arm/mach-s5pv310/Makefile
 create mode 100644 arch/arm/mach-s5pv310/Makefile.boot
arch/arm/Kconfig +19 -5
index 1f254bd..a7a8040 100644
@@ -704,6 +704,15 @@ config ARCH_S5PV210
 	help
 	  Samsung S5PV210/S5PC110 series based systems
 
+config ARCH_S5PV310
+	bool "Samsung S5PV310/S5PC210"
+	select CPU_V7
+	select GENERIC_GPIO
+	select HAVE_CLK
+	select GENERIC_CLOCKEVENTS
+	help
+	  Samsung S5PV310 series based systems
+
 config ARCH_SHARK
 	bool "Shark"
 	select CPU_SA110
@@ -904,6 +913,8 @@ source "arch/arm/mach-s5pc100/Kconfig"
 
 source "arch/arm/mach-s5pv210/Kconfig"
 
+source "arch/arm/mach-s5pv310/Kconfig"
+
 source "arch/arm/mach-shmobile/Kconfig"
 
 source "arch/arm/plat-stmp3xxx/Kconfig"
@@ -1099,10 +1110,11 @@ config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
 		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
-		 ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
+		 ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_S5PV310)
 	depends on GENERIC_CLOCKEVENTS
 	select USE_GENERIC_SMP_HELPERS
-	select HAVE_ARM_SCU if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
+	select HAVE_ARM_SCU if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 ||\
+			ARCH_S5PV310)
 	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
@@ -1171,9 +1183,10 @@ 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 || ARCH_U8500)
+		REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
+		ARCH_U8500 || ARCH_S5PV310)
 	default y
-	select HAVE_ARM_TWD if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500)
+	select HAVE_ARM_TWD if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500 || ARCH_S5PV310)
 	help
 	  Enable support for local timers on SMP platforms, rather then the
 	  legacy IPI broadcast method.  Local timers allows the system
@@ -1185,7 +1198,8 @@ source kernel/Kconfig.preempt
 config HZ
 	int
 	default 128 if ARCH_L7200
-	default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P6440 || ARCH_S5P6442 || ARCH_S5PV210
+	default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P6440 || ARCH_S5P6442 || \
+		       ARCH_S5PV210 || ARCH_S5PV310
 	default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER
 	default AT91_TIMER_HZ if ARCH_AT91
 	default 100
arch/arm/Makefile +1 -0
index 64ba313..d80c9f9 100644
@@ -170,6 +170,7 @@ machine-$(CONFIG_ARCH_S5P6440)		:= s5p6440
 machine-$(CONFIG_ARCH_S5P6442)		:= s5p6442
 machine-$(CONFIG_ARCH_S5PC100)		:= s5pc100
 machine-$(CONFIG_ARCH_S5PV210)		:= s5pv210
+machine-$(CONFIG_ARCH_S5PV310)		:= s5pv310
 machine-$(CONFIG_ARCH_SA1100)		:= sa1100
 machine-$(CONFIG_ARCH_SHARK)		:= shark
 machine-$(CONFIG_ARCH_SHMOBILE) 	:= shmobile
arch/arm/mach-s5pv310/Kconfig new file +26 -0
new file mode 100644
index 0000000..24ef3cd
@@ -0,0 +1,26 @@
+# arch/arm/mach-s5pv310/Kconfig
+#
+# Copyright (c) 2010 Samsung Electronics Co., Ltd.
+#		http://www.samsung.com/
+#
+# Licensed under GPLv2
+
+# Configuration options for the S5PV310
+
+if ARCH_S5PV310
+
+config CPU_S5PV310
+	bool
+	select PLAT_S5P
+	help
+	  Enable S5PV310 CPU support
+
+# machine support
+
+config MACH_SMDKV310
+	bool "SMDKV310"
+	select CPU_S5PV310
+	select ARCH_SPARSEMEM_ENABLE
+	help
+	  Machine support for Samsung SMDKV310
+endif
arch/arm/mach-s5pv310/Makefile new file +20 -0
new file mode 100644
index 0000000..1b263a5
@@ -0,0 +1,20 @@
+# arch/arm/mach-s5pv310/Makefile
+#
+# Copyright (c) 2010 Samsung Electronics Co., Ltd.
+#		http://www.samsung.com/
+#
+# Licensed under GPLv2
+
+obj-y				:=
+obj-m				:=
+obj-n				:=
+obj-				:=
+
+# Core support for S5PV310 system
+
+obj-$(CONFIG_CPU_S5PV310)	+= cpu.o init.o clock.o irq-combiner.o
+obj-$(CONFIG_CPU_S5PV310)	+= setup-i2c0.o time.o
+
+obj-$(CONFIG_SMP)		+= platsmp.o headsmp.o
+obj-$(CONFIG_LOCAL_TIMERS)	+= localtimer.o
+obj-$(CONFIG_HOTPLUG_CPU)	+= hotplug.o
arch/arm/mach-s5pv310/Makefile.boot new file +2 -0
new file mode 100644
index 0000000..d65956f
@@ -0,0 +1,2 @@
+   zreladdr-y	:= 0x40008000
+params_phys-y	:= 0x40000100
arch/arm/mm/Kconfig +2 -1
index 346ae14..45284c8 100644
@@ -763,7 +763,8 @@ config CACHE_L2X0
 	bool "Enable the L2x0 outer cache controller"
 	depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \
 		   REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || \
-		   ARCH_NOMADIK || ARCH_OMAP4 || ARCH_U8500 || ARCH_VEXPRESS_CA9X4
+		   ARCH_NOMADIK || ARCH_OMAP4 || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \
+		   ARCH_S5PV310
 	default y
 	select OUTER_CACHE
 	select OUTER_CACHE_SYNC
arch/arm/plat-s5p/Kconfig +3 -2
index 11d6a1b..907ac63 100644
@@ -7,9 +7,10 @@
 
 config PLAT_S5P
 	bool
-	depends on (ARCH_S5P6440 || ARCH_S5P6442 || ARCH_S5PC100 || ARCH_S5PV210)
+	depends on (ARCH_S5P6440 || ARCH_S5P6442 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_S5PV310)
 	default y
-	select ARM_VIC
+	select ARM_VIC if !ARCH_S5PV310
+	select ARM_GIC if ARCH_S5PV310
 	select NO_IOPORT
 	select ARCH_REQUIRE_GPIOLIB
 	select S3C_GPIO_TRACK
Signature · 1 line
1.6.2.5
author
#10 lore raw

PATCH 7/8 ARM: S5PV310: Add Board support file

In reply to Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds Samsung SMDKV310 board support file.

---
 arch/arm/mach-s5pv310/Makefile        |    4 ++
 arch/arm/mach-s5pv310/mach-smdkv310.c |   94 +++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/mach-smdkv310.c
arch/arm/mach-s5pv310/Makefile +4 -0
index 1b263a5..56e7693 100644
@@ -18,3 +18,7 @@ obj-$(CONFIG_CPU_S5PV310)	+= setup-i2c0.o time.o
 obj-$(CONFIG_SMP)		+= platsmp.o headsmp.o
 obj-$(CONFIG_LOCAL_TIMERS)	+= localtimer.o
 obj-$(CONFIG_HOTPLUG_CPU)	+= hotplug.o
+
+# machine support
+
+obj-$(CONFIG_MACH_SMDKV310)	+= mach-smdkv310.o
arch/arm/mach-s5pv310/mach-smdkv310.c new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
1.6.2.5
author
#11 lore raw

PATCH 8/8 ARM: S5PV310: Add serial port support

In reply to Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds UART serial port support for S5PV310 CPU.

---
 drivers/serial/Kconfig   |    8 +++
 drivers/serial/Makefile  |    1 +
 drivers/serial/s5pv310.c |  124 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 133 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/s5pv310.c
drivers/serial/Kconfig +8 -0
index 8b23165..b5ff41f 100644
@@ -550,6 +550,14 @@ config SERIAL_S5PV210
 	help
 	  Serial port support for Samsung's S5P Family of SoC's
 
+config SERIAL_S5PV310
+	tristate "Samsung S5PV310 Serial port support"
+	depends on SERIAL_SAMSUNG && CPU_S5PV310
+	select SERIAL_SAMSUNG_UARTS_4
+	default y
+	help
+	  Serial port support for Samsung's S5P Family of SoC's
+
 config SERIAL_MAX3100
 	tristate "MAX3100 support"
 	depends on SPI
drivers/serial/Makefile +1 -0
index 208a855..bd32d3f 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o
 obj-$(CONFIG_SERIAL_S3C24A0) += s3c24a0.o
 obj-$(CONFIG_SERIAL_S3C6400) += s3c6400.o
 obj-$(CONFIG_SERIAL_S5PV210) += s5pv210.o
+obj-$(CONFIG_SERIAL_S5PV310) += s5pv310.o
 obj-$(CONFIG_SERIAL_MAX3100) += max3100.o
 obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o
 obj-$(CONFIG_SERIAL_MUX) += mux.o
drivers/serial/s5pv310.c new file +124 -0

124 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#12 lore raw

PATCH 8/8 ARM: S5PV310: Add serial port support

Hi,

As previous description. it's also same except the udivslot calculation and clock selection.
How about to just modify current v210 serial codes by just adding the V310 or C210 type?

Thank you,
Kyungmin Park

Quoted 183 lines · Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds UART serial port support for S5PV310 CPU.

---

?drivers/serial/Kconfig ? | ? ?8 +++
?drivers/serial/Makefile ?| ? ?1 +
?drivers/serial/s5pv310.c | ?124 ++++++++++++++++++++++++++++++++++++++++++++++

?3 files changed, 133 insertions(+), 0 deletions(-) ?create mode 100644 drivers/serial/s5pv310.c

drivers/serial/Kconfig +0 -0
index 8b23165..b5ff41f 100644
@@ -550,6 +550,14 @@ config SERIAL_S5PV210

? ? ? ?help
? ? ? ? ?Serial port support for Samsung's S5P Family of SoC's

drivers/serial/Kconfig +8 -0
+config SERIAL_S5PV310
+ ? ? ? tristate "Samsung S5PV310 Serial port support"
+ ? ? ? depends on SERIAL_SAMSUNG && CPU_S5PV310
+ ? ? ? select SERIAL_SAMSUNG_UARTS_4
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? Serial port support for Samsung's S5P Family of SoC's
+

?config SERIAL_MAX3100
? ? ? ?tristate "MAX3100 support"
? ? ? ?depends on SPI

drivers/serial/Makefile +0 -0
index 208a855..bd32d3f 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o

?obj-$(CONFIG_SERIAL_S3C24A0) += s3c24a0.o
?obj-$(CONFIG_SERIAL_S3C6400) += s3c6400.o
?obj-$(CONFIG_SERIAL_S5PV210) += s5pv210.o
+obj-$(CONFIG_SERIAL_S5PV310) += s5pv310.o
?obj-$(CONFIG_SERIAL_MAX3100) += max3100.o
?obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o
?obj-$(CONFIG_SERIAL_MUX) += mux.o

drivers/serial/s5pv310.c new file +124 -1
new file mode 100644
index 0000000..1d466cf
@@ -0,0 +1,124 @@
+/* linux/drivers/serial/s5pv310.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ * ? ? ? ? ? ? http://www.samsung.com/
+ *
+ * Based on drivers/serial/s5pv210.c
+ *
+ * Driver for Samsung S5PV310 SoC UARTs.
+ *
+ * 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/module.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+
+#include <plat/regs-serial.h>
+#include "samsung.h"
+
+static int s5pv310_serial_setsource(struct uart_port *port,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct s3c24xx_uart_clksrc *clk)
+{
+ ? ? ? /* for s5pv310, serial clock source is only uclk1 */
+ ? ? ? return 0;
+};
+
+static int s5pv310_serial_getsource(struct uart_port *port,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct s3c24xx_uart_clksrc *clk)
+{
+ ? ? ? /* for s5pv310, serial clock source is only uclk1 */
+ ? ? ? clk->divisor = 1;
+ ? ? ? clk->name = "uclk1";
+ ? ? ? return 0;
+};
+
+static int s5pv310_serial_resetport(struct uart_port *port,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct s3c2410_uartcfg *cfg)
+{
+ ? ? ? wr_regl(port, S3C2410_UCON, ?cfg->ucon);
+ ? ? ? wr_regl(port, S3C2410_ULCON, cfg->ulcon);
+
+ ? ? ? /* reset both fifos */
+ ? ? ? wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
+ ? ? ? wr_regl(port, S3C2410_UFCON, cfg->ufcon);
+
+ ? ? ? return 0;
+}
+
+#define S5PV310_UART_DEFAULT_INFO(fifo_size) ? ? ? ? ? ? ? ? ? \
+ ? ? ? ? ? ? ? .name ? ? ? ? ? = "Samsung S5PV310 UART", ? ? ? \
+ ? ? ? ? ? ? ? .type ? ? ? ? ? = PORT_S3C6400, ? ? ? ? ? ? ? ? \
+ ? ? ? ? ? ? ? .fifosize ? ? ? = fifo_size, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ? ? .has_fracval ? ?= 1, ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ? ? .rx_fifomask ? ?= S5PV210_UFSTAT_RXMASK, ? ? ? ?\
+ ? ? ? ? ? ? ? .rx_fifoshift ? = S5PV210_UFSTAT_RXSHIFT, ? ? ? \
+ ? ? ? ? ? ? ? .rx_fifofull ? ?= S5PV210_UFSTAT_RXFULL, ? ? ? ?\
+ ? ? ? ? ? ? ? .tx_fifofull ? ?= S5PV210_UFSTAT_TXFULL, ? ? ? ?\
+ ? ? ? ? ? ? ? .tx_fifomask ? ?= S5PV210_UFSTAT_TXMASK, ? ? ? ?\
+ ? ? ? ? ? ? ? .tx_fifoshift ? = S5PV210_UFSTAT_TXSHIFT, ? ? ? \
+ ? ? ? ? ? ? ? .get_clksrc ? ? = s5pv310_serial_getsource, ? ? \
+ ? ? ? ? ? ? ? .set_clksrc ? ? = s5pv310_serial_setsource, ? ? \
+ ? ? ? ? ? ? ? .reset_port ? ? = s5pv310_serial_resetport
+
+static struct s3c24xx_uart_info s5p_port_fifo256 = {
+ ? ? ? S5PV310_UART_DEFAULT_INFO(256),
+};
+
+static struct s3c24xx_uart_info s5p_port_fifo64 = {
+ ? ? ? S5PV310_UART_DEFAULT_INFO(64),
+};
+
+static struct s3c24xx_uart_info s5p_port_fifo16 = {
+ ? ? ? S5PV310_UART_DEFAULT_INFO(16),
+};
+
+struct s3c24xx_uart_info *s5p_uart_inf[] = {
+ ? ? ? [0] = &s5p_port_fifo256,
+ ? ? ? [1] = &s5p_port_fifo64,
+ ? ? ? [2] = &s5p_port_fifo16,
+ ? ? ? [3] = &s5p_port_fifo16,
+};
+
+/* device management */
+static int s5p_serial_probe(struct platform_device *pdev)
+{
+ ? ? ? return s3c24xx_serial_probe(pdev, s5p_uart_inf[pdev->id]);
+}
+
+static struct platform_driver s5p_serial_driver = {
+ ? ? ? .probe ? ? ? ? ?= s5p_serial_probe,
+ ? ? ? .remove ? ? ? ? = __devexit_p(s3c24xx_serial_remove),
+ ? ? ? .driver ? ? ? ? = {
+ ? ? ? ? ? ? ? .name ? = "s5pv310-uart",
+ ? ? ? ? ? ? ? .owner ?= THIS_MODULE,
+ ? ? ? },
+};
+
+static int __init s5pv310_serial_console_init(void)
+{
+ ? ? ? return s3c24xx_serial_initconsole(&s5p_serial_driver, s5p_uart_inf);
+}
+
+console_initcall(s5pv310_serial_console_init);
+
+static int __init s5p_serial_init(void)
+{
+ ? ? ? return s3c24xx_serial_init(&s5p_serial_driver, *s5p_uart_inf);
+}
+
+static void __exit s5p_serial_exit(void)
+{
+ ? ? ? platform_driver_unregister(&s5p_serial_driver);
+}
+
+module_init(s5p_serial_init);
+module_exit(s5p_serial_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:s5pv310-uart");
+MODULE_DESCRIPTION("Samsung S5PV310 UART Driver support");
+MODULE_AUTHOR("Changhwan Youn <[email protected]>");
--

1.6.2.5

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#13 lore raw

cover ARM: S5PV310: Add support for Samsung S5PV310 SoC

In reply to Kukjin Kim

Hi,

How about to start the single kernel preparation from this patch? Instead of create the new machine directory, we just put the mach-s5pv210 or create the new one.

and don't you think it's confusing of names.
s5pc110 (same as s5pv210), vs. s5pc210 (same as s5pv310). maybe someone don't read the chip carefully. it's misleading the chips.

Thank you,
Kyungmin Park

Quoted 20 lines · Kukjin Kim

This patch set adds support for Samsung S5PV310/S5PC210. The S5PV310 integrates a ARM Cortex A9 microprocessor with several other peripherals to support features such as multimedia, storage, graphics and gaming. The S5PV310 can be used in products such as Netbooks and Mobile devices.

This patch set consists of the following patches.

[PATCH 1/8] ARM: S5P: Remove fixed uart offset dependent code [PATCH 2/8] ARM: S5PV310: Add new CPU initialization support [PATCH 3/8] ARM: S5PV310: Add Clock and PLL support
[PATCH 4/8] ARM: S5PV310: Add IRQ support
[PATCH 5/8] ARM: S5PV310: Add Timer support
[PATCH 6/8] ARM: S5PV310: Add new Kconfig and Makefiles
[PATCH 7/8] ARM: S5PV310: Add Board support file
[PATCH 8/8] ARM: S5PV310: Add serial port support
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html