Skip to contentSkip to conversation

S5PC100: Samsung S5PC100 SoC support

PATCH New HeungJun Kim 2 participants 4 messages Jun 25, 2009 – Jul 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 S5PC100: Samsung S5PC100 SoC support

S5PC100 processor is ARM Cortex A8 Processor SoC
and SMDKC100 Board use this.
So, this patch tested on SMDKC100 Board.

I'll send 6 patch for working on SMDKC100 Board including this. But, this patch make the change to ARM Cortex A8 specific code like a cpu/arm_cortexa8/cpu.c, start.S.

So, I wanna be reviewed to know how to contribute this whole patch.

---

It includes the following :

- Samsung S5PC100 SoC specific source codes
- Samsung S5PC100 SoC specific header files
- modify ARM Cortex A8 cpu.c, start.S

 cpu/arm_cortexa8/cpu.c                      |   80 +---
 cpu/arm_cortexa8/s5pc100/Makefile           |   48 +++
 cpu/arm_cortexa8/s5pc100/config.mk          |   36 ++
 cpu/arm_cortexa8/s5pc100/speed.c            |  186 +++++++++
 cpu/arm_cortexa8/s5pc100/timer.c            |  223 ++++++++++
 cpu/arm_cortexa8/start.S                    |   23 +
 include/asm-arm/arch-s5pc100/clock-others.h |   33 ++
 include/asm-arm/arch-s5pc100/cpu.h          |  379 +++++++++++++++++
 include/asm-arm/arch-s5pc100/gpio.h         |  580 +++++++++++++++++++++++++++
 include/asm-arm/arch-s5pc100/hardware.h     |   63 +++
 include/asm-arm/arch-s5pc100/map-base.h     |   19 +
 include/asm-arm/arch-s5pc100/sys_proto.h    |   30 ++
 include/asm-arm/arch-s5pc100/uart.h         |   68 ++++
 include/asm-arm/arch-s5pc100/watchdog.h     |   16 +
 include/s5pc1xx-onenand.h                   |  105 +++++
 15 files changed, 1828 insertions(+), 61 deletions(-)
 create mode 100644 cpu/arm_cortexa8/s5pc100/Makefile
 create mode 100644 cpu/arm_cortexa8/s5pc100/config.mk
 create mode 100644 cpu/arm_cortexa8/s5pc100/speed.c
 create mode 100644 cpu/arm_cortexa8/s5pc100/timer.c
 create mode 100644 include/asm-arm/arch-s5pc100/clock-others.h
 create mode 100644 include/asm-arm/arch-s5pc100/cpu.h
 create mode 100644 include/asm-arm/arch-s5pc100/gpio.h
 create mode 100644 include/asm-arm/arch-s5pc100/hardware.h
 create mode 100644 include/asm-arm/arch-s5pc100/map-base.h
 create mode 100644 include/asm-arm/arch-s5pc100/sys_proto.h
 create mode 100644 include/asm-arm/arch-s5pc100/uart.h
 create mode 100644 include/asm-arm/arch-s5pc100/watchdog.h
 create mode 100644 include/s5pc1xx-onenand.h
cpu/arm_cortexa8/cpu.c +19 -61
index 6fd07d0..95e8523 100644
@@ -37,11 +37,28 @@
 #include <asm/system.h>
 
 #ifndef CONFIG_L2_OFF
-void l2cache_disable(void);
+void l2_cache_disable(void);
+#endif
+
+#ifdef CONFIG_USE_IRQ
+DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 static void cache_flush(void);
 
+int cpu_init(void)
+{
+	/*
+	 * setup up stacks if necessary
+	 */
+#ifdef CONFIG_USE_IRQ
+	IRQ_STACK_START =
+	    _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4;
+	FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
+#endif
+	return 0;
+}
+
 int cleanup_before_linux(void)
 {
 	unsigned int i;
@@ -63,7 +80,7 @@ int cleanup_before_linux(void)
 
 #ifndef CONFIG_L2_OFF
 	/* turn off L2 cache */
-	l2cache_disable();
+	l2_cache_disable();
 	/* invalidate L2 cache also */
 	v7_flush_dcache_all(get_device_type());
 #endif
@@ -78,65 +95,6 @@ int cleanup_before_linux(void)
 	return 0;
 }
 
-void l2cache_enable()
-{
-	unsigned long i;
-	volatile unsigned int j;
-
-	/* ES2 onwards we can disable/enable L2 ourselves */
-	if (get_cpu_rev() >= CPU_3XX_ES20) {
-		__asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i));
-		__asm__ __volatile__("orr %0, %0, #0x2":"=r"(i));
-		__asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i));
-	} else {
-		/* Save r0, r12 and restore them after usage */
-		__asm__ __volatile__("mov %0, r12":"=r"(j));
-		__asm__ __volatile__("mov %0, r0":"=r"(i));
-
-		/*
-		 * GP Device ROM code API usage here
-		 * r12 = AUXCR Write function and r0 value
-		 */
-		__asm__ __volatile__("mov r12, #0x3");
-		__asm__ __volatile__("mrc p15, 0, r0, c1, c0, 1");
-		__asm__ __volatile__("orr r0, r0, #0x2");
-		/* SMI instruction to call ROM Code API */
-		__asm__ __volatile__(".word 0xE1600070");
-		__asm__ __volatile__("mov r0, %0":"=r"(i));
-		__asm__ __volatile__("mov r12, %0":"=r"(j));
-	}
-
-}
-
-void l2cache_disable()
-{
-	unsigned long i;
-	volatile unsigned int j;
-
-	/* ES2 onwards we can disable/enable L2 ourselves */
-	if (get_cpu_rev() >= CPU_3XX_ES20) {
-		__asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i));
-		__asm__ __volatile__("bic %0, %0, #0x2":"=r"(i));
-		__asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i));
-	} else {
-		/* Save r0, r12 and restore them after usage */
-		__asm__ __volatile__("mov %0, r12":"=r"(j));
-		__asm__ __volatile__("mov %0, r0":"=r"(i));
-
-		/*
-		 * GP Device ROM code API usage here
-		 * r12 = AUXCR Write function and r0 value
-		 */
-		__asm__ __volatile__("mov r12, #0x3");
-		__asm__ __volatile__("mrc p15, 0, r0, c1, c0, 1");
-		__asm__ __volatile__("bic r0, r0, #0x2");
-		/* SMI instruction to call ROM Code API */
-		__asm__ __volatile__(".word 0xE1600070");
-		__asm__ __volatile__("mov r0, %0":"=r"(i));
-		__asm__ __volatile__("mov r12, %0":"=r"(j));
-	}
-}
-
 static void cache_flush(void)
 {
 	asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (0));
(quoted diff) +0 -0

b/cpu/arm_cortexa8/s5pc100/Makefile
new file mode 100644
index 0000000..511a8dc

cpu/arm_cortexa8/s5pc100/Makefile new file +48 -0

48 lines not on this page · raw message

(quoted diff) +0 -0

b/cpu/arm_cortexa8/s5pc100/config.mk
new file mode 100644
index 0000000..e05d7ae

cpu/arm_cortexa8/s5pc100/config.mk new file +36 -0
@@ -0,0 +1,36 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
+	-msoft-float
+
+# Make ARMv5 to allow more compilers to work, even though its v6.
+PLATFORM_CPPFLAGS += -march=armv5t
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,\
+		    $(call cc-option,-malignment-traps,))
cpu/arm_cortexa8/s5pc100/speed.c new file +186 -0

186 lines not on this page · raw message

cpu/arm_cortexa8/s5pc100/timer.c new file +223 -0

223 lines not on this page · raw message

cpu/arm_cortexa8/start.S +23 -0
index 66b4820..da6eed7 100644
@@ -34,6 +34,7 @@
 
 .globl _start
 _start: b	reset
+#ifndef CONFIG_ONENAND_IPL
 	ldr	pc, _undefined_instruction
 	ldr	pc, _software_interrupt
 	ldr	pc, _prefetch_abort
@@ -50,6 +51,9 @@ _not_used:		.word not_used
 _irq:			.word irq
 _fiq:			.word fiq
 _pad:			.word 0x12345678 /* now 16*4=64 */
+#else
+	.	= _start + 64
+#endif
 .global _end_vect
 _end_vect:
 
@@ -108,6 +112,7 @@ reset:
 	orr	r0, r0, #0xd3
 	msr	cpsr,r0
 
