Skip to contentSkip to conversation

s5pc1xx: support Samsung s5pc1xx SoC

PATCH Superseded Minkyu Kang 4 participants 9 messages Sep 10, 2009 – Oct 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 s5pc1xx: support Samsung s5pc1xx SoC

This patch adds support for the Samsung s5pc100 and s5pc110 SoCs. The s5pc1xx SoC is an ARM Cortex A8 processor.

---
 cpu/arm_cortexa8/s5pc1xx/Makefile        |   53 ++++++
 cpu/arm_cortexa8/s5pc1xx/cache.c         |   43 +++++
 cpu/arm_cortexa8/s5pc1xx/clock.c         |  302 ++++++++++++++++++++++++++++++
 cpu/arm_cortexa8/s5pc1xx/cpu_info.c      |   75 ++++++++
 cpu/arm_cortexa8/s5pc1xx/reset.S         |   47 +++++
 cpu/arm_cortexa8/s5pc1xx/timer.c         |  195 +++++++++++++++++++
 include/asm-arm/arch-s5pc1xx/clk.h       |   46 +++++
 include/asm-arm/arch-s5pc1xx/clock.h     |  100 ++++++++++
 include/asm-arm/arch-s5pc1xx/cpu.h       |   73 +++++++
 include/asm-arm/arch-s5pc1xx/gpio.h      |  127 +++++++++++++
 include/asm-arm/arch-s5pc1xx/hardware.h  |   63 ++++++
 include/asm-arm/arch-s5pc1xx/i2c.h       |   43 +++++
 include/asm-arm/arch-s5pc1xx/interrupt.h |   40 ++++
 include/asm-arm/arch-s5pc1xx/mem.h       |   58 ++++++
 include/asm-arm/arch-s5pc1xx/power.h     |   42 ++++
 include/asm-arm/arch-s5pc1xx/pwm.h       |   65 +++++++
 include/asm-arm/arch-s5pc1xx/uart.h      |   53 ++++++
 17 files changed, 1425 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/Makefile
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/cache.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/clock.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/cpu_info.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/reset.S
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/timer.c
 create mode 100644 include/asm-arm/arch-s5pc1xx/clk.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/clock.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/cpu.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/gpio.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/hardware.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/i2c.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/interrupt.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/mem.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/power.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/pwm.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/uart.h