+#ifndef CONFIG_ONENAND_IPL
 #if (CONFIG_OMAP34XX)
 	/* Copy vectors to mask ROM indirect addr */
 	adr	r0, _start		@ r0 <- current position of code
@@ -131,11 +136,13 @@ next:
 	bl	cpy_clk_code		@ put dpll adjust code behind vectors
 #endif /* NAND Boot */
 #endif
+#endif	/* CONFIG_ONENAND_IPL */
 	/* the mask ROM code should have PLL and others stable */
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
 	bl	cpu_init_crit
 #endif
 
+#ifndef CONFIG_ONENAND_IPL
 #ifndef CONFIG_SKIP_RELOCATE_UBOOT
 relocate:				@ relocate U-Boot to RAM
 	adr	r0, _start		@ r0 <- current position of code
@@ -154,18 +161,24 @@ copy_loop:				@ copy 32 bytes at a time
 	cmp	r0, r2			@ until source end addreee [r2]
 	ble	copy_loop
 #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
+#endif	/* CONFIG_ONENAND_IPL */
 
 	/* Set up the stack */
 stack_setup:
 	ldr	r0, _TEXT_BASE		@ upper 128 KiB: relocated uboot
+#ifdef CONFIG_ONENAND_IPL
+	sub	sp, r0, #128		@ leave 32 words for abort-stack
+#else
 	sub	r0, r0, #CONFIG_SYS_MALLOC_LEN @ malloc area
 	sub	r0, r0, #CONFIG_SYS_GBL_DATA_SIZE @ bdinfo
 #ifdef CONFIG_USE_IRQ
 	sub	r0, r0, #(CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ)
 #endif
 	sub	sp, r0, #12		@ leave 3 words for abort-stack
+#endif	/* CONFIG_ONENAND_IPL */
 	and	sp, sp, #~7		@ 8 byte alinged for (ldr/str)d
 
+#ifndef CONFIG_ONENAND_IPL
 	/* Clear BSS (if any). Is below tx (watch load addr - need space) */
 clear_bss:
 	ldr	r0, _bss_start		@ find start of bss segment
@@ -176,10 +189,15 @@ clbss_l:
 	cmp	r0, r1			@ are we at the end yet
 	add	r0, r0, #4		@ increment clear index pointer
 	bne	clbss_l			@ keep clearing till@end
+#endif	/* CONFIG_ONENAND_IPL */
 
 	ldr	pc, _start_armboot	@ jump to C code
 
+#ifdef CONFIG_ONENAND_IPL
+_start_armboot: .word start_oneboot
+#else
 _start_armboot: .word start_armboot
+#endif
 
 
 /*************************************************************************
@@ -218,6 +236,8 @@ cpu_init_crit:
 	bl	lowlevel_init		@ go setup pll,mux,memory
 	mov	lr, ip			@ restore link
 	mov	pc, lr			@ back to my caller
+
+#ifndef CONFIG_ONENAND_IPL
 /*
  *************************************************************************
  *
@@ -502,6 +522,7 @@ finished_inval:
 	ldmfd	r13!, {r0 - r5, r7, r9 - r12, pc}
 
 
+#if (CONFIG_OMAP34XX)
 	.align	5
 .global reset_cpu
 reset_cpu:
@@ -514,3 +535,5 @@ _loop_forever:
 	b	_loop_forever
 rstctl:
 	.word	PRM_RSTCTRL
+#endif
+#endif	/* CONFIG_ONENAND_IPL */
(quoted diff) +0 -0

b/include/asm-arm/arch-s5pc100/clock-others.h
new file mode 100644
index 0000000..35f1686

include/asm-arm/arch-s5pc100/clock-others.h new file +33 -0
@@ -0,0 +1,33 @@
+
+/*
+ * Clock control - Others
+ */
+#define S5P_OTHERS_REG_BASE(x)		(S5P_PA_CLK_OTHERS + (x))
+#define S5P_OTHERS_BASE			S5P_OTHERS_REG_BASE(0x0)
+#define S5P_SW_RST			S5P_OTHERS_REG_BASE(0x0)
+#define S5P_ONENAND_RST			S5P_OTHERS_REG_BASE(0x8)
+#define S5P_GENERAL_CTRL		S5P_OTHERS_REG_BASE(0x100)
+#define S5P_GENERAL_STATUS		S5P_OTHERS_REG_BASE(0x104)
+#define S5P_MEM_SYS_CFG			S5P_OTHERS_REG_BASE(0x200)
+#define S5P_CAM_MUX_SEL			S5P_OTHERS_REG_BASE(0x300)
+#define S5P_MIXER_OUT_SEL		S5P_OTHERS_REG_BASE(0x304)
+#define S5P_LPMP3_MODE_SEL		S5P_OTHERS_REG_BASE(0x308)
+#define S5P_MIPI_PHY_CON0		S5P_OTHERS_REG_BASE(0x400)
+#define S5P_MIPI_PHY_CON1		S5P_OTHERS_REG_BASE(0x414)
+#define S5P_HDMI_PHY_CON0		S5P_OTHERS_REG_BASE(0x420)
+
+#ifndef __ASSEMBLY__
+#define S5P_OTHERS_BASE_REG		__REG(S5P_OTHERS_BASE)
+#define S5P_SW_RST_REG			__REG(S5P_SW_RST)
+#define S5P_ONENAND_RST_REG		__REG(S5P_ONENAND_RST)
+#define S5P_GENERAL_CTRL_REG		__REG(S5P_GENERAL_CTRL)
+#define S5P_GENERAL_STATUS_REG		__REG(S5P_GENERAL_STATUS)
+#define S5P_MEM_SYS_CFG_REG		__REG(S5P_MEM_SYS_CFG)
+#define S5P_CAM_MUX_SEL_REG		__REG(S5P_CAM_MUX_SEL)
+#define S5P_MIXER_OUT_SEL_REG		__REG(S5P_MIXER_OUT_SEL)
+#define S5P_LPMP3_MODE_SEL_REG		__REG(S5P_LPMP3_MODE_SEL)
+#define S5P_MIPI_PHY_CON0_REG		__REG(S5P_MIPI_PHY_CON0)
+#define S5P_MIPI_PHY_CON1_REG		__REG(S5P_MIPI_PHY_CON1)
+#define S5P_HDMI_PHY_CON0_REG		__REG(S5P_HDMI_PHY_CON0)
+#endif	/* __ASSENBLY__ */
+
(quoted diff) +0 -0

b/include/asm-arm/arch-s5pc100/cpu.h
new file mode 100644
index 0000000..6ec8656

include/asm-arm/arch-s5pc100/cpu.h new file +40 -0
@@ -0,0 +1,379 @@
+/*
+ * (C) Copyright 2009
+ * Samsung Electronics, <www.samsung.com/sec>
+ * Heungjun Kim <[email protected]>
+ * Minkyu Kang <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#ifndef _CPU_H
+#define _CPU_H
+
+#include <asm/hardware.h>
+
+#ifndef __S5PC100_H__
+#define __S5PC100_H__
+
+#define S5P_ADDR_BASE		0xe0000000
+#define S5P_ADDR(x)		(S5P_ADDR_BASE + (x))
+
+#define S5P_PA_ID		S5P_ADDR(0x00000000)	/* Chip ID Base */
+#define S5P_PA_CLK		S5P_ADDR(0x00100000)	/* Clock Base */
+#define S5P_PA_PWR		S5P_ADDR(0x00108000)	/* Power Base */
+#define S5P_PA_CLK_OTHERS	S5P_ADDR(0x00200000)	/* Clock Others Base */
+#define S5P_PA_GPIO		S5P_ADDR(0x00300000)    /* GPIO Base */
+#define S5P_PA_VIC0		S5P_ADDR(0x04000000)    /* Vector Interrupt

Controller 0 */
+#define S5P_PA_VIC1 S5P_ADDR(0x04100000) /* Vector Interrupt
Controller 1 */
+#define S5P_PA_VIC2 S5P_ADDR(0x04200000) /* Vector Interrupt
Controller 2 */
+#define S5P_PA_DMC S5P_ADDR(0x06000000) /* Dram Memory Controller */
+#define S5P_PA_SROMC S5P_ADDR(0x07000000) /* SROM Controller */
+#define S5P_PA_WATCHDOG S5P_ADDR(0x0a200000) /* Watchdog Timer */
+#define S5P_PA_PWMTIMER S5P_ADDR(0x0a000000) /* PWM Timer */
+
+/*
+ * Chip ID
+ */
+#define S5P_ID(x) (S5P_PA_ID + (x))
+
+#define S5P_PRO_ID S5P_ID(0)
+#define S5P_OMR S5P_ID(4)
+
+/*
+ * Clock control
+ */
+#define S5P_CLKREG(x) (S5P_PA_CLK + (x))
+
+/* Clock Register */
+#define S5P_APLL_LOCK S5P_CLKREG(0x0)
+#define S5P_MPLL_LOCK S5P_CLKREG(0x4)
+#define S5P_EPLL_LOCK S5P_CLKREG(0x8)
+#define S5P_HPLL_LOCK S5P_CLKREG(0xc)
+
+#define S5P_APLL_CON S5P_CLKREG(0x100)
+#define S5P_MPLL_CON S5P_CLKREG(0x104)
+#define S5P_EPLL_CON S5P_CLKREG(0x108)
+#define S5P_HPLL_CON S5P_CLKREG(0x10c)
+
+#define S5P_CLK_SRC0 S5P_CLKREG(0x200)
+#define S5P_CLK_SRC1 S5P_CLKREG(0x204)
+#define S5P_CLK_SRC2 S5P_CLKREG(0x208)
+#define S5P_CLK_SRC3 S5P_CLKREG(0x20c)
+
+#define S5P_CLK_DIV0 S5P_CLKREG(0x300)
+#define S5P_CLK_DIV1 S5P_CLKREG(0x304)
+#define S5P_CLK_DIV2 S5P_CLKREG(0x308)
+#define S5P_CLK_DIV3 S5P_CLKREG(0x30c)
+#define S5P_CLK_DIV4 S5P_CLKREG(0x310)
+
+#define S5P_CLK_OUT S5P_CLKREG(0x400)
+
+#define S5P_CLK_GATE_D00 S5P_CLKREG(0x500)
+#define S5P_CLK_GATE_D01 S5P_CLKREG(0x504)
+#define S5P_CLK_GATE_D02 S5P_CLKREG(0x508)
+
+#define S5P_CLK_GATE_D10 S5P_CLKREG(0x520)
+#define S5P_CLK_GATE_D11 S5P_CLKREG(0x524)
+#define S5P_CLK_GATE_D12 S5P_CLKREG(0x528)
+#define S5P_CLK_GATE_D13 S5P_CLKREG(0x530)
+#define S5P_CLK_GATE_D14 S5P_CLKREG(0x534)
+
+#define S5P_CLK_GATE_D20 S5P_CLKREG(0x540)
+
+#define S5P_CLK_GATE_SCLK0 S5P_CLKREG(0x560)
+#define S5P_CLK_GATE_SCLK1 S5P_CLKREG(0x564)
+
+#ifndef __ASSEMBLY__
+/* Clock Address */
+#define S5P_APLL_LOCK_REG __REG(S5P_APLL_LOCK)
+#define S5P_MPLL_LOCK_REG __REG(S5P_MPLL_LOCK)
+#define S5P_EPLL_LOCK_REG __REG(S5P_EPLL_LOCK)
+#define S5P_HPLL_LOCK_REG __REG(S5P_HPLL_LOCK)
+
+#define S5P_APLL_CON_REG __REG(S5P_APLL_CON)
+#define S5P_MPLL_CON_REG __REG(S5P_MPLL_CON)
+#define S5P_EPLL_CON_REG __REG(S5P_EPLL_CON)
+#define S5P_HPLL_CON_REG __REG(S5P_HPLL_CON)
+
+#define S5P_CLK_SRC0_REG __REG(S5P_CLK_SRC0)
+#define S5P_CLK_SRC1_REG __REG(S5P_CLK_SRC1)
+#define S5P_CLK_SRC2_REG __REG(S5P_CLK_SRC2)
+#define S5P_CLK_SRC3_REG __REG(S5P_CLK_SRC3)
+
+#define S5P_CLK_DIV0_REG __REG(S5P_CLK_DIV0)
+#define S5P_CLK_DIV1_REG __REG(S5P_CLK_DIV1)
+#define S5P_CLK_DIV2_REG __REG(S5P_CLK_DIV2)
+#define S5P_CLK_DIV3_REG __REG(S5P_CLK_DIV3)
+#define S5P_CLK_DIV4_REG __REG(S5P_CLK_DIV4)
+
+#define S5P_CLK_OUT_REG __REG(S5P_CLK_OUT)
+
+#define S5P_CLK_GATE_D00_REG __REG(S5P_CLK_GATE_D00)
+#define S5P_CLK_GATE_D01_REG __REG(S5P_CLK_GATE_D01)
+#define S5P_CLK_GATE_D02_REG __REG(S5P_CLK_GATE_D02)
+
+#define S5P_CLK_GATE_D10_REG __REG(S5P_CLK_GATE_D10)
+#define S5P_CLK_GATE_D11_REG __REG(S5P_CLK_GATE_D11)
+#define S5P_CLK_GATE_D12_REG __REG(S5P_CLK_GATE_D12)
+#define S5P_CLK_GATE_D13_REG __REG(S5P_CLK_GATE_D13)
+#define S5P_CLK_GATE_D14_REG __REG(S5P_CLK_GATE_D14)
+
+#define S5P_CLK_GATE_D20_REG __REG(S5P_CLK_GATE_D20)
+
+#define S5P_CLK_GATE_SCLK0_REG __REG(S5P_CLK_GATE_SCLK0)
+#define S5P_CLK_GATE_SCLK1_REG __REG(S5P_CLK_GATE_SCLK1)
+#endif /* __ASSENBLY__ */
+
+
+/*
+ * Power control
+ */
+#define S5P_PWRREG(x) (S5P_PA_PWR + (x))
+
+#define S5P_PWR_CFG S5P_PWRREG(0x0)
+#define S5P_EINT_WAKEUP_MASK S5P_PWRREG(0x04)
+#define S5P_NORMAL_CFG S5P_PWRREG(0x10)
+#define S5P_STOP_CFG S5P_PWRREG(0x14)
+#define S5P_SLEEP_CFG S5P_PWRREG(0x18)
+#define S5P_STOP_MEM_CFG S5P_PWRREG(0x1c)
+#define S5P_OSC_FREQ S5P_PWRREG(0x100)
+#define S5P_OSC_STABLE S5P_PWRREG(0x104)
+#define S5P_PWR_STABLE S5P_PWRREG(0x108)
+#define S5P_INTERNAL_PWR_STABLE S5P_PWRREG(0x110)
+#define S5P_CLAMP_STABLE S5P_PWRREG(0x114)
+#define S5P_OTHERS S5P_PWRREG(0x200)
+#define S5P_RST_STAT S5P_PWRREG(0x300)
+#define S5P_WAKEUP_STAT S5P_PWRREG(0x304)
+#define S5P_BLK_PWR_STAT S5P_PWRREG(0x308)
+#define S5P_INFORM0 S5P_PWRREG(0x400)
+#define S5P_INFORM1 S5P_PWRREG(0x404)
+#define S5P_INFORM2 S5P_PWRREG(0x408)
+#define S5P_INFORM3 S5P_PWRREG(0x40c)
+#define S5P_INFORM4 S5P_PWRREG(0x410)
+#define S5P_INFORM5 S5P_PWRREG(0x414)
+#define S5P_INFORM6 S5P_PWRREG(0x418)
+#define S5P_INFORM7 S5P_PWRREG(0x41c)
+#define S5P_DCGIDX_MAP0 S5P_PWRREG(0x500)
+#define S5P_DCGIDX_MAP1 S5P_PWRREG(0x504)
+#define S5P_DCGIDX_MAP2 S5P_PWRREG(0x508)
+#define S5P_DCGPERF_MAP0 S5P_PWRREG(0x50c)
+#define S5P_DCGPERF_MAP1 S5P_PWRREG(0x510)
+#define S5P_DVCIDX_MAP S5P_PWRREG(0x514)
+#define S5P_FREQ_CPU S5P_PWRREG(0x518)
+#define S5P_FREQ_DPM S5P_PWRREG(0x51c)
+#define S5P_DVSEMCLK_EN S5P_PWRREG(0x520)
+#define S5P_APLL_CON_L8 S5P_PWRREG(0x600)
+#define S5P_APLL_CON_L7 S5P_PWRREG(0x604)
+#define S5P_APLL_CON_L6 S5P_PWRREG(0x608)
+#define S5P_APLL_CON_L5 S5P_PWRREG(0x60c)
+#define S5P_APLL_CON_L4 S5P_PWRREG(0x610)
+#define S5P_APLL_CON_L3 S5P_PWRREG(0x614)
+#define S5P_APLL_CON_L2 S5P_PWRREG(0x618)
+#define S5P_APLL_CON_L1 S5P_PWRREG(0x61c)
+#define S5P_EM_CONTROL S5P_PWRREG(0x620)
+
+#define S5P_CLKDIV_IEM_L8 S5P_PWRREG(0x700)
+#define S5P_CLKDIV_IEM_L7 S5P_PWRREG(0x704)
+#define S5P_CLKDIV_IEM_L6 S5P_PWRREG(0x708)
+#define S5P_CLKDIV_IEM_L5 S5P_PWRREG(0x70c)
+#define S5P_CLKDIV_IEM_L4 S5P_PWRREG(0x710)
+#define S5P_CLKDIV_IEM_L3 S5P_PWRREG(0x714)
+#define S5P_CLKDIV_IEM_L2 S5P_PWRREG(0x718)
+#define S5P_CLKDIV_IEM_L1 S5P_PWRREG(0x71c)
+
+#define S5P_IEM_HPMCLK_DIV S5P_PWRREG(0x724)
+
+
+/*
+ * Vector Interrupt Controller
+ * : VIC0, VIC1, VIC2
+ */
+/* VIC0 */
+#define S5P_VIC0_BASE(x) (S5P_PA_VIC0 + (x))
+#define S5P_VIC1_BASE(x) (S5P_PA_VIC1 + (x))
+#define S5P_VIC2_BASE(x) (S5P_PA_VIC2 + (x))
+
+/* Vector Interrupt Offset */
+#define VIC_IRQSTATUS_OFFSET 0x0 /* IRQ Status Register */
+#define VIC_FIQSTATUS_OFFSET 0x4 /* FIQ Status Register */
+#define VIC_RAWINTR_OFFSET 0x8 /* Raw Interrupt Status Register */
+#define VIC_INTSELECT_OFFSET 0xc /* Interrupt Select Register */
+#define VIC_INTENABLE_OFFSET 0x10 /* Interrupt Enable Register */
+#define VIC_INTENCLEAR_OFFSET 0x14 /* Interrupt Enable Clear Register */
+#define VIC_SOFTINT_OFFSET 0x18 /* Software Interrupt Register */
+#define VIC_SOFTINTCLEAR_OFFSET 0x1c /* Software Interrupt Clear Register */
+#define VIC_PROTECTION_OFFSET 0x20 /* Protection Enable Register */
+#define VIC_SWPRIORITYMASK_OFFSET 0x24 /* Software Priority Mask Register */
+#define VIC_PRIORITYDAISY_OFFSET 0x28 /* Vector Priority Register for
Daisy Chain */
+#define VIC_INTADDRESS_OFFSET 0xf00 /* Vector Priority Register for
Daisy Chain */
+
+
+/*
+ * SROMC Controller
+ */
+/* DRAM Memory Controller */
+#define S5P_DMC_BASE(x) (S5P_PA_DMC + (x))
+/* SROMC Base */
+#define S5P_SROMC_BASE(x) (S5P_PA_SROMC + (x))
+/* SROMC offset */
+#define CONCONTROL_OFFSET 0x0 /* Controller Control Register */
+#define MEMCONTROL_OFFSET 0x04 /* Memory Control Register */
+#define MEMCONFIG0_OFFSET 0x08 /* Memory Chip0 Configuration Register */
+#define MEMCONFIG1_OFFSET 0x0c /* Memory Chip1 Configuration Register */
+#define DIRECTCMD_OFFSET 0x10 /* Memory Direct Command Register */
+#define PRECHCONFIG_OFFSET 0x14 /* Precharge Policy Configuration Register */
+#define PHYCONTROL0_OFFSET 0x18 /* PHY Control0 Register */
+#define PHYCONTROL1_OFFSET 0x1c /* PHY Control1 Register */
+#define PHYCONTROL2_OFFSET 0x20 /* PHY Control2 Register */
+#define PWRDNCONFIG_OFFSET 0x28 /* Dynamic Power Down Configuration Register */
+#define TIMINGAREF_OFFSET 0x30 /* AC Timing Register for SDRAM Auto Refresh */
+#define TIMINGROW_OFFSET 0x34 /* AC Timing Register for SDRAM Row */
+#define TIMINGDATA_OFFSET 0x38 /* AC Timing Register for SDRAM Data */
+#define TIMINGPOWER_OFFSET 0x3c /* AC Timing Register for Power Mode
of SDRAM */
+#define PHYSTATUS0_OFFSET 0x40 /* PHY Status Register 0 */
+#define PHYSTATUS1_OFFSET 0x44 /* PHY Status Register 1 */
+#define CHIP0STATUS_OFFSET 0x48 /* Memory Chip0 Status Register */
+#define CHIP1STATUS_OFFSET 0x4c /* Memory Chip1 Status Register */
+#define AREFSTATUS_OFFSET 0x50 /* Counter status Register for Auto Refresh */
+#define MRSTATUS_OFFSET 0x54 /* Memory Mode Registers Status Register */
+#define PHYTEST0_OFFSET 0x58 /* PHY Test Register 0 */
+#define PHYTEST1_OFFSET 0x5c /* PHY Test Register 1 */
+
+#define S5P_CONCONTROL S5P_DMC_BASE(CONCONTROL_OFFSET)
+#define S5P_MEMCONTROL S5P_DMC_BASE(MEMCONTROL_OFFSET)
+#define S5P_MEMCONFIG0 S5P_DMC_BASE(MEMCONFIG0_OFFSET)
+#define S5P_MEMCONFIG1 S5P_DMC_BASE(MEMCONFIG1_OFFSET)
+#define S5P_DIRECTCMD S5P_DMC_BASE(DIRECTCMD_OFFSET)
+#define S5P_PRECHCONFIG S5P_DMC_BASE(PRECHCONFIG_OFFSET)
+#define S5P_PHYCONTROL0 S5P_DMC_BASE(PHYCONTROL0_OFFSET)
+#define S5P_PHYCONTROL1 S5P_DMC_BASE(PHYCONTROL1_OFFSET)
+#define S5P_PHYCONTROL2 S5P_DMC_BASE(PHYCONTROL2_OFFSET)
+#define S5P_PWRDNCONFIG S5P_DMC_BASE(PWRDNCONFIG_OFFSET)
+#define S5P_TIMINGAREF S5P_DMC_BASE(TIMINGAREF_OFFSET)
+#define S5P_TIMINGROW S5P_DMC_BASE(TIMINGROW_OFFSET)
+#define S5P_TIMINGDATA S5P_DMC_BASE(TIMINGDATA_OFFSET)
+#define S5P_TIMINGPOWER S5P_DMC_BASE(TIMINGPOWER_OFFSET)
+#define S5P_PHYSTATUS0 S5P_DMC_BASE(PHYSTATUS0_OFFSET)
+#define S5P_PHYSTATUS1 S5P_DMC_BASE(PHYSTATUS1_OFFSET)
+#define S5P_CHIP0STATUS S5P_DMC_BASE(CHIP0STATUS_OFFSET)
+#define S5P_CHIP1STATUS S5P_DMC_BASE(CHIP1STATUS_OFFSET)
+#define S5P_AREFSTATUS S5P_DMC_BASE(AREFSTATUS_OFFSET)
+#define S5P_MRSTATUS S5P_DMC_BASE(MRSTATUS_OFFSET)
+#define S5P_PHYTEST0 S5P_DMC_BASE(PHYTEST0_OFFSET)
+#define S5P_PHYTEST1 S5P_DMC_BASE(PHYTEST1_OFFSET)
+
+
+/*
+ * PWM Timer
+ */
+#define S5P_PWMTIMER_BASE(x) (S5P_PA_PWMTIMER + (x))
+
+/* PWM timer offset */
+#define PWM_TCFG0_OFFSET 0x0
+#define PWM_TCFG1_OFFSET 0x04
+#define PWM_TCON_OFFSET 0x08
+#define PWM_TCNTB0_OFFSET 0x0c
+#define PWM_TCMPB0_OFFSET 0x10
+#define PWM_TCNTO0_OFFSET 0x14
+#define PWM_TCNTB1_OFFSET 0x18
+#define PWM_TCMPB1_OFFSET 0x1c
+#define PWM_TCNTO1_OFFSET 0x20
+#define PWM_TCNTB2_OFFSET 0x24
+#define PWM_TCMPB2_OFFSET 0x28
+#define PWM_TCNTO2_OFFSET 0x2c
+#define PWM_TCNTB3_OFFSET 0x30
+#define PWM_TCNTO3_OFFSET 0x38
+#define PWM_TCNTB4_OFFSET 0x3c
+#define PWM_TCNTO4_OFFSET 0x40
+#define PWM_TINT_CSTAT_OFFSET 0x44
+
+/* PWM timer register */
+#define S5P_PWM_TCFG0 S5P_PWMTIMER_BASE(PWM_TCFG0_OFFSET)
+#define S5P_PWM_TCFG1 S5P_PWMTIMER_BASE(PWM_TCFG1_OFFSET)
+#define S5P_PWM_TCON S5P_PWMTIMER_BASE(PWM_TCON_OFFSET)
+#define S5P_PWM_TCNTB0 S5P_PWMTIMER_BASE(PWM_TCNTB0_OFFSET)
+#define S5P_PWM_TCMPB0 S5P_PWMTIMER_BASE(PWM_TCMPB0_OFFSET)
+#define S5P_PWM_TCNTO0 S5P_PWMTIMER_BASE(PWM_TCNTO0_OFFSET)
+#define S5P_PWM_TCNTB1 S5P_PWMTIMER_BASE(PWM_TCNTB1_OFFSET)
+#define S5P_PWM_TCMPB1 S5P_PWMTIMER_BASE(PWM_TCMPB1_OFFSET)
+#define S5P_PWM_TCNTO1 S5P_PWMTIMER_BASE(PWM_TCNTO1_OFFSET)
+#define S5P_PWM_TCNTB2 S5P_PWMTIMER_BASE(PWM_TCNTB2_OFFSET)
+#define S5P_PWM_TCMPB2 S5P_PWMTIMER_BASE(PWM_TCMPB2_OFFSET)
+#define S5P_PWM_TCNTO2 S5P_PWMTIMER_BASE(PWM_TCNTO2_OFFSET)
+#define S5P_PWM_TCNTB3 S5P_PWMTIMER_BASE(PWM_TCNTB3_OFFSET)
+#define S5P_PWM_TCNTO3 S5P_PWMTIMER_BASE(PWM_TCNTO3_OFFSET)
+#define S5P_PWM_TCNTB4 S5P_PWMTIMER_BASE(PWM_TCNTB4_OFFSET)
+#define S5P_PWM_TCNTO4 S5P_PWMTIMER_BASE(PWM_TCNTO4_OFFSET)
+#define S5P_PWM_TINT_CSTAT S5P_PWMTIMER_BASE(PWM_TINT_CSTAT_OFFSET)
+
+/* PWM timer addressing */
+#define S5P_TIMER_BASE S5P_PWMTIMER_BASE(0x0)
+#define S5P_PWMTIMER_BASE_REG __REG(S5P_PWMTIMER_BASE(0x0))
+#define S5P_PWM_TCFG0_REG __REG(S5P_PWM_TCFG0)
+#define S5P_PWM_TCFG1_REG __REG(S5P_PWM_TCFG1)
+#define S5P_PWM_TCON_REG __REG(S5P_PWM_TCON)
+#define S5P_PWM_TCNTB0_REG __REG(S5P_PWM_TCNTB0)
+#define S5P_PWM_TCMPB0_REG __REG(S5P_PWM_TCMPB0)
+#define S5P_PWM_TCNTO0_REG __REG(S5P_PWM_TCNTO0)
+#define S5P_PWM_TCNTB1_REG __REG(S5P_PWM_TCNTB1)
+#define S5P_PWM_TCMPB1_REG __REG(S5P_PWM_TCMPB1)
+#define S5P_PWM_TCNTO1_REG __REG(S5P_PWM_TCNTO1)
+#define S5P_PWM_TCNTB2_REG __REG(S5P_PWM_TCNTB2)
+#define S5P_PWM_TCMPB2_REG __REG(S5P_PWM_TCMPB2)
+#define S5P_PWM_TCNTO2_REG __REG(S5P_PWM_TCNTO2)
+#define S5P_PWM_TCNTB3_REG __REG(S5P_PWM_TCNTB3)
+#define S5P_PWM_TCNTO3_REG __REG(S5P_PWM_TCNTO3)
+#define S5P_PWM_TCNTB4_REG __REG(S5P_PWM_TCNTB4)
+#define S5P_PWM_TCNTO4_REG __REG(S5P_PWM_TCNTO4)
+#define S5P_PWM_TINT_CSTAT_REG __REG(S5P_PWM_TINT_CSTAT)
+
+/* PWM timer value */
+#define S5P_TCON4_AUTO_RELOAD (1 << 22) /* Interval mode(Auto
Reload) of PWM Timer 4 */
+#define S5P_TCON4_UPDATE (1 << 21) /* Update TCNTB4 */
+#define S5P_TCON4_ON (1 << 20) /* start bit of PWM Timer 4 */
+
+#ifndef __ASSEMBLY__
+typedef struct s5pc1xx_timer {
+ volatile unsigned long TCFG0;
+ volatile unsigned long TCFG1;
+ volatile unsigned long TCON;
+ volatile unsigned long TCNTB0;
+ volatile unsigned long TCMPB0;
+ volatile unsigned long TCNTO0;
+ volatile unsigned long TCNTB1;
+ volatile unsigned long TCMPB1;
+ volatile unsigned long TCNTO1;
+ volatile unsigned long TCNTB2;
+ volatile unsigned long TCMPB2;
+ volatile unsigned long TCNTO2;
+ volatile unsigned long TCNTB3;
+ volatile unsigned long res1;
+ volatile unsigned long TCNTO3;
+ volatile unsigned long TCNTB4;
+ volatile unsigned long TCNTO4;
+ volatile unsigned long TINTCSTAT;
+} s5pc1xx_timers_t;
+#endif /* __ASSEMBLY__ */
+
+#include <asm/arch/uart.h>
+#include <asm/arch/watchdog.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/clock-others.h>
+
+#endif /* __S5PC100_H__ */
+
+#endif /* _CPU_H */