cpu/arm_cortexa8/s5pc1xx/Makefile new file +53 -0
new file mode 100644
index 0000000..e08d9d8
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, 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
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+SOBJS	= reset.o
+
+COBJS	+= cache.o
+COBJS	+= clock.o
+COBJS	+= cpu_info.o
+COBJS	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+
+all:	 $(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm_cortexa8/s5pc1xx/cache.c new file +43 -0

43 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/clock.c new file +302 -0

302 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/cpu_info.c new file +75 -0

75 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/reset.S new file +47 -0

47 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/timer.c new file +195 -0

195 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/clk.h new file +46 -0

46 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/clock.h new file +100 -0

100 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/cpu.h new file +73 -0

73 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/gpio.h new file +127 -0

127 lines not on this page · raw message

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

63 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/i2c.h new file +43 -0

43 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/interrupt.h new file +40 -0
new file mode 100644
index 0000000..a3c8680
@@ -0,0 +1,40 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[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 __ASM_ARM_ARCH_INTERRUPT_H_
+#define __ASM_ARM_ARCH_INTERRUPT_H_
+
+/* Vector Interrupt Offset */
+#define VIC_IRQSTATUS_OFFSET		0x0
+#define VIC_FIQSTATUS_OFFSET		0x4
+#define VIC_RAWINTR_OFFSET		0x8
+#define VIC_INTSELECT_OFFSET		0xc
+#define VIC_INTENABLE_OFFSET		0x10
+#define VIC_INTENCLEAR_OFFSET		0x14
+#define VIC_SOFTINT_OFFSET		0x18
+#define VIC_SOFTINTCLEAR_OFFSET		0x1c
+#define VIC_PROTECTION_OFFSET		0x20
+#define VIC_SWPRIORITYMASK_OFFSET	0x24
+#define VIC_PRIORITYDAISY_OFFSET	0x28
+#define VIC_INTADDRESS_OFFSET		0xf00
+
+#endif
include/asm-arm/arch-s5pc1xx/mem.h new file +58 -0

58 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/power.h new file +42 -0

42 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/pwm.h new file +65 -0

65 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/uart.h new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
1.5.4.3
#1 lore raw

PATCH v2 1/4 s5pc1xx: support Samsung s5pc1xx SoC

Dear Minkyu Kang,

Quoted 5 lines · In message <[email protected]> you wrote:

This patch adds support for the Samsung s5pc100 and s5pc110 SoCs. The s5pc1xx SoC is an ARM Cortex A8 processor.

When posting new versions of patches, please always make sure to set appropriate "In-reply-to:" and "References:" headers, so your new versions get correctly threaded with the previous discussion, which makes it much easier to check previous review comments against what you actually changed.

Also, please always include a list of changed between the current and the previous version of the patch, otherwise we have to review the whole code completely again.

Please consider using "git send-email" to submit patches which will make your (and our) life easier, for example because it prompts you for the message IDs to be used in the "In-reply-to:" and "References:" headers.

But the biggest problem with your new version is that you obviously ignore some (large) parts of my previous review comments. This is not the way it is supposed to work.

I don't waste my time on reviewing your code if you don't bother to fix it.

If you want to get your code into mainline, than please clean it up as requested. If you don't understand what changes are required, then please ask. If you think a change request is unreasonable, the ask. But silently ignoring review comments is not helpful.

Quoted 32 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +32 -0
+unsigned long get_pll_clk(int pllreg)
+{
+	struct s5pc100_clock *clk_c100 =
+		(struct s5pc100_clock *)S5PC1XX_CLOCK_BASE;
+	struct s5pc110_clock *clk_c110 =
+		(struct s5pc110_clock *)S5PC1XX_CLOCK_BASE;
+	unsigned long r, m, p, s, mask, fout;
+	unsigned int freq;
+
+	switch (pllreg) {
+	case APLL:
+		if (cpu_is_s5pc110())
+			r = readl(&clk_c110->APLL_CON);
+		else
+			r = readl(&clk_c100->APLL_CON);
+		break;
+	case MPLL:
+		if (cpu_is_s5pc110())
+			r = readl(&clk_c110->MPLL_CON);
+		else
+			r = readl(&clk_c100->MPLL_CON);
+		break;
+	case EPLL:
+		if (cpu_is_s5pc110())
+			r = readl(&clk_c110->EPLL_CON);
+		else
+			r = readl(&clk_c100->EPLL_CON);
+		break;
+	case HPLL:
+		if (cpu_is_s5pc110()) {
+			puts("s5pc110 don't use HPLL\n");
+			return 0;

cpu/arm_cortexa8/s5pc1xx/clock.c line 90

Quoted 10 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +10 -0
+		}
+		r = readl(&clk_c100->HPLL_CON);
+		break;
+	case VPLL:
+		if (cpu_is_s5pc100()) {
+			puts("s5pc100 don't use VPLL\n");
+			return 0;
+		}
+		r = readl(&clk_c110->VPLL_CON);
+		break;

I think this code is inefficient, and it does not scale at all if you ever have to add additional processors. I recomment we don't try to mix this code all in a single function that covers all processors.

Instead, provide two separate functions, one for each of the CPU types, and then set a fuction pointer to the right function. This way we have only a single test for the CPU type (when stting the function pointer). And this allows easily to add support for other CPU types, and even then the code will remain readable.

Quoted 5 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +5 -0
+	if (cpu_is_s5pc110()) {
+		freq = CONFIG_SYS_CLK_FREQ_C110;
+		if (pllreg == APLL) {
+			if (s < 1)
+				s = 1;

cpu/arm_cortexa8/s5pc1xx/clock.c line 140

Quoted 10 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +10 -0
+			/* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */
+			fout = m * (freq / (p * (1 << (s - 1))));
+		} else
+			/* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */
+			fout = m * (freq / (p * (1 << s)));
+	} else {
+		/* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */
+		freq = CONFIG_SYS_CLK_FREQ_C100;
+		fout = m * (freq / (p * (1 << s)));
+	}

Similar here. I suggest you move this CPU dependent code into separate functions. There will be more such places below. In the end, you can probably even split the CPU specific code off into separate files, and set up a table with method pointers. At a central place a single test for the CPU type will be done, and the right method table be selected.

The code here will then be lean and completely independent of CPU types. Thsi will be much easier to read, and easier to maintain.

Quoted 15 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +15 -0
+unsigned long get_arm_clk(void)
+{
+	struct s5pc100_clock *clk = (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE;
+	unsigned long div;
+	unsigned long dout_apll, armclk;
+	unsigned int apll_ratio, arm_ratio;
+
+	div = readl(&clk->DIV0);
+	if (cpu_is_s5pc110()) {
+		/* ARM_RATIO: don't use */
+		arm_ratio = 0;
+		/* APLL_RATIO: [2:0] */
+		apll_ratio = div & 0x7;
+	} else {
+		/* ARM_RATIO: [6:4] */

cpu/arm_cortexa8/s5pc1xx/clock.c line 170

Quoted 10 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +10 -0
+		arm_ratio = (div >> 4) & 0x7;
+		/* APLL_RATIO: [0] */
+		apll_ratio = div & 0x1;
+	}
+
+	dout_apll = get_pll_clk(APLL) / (apll_ratio + 1);
+	armclk = dout_apll / (arm_ratio + 1);
+
+	return armclk;
+}

This is another such candiate.

cpu/arm_cortexa8/s5pc1xx/clock.c line 182

Quoted 11 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +11 -0
+/* return FCLK frequency */
+unsigned long get_fclk(void)
+{
+	return get_pll_clk(APLL);
+}
+
+/* return MCLK frequency */
+unsigned long get_mclk(void)
+{
+	return get_pll_clk(MPLL);
+}

It seems nobody else uses these functions, and get_pll_clk() is globally visible, too. So we can probably omit get_fclk() and get_mclk() and rather call get_pll_clk() directly?

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc100: return HCLKD0 frequency */
+unsigned long get_hclk(void)

...

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc100: return PCLKD0 frequency */
+unsigned long get_pclkd0(void)

...

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc100: return PCLKD1 frequency */
+unsigned long get_pclkd1(void)

...

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc110: return HCLKs frequency */
+unsigned long get_hclk_sys(int dom)

...

cpu/arm_cortexa8/s5pc1xx/clock.c line 265

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc110: return PCLKs frequency */
+unsigned long get_pclk_sys(int dom)

...

Seems these are even more candiates for method pointers...

And more follow. I think this should be reworked globally.

Quoted 16 lines
cpu/arm_cortexa8/s5pc1xx/cpu_info.c new file +16 -0
+int print_cpuinfo(void)
+{
+	char buf[32];
+
+	printf("CPU:\tS5P%X@%sMHz\n",
+			s5pc1xx_cpu_id, strmhz(buf, get_arm_clk()));
+	if (cpu_is_s5pc110()) {
+		printf("\tAPLL = %s MHz, ", strmhz(buf, get_fclk()));
+		printf("MPLL = %s MHz, ", strmhz(buf, get_mclk()));
+		printf("EPLL = %s MHz\n", strmhz(buf, get_uclk()));
+
+		printf("\tHclk: Msys %s MHz, ",
+				strmhz(buf, get_hclk_sys(CLK_M)));
+		printf("Dsys %7s MHz, ", strmhz(buf, get_hclk_sys(CLK_D)));
+		printf("Psys %7s MHz\n", strmhz(buf, get_hclk_sys(CLK_P)));
+

cpu/arm_cortexa8/s5pc1xx/cpu_info.c line 71

Quoted 10 lines
cpu/arm_cortexa8/s5pc1xx/cpu_info.c new file +10 -0
+		printf("\tPclk: Msys %s MHz, ",
+				strmhz(buf, get_pclk_sys(CLK_M)));
+		printf("Dsys %7s MHz, ", strmhz(buf, get_pclk_sys(CLK_D)));
+		printf("Psys %7s MHz\n", strmhz(buf, get_pclk_sys(CLK_P)));
+	} else {
+		printf("\tFclk = %s MHz\n", strmhz(buf, get_fclk()));
+		printf("\tHclkD0 = %s MHz\n", strmhz(buf, get_hclk()));
+		printf("\tPclkD0 = %s MHz\n", strmhz(buf, get_pclkd0()));
+		printf("\tPclkD1 = %s MHz\n", strmhz(buf, get_pclkd1()));
+	}

Please review how much of this is really significant information for the end user, and how much is more or less only interesting for the developer. Consider to change such development-only parts into debug() calls.

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/clock.h new file +0 -0
new file mode 100644
index 0000000..f11c9ce

...

Quoted 22 lines
include/asm-arm/arch-s5pc1xx/clock.h new file +22 -0
+/* Clock Register */
+
+#ifndef __ASSEMBLY__
+struct s5pc100_clock {
+	unsigned long	APLL_LOCK;
+	unsigned long	MPLL_LOCK;
+	unsigned long	EPLL_LOCK;
+	unsigned long	HPLL_LOCK;
+	unsigned char	res1[0xf0];
+	unsigned long	APLL_CON;
+	unsigned long	MPLL_CON;
+	unsigned long	EPLL_CON;
+	unsigned long	HPLL_CON;
+	unsigned char	res2[0xf0];
+	unsigned long	SRC0;
+	unsigned long	SRC1;
+	unsigned long	SRC2;
+	unsigned long	SRC3;
+	unsigned char	res3[0xf0];
+	unsigned long	DIV0;
+	unsigned long	DIV1;
+	unsigned long	DIV2;

include/asm-arm/arch-s5pc1xx/clock.h line 61

Quoted 10 lines
include/asm-arm/arch-s5pc1xx/clock.h new file +10 -0
+	unsigned long	DIV3;
+	unsigned long	DIV4;
+	unsigned char	res4[0x1ec];
+	unsigned long	GATE_D00;
+	unsigned long	GATE_D01;
+	unsigned long	GATE_D02;
+	unsigned char	res5[0x54];
+	unsigned long	GATE_SCLK0;
+	unsigned long	GATE_SCLK1;
+};

Sorry, but variable names must not use upper case letters; these are reserved for macro definitions only. Please rename and use lower case letters only. Also for other names in the rest of the patch.

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +0 -0
new file mode 100644
index 0000000..c7d7183

..

include/asm-arm/arch-s5pc1xx/cpu.h line 32

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +5 -0
+#define S5PC1XX_ADDR_BASE	0xe0000000
+#define S5P_ADDR(x)		(S5PC1XX_ADDR_BASE + (x))
+
+#define S5PC1XX_CLOCK_BASE	0xE0100000
+#define S5P_PA_CLK_OTHERS	S5P_ADDR(0x00200000)	/* Clock Others Base */

Seems thisis the only place where S5P_ADDR is used - consider to avoid it.

By the way: I already commented about this part in my previous review. Why did you not change it?

include/asm-arm/arch-s5pc1xx/cpu.h line 54

Quoted 6 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +6 -0
+/*
+ * Chip ID
+ */
+#define S5PC1XX_CHIP_ID(x)	(0xE0000000 + (x))
+#define S5PC1XX_PRO_ID		S5PC1XX_CHIP_ID(0)
+#define S5PC1XX_OMR		S5PC1XX_CHIP_ID(4)

Create a C struct instead of using base address + offset?

include/asm-arm/arch-s5pc1xx/cpu.h line 71

Quoted 12 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +12 -0
+#define IS_SAMSUNG_TYPE(type, id)					\
+static inline int is_##type(void)					\
+{									\
+	return (s5pc1xx_cpu_id == (id)) ? 1 : 0;			\
+}
+
+IS_SAMSUNG_TYPE(s5pc100, 0xc100)
+IS_SAMSUNG_TYPE(s5pc110, 0xc110)
+
+#define cpu_is_s5pc100()	is_s5pc100()
+#define cpu_is_s5pc110()	is_s5pc110()
+#endif

Why do we need both the inline functions and a macro? Maybe we can use the right name in the inline functions and drop the macro?

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/gpio.h new file +0 -0
new file mode 100644
index 0000000..26d0950

...

Quoted 29 lines
include/asm-arm/arch-s5pc1xx/gpio.h new file +29 -0
+/* GPIO Bank Base */
+#define S5PC100_GPIO_BASE(x)		(0xE0300000 + (x))
+#define S5PC110_GPIO_BASE(x)		(0xE0200000 + (x))
+
+/* S5PC100 bank offset */
+#define S5PC100_GPIO_A0_OFFSET		0x000
+#define S5PC100_GPIO_A1_OFFSET		0x020
+#define S5PC100_GPIO_B_OFFSET		0x040
+#define S5PC100_GPIO_C_OFFSET		0x060
+#define S5PC100_GPIO_D_OFFSET		0x080
+#define S5PC100_GPIO_E0_OFFSET		0x0A0
+#define S5PC100_GPIO_E1_OFFSET		0x0C0
+#define S5PC100_GPIO_F0_OFFSET		0x0E0
+#define S5PC100_GPIO_F1_OFFSET		0x100
+#define S5PC100_GPIO_F2_OFFSET		0x120
+#define S5PC100_GPIO_F3_OFFSET		0x140
+#define S5PC100_GPIO_G0_OFFSET		0x160
+#define S5PC100_GPIO_G1_OFFSET		0x180
+#define S5PC100_GPIO_G2_OFFSET		0x1A0
+#define S5PC100_GPIO_G3_OFFSET		0x1C0
+#define S5PC100_GPIO_I_OFFSET		0x1E0
+#define S5PC100_GPIO_J0_OFFSET		0x200
+#define S5PC100_GPIO_J1_OFFSET		0x220
+#define S5PC100_GPIO_J2_OFFSET		0x240
+#define S5PC100_GPIO_J3_OFFSET		0x260
+#define S5PC100_GPIO_J4_OFFSET		0x280
+#define S5PC100_GPIO_K0_OFFSET		0x2A0
+#define S5PC100_GPIO_K1_OFFSET		0x2C0
+#define S5PC100_GPIO_K2_OFFSET		0x2E0

include/asm-arm/arch-s5pc1xx/gpio.h line 63

Quoted 10 lines
include/asm-arm/arch-s5pc1xx/gpio.h new file +10 -0
+#define S5PC100_GPIO_K3_OFFSET		0x300
+#define S5PC100_GPIO_L0_OFFSET		0x320
+#define S5PC100_GPIO_L1_OFFSET		0x340
+#define S5PC100_GPIO_L2_OFFSET		0x360
+#define S5PC100_GPIO_L3_OFFSET		0x380
+#define S5PC100_GPIO_L4_OFFSET		0x3A0
+#define S5PC100_GPIO_H0_OFFSET		0xC00
+#define S5PC100_GPIO_H1_OFFSET		0xC20
+#define S5PC100_GPIO_H2_OFFSET		0xC40
+#define S5PC100_GPIO_H3_OFFSET		0xC60

...

If this should be used anywhere in the code, add this needs to be converted in a C struct, too.

But as far as I can see, only S5PC100_GPIO_A*_OFFSET are ever referenced (from assembler code); maybe we can omit most of this stuff ? These offsets should then be auto-generated.

But again this is a part I already commented about in my previous review.

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/hardware.h new file +0 -0
new file mode 100644
index 0000000..ca95c3d

...

Quoted 25 lines
include/asm-arm/arch-s5pc1xx/hardware.h new file +25 -0
+#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
+#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
+
+#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)
+#define F1stBit(Field)	(UData(1) << FShft(Field))

include/asm-arm/arch-s5pc1xx/hardware.h line 62

Quoted 10 lines
include/asm-arm/arch-s5pc1xx/hardware.h new file +10 -0
+
+#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))
+

I wrote before:

Quoted 4 lines

Please get rid of all these definitions. None of these will be accepted in U-Boot.

Please use existent accessors and macros instead.

Why did you not implement the required chanegs?

Review stops here. Please fix first.

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Here's a fish hangs in the net like a poor man's right in  the  law.
'Twill hardly come out."     - Shakespeare, Pericles, Act II, Scene 1
#2 lore raw

PATCH v2 1/4 s5pc1xx: support Samsung s5pc1xx SoC

Dear Wolfgang

2009/9/10 Wolfgang Denk <[email protected]>:

Quoted 15 lines

Dear Minkyu Kang,

Quoted 5 lines · In message <[email protected]> you wrote:

This patch adds support for the Samsung s5pc100 and s5pc110 SoCs. The s5pc1xx SoC is an ARM Cortex A8 processor.

When posting new versions of patches, please always make sure to set appropriate "In-reply-to:" and "References:" headers, so your new versions get correctly threaded with the previous discussion, which makes it much easier to check previous review comments against what you actually changed.

Quoted 9 lines

Also, please always include a list of changed between the current and the previous version of the patch, otherwise we have to review the whole code completely again.

Please consider using "git send-email" to submit patches which will make your (and our) life easier, for example because it prompts you for the message IDs to be used in the "In-reply-to:" and "References:" headers.

I see.

Quoted 6 lines

But the biggest problem with your new version is that you obviously ignore some (large) parts of my previous review comments. This is not the way it is supposed to work.

Quoted 9 lines

I don't waste my time on reviewing your code if you don't bother to fix it.

If you want to get your code into mainline, than please clean it up as requested. If you don't understand what changes are required, then please ask. If you think a change request is unreasonable, the ask. But silently ignoring review comments is not helpful.

hm.. did I?
sorry, I just missing..
I'll check all of your comments again..
I'm sorry to your time

Quoted 48 lines
Quoted 33 lines
(quoted diff) +32 -0
+unsigned long get_pll_clk(int pllreg)
+{
+ ? ? struct s5pc100_clock *clk_c100 =
+ ? ? ? ? ? ? (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE;
+ ? ? struct s5pc110_clock *clk_c110 =
+ ? ? ? ? ? ? (struct s5pc110_clock *)S5PC1XX_CLOCK_BASE;
+ ? ? unsigned long r, m, p, s, mask, fout;
+ ? ? unsigned int freq;
+
+ ? ? switch (pllreg) {
+ ? ? case APLL:
+ ? ? ? ? ? ? if (cpu_is_s5pc110())
+ ? ? ? ? ? ? ? ? ? ? r = readl(&clk_c110->APLL_CON);
+ ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? r = readl(&clk_c100->APLL_CON);
+ ? ? ? ? ? ? break;
+ ? ? case MPLL:
+ ? ? ? ? ? ? if (cpu_is_s5pc110())
+ ? ? ? ? ? ? ? ? ? ? r = readl(&clk_c110->MPLL_CON);
+ ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? r = readl(&clk_c100->MPLL_CON);
+ ? ? ? ? ? ? break;
+ ? ? case EPLL:
+ ? ? ? ? ? ? if (cpu_is_s5pc110())
+ ? ? ? ? ? ? ? ? ? ? r = readl(&clk_c110->EPLL_CON);
+ ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? r = readl(&clk_c100->EPLL_CON);
+ ? ? ? ? ? ? break;
+ ? ? case HPLL:
+ ? ? ? ? ? ? if (cpu_is_s5pc110()) {
+ ? ? ? ? ? ? ? ? ? ? puts("s5pc110 don't use HPLL\n");
+ ? ? ? ? ? ? ? ? ? ? return 0;

Review

Quoted 10 lines
(quoted diff) +10 -0
+ ? ? ? ? ? ? }
+ ? ? ? ? ? ? r = readl(&clk_c100->HPLL_CON);
+ ? ? ? ? ? ? break;
+ ? ? case VPLL:
+ ? ? ? ? ? ? if (cpu_is_s5pc100()) {
+ ? ? ? ? ? ? ? ? ? ? puts("s5pc100 don't use VPLL\n");
+ ? ? ? ? ? ? ? ? ? ? return 0;
+ ? ? ? ? ? ? }
+ ? ? ? ? ? ? r = readl(&clk_c110->VPLL_CON);
+ ? ? ? ? ? ? break;

I think this code is inefficient, and it does not scale at all if you ever have to add additional processors. I recomment we don't try to mix this code all in a single function that covers all processors.

Quoted 6 lines

Instead, provide two separate functions, one for each of the CPU types, and then set a fuction pointer to the right function. This way we have only a single test for the CPU type (when stting the function pointer). And this allows easily to add support for other CPU types, and even then the code will remain readable.

I'll split the function.
and I think we don't need the function pointer fully.
get_pclkd0, get_pclkd1, get_hclk_sys and get_pclk_sys are not generic functions. but, get_pll_clk, get_arm_clk and get_pclk can be make function pointer.

Quoted 83 lines
Quoted 16 lines

+ ? ? if (cpu_is_s5pc110()) {
+ ? ? ? ? ? ? freq = CONFIG_SYS_CLK_FREQ_C110;
+ ? ? ? ? ? ? if (pllreg == APLL) {
+ ? ? ? ? ? ? ? ? ? ? if (s < 1)
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? s = 1;
+ ? ? ? ? ? ? ? ? ? ? /* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */
+ ? ? ? ? ? ? ? ? ? ? fout = m * (freq / (p * (1 << (s - 1))));
+ ? ? ? ? ? ? } else
+ ? ? ? ? ? ? ? ? ? ? /* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */
+ ? ? ? ? ? ? ? ? ? ? fout = m * (freq / (p * (1 << s)));
+ ? ? } else {
+ ? ? ? ? ? ? /* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */
+ ? ? ? ? ? ? freq = CONFIG_SYS_CLK_FREQ_C100;
+ ? ? ? ? ? ? fout = m * (freq / (p * (1 << s)));
+ ? ? }

Similar here. I suggest you move this CPU dependent code into separate functions. There will be more such places below. In the end, you can probably even split the CPU specific code off into separate files, and set up a table with method pointers. ?At a central place a single test for the CPU type will be done, and the right method table be selected.

The code here will then be lean and completely independent of CPU types. ?Thsi will be much easier to read, and easier to maintain.

Quoted 15 lines
(quoted diff) +15 -0
+unsigned long get_arm_clk(void)
+{
+ ? ? struct s5pc100_clock *clk = (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE;
+ ? ? unsigned long div;
+ ? ? unsigned long dout_apll, armclk;
+ ? ? unsigned int apll_ratio, arm_ratio;
+
+ ? ? div = readl(&clk->DIV0);
+ ? ? if (cpu_is_s5pc110()) {
+ ? ? ? ? ? ? /* ARM_RATIO: don't use */
+ ? ? ? ? ? ? arm_ratio = 0;
+ ? ? ? ? ? ? /* APLL_RATIO: [2:0] */
+ ? ? ? ? ? ? apll_ratio = div & 0x7;
+ ? ? } else {
+ ? ? ? ? ? ? /* ARM_RATIO: [6:4] */

Review

Quoted 10 lines
(quoted diff) +10 -0
+ ? ? ? ? ? ? arm_ratio = (div >> 4) & 0x7;
+ ? ? ? ? ? ? /* APLL_RATIO: [0] */
+ ? ? ? ? ? ? apll_ratio = div & 0x1;
+ ? ? }
+
+ ? ? dout_apll = get_pll_clk(APLL) / (apll_ratio + 1);
+ ? ? armclk = dout_apll / (arm_ratio + 1);
+
+ ? ? return armclk;
+}

This is another such candiate.

cpu/arm_cortexa8/s5pc1xx/clock.c line 182

Quoted 11 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +11 -0
+/* return FCLK frequency */
+unsigned long get_fclk(void)
+{
+ ? ? return get_pll_clk(APLL);
+}
+
+/* return MCLK frequency */
+unsigned long get_mclk(void)
+{
+ ? ? return get_pll_clk(MPLL);
+}

It seems nobody else uses these functions, and get_pll_clk() is globally visible, too. So we can probably omit get_fclk() and get_mclk() and rather call get_pll_clk() directly?

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc100: return HCLKD0 frequency */
+unsigned long get_hclk(void)

...

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc100: return PCLKD0 frequency */
+unsigned long get_pclkd0(void)

...

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc100: return PCLKD1 frequency */
+unsigned long get_pclkd1(void)

...

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc110: return HCLKs frequency */
+unsigned long get_hclk_sys(int dom)

...

Quoted 7 lines

cpu/arm_cortexa8/s5pc1xx/clock.c line 265

Quoted 2 lines
cpu/arm_cortexa8/s5pc1xx/clock.c new file +2 -0
+/* s5pc110: return PCLKs frequency */
+unsigned long get_pclk_sys(int dom)

...

Seems these are even more candiates for method pointers...

And more follow. I think this should be reworked globally.

ok i'll rechek.

Quoted 67 lines
Quoted 17 lines
(quoted diff) +16 -0
+int print_cpuinfo(void)
+{
+ ? ? char buf[32];
+
+ ? ? printf("CPU:\tS5P%X@%sMHz\n",
+ ? ? ? ? ? ? ? ? ? ? s5pc1xx_cpu_id, strmhz(buf, get_arm_clk()));
+ ? ? if (cpu_is_s5pc110()) {
+ ? ? ? ? ? ? printf("\tAPLL = %s MHz, ", strmhz(buf, get_fclk()));
+ ? ? ? ? ? ? printf("MPLL = %s MHz, ", strmhz(buf, get_mclk()));
+ ? ? ? ? ? ? printf("EPLL = %s MHz\n", strmhz(buf, get_uclk()));
+
+ ? ? ? ? ? ? printf("\tHclk: Msys %s MHz, ",
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? strmhz(buf, get_hclk_sys(CLK_M)));
+ ? ? ? ? ? ? printf("Dsys %7s MHz, ", strmhz(buf, get_hclk_sys(CLK_D)));
+ ? ? ? ? ? ? printf("Psys %7s MHz\n", strmhz(buf, get_hclk_sys(CLK_P)));
+

Review

Quoted 10 lines
(quoted diff) +10 -0
+ ? ? ? ? ? ? printf("\tPclk: Msys %s MHz, ",
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? strmhz(buf, get_pclk_sys(CLK_M)));
+ ? ? ? ? ? ? printf("Dsys %7s MHz, ", strmhz(buf, get_pclk_sys(CLK_D)));
+ ? ? ? ? ? ? printf("Psys %7s MHz\n", strmhz(buf, get_pclk_sys(CLK_P)));
+ ? ? } else {
+ ? ? ? ? ? ? printf("\tFclk = %s MHz\n", strmhz(buf, get_fclk()));
+ ? ? ? ? ? ? printf("\tHclkD0 = %s MHz\n", strmhz(buf, get_hclk()));
+ ? ? ? ? ? ? printf("\tPclkD0 = %s MHz\n", strmhz(buf, get_pclkd0()));
+ ? ? ? ? ? ? printf("\tPclkD1 = %s MHz\n", strmhz(buf, get_pclkd1()));
+ ? ? }

Please review how much of this is really significant information for the end user, and how much is more or less only interesting for the developer. Consider to change such development-only parts into debug() calls.

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/clock.h new file +0 -0
new file mode 100644
index 0000000..f11c9ce

...

Quoted 28 lines
include/asm-arm/arch-s5pc1xx/clock.h new file +28 -0
+/* Clock Register */
+
+#ifndef __ASSEMBLY__
+struct s5pc100_clock {
+ ? ? unsigned long ? APLL_LOCK;
+ ? ? unsigned long ? MPLL_LOCK;
+ ? ? unsigned long ? EPLL_LOCK;
+ ? ? unsigned long ? HPLL_LOCK;
+ ? ? unsigned char ? res1[0xf0];
+ ? ? unsigned long ? APLL_CON;
+ ? ? unsigned long ? MPLL_CON;
+ ? ? unsigned long ? EPLL_CON;
+ ? ? unsigned long ? HPLL_CON;
+ ? ? unsigned char ? res2[0xf0];
+ ? ? unsigned long ? SRC0;
+ ? ? unsigned long ? SRC1;
+ ? ? unsigned long ? SRC2;
+ ? ? unsigned long ? SRC3;
+ ? ? unsigned char ? res3[0xf0];
+ ? ? unsigned long ? DIV0;
+ ? ? unsigned long ? DIV1;
+ ? ? unsigned long ? DIV2;
+ ? ? unsigned long ? DIV3;
+ ? ? unsigned long ? DIV4;
+ ? ? unsigned char ? res4[0x1ec];
+ ? ? unsigned long ? GATE_D00;
+ ? ? unsigned long ? GATE_D01;
+ ? ? unsigned long ? GATE_D02;
Quoted 8 lines
Quoted 4 lines

+ ? ? unsigned char ? res5[0x54];
+ ? ? unsigned long ? GATE_SCLK0;
+ ? ? unsigned long ? GATE_SCLK1;
+};

Sorry, but variable names must not use upper case letters; these are reserved for macro definitions only. Please rename and use lower case letters only. Also for other names in the rest of the patch.

ok. I will fix it.

Quoted 7 lines
Quoted 6 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +0 -0
new file mode 100644
index 0000000..c7d7183

..

Quoted 8 lines

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

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +5 -0
+#define S5PC1XX_ADDR_BASE ? ?0xe0000000
+#define S5P_ADDR(x) ? ? ? ? ?(S5PC1XX_ADDR_BASE + (x))
+
+#define S5PC1XX_CLOCK_BASE ? 0xE0100000
+#define S5P_PA_CLK_OTHERS ? ?S5P_ADDR(0x00200000) ? ?/* Clock Others Base */

Seems thisis the only place where S5P_ADDR is used - consider to avoid it.

i'll fix it, too.

Quoted 3 lines

By the way: I already commented about this part in my previous review. Why did you not change it?

sorry again.

Quoted 10 lines

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

Quoted 7 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +6 -0
+/*
+ * Chip ID
+ */
+#define S5PC1XX_CHIP_ID(x) ? (0xE0000000 + (x))
+#define S5PC1XX_PRO_ID ? ? ? ? ? ? ? S5PC1XX_CHIP_ID(0)
+#define S5PC1XX_OMR ? ? ? ? ?S5PC1XX_CHIP_ID(4)

Create a C struct instead of using base address + offset?

we don't use S5PC1XX_OMR so I'll delete it.
and will fix like this

+#define S5PC1XX_PRO_ID 0xE0000000

Quoted 7 lines
Quoted 7 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +7 -0
+#define IS_SAMSUNG_TYPE(type, id) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
+static inline int is_##type(void) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
+{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
+ ? ? return (s5pc1xx_cpu_id == (id)) ? 1 : 0; ? ? ? ? ? ? ? ? ? ? ? ?\
+}
+
+IS_SAMSUNG_TYPE(s5pc100, 0xc100)
Quoted 8 lines

include/asm-arm/arch-s5pc1xx/cpu.h line 71

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/cpu.h new file +5 -0
+IS_SAMSUNG_TYPE(s5pc110, 0xc110)
+
+#define cpu_is_s5pc100() ? ? is_s5pc100()
+#define cpu_is_s5pc110() ? ? is_s5pc110()
+#endif

Why do we need both the inline functions and a macro? Maybe we can use the right name in the inline functions and drop the macro?

agreed. i'll drop the macro.

Quoted 48 lines
Quoted 6 lines
include/asm-arm/arch-s5pc1xx/gpio.h new file +0 -0
new file mode 100644
index 0000000..26d0950

...

Quoted 39 lines
include/asm-arm/arch-s5pc1xx/gpio.h new file +39 -0
+/* GPIO Bank Base */
+#define S5PC100_GPIO_BASE(x) ? ? ? ? (0xE0300000 + (x))
+#define S5PC110_GPIO_BASE(x) ? ? ? ? (0xE0200000 + (x))
+
+/* S5PC100 bank offset */
+#define S5PC100_GPIO_A0_OFFSET ? ? ? ? ? ? ? 0x000
+#define S5PC100_GPIO_A1_OFFSET ? ? ? ? ? ? ? 0x020
+#define S5PC100_GPIO_B_OFFSET ? ? ? ? ? ? ? ?0x040
+#define S5PC100_GPIO_C_OFFSET ? ? ? ? ? ? ? ?0x060
+#define S5PC100_GPIO_D_OFFSET ? ? ? ? ? ? ? ?0x080
+#define S5PC100_GPIO_E0_OFFSET ? ? ? ? ? ? ? 0x0A0
+#define S5PC100_GPIO_E1_OFFSET ? ? ? ? ? ? ? 0x0C0
+#define S5PC100_GPIO_F0_OFFSET ? ? ? ? ? ? ? 0x0E0
+#define S5PC100_GPIO_F1_OFFSET ? ? ? ? ? ? ? 0x100
+#define S5PC100_GPIO_F2_OFFSET ? ? ? ? ? ? ? 0x120
+#define S5PC100_GPIO_F3_OFFSET ? ? ? ? ? ? ? 0x140
+#define S5PC100_GPIO_G0_OFFSET ? ? ? ? ? ? ? 0x160
+#define S5PC100_GPIO_G1_OFFSET ? ? ? ? ? ? ? 0x180
+#define S5PC100_GPIO_G2_OFFSET ? ? ? ? ? ? ? 0x1A0
+#define S5PC100_GPIO_G3_OFFSET ? ? ? ? ? ? ? 0x1C0
+#define S5PC100_GPIO_I_OFFSET ? ? ? ? ? ? ? ?0x1E0
+#define S5PC100_GPIO_J0_OFFSET ? ? ? ? ? ? ? 0x200
+#define S5PC100_GPIO_J1_OFFSET ? ? ? ? ? ? ? 0x220
+#define S5PC100_GPIO_J2_OFFSET ? ? ? ? ? ? ? 0x240
+#define S5PC100_GPIO_J3_OFFSET ? ? ? ? ? ? ? 0x260
+#define S5PC100_GPIO_J4_OFFSET ? ? ? ? ? ? ? 0x280
+#define S5PC100_GPIO_K0_OFFSET ? ? ? ? ? ? ? 0x2A0
+#define S5PC100_GPIO_K1_OFFSET ? ? ? ? ? ? ? 0x2C0
+#define S5PC100_GPIO_K2_OFFSET ? ? ? ? ? ? ? 0x2E0
+#define S5PC100_GPIO_K3_OFFSET ? ? ? ? ? ? ? 0x300
+#define S5PC100_GPIO_L0_OFFSET ? ? ? ? ? ? ? 0x320
+#define S5PC100_GPIO_L1_OFFSET ? ? ? ? ? ? ? 0x340
+#define S5PC100_GPIO_L2_OFFSET ? ? ? ? ? ? ? 0x360
+#define S5PC100_GPIO_L3_OFFSET ? ? ? ? ? ? ? 0x380
+#define S5PC100_GPIO_L4_OFFSET ? ? ? ? ? ? ? 0x3A0
+#define S5PC100_GPIO_H0_OFFSET ? ? ? ? ? ? ? 0xC00
+#define S5PC100_GPIO_H1_OFFSET ? ? ? ? ? ? ? 0xC20
+#define S5PC100_GPIO_H2_OFFSET ? ? ? ? ? ? ? 0xC40
+#define S5PC100_GPIO_H3_OFFSET ? ? ? ? ? ? ? 0xC60

...

Quoted 7 lines

If this should be used anywhere in the code, add this needs to be converted in a C struct, too.

But as far as I can see, only S5PC100_GPIO_A*_OFFSET are ever referenced (from assembler code); maybe we can omit most of this stuff ? These offsets should then be auto-generated.

on smdkc100? yes right.. but, our other boards use so many gpios. so, it was hard to rework.
but, I will consider to convert C struct.

Quoted 49 lines

But again this is a part I already commented about in my previous review.

Quoted 5 lines
include/asm-arm/arch-s5pc1xx/hardware.h new file +0 -0
new file mode 100644
index 0000000..ca95c3d

...

Quoted 25 lines
include/asm-arm/arch-s5pc1xx/hardware.h new file +25 -0
+#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
+#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
+
+#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)
+#define F1stBit(Field) ? ? ? (UData(1) << FShft(Field))

include/asm-arm/arch-s5pc1xx/hardware.h line 62

Quoted 10 lines
include/asm-arm/arch-s5pc1xx/hardware.h new file +10 -0
+
+#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))
+

I wrote before:

Quoted 6 lines
Quoted 4 lines

Please get rid of all these definitions. None of these will be accepted in U-Boot.

Please use existent accessors and macros instead.

Why did you not implement the required chanegs?

sorry, this file will be deleted.

Quoted 7 lines

Review stops here. Please fix first.

Wolfgang Denk

Quoted 11 lines

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Here's a fish hangs in the net like a poor man's right in ?the ?law. 'Twill hardly come out." ? ? - Shakespeare, Pericles, Act II, Scene 1
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

thanks.

Signature · 2 lines
from. prom.
www.promsoft.net
#3 lore raw

PATCH v3 1/4 s5pc1xx: support Samsung s5pc1xx SoC

This patch adds support for the Samsung s5pc100 and s5pc110 SoCs. The s5pc1xx SoC is an ARM Cortex A8 processor.

---
Changes since v1:
- make C struct instead of base+offset
- use writel/readl function
- use the strmhz function
- fix some comments

Changes since v2:
- use function pointer for separate Soc
- provide two separate functions for each Soc
- remove not helpful cpu informations
- modify to lower case letter in C struct
- remove unnecessary Macro and header files

 cpu/arm_cortexa8/s5pc1xx/Makefile    |   53 ++++++
 cpu/arm_cortexa8/s5pc1xx/cache.c     |   43 +++++
 cpu/arm_cortexa8/s5pc1xx/clock.c     |  308 ++++++++++++++++++++++++++++++++++
 cpu/arm_cortexa8/s5pc1xx/cpu_info.c  |   57 +++++++
 cpu/arm_cortexa8/s5pc1xx/reset.S     |   47 +++++
 cpu/arm_cortexa8/s5pc1xx/timer.c     |  195 +++++++++++++++++++++
 include/asm-arm/arch-s5pc1xx/clk.h   |   32 ++++
 include/asm-arm/arch-s5pc1xx/clock.h |   94 ++++++++++
 include/asm-arm/arch-s5pc1xx/cpu.h   |   72 ++++++++
 include/asm-arm/arch-s5pc1xx/gpio.h  |  129 ++++++++++++++
 include/asm-arm/arch-s5pc1xx/power.h |   42 +++++
 include/asm-arm/arch-s5pc1xx/pwm.h   |   59 +++++++
 include/asm-arm/arch-s5pc1xx/uart.h  |   47 +++++
 13 files changed, 1178 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/Makefile
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/cache.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/clock.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/cpu_info.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/reset.S
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/timer.c
 create mode 100644 include/asm-arm/arch-s5pc1xx/clk.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/clock.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/cpu.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/gpio.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/power.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/pwm.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/uart.h
cpu/arm_cortexa8/s5pc1xx/Makefile new file +53 -0
new file mode 100644
index 0000000..e08d9d8
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, 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
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+SOBJS	= reset.o
+
+COBJS	+= cache.o
+COBJS	+= clock.o
+COBJS	+= cpu_info.o
+COBJS	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+
+all:	 $(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm_cortexa8/s5pc1xx/cache.c new file +43 -0

43 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/clock.c new file +308 -0

308 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/cpu_info.c new file +57 -0

57 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/reset.S new file +47 -0

47 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/timer.c new file +195 -0

195 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/clk.h new file +32 -0
new file mode 100644
index 0000000..f1aa44f
@@ -0,0 +1,32 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[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 __ASM_ARM_ARCH_CLK_H_
+#define __ASM_ARM_ARCH_CLK_H_
+
+void s5pc1xx_clock_init(void);
+
+extern unsigned long (*get_pll_clk)(int pllreg);
+extern unsigned long (*get_arm_clk)(void);
+extern unsigned long (*get_pclk)(void);
+
+#endif
include/asm-arm/arch-s5pc1xx/clock.h new file +94 -0

94 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/cpu.h new file +72 -0

72 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/gpio.h new file +129 -0

129 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/power.h new file +42 -0

42 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/pwm.h new file +59 -0

59 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/uart.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.5.4.3
#5 lore raw

PATCH v3 1/4 s5pc1xx: support Samsung s5pc1xx SoC

Dear Tom

2009/9/22 Tom <[email protected]>:

Quoted 7 lines
Quoted 5 lines · Minkyu Kang

This patch adds support for the Samsung s5pc100 and s5pc110 SoCs. The s5pc1xx SoC is an ARM Cortex A8 processor.

Quoted 7 lines

Ack-ed
Tom
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Thanks for review

and I have one question
when I send next patch or commit this patch, should I add Acked-by?

Thanks again
Minkyu Kang

Signature · 2 lines
from. prom.
www.promsoft.net
#6 lore raw

PATCH v3 1/4 s5pc1xx: support Samsung s5pc1xx SoC

Quoted 17 lines · Minkyu Kang

Dear Tom

2009/9/22 Tom <[email protected]>:

Quoted 4 lines
Quoted 3 lines · Minkyu Kang

This patch adds support for the Samsung s5pc100 and s5pc110 SoCs. The s5pc1xx SoC is an ARM Cortex A8 processor.

Quoted 9 lines
Quoted 2 lines

Ack-ed
Tom
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Quoted 4 lines

Thanks for review

and I have one question
when I send next patch or commit this patch, should I add Acked-by?

Good question!
From the way you submitted the patch, you added yourself as the
sign off line. When you push the patch, you may add me to the sign off. As long as the original author gets the credit.

This is also useful so multiple re-reviews of an ack-ed patch do not stall submission.

Tom

Quoted 3 lines

Thanks again
Minkyu Kang

#7 lore raw

PATCH v4 1/4 s5pc1xx: support Samsung s5pc1xx SoC

This patch adds support for the Samsung s5pc100 and s5pc110 SoCs. The s5pc1xx SoC is an ARM Cortex A8 processor.

---
Changes since v1:
- make C struct instead of base+offset
- use writel/readl function
- use the strmhz function
- fix some comments

Changes since v2:
- use function pointer for separate Soc
- provide two separate functions for each Soc
- remove not helpful cpu informations
- modify to lower case letter in C struct
- remove unnecessary Macro and header files

Changes since v3:
- N/A

 cpu/arm_cortexa8/s5pc1xx/Makefile    |   53 ++++++
 cpu/arm_cortexa8/s5pc1xx/cache.c     |   43 +++++
 cpu/arm_cortexa8/s5pc1xx/clock.c     |  308 ++++++++++++++++++++++++++++++++++
 cpu/arm_cortexa8/s5pc1xx/cpu_info.c  |   57 +++++++
 cpu/arm_cortexa8/s5pc1xx/reset.S     |   47 +++++
 cpu/arm_cortexa8/s5pc1xx/timer.c     |  195 +++++++++++++++++++++
 include/asm-arm/arch-s5pc1xx/clk.h   |   32 ++++
 include/asm-arm/arch-s5pc1xx/clock.h |   94 ++++++++++
 include/asm-arm/arch-s5pc1xx/cpu.h   |   72 ++++++++
 include/asm-arm/arch-s5pc1xx/gpio.h  |  129 ++++++++++++++
 include/asm-arm/arch-s5pc1xx/power.h |   42 +++++
 include/asm-arm/arch-s5pc1xx/pwm.h   |   59 +++++++
 include/asm-arm/arch-s5pc1xx/uart.h  |   47 +++++
 13 files changed, 1178 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/Makefile
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/cache.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/clock.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/cpu_info.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/reset.S
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/timer.c
 create mode 100644 include/asm-arm/arch-s5pc1xx/clk.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/clock.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/cpu.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/gpio.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/power.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/pwm.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/uart.h
cpu/arm_cortexa8/s5pc1xx/Makefile new file +53 -0
new file mode 100644
index 0000000..e08d9d8
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, 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
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+SOBJS	= reset.o
+
+COBJS	+= cache.o
+COBJS	+= clock.o
+COBJS	+= cpu_info.o
+COBJS	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+
+all:	 $(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm_cortexa8/s5pc1xx/cache.c new file +43 -0

43 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/clock.c new file +308 -0

308 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/cpu_info.c new file +57 -0

57 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/reset.S new file +47 -0

47 lines not on this page · raw message

cpu/arm_cortexa8/s5pc1xx/timer.c new file +195 -0

195 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/clk.h new file +32 -0
new file mode 100644
index 0000000..f1aa44f
@@ -0,0 +1,32 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[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 __ASM_ARM_ARCH_CLK_H_
+#define __ASM_ARM_ARCH_CLK_H_
+
+void s5pc1xx_clock_init(void);
+
+extern unsigned long (*get_pll_clk)(int pllreg);
+extern unsigned long (*get_arm_clk)(void);
+extern unsigned long (*get_pclk)(void);
+
+#endif
include/asm-arm/arch-s5pc1xx/clock.h new file +94 -0

94 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/cpu.h new file +72 -0

72 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/gpio.h new file +129 -0

129 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/power.h new file +42 -0

42 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/pwm.h new file +59 -0

59 lines not on this page · raw message

include/asm-arm/arch-s5pc1xx/uart.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.5.4.3
#8 lore raw

PATCH v4 1/4 s5pc1xx: support Samsung s5pc1xx SoC

Quoted 41 lines · Minkyu Kang

This patch adds support for the Samsung s5pc100 and s5pc110 SoCs. The s5pc1xx SoC is an ARM Cortex A8 processor.

---
Changes since v1:
- make C struct instead of base+offset
- use writel/readl function
- use the strmhz function
- fix some comments

Changes since v2:
- use function pointer for separate Soc
- provide two separate functions for each Soc
- remove not helpful cpu informations
- modify to lower case letter in C struct
- remove unnecessary Macro and header files

Changes since v3:
- N/A

 cpu/arm_cortexa8/s5pc1xx/Makefile    |   53 ++++++
 cpu/arm_cortexa8/s5pc1xx/cache.c     |   43 +++++
 cpu/arm_cortexa8/s5pc1xx/clock.c     |  308 ++++++++++++++++++++++++++++++++++
 cpu/arm_cortexa8/s5pc1xx/cpu_info.c  |   57 +++++++
 cpu/arm_cortexa8/s5pc1xx/reset.S     |   47 +++++
 cpu/arm_cortexa8/s5pc1xx/timer.c     |  195 +++++++++++++++++++++
 include/asm-arm/arch-s5pc1xx/clk.h   |   32 ++++
 include/asm-arm/arch-s5pc1xx/clock.h |   94 ++++++++++
 include/asm-arm/arch-s5pc1xx/cpu.h   |   72 ++++++++
 include/asm-arm/arch-s5pc1xx/gpio.h  |  129 ++++++++++++++
 include/asm-arm/arch-s5pc1xx/power.h |   42 +++++
 include/asm-arm/arch-s5pc1xx/pwm.h   |   59 +++++++
 include/asm-arm/arch-s5pc1xx/uart.h  |   47 +++++
 13 files changed, 1178 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/Makefile
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/cache.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/clock.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/cpu_info.c
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/reset.S
Quoted 9 lines
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/timer.c
 create mode 100644 include/asm-arm/arch-s5pc1xx/clk.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/clock.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/cpu.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/gpio.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/power.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/pwm.h
 create mode 100644 include/asm-arm/arch-s5pc1xx/uart.h

applied to u-boot-samsung

Minkyu Kang