(quoted diff) +0 -0

b/include/asm-arm/arch-s5pc100/gpio.h
new file mode 100644
index 0000000..bd49aaa

include/asm-arm/arch-s5pc100/gpio.h new file +580 -0

580 lines not on this page · raw message

(quoted diff) +0 -0

b/include/asm-arm/arch-s5pc100/hardware.h
new file mode 100644
index 0000000..84d24c9

include/asm-arm/arch-s5pc100/hardware.h new file +63 -0

63 lines not on this page · raw message

(quoted diff) +0 -0

b/include/asm-arm/arch-s5pc100/map-base.h
new file mode 100644
index 0000000..37cc9ba

include/asm-arm/arch-s5pc100/map-base.h new file +19 -0
@@ -0,0 +1,19 @@
+/* include/asm/arch/map-base.h
+ *
+ * Author: InKi Dae <[email protected]>
+ *
+ * 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_BASE_H
+#define ___ASM_ARCH_MAP_BASE_H
+
+#define S5P_ADDR_BASE	0xE1F00000
+
+#define S5P_ADDR(x)	(S5P_ADDR_BASE + (x))
+
+#define S5P_LCD_BASE	S5P_ADDR(0xC100000)	/* Display Controller */
+
+#endif
(quoted diff) +0 -0

b/include/asm-arm/arch-s5pc100/sys_proto.h
new file mode 100644
index 0000000..b601547

include/asm-arm/arch-s5pc100/sys_proto.h new file +30 -0
@@ -0,0 +1,30 @@
+/*
+ * (C) Copyright 2009
+ * Samsung Electronics, <www.samsung.com/sec>
+ *
+ * (C) Copyright 2004-2008
+ * Texas Instruments, <www.ti.com>
+ * Richard Woodruff <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+  */
+#ifndef _SYS_PROTO_H_
+#define _SYS_PROTO_H_
+
+ulong get_PCLK(void);
+static inline s5pc1xx_uart_t *s5pc1xx_get_base_uart(enum s5pc1xx_uarts_nr nr);
+
+#endif
(quoted diff) +0 -0

b/include/asm-arm/arch-s5pc100/uart.h
new file mode 100644
index 0000000..4d2482a

include/asm-arm/arch-s5pc100/uart.h new file +68 -0

68 lines not on this page · raw message

(quoted diff) +0 -0

b/include/asm-arm/arch-s5pc100/watchdog.h
new file mode 100644
index 0000000..668bb09

include/asm-arm/arch-s5pc100/watchdog.h new file +16 -0
@@ -0,0 +1,16 @@
+
+/*
+ * Watchdog
+ */
+#define S5P_WATCHDOG_BASE(x)	(S5P_PA_WATCHDOG + (x))
+
+#define WTCON_OFFSET		0x0
+#define WTDAT_OFFSET		0x4
+#define WTCNT_OFFSET		0x8
+#define WTCLRINT_OFFSET		0xc
+
+#define S5P_WTCON		S5P_WATCHDOG_BASE(WTCON_OFFSET)
+#define S5P_WTDAT		S5P_WATCHDOG_BASE(WTDAT_OFFSET)
+#define S5P_WTCNT		S5P_WATCHDOG_BASE(WTCNT_OFFSET)
+#define S5P_WTCLRINT		S5P_WATCHDOG_BASE(WTCLRINT_OFFSET)
+
include/s5pc1xx-onenand.h new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
1.5.6.3
#1 lore raw

PATCH 1/6 S5PC100: Samsung S5PC100 SoC support

Quoted 9 lines · HeungJun Kim

S5PC100 processor is ARM Cortex A8 Processor SoC
and SMDKC100 Board use this.
So, this patch tested on SMDKC100 Board.

I'll send 6 patch for working on SMDKC100 Board including this. But, this patch make the change to ARM Cortex A8 specific code like a cpu/arm_cortexa8/cpu.c, start.S.

So, I wanna be reviewed to know how to contribute this whole patch.

this will go in a PATCH 0/X e-mail
please fix the commit message

Quoted 2 lines
CC Dirk Behme <[email protected]>

please @

Quoted 3 lines

---

please rebase your patch as it's does not apply against the u-boot-arm master, next or testing

Quoted 57 lines

It includes the following :

- Samsung S5PC100 SoC specific source codes
- Samsung S5PC100 SoC specific header files
- modify ARM Cortex A8 cpu.c, start.S

 cpu/arm_cortexa8/cpu.c                      |   80 +---
 cpu/arm_cortexa8/s5pc100/Makefile           |   48 +++
 cpu/arm_cortexa8/s5pc100/config.mk          |   36 ++
 cpu/arm_cortexa8/s5pc100/speed.c            |  186 +++++++++
 cpu/arm_cortexa8/s5pc100/timer.c            |  223 ++++++++++
 cpu/arm_cortexa8/start.S                    |   23 +
 include/asm-arm/arch-s5pc100/clock-others.h |   33 ++
 include/asm-arm/arch-s5pc100/cpu.h          |  379 +++++++++++++++++
 include/asm-arm/arch-s5pc100/gpio.h         |  580 +++++++++++++++++++++++++++
 include/asm-arm/arch-s5pc100/hardware.h     |   63 +++
 include/asm-arm/arch-s5pc100/map-base.h     |   19 +
 include/asm-arm/arch-s5pc100/sys_proto.h    |   30 ++
 include/asm-arm/arch-s5pc100/uart.h         |   68 ++++
 include/asm-arm/arch-s5pc100/watchdog.h     |   16 +
 include/s5pc1xx-onenand.h                   |  105 +++++
 15 files changed, 1828 insertions(+), 61 deletions(-)
 create mode 100644 cpu/arm_cortexa8/s5pc100/Makefile
 create mode 100644 cpu/arm_cortexa8/s5pc100/config.mk
 create mode 100644 cpu/arm_cortexa8/s5pc100/speed.c
 create mode 100644 cpu/arm_cortexa8/s5pc100/timer.c
 create mode 100644 include/asm-arm/arch-s5pc100/clock-others.h
 create mode 100644 include/asm-arm/arch-s5pc100/cpu.h
 create mode 100644 include/asm-arm/arch-s5pc100/gpio.h
 create mode 100644 include/asm-arm/arch-s5pc100/hardware.h
 create mode 100644 include/asm-arm/arch-s5pc100/map-base.h
 create mode 100644 include/asm-arm/arch-s5pc100/sys_proto.h
 create mode 100644 include/asm-arm/arch-s5pc100/uart.h
 create mode 100644 include/asm-arm/arch-s5pc100/watchdog.h
 create mode 100644 include/s5pc1xx-onenand.h
cpu/arm_cortexa8/cpu.c +7 -1
index 6fd07d0..95e8523 100644
@@ -37,11 +37,28 @@
 #include <asm/system.h>
 
 #ifndef CONFIG_L2_OFF
-void l2cache_disable(void);
+void l2_cache_disable(void);
+#endif
+
+#ifdef CONFIG_USE_IRQ
+DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 static void cache_flush(void);
 
+int cpu_init(void)
+{

cpu/arm_cortexa8/cpu.c line 60

Quoted 10 lines
cpu/arm_cortexa8/cpu.c +10 -0
+	/*
+	 * setup up stacks if necessary
+	 */
+#ifdef CONFIG_USE_IRQ
+	IRQ_STACK_START =
+	    _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4;
+	FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
+#endif
+	return 0;
+}

no need please remove

Quoted 17 lines
cpu/arm_cortexa8/cpu.c +2 -1
+
 int cleanup_before_linux(void)
 {
 	unsigned int i;
@@ -63,7 +80,7 @@ int cleanup_before_linux(void)
 
 #ifndef CONFIG_L2_OFF
 	/* turn off L2 cache */
-	l2cache_disable();
+	l2_cache_disable();
 	/* invalidate L2 cache also */
 	v7_flush_dcache_all(get_device_type());
 #endif
@@ -78,65 +95,6 @@ int cleanup_before_linux(void)
 	return 0;
 }
 

<snip>

Quoted 46 lines
cpu/arm_cortexa8/s5pc100/speed.c new file +40 -0
new file mode 100644
index 0000000..c5768f8
@@ -0,0 +1,186 @@
+/*
+ * (C) Copyright 2009
+ * Inki Dae, SAMSUNG Electronics, <[email protected]>
+ * Heungjun Kim, SAMSUNG Electronics, <[email protected]>
+ * Minkyu Kang, SAMSUNG Electronics, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * This code should work for both the S3C2400 and the S3C2410
+ * as they seem to have the same PLL and clock machinery inside.
+ * The different address mapping is handled by the s3c24xx.h files below.
+ */
+
+#include <common.h>
+
+#define APLL 0
+#define MPLL 1
+#define EPLL 2
+#define HPLL 3
+
+/* ------------------------------------------------------------------------- */
+/*

cpu/arm_cortexa8/s5pc100/speed.c line 50

Quoted 10 lines
cpu/arm_cortexa8/s5pc100/speed.c new file +10 -0
+ * NOTE: This describes the proper use of this file.
+ *
+ * CONFIG_SYS_CLK_FREQ should be defined as the input frequency of the PLL.
+ *
+ * get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() return the clock of
+ * the specified bus in HZ.
+ */
+/* ------------------------------------------------------------------------- */
+
+static ulong get_PLLCLK(int pllreg)

please use this convention
get_xxx_clk_rate for all clock function
and please rename the file clock.c
and please create a clk.h file with this functions prototype

Quoted 33 lines
cpu/arm_cortexa8/s5pc100/speed.c new file +33 -0
+{
+	ulong r, m, p, s, mask;
+
+	switch (pllreg) {
+	case APLL:
+		r = S5P_APLL_CON_REG;
+		break;
+	case MPLL:
+		r = S5P_MPLL_CON_REG;
+		break;
+	case EPLL:
+		r = S5P_EPLL_CON_REG;
+		break;
+	case HPLL:
+		r = S5P_HPLL_CON_REG;
+		break;
+	default:
+		hang();
+	}
+
+	if (pllreg == APLL)
+		mask = 0x3ff;
+	else
+		mask = 0x0ff;
+
+	m = (r >> 16) & mask;
+	p = (r >> 8) & 0x3f;
+	s = r & 0x7;
+
+	return m * (CONFIG_SYS_CLK_FREQ / (p * (1 << s)));
+}
+
+/* return ARMCORE frequency */

<snip>

Quoted 8 lines
cpu/arm_cortexa8/s5pc100/speed.c new file +8 -0
+
+#ifdef CONFIG_DISPLAY_CPUINFO
+int print_cpuinfo(void)
+{
+	unsigned int pid = __REG(S5P_PRO_ID);
+
+	pid >>= 12;
+	pid &= 0x00fff;

cpu/arm_cortexa8/s5pc100/speed.c line 185

Quoted 10 lines
cpu/arm_cortexa8/s5pc100/speed.c new file +10 -0
+
+	printf("CPU:\tS5PC%x@%luMHz\n", pid, get_ARMCLK() / 1000000);
+	printf("\tFclk = %luMHz, HclkD0 = %luMHz, PclkD0 = %luMHz,"
+		" PclkD1 = %luMHz\n",
+			get_FCLK() / 1000000, get_HCLK() / 1000000,
+			get_PCLKD0() / 1000000, get_PCLK() / 1000000);
+
+	return 0;
+}
+#endif

please move this in cpu.c or cpu_info.c

Quoted 17 lines
cpu/arm_cortexa8/s5pc100/speed.c new file +1 -0
+
cpu/arm_cortexa8/s5pc100/timer.c new file +10 -0
new file mode 100644
index 0000000..0864600
@@ -0,0 +1,223 @@
+/*
+ * (C) Copyright 2003
+ * Texas Instruments <www.ti.com>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <[email protected]>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>

cpu/arm_cortexa8/s5pc100/timer.c line 20

Quoted 10 lines
cpu/arm_cortexa8/s5pc100/timer.c new file +10 -0
+ * Alex Zuepke <[email protected]>
+ *
+ * (C) Copyright 2002-2004
+ * Gary Jennejohn, DENX Software Engineering, <[email protected]>
+ *
+ * (C) Copyright 2004
+ * Philippe Robin, ARM Ltd. <[email protected]>
+ *
+ * (C) Copyright 2008
+ * Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>

all there people write the code?

Quoted 83 lines
cpu/arm_cortexa8/s5pc100/timer.c new file +83 -0
+ *
+ * (C) Copyright 2009
+ * Heungjun Kim, SAMSUNG Electronics, <[email protected]>
+ * Inki Dae, SAMSUNG Electronics, <[email protected]>
+ * Minkyu Kang, SAMSUNG Electronics, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+
+#define PRESCALER_1		(16 - 1)	/* prescaler of timer 2, 3, 4 */
+#define MUX_DIV_2		(1)		/* 1/2 period */
+#define MUX_DIV_4		(2)		/* 1/4 period */
+#define MUX_DIV_8		(3)		/* 1/8 period */
+#define MUX_DIV_16		(4)		/* 1/16 period */
+#define MUX4_DIV_SHIFT		16
+
+#define TCON_TIMER4_SHIFT	20
+
+static ulong count_value;
+
+/* Internal tick units */
+static unsigned long long timestamp;	/* Monotonic incrementing timer */
+static unsigned long lastdec;	/* Last decremneter snapshot */
+
+/* macro to read the 16 bit timer */
+static inline ulong READ_TIMER(void)
+{
+	const s5pc1xx_timers_t *timers = (s5pc1xx_timers_t *) S5P_TIMER_BASE;
+
+	return timers->TCNTO4;
+}
+
+int timer_init(void)
+{
+	s5pc1xx_timers_t *timers = (s5pc1xx_timers_t *) S5P_TIMER_BASE;
+
+	/*
+	 * @ PWM Timer 4
+	 * Timer Freq(HZ) =
+	 *	PCLK / { (prescaler_value + 1) * (divider_value) }
+	 */
+
+	/* set prescaler : 16 */
+	/* set divider : 2 */
+	timers->TCFG0 = (PRESCALER_1 & 0xff) << 8;
+	timers->TCFG1 = (MUX_DIV_2 & 0xf) << MUX4_DIV_SHIFT;
+
+	if (count_value == 0) {
+
+		/* reset initial value */
+		/* count_value = 2085937.5(HZ) (per 1 sec)*/
+		count_value = get_PCLK() / ((PRESCALER_1 + 1) *
+				(MUX_DIV_2 + 1));
+
+		/* count_value / 100 = 20859.375(HZ) (per 10 msec) */
+		count_value = count_value / 100;
+	}
+
+	/* set count value */
+	timers->TCNTB4 = count_value;
+	lastdec = count_value;
+
+	/* auto reload & manual update */
+	timers->TCON = (timers->TCON & ~(0x07 << TCON_TIMER4_SHIFT)) |
+		S5P_TCON4_AUTO_RELOAD | S5P_TCON4_UPDATE;

cpu/arm_cortexa8/s5pc100/timer.c line 113

Quoted 10 lines
cpu/arm_cortexa8/s5pc100/timer.c new file +10 -0
+
+	/* start PWM timer 4 */
+	timers->TCON = (timers->TCON & ~(0x07 << TCON_TIMER4_SHIFT)) |
+		S5P_TCON4_AUTO_RELOAD | S5P_TCON4_ON;
+
+	timestamp = 0;
+
+	return 0;
+}
+

please remove one empty file

Quoted 4 lines
cpu/arm_cortexa8/s5pc100/timer.c new file +4 -0
+
+/*
+ * timer without interrupts
+ */

<snip>

cpu/arm_cortexa8/s5pc100/timer.c line 212

Quoted 2 lines
cpu/arm_cortexa8/s5pc100/timer.c new file +2 -0
+
+void reset_cpu(ulong ignored)

please move this to reset.c or cpu.c
it's not related to the timer

Quoted 16 lines
cpu/arm_cortexa8/s5pc100/timer.c new file +11 -0
+{
+	unsigned int pid = __REG(S5P_PRO_ID);
+
+	pid >>= 12;
+	pid &= 0x00fff;
+	pid |= (0xC << 12);
+
+	__REG(S5P_SW_RST) = pid;
+
+	while (1) ;
+}
cpu/arm_cortexa8/start.S +0 -0
index 66b4820..da6eed7 100644

cpu/arm_cortexa8/start.S line 37

Quoted 4 lines
cpu/arm_cortexa8/start.S +1 -0
@@ -34,6 +34,7 @@
 
 .globl _start
 _start: b	reset
+#ifndef CONFIG_ONENAND_IPL

please sync with arm1136/start.S
I do want to have multiple start.S implementation anymore please also note the we introduce a CONFIG_PRELOADER

Quoted 31 lines
cpu/arm_cortexa8/start.S +5 -0
 	ldr	pc, _undefined_instruction
 	ldr	pc, _software_interrupt
 	ldr	pc, _prefetch_abort
@@ -50,6 +51,9 @@ _not_used:		.word not_used
 _irq:			.word irq
 _fiq:			.word fiq
 _pad:			.word 0x12345678 /* now 16*4=64 */
+#else
+	.	= _start + 64
+#endif
 .global _end_vect
 _end_vect:
 
@@ -108,6 +112,7 @@ reset:
 	orr	r0, r0, #0xd3
 	msr	cpsr,r0
 
+#ifndef CONFIG_ONENAND_IPL
 #if (CONFIG_OMAP34XX)
 	/* Copy vectors to mask ROM indirect addr */
 	adr	r0, _start		@ r0 <- current position of code
@@ -131,11 +136,13 @@ next:
 	bl	cpy_clk_code		@ put dpll adjust code behind vectors
 #endif /* NAND Boot */
 #endif
+#endif	/* CONFIG_ONENAND_IPL */
 	/* the mask ROM code should have PLL and others stable */
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
 	bl	cpu_init_crit
 #endif
 

<snip>

Quoted 12 lines

/*
*************************************************************************
*

cpu/arm_cortexa8/start.S +1 -0
@@ -502,6 +522,7 @@ finished_inval:
 	ldmfd	r13!, {r0 - r5, r7, r9 - r12, pc}
 
 
+#if (CONFIG_OMAP34XX)
 	.align	5
 .global reset_cpu
 reset_cpu:

cpu/arm_cortexa8/start.S _loop_forever: · line 538

Quoted 4 lines
cpu/arm_cortexa8/start.S +1 -0
@@ -514,3 +535,5 @@ _loop_forever:
 	b	_loop_forever
 rstctl:
 	.word	PRM_RSTCTRL
+#endif

please move this reset_cpu to cortexA8/omap3/

include/asm-arm/arch-s5pc100/clock-others.h

Quoted 8 lines
cpu/arm_cortexa8/start.S +1 -0
+#endif	/* CONFIG_ONENAND_IPL */
include/asm-arm/arch-s5pc100/clock-others.h new file +0 -0
new file mode 100644
index 0000000..35f1686
@@ -0,0 +1,33 @@

please add licence header

Quoted 4 lines
include/asm-arm/arch-s5pc100/clock-others.h new file +4 -0
+
+/*
+ * Clock control - Others
+ */

<snip>

Quoted 24 lines
include/asm-arm/arch-s5pc100/clock-others.h new file +1 -0
+
include/asm-arm/arch-s5pc100/cpu.h new file +16 -0
new file mode 100644
index 0000000..6ec8656
@@ -0,0 +1,379 @@
+/*
+ * (C) Copyright 2009
+ * Samsung Electronics, <www.samsung.com/sec>
+ * Heungjun Kim <[email protected]>
+ * Minkyu Kang <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *

include/asm-arm/arch-s5pc100/cpu.h line 26

Quoted 10 lines
include/asm-arm/arch-s5pc100/cpu.h new file +10 -0
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#ifndef _CPU_H
+#define _CPU_H
+

please split this file a few more as somethink like this clock.h
pwm.h
power.h etc....
please also not that you have whitespace and your patch is line wrapped

Quoted 32 lines
include/asm-arm/arch-s5pc100/cpu.h new file +14 -0
+#include <asm/hardware.h>
+
+#ifndef __S5PC100_H__
+#define __S5PC100_H__
+
+#define S5P_ADDR_BASE		0xe0000000
+#define S5P_ADDR(x)		(S5P_ADDR_BASE + (x))
+
+#define S5P_PA_ID		S5P_ADDR(0x00000000)	/* Chip ID Base */
+#define S5P_PA_CLK		S5P_ADDR(0x00100000)	/* Clock Base */
+#define S5P_PA_PWR		S5P_ADDR(0x00108000)	/* Power Base */
+#define S5P_PA_CLK_OTHERS	S5P_ADDR(0x00200000)	/* Clock Others Base */
+#define S5P_PA_GPIO		S5P_ADDR(0x00300000)    /* GPIO Base */
+#define S5P_PA_VIC0		S5P_ADDR(0x04000000)    /* Vector Interrupt

Controller 0 */
+#define S5P_PA_VIC1 S5P_ADDR(0x04100000) /* Vector Interrupt
Controller 1 */
+#define S5P_PA_VIC2 S5P_ADDR(0x04200000) /* Vector Interrupt
Controller 2 */

include/asm-arm/arch-s5pc100/cpu.h new file +13 -0
+#define S5P_PA_DMC		S5P_ADDR(0x06000000)    /* Dram Memory Controller */
+#define S5P_PA_SROMC		S5P_ADDR(0x07000000)    /* SROM Controller */
+#define S5P_PA_WATCHDOG		S5P_ADDR(0x0a200000)    /* Watchdog Timer */
+#define S5P_PA_PWMTIMER		S5P_ADDR(0x0a000000)    /* PWM Timer */
+
+/*
+ * Chip ID
+ */
+#define S5P_ID(x)		(S5P_PA_ID + (x))
+
+#define S5P_PRO_ID		S5P_ID(0)
+#define S5P_OMR			S5P_ID(4)
+

<snip>

include/asm-arm/arch-s5pc100/cpu.h

Quoted 5 lines
include/asm-arm/arch-s5pc100/cpu.h new file +5 -0
+
+#include <asm/arch/uart.h>
+#include <asm/arch/watchdog.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/clock-others.h>

why do you include it?

Quoted 4 lines
include/asm-arm/arch-s5pc100/cpu.h new file +4 -0
+
+#endif	/* __S5PC100_H__ */
+
+#endif	/* _CPU_H */

<snip>

Quoted 43 lines
include/asm-arm/arch-s5pc100/hardware.h new file +36 -0
new file mode 100644
index 0000000..84d24c9
@@ -0,0 +1,63 @@
+/*
+ * Originates from Samsung's u-boot 1.1.6 port to S3C6400 / SMDK6400
+ *
+ * (C) Copyright 2008
+ * Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _ARCH_HARDWARE_H_
+#define _ARCH_HARDWARE_H_
+
+#include <asm/sizes.h>
+
+#ifndef __ASSEMBLY__
+#define UData(Data)	((unsigned long) (Data))
+
+#define __REG(x)	(*(vu_long *)(x))
+#define __REGl(x)	(*(vu_long *)(x))
+#define __REGw(x)	(*(vu_short *)(x))
+#define __REGb(x)	(*(vu_char *)(x))
+#define __REG2(x, y)	(*(vu_long *)((x) + (y)))
+#else

include/asm-arm/arch-s5pc100/hardware.h line 44

Quoted 10 lines
include/asm-arm/arch-s5pc100/hardware.h new file +8 -0
+#define UData(Data)	(Data)
+
+#define __REG(x)	(x)
+#define __REGl(x)	(x)
+#define __REGw(x)	(x)
+#define __REGb(x)	(x)
+#define __REG2(x, y)	((x) + (y))
 
 
+#endif

please use proper accessor in the file, so you do not need those macro

Quoted 7 lines
include/asm-arm/arch-s5pc100/hardware.h new file +7 -0
+
+#define Fld(Size, Shft)	(((Size) << 16) + (Shft))
+
+#define FSize(Field)	((Field) >> 16)
+#define FShft(Field)	((Field) & 0x0000FFFF)
+#define FMsk(Field)	(((UData (1) << FSize (Field)) - 1) << FShft (Field))
+#define FAlnMsk(Field)	((UData (1) << FSize (Field)) - 1)

include/asm-arm/arch-s5pc100/hardware.h line 61

Quoted 10 lines
include/asm-arm/arch-s5pc100/hardware.h new file +10 -0
+#define F1stBit(Field)	(UData (1) << FShft (Field))
+
+#define FClrBit(Data, Bit)	(Data = (Data & ~(Bit)))
+#define FClrFld(Data, Field)	(Data = (Data & ~FMsk(Field)))
+
+#define FInsrt(Value, Field) \
+			(UData (Value) << FShft (Field))
+
+#define FExtr(Data, Field) \
+			((UData (Data) >> FShft (Field)) & FAlnMsk (Field))

please use generic bits ops

include/asm-arm/arch-s5pc100/hardware.h line 63

Quoted 2 lines
include/asm-arm/arch-s5pc100/hardware.h new file +2 -0
+
+#endif /* _ARCH_HARDWARE_H_ */

Best Regards,
J.

#2 lore raw

PATCH 1/6 S5PC100: Samsung S5PC100 SoC support

In reply to HeungJun Kim
Quoted 8 lines · HeungJun Kim

S5PC100 processor is ARM Cortex A8 Processor SoC
and SMDKC100 Board use this.
So, this patch tested on SMDKC100 Board.

I'll send 6 patch for working on SMDKC100 Board including this. But, this patch make the change to ARM Cortex A8 specific code like a cpu/arm_cortexa8/cpu.c, start.S.

Quoted 6 lines

So, I wanna be reviewed to know how to contribute this whole patch.

---

do you plan to send a new version?

Best Regards,
J.

#3 lore raw

PATCH 1/6 S5PC100: Samsung S5PC100 SoC support

Mr. Jean,

Yes. Definitely.
To send the new version patch may be so late,
cause of my busy days, not my laziness.

BTW, is there any issues or problem?
If there is, can you tell me about that things for me to handle it? I hope your waiting a few days.
sorry for that.

Best regards,
riverful

2009/7/8, Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

Quoted 20 lines · HeungJun Kim
Quoted 8 lines

S5PC100 processor is ARM Cortex A8 Processor SoC
and SMDKC100 Board use this.
So, this patch tested on SMDKC100 Board.

I'll send 6 patch for working on SMDKC100 Board including this. But, this patch make the change to ARM Cortex A8 specific code like a cpu/arm_cortexa8/cpu.c, start.S.

Quoted 6 lines

So, I wanna be reviewed to know how to contribute this whole patch.

---

do you plan to send a new version?

Best Regards,
J.