Skip to contentSkip to conversation

Marvell Kirkwood family SOC support

PATCH Superseded Prafulla Wadaskar 4 participants 26 messages May 4, 2009 – May 22, 2009 SPI

v6 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 Marvell Kirkwood family SOC support

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

SOC versions supported:-
1) 88F6281-A0 define CONFIG_KW88F6281_A0
2) 88F6192-A0 define CONFIG_KW88F6192_A0

Other supported features:-
1) get_random_hex() fucntion
2) SPI port controller driver
3) PCI Express port initialization

Contributors:
Yotam Admon <[email protected]>
Michael Blostein <michaelbl at marvell.com

---
Change log:
v2: crated arch-kirkwood and moved some header files there renamed and moved spi.c to drivers/spi/
renamed and moved serial.c to drivers/serial/ doimage utility removed
soc_init.S renamed as lowlevel_init.S
debug prints removed

v3: lowlevel_init.S converted to lowlevel_init.c removed BITxx macros, removed entire assembly code Added CONFIG_ARCH_LOWLEVE_INIT support for arm926ejs core updated as per review commens for v2

v4: updated as per review comments for v3 print_cpuinfo used to display Soc info arch_misc_init support created and used for lib_arm mandatory readl/write macros used
asm/cache.h asm/arch/spi.h asm//arch/serial.h created and used

v5: updated as per review comments for v4
cosmetic updates, arch_misc_init and arch_cpu_init used
start.S updated to call arch_lowlevel_init in case if lowlevl_init is skipped bug fix in cpu.c

v6: lowlevel_init.S removed code moved under arch_cpu_init

 cpu/arm926ejs/kirkwood/Makefile           |   48 +++++
 cpu/arm926ejs/kirkwood/config.mk          |   25 +++
 cpu/arm926ejs/kirkwood/cpu.c              |  295 +++++++++++++++++++++++++++++
 cpu/arm926ejs/kirkwood/cpu.h              |   99 ++++++++++
 cpu/arm926ejs/kirkwood/dram.c             |   57 ++++++
 cpu/arm926ejs/kirkwood/timer.c            |  159 ++++++++++++++++
 drivers/serial/Makefile                   |    1 +
 drivers/serial/kirkwood_serial.c          |  128 +++++++++++++
 drivers/spi/Makefile                      |    1 +
 drivers/spi/kirkwood_spi.c                |  167 ++++++++++++++++
 include/asm-arm/arch-kirkwood/kirkwood.h  |  118 ++++++++++++
 include/asm-arm/arch-kirkwood/kw88f6192.h |   37 ++++
 include/asm-arm/arch-kirkwood/kw88f6281.h |   37 ++++
 include/asm-arm/arch-kirkwood/serial.h    |   89 +++++++++
 include/asm-arm/arch-kirkwood/spi.h       |   39 ++++
 include/asm-arm/cache.h                   |   41 ++++
 include/asm-arm/config.h                  |    4 +
 include/common.h                          |    1 +
 lib_arm/board.c                           |    4 +
 19 files changed, 1350 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/kirkwood/Makefile
 create mode 100644 cpu/arm926ejs/kirkwood/config.mk
 create mode 100644 cpu/arm926ejs/kirkwood/cpu.c
 create mode 100644 cpu/arm926ejs/kirkwood/cpu.h
 create mode 100644 cpu/arm926ejs/kirkwood/dram.c
 create mode 100644 cpu/arm926ejs/kirkwood/timer.c
 create mode 100644 drivers/serial/kirkwood_serial.c
 create mode 100644 drivers/spi/kirkwood_spi.c
 create mode 100644 include/asm-arm/arch-kirkwood/kirkwood.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6192.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6281.h
 create mode 100644 include/asm-arm/arch-kirkwood/serial.h
 create mode 100644 include/asm-arm/arch-kirkwood/spi.h
 create mode 100644 include/asm-arm/cache.h
cpu/arm926ejs/kirkwood/Makefile new file +48 -0
new file mode 100644
index 0000000..ef1176e
@@ -0,0 +1,48 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <[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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS-y	= dram.o
+COBJS-y	+= cpu.o
+COBJS-y	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm926ejs/kirkwood/config.mk new file +25 -0
new file mode 100644
index 0000000..000eeb4
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <[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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+PLATFORM_CPPFLAGS += -march=armv5te
cpu/arm926ejs/kirkwood/cpu.c new file +295 -0

295 lines not on this page · raw message

cpu/arm926ejs/kirkwood/cpu.h new file +99 -0

99 lines not on this page · raw message

cpu/arm926ejs/kirkwood/dram.c new file +57 -0

57 lines not on this page · raw message

cpu/arm926ejs/kirkwood/timer.c new file +159 -0

159 lines not on this page · raw message

drivers/serial/Makefile +1 -0
index 14c818d..9174ec6 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libserial.a
 COBJS-$(CONFIG_ARM_DCC) += arm_dcc.o
 COBJS-$(CONFIG_AT91RM9200_USART) += at91rm9200_usart.o
 COBJS-$(CONFIG_ATMEL_USART) += atmel_usart.o
+COBJS-$(CONFIG_KIRKWOOD_SERIAL) += kirkwood_serial.o
 COBJS-$(CONFIG_MCFUART) += mcfuart.o
 COBJS-$(CONFIG_NS9750_UART) += ns9750_serial.o
 COBJS-$(CONFIG_SYS_NS16550) += ns16550.o
drivers/serial/kirkwood_serial.c new file +128 -0

128 lines not on this page · raw message

drivers/spi/Makefile +1 -0
index 1350f3e..7ffa47d 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi.a
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
drivers/spi/kirkwood_spi.c new file +167 -0

167 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kirkwood.h new file +118 -0

118 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kw88f6192.h new file +37 -0
new file mode 100644
index 0000000..000fc16
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6192 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CONFIG_KW88F6192_H
+#define _CONFIG_KW88F6192_H
+
+/* SOC specific definations */
+#define KW88F6192_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6192_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination */
+#define CONFIG_SYS_TCLK         166000000 /* 166MHz */
+
+#endif /* _CONFIG_KW88F6192_H */
include/asm-arm/arch-kirkwood/kw88f6281.h new file +37 -0
new file mode 100644
index 0000000..270d931
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6281 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _ASM_ARCH_KW88F6281_H
+#define _ASM_ARCH_KW88F6281_H
+
+/* SOC specific definations */
+#define KW88F6281_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6281_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination*/
+#define CONFIG_SYS_TCLK         200000000 /* 200MHz */
+
+#endif /* _ASM_ARCH_KW88F6281_H */
include/asm-arm/arch-kirkwood/serial.h new file +89 -0

89 lines not on this page · raw message

include/asm-arm/arch-kirkwood/spi.h new file +39 -0
new file mode 100644
index 0000000..0fd9131
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Derived from drivers/spi/mpc8xxx_spi.c
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef __KW_SPI_H__
+#define __KW_SPI_H__
+
+/* SPI Registers on kirkwood SOC */
+#define KW_REG_SPI_CTRL		KW_REGISTER(0x10600)
+#define KW_REG_SPI_CONFIG	KW_REGISTER(0x10604)
+#define KW_REG_SPI_DATA_OUT	KW_REGISTER(0x10608)
+#define KW_REG_SPI_DATA_IN	KW_REGISTER(0x1060c)
+#define KW_REG_SPI_IRQ_CAUSE	KW_REGISTER(0x10610)
+#define KW_REG_SPI_IRQ_MASK	KW_REGISTER(0x10614)
+
+#define KW_SPI_TIMEOUT		10000
+#endif __KW_SPI_H__
include/asm-arm/cache.h new file +41 -0

41 lines not on this page · raw message

include/asm-arm/config.h +4 -0
index 049c44e..5d52f15 100644
@@ -21,4 +21,8 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
+#if defined (CONFIG_KIRKWOOD)
+#include <asm-arm/arch-kirkwood/kirkwood.h>
+#endif /* CONFIG_KIRKWOOD */
+
 #endif
include/common.h +1 -0
index 30fff7d..9e4b859 100644
@@ -294,6 +294,7 @@ void	pciinfo	      (int, int);
 #endif
 #endif
 
+int	arch_misc_init (void);
 int	misc_init_f   (void);
 int	misc_init_r   (void);
 
lib_arm/board.c +4 -0
index 5d05d9b..b8db60d 100644
@@ -393,6 +393,10 @@ void start_armboot (void)
 
 	console_init_r ();	/* fully init console as a device */
 
+#if defined(CONFIG_ARCH_MISC_INIT)
+	/* miscellaneous arch dependent initialisations */
+	arch_misc_init ();
+#endif
 #if defined(CONFIG_MISC_INIT_R)
 	/* miscellaneous platform dependent initialisations */
 	misc_init_r ();
Signature · 1 line
1.5.3.4
#1 lore raw

PATCH v6 1/1 Marvell Kirkwood family SOC support

cpu/arm926ejs/kirkwood/cpu.c line 244

Quoted 8 lines
cpu/arm926ejs/kirkwood/cpu.c new file +8 -0
+#ifdef CONFIG_KIRKWOOD_EGIGA_INIT
+	/*
+	 * Set egiga port0/1 in normal functional mode
+	 * This is required becasue on kirkwood by default ports are in reset mode
+	 * OS egiga driver may not have provision to set them in normal mode
+	 * and if u-boot is build without network support, network may fail at OS level
+	 */
+	reg = readl((KW_EGIGA0_BASE + 0x44c));	/* PORT_SERIAL_CONTROL1_REG */

so please define it and use it

Quoted 22 lines
cpu/arm926ejs/kirkwood/cpu.c new file +17 -0
+	reg &= ~(1 << 4);	/* Clear PortReset Bit */
+	writel(reg, (KW_EGIGA0_BASE + 0x44c));	/* PORT_SERIAL_CONTROL1_REG */
+	reg = readl((KW_EGIGA1_BASE + 0x44c));	/* PORT_SERIAL_CONTROL1_REG */
+	reg &= ~(1 << 4);	/* Clear PortReset Bit */
+	writel(reg, (KW_EGIGA1_BASE + 0x44c));	/* PORT_SERIAL_CONTROL1_REG */
+#endif
+#ifdef CONFIG_KIRKWOOD_PCIE_INIT
+	/*
+	 * Enable PCI Express Port0
+	 */
+	reg = readl(KW_REG_CPU_CTRL_STAT);
+	reg |= (1 << 0);		/* Set PEX0En Bit */
+	writel(reg, KW_REG_CPU_CTRL_STAT);
+#endif
+	return 0;
+}
+#endif /* CONFIG_ARCH_CPU_INIT */
include/asm-arm/config.h +0 -0
index 049c44e..5d52f15 100644

include/asm-arm/config.h line 26

Quoted 6 lines
include/asm-arm/config.h +3 -0
@@ -21,4 +21,8 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
+#if defined (CONFIG_KIRKWOOD)
+#include <asm-arm/arch-kirkwood/kirkwood.h>
+#endif /* CONFIG_KIRKWOOD */

a header must only be include in the file that need it please remove from here

include/common.h void pciinfo (int, int); · line 297

Quoted 11 lines
include/asm-arm/config.h +1 -0
+
 #endif
include/common.h +1 -0
index 30fff7d..9e4b859 100644
@@ -294,6 +294,7 @@ void	pciinfo	      (int, int);
 #endif
 #endif
 
+int	arch_misc_init (void);

please move to include/asm-arm/u-boot-arm.h

Best Regards,
J.

#2 lore raw

PATCH v6 1/1 Marvell Kirkwood family SOC support

Dear Jean-Christophe PLAGNIOL-VILLARD,

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

include/common.h void pciinfo (int, int); · line 297

Quoted 10 lines
include/common.h +1 -0
index 30fff7d..9e4b859 100644
@@ -294,6 +294,7 @@ void	pciinfo	      (int, int);
 #endif
 #endif
 
+int	arch_misc_init (void);

please move to include/asm-arm/u-boot-arm.h

This change request makes no sense to me. Please leave as is.

Best regards,

Wolfgang Denk

Signature · 4 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
"I refuse to have a battle of wits with an unarmed person."
#3 lore raw

PATCH v6 1/1 Marvell Kirkwood family SOC support

Quoted 12 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 9 lines
include/common.h +0 -0
index 30fff7d..9e4b859 100644
@@ -294,6 +294,7 @@ void	pciinfo	      (int, int);
 #endif
 #endif
 
Quoted 4 lines
Quoted 2 lines

include/common.h void pciinfo (int, int); · line 297

Quoted 1 line
include/common.h +1 -0
+int	arch_misc_init (void);

please move to include/asm-arm/u-boot-arm.h

This change request makes no sense to me. Please leave as is.

all other arm specific init are already store there so for me it's make sense to have them all store at the same place

Best Regards,
J.

#4 lore raw

PATCH v6 1/1 Marvell Kirkwood family SOC support

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Quoted 2 lines

please move to include/asm-arm/u-boot-arm.h

This change request makes no sense to me. Please leave as is.

all other arm specific init are already store there so for me it's make sense to have them all store at the same place

arch_misc_init() is not exactly ARM specific. It might as well be used by other architectures (ievenif this is currently not the case).

Best regards,

Wolfgang Denk

Signature · 4 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
Objects in mirror are closer than they appear.
#5 lore raw

PATCH v6 1/1 Marvell Kirkwood family SOC support

Quoted 16 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Tuesday, May 05, 2009 4:21 AM
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Prafulla Wadaskar; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v6] Marvell Kirkwood family SOC support

Dear Jean-Christophe PLAGNIOL-VILLARD,

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

please move to include/asm-arm/u-boot-arm.h

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

This change request makes no sense to me. Please leave as is.

all other arm specific init are already store there so for me it's make sense to have them all store at the same place

arch_misc_init() is not exactly ARM specific. It might as well be used by other architectures (ievenif this is currently not the case).

I agree with Wolfgang on this.
arch_misc_init() can be used by any architecture.
It may not be currently used by other architectures. Same applies for arch_cpu_init() too

Regards..
Prafulla . .

#6 lore raw

PATCH v6 1/1 Marvell Kirkwood family SOC support

Quoted 32 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de
[mailto:u-boot-bounces at lists.denx.de] On Behalf Of Prafulla Wadaskar
Sent: Tuesday, May 05, 2009 11:41 AM
To: Wolfgang Denk; Jean-Christophe PLAGNIOL-VILLARD
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v6] Marvell Kirkwood family SOC support

Quoted 8 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Tuesday, May 05, 2009 4:21 AM
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Prafulla Wadaskar; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v6] Marvell Kirkwood family SOC support

Quoted 8 lines

Dear Jean-Christophe PLAGNIOL-VILLARD,

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

please move to include/asm-arm/u-boot-arm.h

This change request makes no sense to me. Please leave as is.

all other arm specific init are already store there so

for me it's

Quoted 2 lines
Quoted 1 line

make sense to have them all store at the same place

Quoted 8 lines
Quoted 1 line

arch_misc_init() is not exactly ARM specific. It might as

well be used

Quoted 1 line

by other architectures (ievenif this is currently not the case).

I agree with Wolfgang on this.
arch_misc_init() can be used by any architecture.
It may not be currently used by other architectures. Same applies for arch_cpu_init() too

Hi Jean,
For my next patch I am not changing for arch_misc_init(), i.e. keeping it in common.h There are other architectures (non ARM too) using cpu_init() declared in their respective headers. It make more sense to move them to common.h along with newly defined arch_cpu_init(). Shall I do this as a part of this patch? Or separate patch?

Regards..
Prafulla . .

Quoted 9 lines

Regards..
Prafulla . .

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

#7 lore raw

PATCH v7 1/1 Marvell Kirkwood family SOC support

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

SOC versions supported:-
1) 88F6281-A0 define CONFIG_KW88F6281_A0
2) 88F6192-A0 define CONFIG_KW88F6192_A0

Other supported features:-
1) get_random_hex() fucntion
2) SPI port controller driver
3) PCI Express port initialization

Contributors:
Yotam Admon <[email protected]>
Michael Blostein <michaelbl at marvell.com

---
Change log:
v2: crated arch-kirkwood and moved some header files there renamed and moved spi.c to drivers/spi/
renamed and moved serial.c to drivers/serial/ doimage utility removed
soc_init.S renamed as lowlevel_init.S
debug prints removed

v3: lowlevel_init.S converted to lowlevel_init.c removed BITxx macros, removed entire assembly code Added CONFIG_ARCH_LOWLEVE_INIT support for arm926ejs core updated as per review commens for v2

v4: updated as per review comments for v3 print_cpuinfo used to display Soc info arch_misc_init support created and used for lib_arm mandatory readl/write macros used
asm/cache.h asm/arch/spi.h asm//arch/serial.h created and used

v5: updated as per review comments for v4
cosmetic updates, arch_misc_init and arch_cpu_init used
start.S updated to call arch_lowlevel_init in case if lowlevl_init is skipped bug fix in cpu.c

v6: lowlevel_init.S removed code moved under arch_cpu_init

v7: include <asm/arch/kirkwood.h> added to each c file reference removed from include/asm/config.h arch_misc_init defination kept as it is in include/common.h bugfixed in get_random_hex function

 cpu/arm926ejs/kirkwood/Makefile           |   48 +++++
 cpu/arm926ejs/kirkwood/config.mk          |   25 +++
 cpu/arm926ejs/kirkwood/cpu.c              |  297 +++++++++++++++++++++++++++++
 cpu/arm926ejs/kirkwood/cpu.h              |  103 ++++++++++
 cpu/arm926ejs/kirkwood/dram.c             |   58 ++++++
 cpu/arm926ejs/kirkwood/timer.c            |  160 ++++++++++++++++
 drivers/serial/Makefile                   |    1 +
 drivers/serial/kirkwood_serial.c          |  129 +++++++++++++
 drivers/spi/Makefile                      |    1 +
 drivers/spi/kirkwood_spi.c                |  168 ++++++++++++++++
 include/asm-arm/arch-kirkwood/kirkwood.h  |  117 +++++++++++
 include/asm-arm/arch-kirkwood/kw88f6192.h |   37 ++++
 include/asm-arm/arch-kirkwood/kw88f6281.h |   37 ++++
 include/asm-arm/arch-kirkwood/serial.h    |   89 +++++++++
 include/asm-arm/arch-kirkwood/spi.h       |   39 ++++
 include/asm-arm/cache.h                   |   41 ++++
 include/common.h                          |    1 +
 lib_arm/board.c                           |    4 +
 18 files changed, 1355 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/kirkwood/Makefile
 create mode 100644 cpu/arm926ejs/kirkwood/config.mk
 create mode 100644 cpu/arm926ejs/kirkwood/cpu.c
 create mode 100644 cpu/arm926ejs/kirkwood/cpu.h
 create mode 100644 cpu/arm926ejs/kirkwood/dram.c
 create mode 100644 cpu/arm926ejs/kirkwood/timer.c
 create mode 100644 drivers/serial/kirkwood_serial.c
 create mode 100644 drivers/spi/kirkwood_spi.c
 create mode 100644 include/asm-arm/arch-kirkwood/kirkwood.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6192.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6281.h
 create mode 100644 include/asm-arm/arch-kirkwood/serial.h
 create mode 100644 include/asm-arm/arch-kirkwood/spi.h
 create mode 100644 include/asm-arm/cache.h
cpu/arm926ejs/kirkwood/Makefile new file +48 -0
new file mode 100644
index 0000000..ef1176e
@@ -0,0 +1,48 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <[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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS-y	= dram.o
+COBJS-y	+= cpu.o
+COBJS-y	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm926ejs/kirkwood/config.mk new file +25 -0
new file mode 100644
index 0000000..000eeb4
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <[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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+PLATFORM_CPPFLAGS += -march=armv5te
cpu/arm926ejs/kirkwood/cpu.c new file +297 -0

297 lines not on this page · raw message

cpu/arm926ejs/kirkwood/cpu.h new file +103 -0

103 lines not on this page · raw message

cpu/arm926ejs/kirkwood/dram.c new file +58 -0

58 lines not on this page · raw message

cpu/arm926ejs/kirkwood/timer.c new file +160 -0

160 lines not on this page · raw message

drivers/serial/Makefile +1 -0
index 14c818d..9174ec6 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libserial.a
 COBJS-$(CONFIG_ARM_DCC) += arm_dcc.o
 COBJS-$(CONFIG_AT91RM9200_USART) += at91rm9200_usart.o
 COBJS-$(CONFIG_ATMEL_USART) += atmel_usart.o
+COBJS-$(CONFIG_KIRKWOOD_SERIAL) += kirkwood_serial.o
 COBJS-$(CONFIG_MCFUART) += mcfuart.o
 COBJS-$(CONFIG_NS9750_UART) += ns9750_serial.o
 COBJS-$(CONFIG_SYS_NS16550) += ns16550.o
drivers/serial/kirkwood_serial.c new file +129 -0

129 lines not on this page · raw message

drivers/spi/Makefile +1 -0
index 1350f3e..7ffa47d 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi.a
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
drivers/spi/kirkwood_spi.c new file +168 -0

168 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kirkwood.h new file +117 -0

117 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kw88f6192.h new file +37 -0
new file mode 100644
index 0000000..000fc16
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6192 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CONFIG_KW88F6192_H
+#define _CONFIG_KW88F6192_H
+
+/* SOC specific definations */
+#define KW88F6192_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6192_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination */
+#define CONFIG_SYS_TCLK         166000000 /* 166MHz */
+
+#endif /* _CONFIG_KW88F6192_H */
include/asm-arm/arch-kirkwood/kw88f6281.h new file +37 -0
new file mode 100644
index 0000000..270d931
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6281 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _ASM_ARCH_KW88F6281_H
+#define _ASM_ARCH_KW88F6281_H
+
+/* SOC specific definations */
+#define KW88F6281_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6281_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination*/
+#define CONFIG_SYS_TCLK         200000000 /* 200MHz */
+
+#endif /* _ASM_ARCH_KW88F6281_H */
include/asm-arm/arch-kirkwood/serial.h new file +89 -0

89 lines not on this page · raw message

include/asm-arm/arch-kirkwood/spi.h new file +39 -0
new file mode 100644
index 0000000..d8fcb86
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Derived from drivers/spi/mpc8xxx_spi.c
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef __KW_SPI_H__
+#define __KW_SPI_H__
+
+/* SPI Registers on kirkwood SOC */
+#define KW_REG_SPI_CTRL		KW_REGISTER(0x10600)
+#define KW_REG_SPI_CONFIG	KW_REGISTER(0x10604)
+#define KW_REG_SPI_DATA_OUT	KW_REGISTER(0x10608)
+#define KW_REG_SPI_DATA_IN	KW_REGISTER(0x1060c)
+#define KW_REG_SPI_IRQ_CAUSE	KW_REGISTER(0x10610)
+#define KW_REG_SPI_IRQ_MASK	KW_REGISTER(0x10614)
+
+#define KW_SPI_TIMEOUT		10000
+#endif /* __KW_SPI_H__ */
include/asm-arm/cache.h new file +41 -0

41 lines not on this page · raw message

include/common.h +1 -0
index 30fff7d..9e4b859 100644
@@ -294,6 +294,7 @@ void	pciinfo	      (int, int);
 #endif
 #endif
 
+int	arch_misc_init (void);
 int	misc_init_f   (void);
 int	misc_init_r   (void);
 
lib_arm/board.c +4 -0
index 5d05d9b..b8db60d 100644
@@ -393,6 +393,10 @@ void start_armboot (void)
 
 	console_init_r ();	/* fully init console as a device */
 
+#if defined(CONFIG_ARCH_MISC_INIT)
+	/* miscellaneous arch dependent initialisations */
+	arch_misc_init ();
+#endif
 #if defined(CONFIG_MISC_INIT_R)
 	/* miscellaneous platform dependent initialisations */
 	misc_init_r ();
Signature · 1 line
1.5.3.3
#8 lore raw

PATCH v7 1/1 Marvell Kirkwood family SOC support

cpu/arm926ejs/kirkwood/cpu.h

Quoted 10 lines
cpu/arm926ejs/kirkwood/cpu.c new file +9 -0
+
+	icache_enable();
+	/* Change reset vector to address 0x0 */
+	temp = get_cr();
+	set_cr(temp & ~CR_V);
+
+	return 0;
+}
+#endif /* CONFIG_ARCH_MISC_INIT */
cpu/arm926ejs/kirkwood/cpu.h +0 -0

please move to include/asm-arm/arch-kirkwood/

Quoted 41 lines

new file mode 100644
index 0000000..d36835b

cpu/arm926ejs/kirkwood/cpu.h new file +36 -0
@@ -0,0 +1,103 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _KWCPU_H
+#define _KWCPU_H
+
+#include <asm/system.h>
+
+#ifndef __ASSEMBLY__
+
+#define KWGBE_PORT_SERIAL_CONTROL1_REG(_x)	\
+		((_x ? KW_EGIGA0_BASE : KW_EGIGA1_BASE) + 0x44c)
+
+enum memory_bank {
+	BANK0,

....

cpu/arm926ejs/kirkwood/cpu.h

Quoted 11 lines
cpu/arm926ejs/kirkwood/cpu.h new file +11 -0
+void serial_putc(const char c)
+{
+	if (c == '\n')
+		kw_uart_putc('\r');
+
+	kw_uart_putc(c);
+}
+
+int serial_getc(void)
+{
+	while ((p_uart_port->lsr & LSR_DR) == 0) ;

while(!serial_tstc());

Quoted 46 lines
cpu/arm926ejs/kirkwood/cpu.h new file +46 -0
+	return (p_uart_port->rbr);
+}
+
+int serial_tstc(void)
+{
+	return ((p_uart_port->lsr & LSR_DR) != 0);
+}
+
+void serial_setbrg(void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+
+	int clock_divisor = (CONFIG_SYS_TCLK / 16) / gd->baudrate;
+
+	p_uart_port->ier = 0x00;
+	p_uart_port->lcr = LCR_DIVL_EN;	/* Access baud rate */
+	p_uart_port->dll = clock_divisor & 0xff;	/* 9600 baud */
+	p_uart_port->dlm = (clock_divisor >> 8) & 0xff;
+	p_uart_port->lcr = LCR_8N1;	/* 8 data, 1 stop, no parity */
+	/* Clear & enable FIFOs */
+	p_uart_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR;
+	return;
+}
+
+void serial_puts(const char *s)
+{
+	while (*s) {
+		serial_putc(*s++);
+	}
+}
+
+#ifdef CONFIG_CMD_KGDB
+void kgdb_serial_init(void)
+{
+}
+
+void putDebugChar(int c)
+{
+	serial_putc(c);
+}
+
+void putDebugStr(const char *str)
+{
+	serial_puts(str);
+}
+

cpu/arm926ejs/kirkwood/cpu.h

Quoted 10 lines
cpu/arm926ejs/kirkwood/cpu.h new file +10 -0
+int getDebugChar(void)
+{
+	return serial_getc();
+}
+
+void kgdb_interruptible(int yes)
+{
+	return;
+}
+#endif /* CONFIG_CMD_KGDB */

no need please remove the KGBD support as the does not support it

Quoted 12 lines
drivers/spi/Makefile +1 -0
index 1350f3e..7ffa47d 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi.a
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o

...

Quoted 32 lines
include/asm-arm/arch-kirkwood/kirkwood.h new file +26 -0
new file mode 100644
index 0000000..0e6e0be
@@ -0,0 +1,117 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for the Marvell's Feroceon CPU core.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+

include/asm-arm/arch-kirkwood/kirkwood.h line 36

Quoted 10 lines
include/asm-arm/arch-kirkwood/kirkwood.h new file +10 -0
+#ifndef _ASM_ARCH_KIRKWOOD_H
+#define _ASM_ARCH_KIRKWOOD_H
+
+#ifndef __ASSEMBLY__
+#include <asm/types.h>
+#include <asm/io.h>
+#endif /* __ASSEMBLY__ */
+
+#if defined (CONFIG_FEROCEON_88FR131) || defined (CONFIG_SHEEVA_88SV131)
+#include <../cpu/arm926ejs/kirkwood/cpu.h>

as mention upper include/asm/arch/cpu.h

include/asm-arm/arch-kirkwood/kirkwood.h line 110

Quoted 5 lines
include/asm-arm/arch-kirkwood/kirkwood.h new file +4 -0
+
 
+
+#if defined (CONFIG_KW88F6281)
+#include "kw88f6281.h"

please use <include/asm/arch/kw88f6281.h>

include/asm-arm/arch-kirkwood/kirkwood.h line 112

Quoted 2 lines
include/asm-arm/arch-kirkwood/kirkwood.h new file +2 -0
+#endif /* CONFIG_KW88F6281 */
+#if defined (CONFIG_KW88F6192)

please use elif as they will not be include together

Quoted 1 line

+#include "kw88f6192.h"

please use <include/asm/arch/kw88f6192.h>

include/asm-arm/arch-kirkwood/kw88f6192.h

Quoted 7 lines
include/asm-arm/arch-kirkwood/kirkwood.h new file +4 -0
+#endif /* CONFIG_KW88F6192 */
+
+#endif /* CONFIG_FEROCEON_88FR131 */
+#endif /* _ASM_ARCH_KIRKWOOD_H */
include/asm-arm/arch-kirkwood/kw88f6192.h new file +0 -0
new file mode 100644
index 0000000..000fc16

Best Regards,
J.

#9 lore raw

PATCH v7 1/1 Marvell Kirkwood family SOC support

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 4 lines
cpu/arm926ejs/kirkwood/cpu.c new file +4 -0
+unsigned char get_random_hex(void)
+{
+	int i;
+	u32 inbuf[16];

cpu/arm926ejs/kirkwood/cpu.c line 56

Quoted 10 lines
cpu/arm926ejs/kirkwood/cpu.c new file +10 -0
+	u8 outbuf[16];
+
+	/*
+	 * in case of 88F6281/88F6192 A0,
+	 * Bit7 need to reset to generate random values in KW_REG_UNDOC_0x1470
+	 * Soc reg offsets KW_REG_UNDOC_0x1470 and KW_REG_UNDOC_0x1478 are reserved regs and
+	 * Does not have names at this moment (no errata available)
+	 */
+	writel(readl(KW_REG_UNDOC_0x1478) & ~(1 << 7), KW_REG_UNDOC_0x1478);
+	for (i = 0; i < 16; i++) {

either use a #define'd name instead of the repeated 16, or use sizeof(inbuf), but don't hard-code the same constant in multiple places. This is calling for inconsistency.

Quoted 3 lines
drivers/serial/kirkwood_serial.c new file +0 -0
@@ -0,0 +1,129 @@

...
...

Quoted 30 lines
drivers/serial/kirkwood_serial.c new file +30 -0
+static void kw_uart_putc(u8 c)
+{
+	while ((p_uart_port->lsr & LSR_THRE) == 0) ;
+	p_uart_port->thr = c;
+	return;
+}
+
+void serial_putc(const char c)
+{
+	if (c == '\n')
+		kw_uart_putc('\r');
+
+	kw_uart_putc(c);
+}
+
+int serial_getc(void)
+{
+	while ((p_uart_port->lsr & LSR_DR) == 0) ;
+	return (p_uart_port->rbr);
+}
+
+int serial_tstc(void)
+{
+	return ((p_uart_port->lsr & LSR_DR) != 0);
+}
+
+void serial_setbrg(void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+

drivers/serial/kirkwood_serial.c line 95

Quoted 10 lines
drivers/serial/kirkwood_serial.c new file +10 -0
+	int clock_divisor = (CONFIG_SYS_TCLK / 16) / gd->baudrate;
+
+	p_uart_port->ier = 0x00;
+	p_uart_port->lcr = LCR_DIVL_EN;	/* Access baud rate */
+	p_uart_port->dll = clock_divisor & 0xff;	/* 9600 baud */
+	p_uart_port->dlm = (clock_divisor >> 8) & 0xff;
+	p_uart_port->lcr = LCR_8N1;	/* 8 data, 1 stop, no parity */
+	/* Clear & enable FIFOs */
+	p_uart_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR;
+	return;

Please use I/O accessors instead of all trhese raw register accesses.

drivers/serial/kirkwood_serial.c

Quoted 4 lines
drivers/serial/kirkwood_serial.c new file +4 -0
+/* SOC specific definations */
+#define INTREG_BASE			0xd0000000
+#define KW_REGISTER(x)			(KW_REGS_PHY_BASE | x)
+#define KW_OFFSET_REG			(INTREG_BASE | 0x20080)

You want to perform a "base + offset" addition, so please write this as an addition and not as a logical operation! But...

Quoted 55 lines
drivers/serial/kirkwood_serial.c new file +55 -0
+/* undocumented registers */
+#define KW_REG_UNDOC_0x1470		(KW_REGISTER(0x1470))
+#define KW_REG_UNDOC_0x1478		(KW_REGISTER(0x1478))
+
+#define KW_UART0_BASE			(KW_REGISTER(0x12000))	/* UArt 0 */
+#define KW_UART1_BASE			(KW_REGISTER(0x13000))	/* UArt 1 */
+
+/* Controler environment registers offsets */
+#define KW_REG_MPP_CONTROL0		(KW_REGISTER(0x10000))
+#define KW_REG_MPP_CONTROL1		(KW_REGISTER(0x10004))
+#define KW_REG_MPP_CONTROL2		(KW_REGISTER(0x10008))
+#define KW_REG_MPP_CONTROL3		(KW_REGISTER(0x1000C))
+#define KW_REG_MPP_CONTROL4		(KW_REGISTER(0x10010))
+#define KW_REG_MPP_CONTROL5		(KW_REGISTER(0x10014))
+#define KW_REG_MPP_CONTROL6		(KW_REGISTER(0x10018))
+#define KW_REG_MPP_SMPL_AT_RST		(KW_REGISTER(0x10030))
+#define KW_REG_DEVICE_ID		(KW_REGISTER(0x10034))
+#define KW_REG_MPP_OUT_DRV_REG		(KW_REGISTER(0x100E0))
+
+#define KW_REG_GPP0_DATA_OUT		(KW_REGISTER(0x10100))
+#define KW_REG_GPP0_DATA_OUT_EN		(KW_REGISTER(0x10104))
+#define KW_REG_GPP0_BLINK_EN		(KW_REGISTER(0x10108))
+#define KW_REG_GPP0_DATA_IN_POL		(KW_REGISTER(0x1010C))
+#define KW_REG_GPP0_DATA_IN		(KW_REGISTER(0x10110))
+#define KW_REG_GPP0_INT_CAUSE		(KW_REGISTER(0x10114))
+#define KW_REG_GPP0_INT_MASK		(KW_REGISTER(0x10118))
+#define KW_REG_GPP0_INT_LVL		(KW_REGISTER(0x1011c))
+
+#define KW_REG_GPP1_DATA_OUT		(KW_REGISTER(0x10140))
+#define KW_REG_GPP1_DATA_OUT_EN		(KW_REGISTER(0x10144))
+#define KW_REG_GPP1_BLINK_EN		(KW_REGISTER(0x10148))
+#define KW_REG_GPP1_DATA_IN_POL		(KW_REGISTER(0x1014C))
+#define KW_REG_GPP1_DATA_IN		(KW_REGISTER(0x10150))
+#define KW_REG_GPP1_INT_CAUSE		(KW_REGISTER(0x10154))
+#define KW_REG_GPP1_INT_MASK		(KW_REGISTER(0x10158))
+#define KW_REG_GPP1_INT_LVL		(KW_REGISTER(0x1015c))
+
+#define KW_REG_NAND_READ_PARAM		(KW_REGISTER(0x10418))
+#define KW_REG_NAND_WRITE_PARAM		(KW_REGISTER(0x1041c))
+#define KW_REG_NAND_CTRL		(KW_REGISTER(0x10470))
+
+#define KW_REG_WIN_CTRL(x)		(KW_REGISTER((0x20000 + (x * 0x10))))
+#define KW_REG_WIN_BASE(x)		(KW_REGISTER((0x20004 + (x * 0x10))))
+#define KW_REG_WIN_REMAP_LOW(x)		(KW_REGISTER((0x20008 + (x * 0x10))))
+#define KW_REG_WIN_REMAP_HIGH(x)	(KW_REGISTER((0x2000c + (x * 0x10))))
+
+#define KW_REG_CPU_CONFIG		(KW_REGISTER(0x20100))
+#define KW_REG_CPU_CTRL_STAT		(KW_REGISTER(0x20104))
+#define KW_REG_CPU_RSTOUTN_MASK		(KW_REGISTER(0x20108))
+#define KW_REG_CPU_SYS_SOFT_RST		(KW_REGISTER(0x2010C))
+#define KW_REG_CPU_AHB_MBUS_CAUSE_INT	(KW_REGISTER(0x20110))
+#define KW_REG_CPU_AHB_MBUS_MASK_INT	(KW_REGISTER(0x20114))
+#define KW_REG_CPU_FTDLL_CONFIG		(KW_REGISTER(0x20120))
+#define KW_REG_CPU_L2_CONFIG		(KW_REGISTER(0x20128))
+#define KW_REG_L2_RAM_TIMING0		(KW_REGISTER(0x20134))

drivers/serial/kirkwood_serial.c

Quoted 10 lines
drivers/serial/kirkwood_serial.c new file +10 -0
+#define KW_REG_L2_RAM_TIMING1		(KW_REGISTER(0x20138))
+
+#define KW_REG_TMR_CTRL			(KW_REGISTER(0x20300))
+#define KW_REG_TMR_RELOAD		(KW_REGISTER(0x20310))
+#define KW_REG_TMR_VAL			(KW_REGISTER(0x20314))
+
+#define KW_REG_PCIE_BASE		(KW_REGISTER(0x40000))
+
+#define KW_EGIGA0_BASE			(KW_REGISTER(0x72000))
+#define KW_EGIGA1_BASE			(KW_REGISTER(0x76000))

... please get rid of all these register offsets and use C structs instead, as has been discussed here a couple of times recently.

...

Quoted 2 lines

+++ b/include/asm-arm/arch-kirkwood/serial.h

drivers/serial/kirkwood_serial.c new file +0 -0
@@ -0,0 +1,89 @@

...

Quoted 9 lines
drivers/serial/kirkwood_serial.c new file +9 -0
+/* This structure describes the registers offsets for one UART port/channel */
+struct kw_uart_port {
+	u8 rbr;			/* 0 = 0-3 */
+	u8 pad1[3];
+	u8 ier;			/* 1 = 4-7 */
+	u8 pad2[3];
+	u8 fcr;			/* 2 = 8-b */
+	u8 pad3[3];
+	u8 lcr;			/* 3 = c-f */

drivers/serial/kirkwood_serial.c

Quoted 10 lines
drivers/serial/kirkwood_serial.c new file +10 -0
+	u8 pad4[3];
+	u8 mcr;			/* 4 = 10-13 */
+	u8 pad5[3];
+	u8 lsr;			/* 5 = 14-17 */
+	u8 pad6[3];
+	u8 msr;			/* 6 =18-1b */
+	u8 pad7[3];
+	u8 scr;			/* 7 =1c-1f */
+	u8 pad8[3];
+};

Come on. Why does this have to be a separate header file? Does this not look very much the same like a zillion of other UARTs Why cannot you simply use "include/ns16550.h" instead?

Heck. Why do you need your own serial driver at all? I bet the standard 16550 driver just works fine for you, too.

Best regards,

Wolfgang Denk

Signature · 4 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
Mistakes are often the stepping stones to utter failure.
#10 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

SOC versions supported:-
1) 88F6281-A0 define CONFIG_KW88F6281_A0
2) 88F6192-A0 define CONFIG_KW88F6192_A0

Other supported features:-
1) get_random_hex() fucntion
2) SPI port controller driver
3) PCI Express port initialization
4) Mpp configuration support

Contributors:
Yotam Admon <[email protected]>
Michael Blostein <michaelbl at marvell.com

---
Change log:
v2: crated arch-kirkwood and moved some header files there renamed and moved spi.c to drivers/spi/
renamed and moved serial.c to drivers/serial/ doimage utility removed
soc_init.S renamed as lowlevel_init.S
debug prints removed

v3: lowlevel_init.S converted to lowlevel_init.c removed BITxx macros, removed entire assembly code Added CONFIG_ARCH_LOWLEVE_INIT support for arm926ejs core updated as per review commens for v2

v4: updated as per review comments for v3 print_cpuinfo used to display Soc info arch_misc_init support created and used for lib_arm mandatory readl/write macros used
asm/cache.h asm/arch/spi.h asm//arch/serial.h created and used

v5: updated as per review comments for v4
cosmetic updates, arch_misc_init and arch_cpu_init used
start.S updated to call arch_lowlevel_init in case if lowlevl_init is skipped bug fix in cpu.c

v6: lowlevel_init.S removed code moved under arch_cpu_init

v7: include <asm/arch/kirkwood.h> added to each c file reference removed from include/asm/config.h arch_misc_init defination kept as it is in include/common.h bugfixed in get_random_hex function

v7.1: u-boot.lds moved from board specific to kirkwood

v8: mpp configuration added
u-boot.lsd and config.mk removed
serial driver removed and used ns16550
register offsets replaced by c struct
updated as per review comments for v7

 cpu/arm926ejs/kirkwood/Makefile           |   49 +++++
 cpu/arm926ejs/kirkwood/cpu.c              |  311 +++++++++++++++++++++++++++++
 cpu/arm926ejs/kirkwood/dram.c             |   58 ++++++
 cpu/arm926ejs/kirkwood/mpp.c              |   80 ++++++++
 cpu/arm926ejs/kirkwood/timer.c            |  173 ++++++++++++++++
 drivers/serial/serial.c                   |    3 +
 drivers/spi/Makefile                      |    1 +
 drivers/spi/kirkwood_spi.c                |  169 ++++++++++++++++
 include/asm-arm/arch-kirkwood/cpu.h       |  142 +++++++++++++
 include/asm-arm/arch-kirkwood/kirkwood.h  |   67 ++++++
 include/asm-arm/arch-kirkwood/kw88f6192.h |   37 ++++
 include/asm-arm/arch-kirkwood/kw88f6281.h |   37 ++++
 include/asm-arm/arch-kirkwood/mpp.h       |  303 ++++++++++++++++++++++++++++
 include/asm-arm/arch-kirkwood/spi.h       |   39 ++++
 include/asm-arm/cache.h                   |   41 ++++
 include/common.h                          |    1 +
 lib_arm/board.c                           |    4 +
 17 files changed, 1515 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/kirkwood/Makefile
 create mode 100644 cpu/arm926ejs/kirkwood/cpu.c
 create mode 100644 cpu/arm926ejs/kirkwood/dram.c
 create mode 100644 cpu/arm926ejs/kirkwood/mpp.c
 create mode 100644 cpu/arm926ejs/kirkwood/timer.c
 create mode 100644 drivers/spi/kirkwood_spi.c
 create mode 100644 include/asm-arm/arch-kirkwood/cpu.h
 create mode 100644 include/asm-arm/arch-kirkwood/kirkwood.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6192.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6281.h
 create mode 100644 include/asm-arm/arch-kirkwood/mpp.h
 create mode 100644 include/asm-arm/arch-kirkwood/spi.h
 create mode 100644 include/asm-arm/cache.h
cpu/arm926ejs/kirkwood/Makefile new file +49 -0
new file mode 100644
index 0000000..b966ea1
@@ -0,0 +1,49 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <[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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS-y	= dram.o
+COBJS-y	+= cpu.o
+COBJS-y	+= mpp.o
+COBJS-y	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm926ejs/kirkwood/cpu.c new file +311 -0

311 lines not on this page · raw message

cpu/arm926ejs/kirkwood/dram.c new file +58 -0

58 lines not on this page · raw message

cpu/arm926ejs/kirkwood/mpp.c new file +80 -0

80 lines not on this page · raw message

cpu/arm926ejs/kirkwood/timer.c new file +173 -0

173 lines not on this page · raw message

drivers/serial/serial.c +3 -0
index 966df9a..dd5f332 100644
@@ -27,6 +27,9 @@
 #ifdef CONFIG_NS87308
 #include <ns87308.h>
 #endif
+#ifdef CONFIG_KIRKWOOD
+#include <asm/arch/kirkwood.h>
+#endif
 
 #if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
drivers/spi/Makefile +1 -0
index 1350f3e..7ffa47d 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi.a
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
drivers/spi/kirkwood_spi.c new file +169 -0

169 lines not on this page · raw message

include/asm-arm/arch-kirkwood/cpu.h new file +142 -0

142 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kirkwood.h new file +67 -0

67 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kw88f6192.h new file +37 -0
new file mode 100644
index 0000000..000fc16
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6192 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CONFIG_KW88F6192_H
+#define _CONFIG_KW88F6192_H
+
+/* SOC specific definations */
+#define KW88F6192_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6192_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination */
+#define CONFIG_SYS_TCLK         166000000 /* 166MHz */
+
+#endif /* _CONFIG_KW88F6192_H */
include/asm-arm/arch-kirkwood/kw88f6281.h new file +37 -0
new file mode 100644
index 0000000..270d931
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6281 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _ASM_ARCH_KW88F6281_H
+#define _ASM_ARCH_KW88F6281_H
+
+/* SOC specific definations */
+#define KW88F6281_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6281_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination*/
+#define CONFIG_SYS_TCLK         200000000 /* 200MHz */
+
+#endif /* _ASM_ARCH_KW88F6281_H */
include/asm-arm/arch-kirkwood/mpp.h new file +303 -0

303 lines not on this page · raw message

include/asm-arm/arch-kirkwood/spi.h new file +39 -0
new file mode 100644
index 0000000..d8fcb86
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Derived from drivers/spi/mpc8xxx_spi.c
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef __KW_SPI_H__
+#define __KW_SPI_H__
+
+/* SPI Registers on kirkwood SOC */
+#define KW_REG_SPI_CTRL		KW_REGISTER(0x10600)
+#define KW_REG_SPI_CONFIG	KW_REGISTER(0x10604)
+#define KW_REG_SPI_DATA_OUT	KW_REGISTER(0x10608)
+#define KW_REG_SPI_DATA_IN	KW_REGISTER(0x1060c)
+#define KW_REG_SPI_IRQ_CAUSE	KW_REGISTER(0x10610)
+#define KW_REG_SPI_IRQ_MASK	KW_REGISTER(0x10614)
+
+#define KW_SPI_TIMEOUT		10000
+#endif /* __KW_SPI_H__ */
include/asm-arm/cache.h new file +41 -0

41 lines not on this page · raw message

include/common.h +1 -0
index 30fff7d..9e4b859 100644
@@ -294,6 +294,7 @@ void	pciinfo	      (int, int);
 #endif
 #endif
 
+int	arch_misc_init (void);
 int	misc_init_f   (void);
 int	misc_init_r   (void);
 
lib_arm/board.c +4 -0
index e081fbc..5c3bfec 100644
@@ -399,6 +399,10 @@ void start_armboot (void)
 
 	console_init_r ();	/* fully init console as a device */
 
+#if defined(CONFIG_ARCH_MISC_INIT)
+	/* miscellaneous arch dependent initialisations */
+	arch_misc_init ();
+#endif
 #if defined(CONFIG_MISC_INIT_R)
 	/* miscellaneous platform dependent initialisations */
 	misc_init_r ();
Signature · 1 line
1.5.3.3
#11 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Dear Prafulla Wadaskar,

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

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

...

Quoted 8 lines

+/*
+ * Window Size
+ * Used with the Base register to set the address window size and location.
+ * Must be programmed from LSB to MSB as sequence of 1???s followed by
+ * sequence of 0???s. The number of 1???s specifies the size of the window in
+ * 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte).
+ * NOTE: A value of 0x0 specifies 64-KByte size.
+ */

You have a number of strange special characters here. Please try and restrict yourself to plain ASCII text in normal C comments.

cpu/arm926ejs/kirkwood/cpu.c line 82

Quoted 3 lines
cpu/arm926ejs/kirkwood/cpu.c new file +3 -0
+	for (i = 0; i < (sizeval / 0x10000); i++) {
+		j |= (1 << i);
+	}

No curly braces for single line statements, please.

Quoted 10 lines
cpu/arm926ejs/kirkwood/cpu.c new file +10 -0
+}
+
+/* prepares data to be loaded in win_Ctrl register */
+#define KWCPU_WIN_CTRL_DATA(size, target, attr, en)	(en | (target << 4)	\
+			| (attr << 8) | (kw_winctrl_calcsize(size) << 16))
+
+/*
+ * kw_config_adr_windows - Configure address Windows
+ *
+ * There are 7 address windows supported by Kirkwood Soc to addess different

cpu/arm926ejs/kirkwood/cpu.c line 103

Quoted 10 lines
cpu/arm926ejs/kirkwood/cpu.c new file +10 -0
+ * devices. Each window can be configured for size, BAR and remap addr
+ * Below configuration is standard for most of the cases
+ *
+ * Reference Documentation:
+ * Mbus-L to Mbus Bridge Registers Configuration.
+ * (Sec 25.1 and 25.3 of Datasheet)
+ */
+int kw_config_adr_windows(void)
+{
+	struct kwwin_registers *winregs = (struct kwwin_registers *)KW_CPU_WIN_BASE;

Line too long.

cpu/arm926ejs/kirkwood/cpu.c line 170

Quoted 7 lines
cpu/arm926ejs/kirkwood/cpu.c new file +7 -0
+/*
+ * kw_config_gpio - GPIO configuration
+ */
+void kw_config_gpio(u32 gpp0_oe_val, u32 gpp1_oe_val, u32 gpp0_oe, u32 gpp1_oe)
+{
+	struct kwgpio_registers *gpio0reg = (struct kwgpio_registers *)KW_GPIO0_BASE;
+	struct kwgpio_registers *gpio1reg = (struct kwgpio_registers *)KW_GPIO1_BASE;

More too long lines. Pleasse check everywhere.

cpu/arm926ejs/kirkwood/cpu.c line 176

Quoted 5 lines
cpu/arm926ejs/kirkwood/cpu.c new file +5 -0
+	/* Init GPIOS to default values as per board requirement */
+	writel(gpp0_oe_val, (u32)&gpio0reg->dout);
+	writel(gpp1_oe_val, (u32)&gpio1reg->dout);
+	writel(gpp0_oe, (u32)&gpio0reg->oe);
+	writel(gpp1_oe, (u32)&gpio1reg->oe);

Why are you using these casts here? The whole purpose of using a C struct to access device registers is to enable type checking by the C compiler, but you sabotage this with these casts. Please don't do that.

Why are you using these casts here? The whole purpose of using a C struct to access device registers is to enable type checking by the C compiler, but you sabotage this with these casts. Please don't do that. This comment applies to the whole patch.

...

cpu/arm926ejs/kirkwood/timer.c line 164

Quoted 2 lines
cpu/arm926ejs/kirkwood/timer.c new file +2 -0
+	cntmrctrl = readl(CNTMR_CTRL_REG);
+	cntmrctrl |= CTCR_ARM_TIMER_EN(UBOOT_CNTR);	/* enable cnt\timer */

Are you sure you want to have a TAB character in this comment? What's
"cnt imer" ? :-)

drivers/serial/serial.c line 32

Quoted 11 lines
drivers/serial/serial.c +3 -0
index 966df9a..dd5f332 100644
@@ -27,6 +27,9 @@
 #ifdef CONFIG_NS87308
 #include <ns87308.h>
 #endif
+#ifdef CONFIG_KIRKWOOD
+#include <asm/arch/kirkwood.h>
+#endif

What exactly is this needed for?

Quoted 66 lines
drivers/serial/serial.c +0 -0
 #if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
drivers/spi/Makefile +1 -0
index 1350f3e..7ffa47d 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi.a
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
drivers/spi/kirkwood_spi.c new file +46 -0
new file mode 100644
index 0000000..e0c4f0a
@@ -0,0 +1,169 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Derived from drivers/spi/mpc8xxx_spi.c
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <spi.h>
+#include <asm/arch/kirkwood.h>
+#include <asm/arch/spi.h>
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+				  unsigned int max_hz, unsigned int mode)
+{
+	struct spi_slave *slave;
+	u32 data;
+	u32 *mppreg = (u32 *)KW_MPP_BASE;
+
+	if (!spi_cs_is_valid(bus, cs))
+		return NULL;
+
+	slave = malloc(sizeof(struct spi_slave));
+	if (!slave)
+		return NULL;
+

drivers/spi/kirkwood_spi.c line 56

Quoted 10 lines
drivers/spi/kirkwood_spi.c new file +10 -0
+	slave->bus = bus;
+	slave->cs = cs;
+
+	writel(0x00000002, KW_REG_SPI_CTRL);
+	/* program spi clock prescaller using max_hz */
+	data = ((CONFIG_SYS_TCLK / 2) / max_hz) & 0x0000000f;
+	debug("data = 0x%08x \n", data);
+	writel(0x00000210 | data, KW_REG_SPI_CONFIG);
+	writel(0x00000001, KW_REG_SPI_IRQ_CAUSE);
+	writel(0x00000000, KW_REG_SPI_IRQ_MASK);

What does these magic constants mean?

drivers/spi/kirkwood_spi.c line 64

Quoted 7 lines
drivers/spi/kirkwood_spi.c new file +7 -0
+	/* program mpp registers to select  SPI_CSn */
+	if (cs)
+		writel((readl((u32)&mppreg[0]) & 0x0fffffff) |
+		       0x20000000, (u32)&mppreg[0]);
+	else
+		writel((readl((u32)&mppreg[0]) & 0xfffffff0) |
+		       0x00000002, (u32)&mppreg[0]);

Ot these?

Quoted 2 lines
drivers/spi/kirkwood_spi.c new file +2 -0
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+	     void *din, unsigned long flags)

...

drivers/spi/kirkwood_spi.c line 146

Quoted 7 lines
drivers/spi/kirkwood_spi.c new file +7 -0
+		for (tm = 0, isread = 0; tm < KW_SPI_TIMEOUT; ++tm) {
+			if (readl(KW_REG_SPI_IRQ_CAUSE)) {
+				isread = 1;
+				tmpdin = readl(KW_REG_SPI_DATA_IN);
+				debug
+				    ("*** spi_xfer: din %08X ... %08x read\n",
+				     din, tmpdin);

Indentation by TABs only, please.

Quoted 9 lines
drivers/spi/kirkwood_spi.c new file +9 -0
+#define INTREG_BASE			0xd0000000
+#define KW_REGISTER(x)			(KW_REGS_PHY_BASE + x)
+#define KW_OFFSET_REG			(INTREG_BASE + 0x20080)
+
+/* undocumented registers */
+#define KW_REG_UNDOC_0x1470		(KW_REGISTER(0x1470))
+#define KW_REG_UNDOC_0x1478		(KW_REGISTER(0x1478))
+
+#define KW_UART0_BASE			(KW_REGISTER(0x12000))

drivers/spi/kirkwood_spi.c

Quoted 10 lines
drivers/spi/kirkwood_spi.c new file +10 -0
+#define KW_UART1_BASE			(KW_REGISTER(0x13000))
+#define KW_MPP_BASE			(KW_REGISTER(0x10000))
+#define KW_GPIO0_BASE			(KW_REGISTER(0x10100))
+#define KW_GPIO1_BASE			(KW_REGISTER(0x10140))
+#define KW_CPU_WIN_BASE			(KW_REGISTER(0x20000))
+#define KW_CPU_REG_BASE			(KW_REGISTER(0x20100))
+#define KW_TIMER_BASE			(KW_REGISTER(0x20300))
+#define KW_REG_PCIE_BASE		(KW_REGISTER(0x40000))
+#define KW_EGIGA0_BASE			(KW_REGISTER(0x72000))
+#define KW_EGIGA1_BASE			(KW_REGISTER(0x76000))

Use a C struct?

Best regards,

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
"One lawyer can steal more than a hundred men with guns."
- The Godfather
#12 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Dear Wolfgand Denk

Thanks for your review comments

Quoted 25 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Wednesday, May 20, 2009 3:29 AM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

Dear Prafulla Wadaskar,

In message

Quoted 3 lines · <[email protected]> you wrote:

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

...

Quoted 3 lines

+/*
+ * Window Size
+ * Used with the Base register to set the address window

size and location.

Quoted 1 line

+ * Must be programmed from LSB to MSB as sequence of 1???s

followed

Quoted 2 lines

+by
+ * sequence of 0???s. The number of 1???s specifies the

size of the

Quoted 8 lines
Quoted 2 lines

+window in
+ * 64 KByte granularity (e.g., a value of 0x00FF specifies

256 = 16 MByte).

Quoted 2 lines

+ * NOTE: A value of 0x0 specifies 64-KByte size.
+ */

You have a number of strange special characters here. Please try and restrict yourself to plain ASCII text in normal C comments.

I checked the patch that I send across and associated source code too. I didn?t find the above special chars in it
I am using git-send-email to send the patches and vim as my editor I wonder how these special characters appeared in the patch !!!! I will check this issue with my system admin

Quoted 6 lines

cpu/arm926ejs/kirkwood/cpu.c line 82

Quoted 4 lines
cpu/arm926ejs/kirkwood/cpu.c new file +3 -0
+	for (i = 0; i < (sizeval / 0x10000); i++) {
+		j |= (1 << i);
+	}

No curly braces for single line statements, please.

Sorry missed this one, corrected..

Quoted 10 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	struct kwwin_registers *winregs = (struct kwwin_registers 
+*)KW_CPU_WIN_BASE;

Line too long.

Review

Quoted 4 lines
(quoted diff) +4 -0
+/*
+ * kw_config_gpio - GPIO configuration  */ void kw_config_gpio(u32 
+gpp0_oe_val, u32 gpp1_oe_val, u32 gpp0_oe, u32 gpp1_oe) {
+	struct kwgpio_registers *gpio0reg = (struct 

kwgpio_registers *)KW_GPIO0_BASE;

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	struct kwgpio_registers *gpio1reg = (struct kwgpio_registers 
+*)KW_GPIO1_BASE;

More too long lines. Pleasse check everywhere.

Generally I execute Lindent, I missed it this time, I will do it

Quoted 7 lines

cpu/arm926ejs/kirkwood/cpu.c line 176

Quoted 2 lines
cpu/arm926ejs/kirkwood/cpu.c new file +2 -0
+	writel(gpp0_oe, (u32)&gpio0reg->oe);
+	writel(gpp1_oe, (u32)&gpio1reg->oe);

Why are you using these casts here? The whole purpose of using a C struct to access device registers is to enable type checking by the C compiler, but you sabotage this with these casts. Please don't do that. This comment applies to the whole patch.

This was done to remove build warnings in some context I will remove them

Quoted 8 lines

...

Review

Quoted 2 lines
(quoted diff) +2 -0
+	cntmrctrl = readl(CNTMR_CTRL_REG);
+	cntmrctrl |= CTCR_ARM_TIMER_EN(UBOOT_CNTR);	/* 

enable cnt\timer */

Are you sure you want to have a TAB character in this comment? What's
"cnt imer" ? :-)

Not really :-) it was for counter/timer, slash was a confusion. Removed....

Quoted 15 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/drivers/serial/serial.c index

drivers/serial/serial.c line 32

Quoted 10 lines

966df9a..dd5f332 100644

drivers/serial/serial.c +3 -0
@@ -27,6 +27,9 @@
 #ifdef CONFIG_NS87308
 #include <ns87308.h>
 #endif
+#ifdef CONFIG_KIRKWOOD
+#include <asm/arch/kirkwood.h>
+#endif

What exactly is this needed for?

CONFIG_SYS_NS16550_CLK is defined as CONFIG_SYS_TCLK which defined in the soc specific header file

In my earlier versions I had included arch specific header file in board_config header file But in the review comments it has asked to remove
Hence above include is done

Quoted 10 lines

drivers/serial/serial.c

Quoted 7 lines
drivers/serial/serial.c +7 -0
+	writel(0x00000002, KW_REG_SPI_CTRL);
+	/* program spi clock prescaller using max_hz */
+	data = ((CONFIG_SYS_TCLK / 2) / max_hz) & 0x0000000f;
+	debug("data = 0x%08x \n", data);
+	writel(0x00000210 | data, KW_REG_SPI_CONFIG);
+	writel(0x00000001, KW_REG_SPI_IRQ_CAUSE);
+	writel(0x00000000, KW_REG_SPI_IRQ_MASK);

What does these magic constants mean?

Quoted 9 lines

drivers/serial/serial.c

Quoted 7 lines
drivers/serial/serial.c +7 -0
+	/* program mpp registers to select  SPI_CSn */
+	if (cs)
+		writel((readl((u32)&mppreg[0]) & 0x0fffffff) |
+		       0x20000000, (u32)&mppreg[0]);
+	else
+		writel((readl((u32)&mppreg[0]) & 0xfffffff0) |
+		       0x00000002, (u32)&mppreg[0]);

Ot these?

I will provide definitions for magic numbers

Quoted 12 lines
Quoted 2 lines

+int spi_xfer(struct spi_slave *slave, unsigned int bitlen,

const void *dout,

Quoted 1 line
drivers/serial/serial.c +1 -0
+	     void *din, unsigned long flags)

...

drivers/serial/serial.c

Quoted 6 lines
drivers/serial/serial.c +6 -0
+		for (tm = 0, isread = 0; tm < KW_SPI_TIMEOUT; ++tm) {
+			if (readl(KW_REG_SPI_IRQ_CAUSE)) {
+				isread = 1;
+				tmpdin = readl(KW_REG_SPI_DATA_IN);
+				debug
+				    ("*** spi_xfer: din %08X 

... %08x read\n",

Quoted 3 lines

drivers/serial/serial.c

Quoted 1 line
drivers/serial/serial.c +1 -0
+				     din, tmpdin);

Indentation by TABs only, please.

Indentation is done by Lindent.
Do you mean to do it manually?

Quoted 14 lines
Quoted 14 lines
drivers/serial/serial.c +13 -0
+#define INTREG_BASE			0xd0000000
+#define KW_REGISTER(x)			(KW_REGS_PHY_BASE + x)
+#define KW_OFFSET_REG			(INTREG_BASE + 0x20080)
+
+/* undocumented registers */
+#define KW_REG_UNDOC_0x1470		(KW_REGISTER(0x1470))
+#define KW_REG_UNDOC_0x1478		(KW_REGISTER(0x1478))
+
+#define KW_UART0_BASE			(KW_REGISTER(0x12000))
+#define KW_UART1_BASE			(KW_REGISTER(0x13000))
+#define KW_MPP_BASE			(KW_REGISTER(0x10000))
+#define KW_GPIO0_BASE			(KW_REGISTER(0x10100))
+#define KW_GPIO1_BASE			(KW_REGISTER(0x10140))
Quoted 8 lines

drivers/serial/serial.c

Quoted 6 lines
drivers/serial/serial.c +6 -0
+#define KW_CPU_WIN_BASE			(KW_REGISTER(0x20000))
+#define KW_CPU_REG_BASE			(KW_REGISTER(0x20100))
+#define KW_TIMER_BASE			(KW_REGISTER(0x20300))
+#define KW_REG_PCIE_BASE		(KW_REGISTER(0x40000))
+#define KW_EGIGA0_BASE			(KW_REGISTER(0x72000))
+#define KW_EGIGA1_BASE			(KW_REGISTER(0x76000))

Use a C struct?

These are the Base address referred by register structures. Generally this type of declaration used for other cpu/socs. May you point any reference for this?

Regards..
Prafulla . .

Quoted 14 lines

Best regards,

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 "One lawyer can steal more than a hundred men with guns."
- The Godfather
#13 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Quoted 22 lines
Quoted 14 lines
Quoted 14 lines
include/asm-arm/arch-kirkwood/kirkwood.h new file +13 -0
+#define INTREG_BASE			0xd0000000
+#define KW_REGISTER(x)			(KW_REGS_PHY_BASE + x)
+#define KW_OFFSET_REG			(INTREG_BASE + 0x20080)
+
+/* undocumented registers */
+#define KW_REG_UNDOC_0x1470		(KW_REGISTER(0x1470))
+#define KW_REG_UNDOC_0x1478		(KW_REGISTER(0x1478))
+
+#define KW_UART0_BASE			(KW_REGISTER(0x12000))
+#define KW_UART1_BASE			(KW_REGISTER(0x13000))
+#define KW_MPP_BASE			(KW_REGISTER(0x10000))
+#define KW_GPIO0_BASE			(KW_REGISTER(0x10100))
+#define KW_GPIO1_BASE			(KW_REGISTER(0x10140))
Quoted 8 lines

include/asm-arm/arch-kirkwood/kirkwood.h line 57

Quoted 6 lines
include/asm-arm/arch-kirkwood/kirkwood.h new file +6 -0
+#define KW_CPU_WIN_BASE			(KW_REGISTER(0x20000))
+#define KW_CPU_REG_BASE			(KW_REGISTER(0x20100))
+#define KW_TIMER_BASE			(KW_REGISTER(0x20300))
+#define KW_REG_PCIE_BASE		(KW_REGISTER(0x40000))
+#define KW_EGIGA0_BASE			(KW_REGISTER(0x72000))
+#define KW_EGIGA1_BASE			(KW_REGISTER(0x76000))

Use a C struct?

Quoted 3 lines

These are the Base address referred by register structures. Generally this type of declaration used for other cpu/socs. May you point any reference for this?

Hi Wolfgang Denk
I have almost done with other changes except this one Do this really need to be converted C struct? I will have to put some efforts to get it done :-(.

Regards..
Prafulla . .

#14 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Dear Prafulla,

Quoted 1 line · In message <[email protected]>…

...

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

include/asm-arm/arch-kirkwood/kirkwood.h line 57

Quoted 2 lines
include/asm-arm/arch-kirkwood/kirkwood.h new file +2 -0
+#define KW_EGIGA0_BASE			(KW_REGISTER(0x72000))
+#define KW_EGIGA1_BASE			(KW_REGISTER(0x76000))

Use a C struct?

These are the Base address referred by register structures.

I am aware of this.

Quoted 1 line
Quoted 1 line

Generally this type of declaration used for other cpu/socs.

Well, "generally" is a weak argument - you find examples for both. Coming from the PowerPC world, and haveing been using the code these sinde > 10 years, I'm more accustomed to see something like a big IMMR sturcture here.

Quoted 2 lines

I have almost done with other changes except this one Do this really need to be converted C struct?

No, you do not *have* to. That's why I asked it as a question. If I had to write the code, I would use a C struct, and I think it would be easier to read.

But I don't insist on such a change. You can find arguments for both solutions, so decide what deems best for you.

Quoted 1 line

I will have to put some efforts to get it done :-(.

Well, changing it would actually be trivial. But as mentioned above: I don't insist. It's largely a matter of taste, I think.

Best regards,

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
"If people are good only because they fear punishment, and  hope  for
reward, then we are a sorry lot indeed."            - Albert Einstein
#15 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Quoted 20 lines

...

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+#define KW_EGIGA0_BASE

(KW_REGISTER(0x72000))

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+#define KW_EGIGA1_BASE

(KW_REGISTER(0x76000))

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

Use a C struct?

These are the Base address referred by register structures.

I am aware of this.

Quoted 1 line
Quoted 1 line

Generally this type of declaration used for other cpu/socs.

Well, "generally" is a weak argument - you find examples for both. Coming from the PowerPC world, and haveing been using the code these sinde > 10 years, I'm more accustomed to see something like a big IMMR sturcture here.

Quoted 1 line

I have almost done with other changes except this one Do

this really

Quoted 8 lines
Quoted 1 line

need to be converted C struct?

No, you do not *have* to. That's why I asked it as a question. If I had to write the code, I would use a C struct, and I think it would be easier to read.

But I don't insist on such a change. You can find arguments for both solutions, so decide what deems best for you.

Hi Wolfgang
There is always scope for improvements and one should do it. Just to sync current kirkwood code with other arm architectures, I will keep the registers offset definitions as it is.

I appreciate your suggestions, I will take care for future coding

Thanks and regards...
Prafulla . .

#16 lore raw

PATCH v9 1/1 Marvell Kirkwood family SOC support

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

SOC versions supported:-
1) 88F6281-A0 define CONFIG_KW88F6281_A0
2) 88F6192-A0 define CONFIG_KW88F6192_A0

Other supported features:-
1) get_random_hex() fucntion
2) SPI port controller driver
3) PCI Express port initialization

Contributors:
Yotam Admon <[email protected]>
Michael Blostein <michaelbl at marvell.com

---
Change log:
v2: crated arch-kirkwood and moved some header files there renamed and moved spi.c to drivers/spi/
renamed and moved serial.c to drivers/serial/ doimage utility removed
soc_init.S renamed as lowlevel_init.S
debug prints removed

v3: lowlevel_init.S converted to lowlevel_init.c removed BITxx macros, removed entire assembly code Added CONFIG_ARCH_LOWLEVE_INIT support for arm926ejs core updated as per review commens for v2

v4: updated as per review comments for v3 print_cpuinfo used to display Soc info arch_misc_init support created and used for lib_arm mandatory readl/write macros used
asm/cache.h asm/arch/spi.h asm//arch/serial.h created and used

v5: updated as per review comments for v4
cosmetic updates, arch_misc_init and arch_cpu_init used
start.S updated to call arch_lowlevel_init in case if lowlevl_init is skipped bug fix in cpu.c

v6: lowlevel_init.S removed code moved under arch_cpu_init

v7: include <asm/arch/kirkwood.h> added to each c file reference removed from include/asm/config.h arch_misc_init defination kept as it is in include/common.h bugfixed in get_random_hex function

v7.1: u-boot.lds moved from board specific to kirkwood

v8: mpp configuration added
u-boot.lsd and config.mk removed
serial driver removed and used ns16550
register offsets replaced by c struct
updated as per review comments for v7

v9: updated as per v8 review comments
removed all (u32) typecasts
spi driver bugfix and magic constants removed
tabs used for all indentation

 cpu/arm926ejs/kirkwood/Makefile           |   49 +++++
 cpu/arm926ejs/kirkwood/cpu.c              |  316 +++++++++++++++++++++++++++++
 cpu/arm926ejs/kirkwood/dram.c             |   58 ++++++
 cpu/arm926ejs/kirkwood/mpp.c              |   80 ++++++++
 cpu/arm926ejs/kirkwood/timer.c            |  168 +++++++++++++++
 drivers/serial/serial.c                   |    3 +
 drivers/spi/Makefile                      |    1 +
 drivers/spi/kirkwood_spi.c                |  185 +++++++++++++++++
 include/asm-arm/arch-kirkwood/cpu.h       |  142 +++++++++++++
 include/asm-arm/arch-kirkwood/kirkwood.h  |   68 ++++++
 include/asm-arm/arch-kirkwood/kw88f6192.h |   37 ++++
 include/asm-arm/arch-kirkwood/kw88f6281.h |   37 ++++
 include/asm-arm/arch-kirkwood/mpp.h       |  303 +++++++++++++++++++++++++++
 include/asm-arm/arch-kirkwood/spi.h       |   56 +++++
 include/asm-arm/cache.h                   |   41 ++++
 include/common.h                          |    1 +
 lib_arm/board.c                           |    4 +
 17 files changed, 1549 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/kirkwood/Makefile
 create mode 100644 cpu/arm926ejs/kirkwood/cpu.c
 create mode 100644 cpu/arm926ejs/kirkwood/dram.c
 create mode 100644 cpu/arm926ejs/kirkwood/mpp.c
 create mode 100644 cpu/arm926ejs/kirkwood/timer.c
 create mode 100644 drivers/spi/kirkwood_spi.c
 create mode 100644 include/asm-arm/arch-kirkwood/cpu.h
 create mode 100644 include/asm-arm/arch-kirkwood/kirkwood.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6192.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6281.h
 create mode 100644 include/asm-arm/arch-kirkwood/mpp.h
 create mode 100644 include/asm-arm/arch-kirkwood/spi.h
 create mode 100644 include/asm-arm/cache.h
cpu/arm926ejs/kirkwood/Makefile new file +49 -0
new file mode 100644
index 0000000..b966ea1
@@ -0,0 +1,49 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <[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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS-y	= dram.o
+COBJS-y	+= cpu.o
+COBJS-y	+= mpp.o
+COBJS-y	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm926ejs/kirkwood/cpu.c new file +316 -0

316 lines not on this page · raw message

cpu/arm926ejs/kirkwood/dram.c new file +58 -0

58 lines not on this page · raw message

cpu/arm926ejs/kirkwood/mpp.c new file +80 -0

80 lines not on this page · raw message

cpu/arm926ejs/kirkwood/timer.c new file +168 -0

168 lines not on this page · raw message

drivers/serial/serial.c +3 -0
index 966df9a..dd5f332 100644
@@ -27,6 +27,9 @@
 #ifdef CONFIG_NS87308
 #include <ns87308.h>
 #endif
+#ifdef CONFIG_KIRKWOOD
+#include <asm/arch/kirkwood.h>
+#endif
 
 #if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
drivers/spi/Makefile +1 -0
index 1350f3e..7ffa47d 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi.a
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
drivers/spi/kirkwood_spi.c new file +185 -0

185 lines not on this page · raw message

include/asm-arm/arch-kirkwood/cpu.h new file +142 -0

142 lines not on this page · raw message

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

68 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kw88f6192.h new file +37 -0
new file mode 100644
index 0000000..a2b1f96
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6192 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CONFIG_KW88F6192_H
+#define _CONFIG_KW88F6192_H
+
+/* SOC specific definations */
+#define KW88F6192_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6192_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination */
+#define CONFIG_SYS_TCLK	  166000000 /* 166MHz */
+
+#endif /* _CONFIG_KW88F6192_H */
include/asm-arm/arch-kirkwood/kw88f6281.h new file +37 -0
new file mode 100644
index 0000000..9b89b93
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6281 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _ASM_ARCH_KW88F6281_H
+#define _ASM_ARCH_KW88F6281_H
+
+/* SOC specific definations */
+#define KW88F6281_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6281_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination*/
+#define CONFIG_SYS_TCLK	  200000000 /* 200MHz */
+
+#endif /* _ASM_ARCH_KW88F6281_H */
include/asm-arm/arch-kirkwood/mpp.h new file +303 -0

303 lines not on this page · raw message

include/asm-arm/arch-kirkwood/spi.h new file +56 -0

56 lines not on this page · raw message

include/asm-arm/cache.h new file +41 -0

41 lines not on this page · raw message

include/common.h +1 -0
index 30fff7d..9e4b859 100644
@@ -294,6 +294,7 @@ void	pciinfo	      (int, int);
 #endif
 #endif
 
+int	arch_misc_init (void);
 int	misc_init_f   (void);
 int	misc_init_r   (void);
 
lib_arm/board.c +4 -0
index e081fbc..5c3bfec 100644
@@ -399,6 +399,10 @@ void start_armboot (void)
 
 	console_init_r ();	/* fully init console as a device */
 
+#if defined(CONFIG_ARCH_MISC_INIT)
+	/* miscellaneous arch dependent initialisations */
+	arch_misc_init ();
+#endif
 #if defined(CONFIG_MISC_INIT_R)
 	/* miscellaneous platform dependent initialisations */
 	misc_init_r ();
Signature · 1 line
1.5.3.3
#17 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 10 lines · In message <[email protected]>…
Quoted 8 lines

drivers/spi/kirkwood_spi.c

Quoted 4 lines
drivers/spi/kirkwood_spi.c new file +3 -0
+				tmpdin = readl(KW_REG_SPI_DATA_IN);
+				debug
+				    ("*** spi_xfer: din %08X 

... %08x read\n",

drivers/spi/kirkwood_spi.c line 146

Quoted 1 line
drivers/spi/kirkwood_spi.c new file +1 -0
+				     din, tmpdin);

Indentation by TABs only, please.

Indentation is done by Lindent.
Do you mean to do it manually?

Yes, please, if Lindent does it wrong ...

Best regards,

Wolfgang Denk

Signature · 4 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
Our business is run on trust.  We trust you will pay in advance.
#18 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Indentation by TABs only, please.

Indentation is done by Lindent.
Do you mean to do it manually?

Yes, please, if Lindent does it wrong ...

Done in V9 :-)

Regards..
Prafulla . .

#19 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

In reply to Prafulla Wadaskar
Quoted 46 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de
[mailto:u-boot-bounces at lists.denx.de] On Behalf Of Prafulla Wadaskar
Sent: Wednesday, May 20, 2009 2:30 PM
To: Wolfgang Denk
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

Dear Wolfgand Denk

Thanks for your review comments

Quoted 31 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Wednesday, May 20, 2009 3:29 AM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

Dear Prafulla Wadaskar,

In message

Quoted 3 lines · <[email protected]> you wrote:

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

...

Quoted 3 lines

+/*
+ * Window Size
+ * Used with the Base register to set the address window

size and location.

Quoted 1 line

+ * Must be programmed from LSB to MSB as sequence of 1???s

followed

Quoted 2 lines

+by
+ * sequence of 0???s. The number of 1???s specifies the

size of the

Quoted 2 lines

+window in
+ * 64 KByte granularity (e.g., a value of 0x00FF specifies

256 = 16 MByte).

Quoted 2 lines

+ * NOTE: A value of 0x0 specifies 64-KByte size.
+ */

Quoted 8 lines
Quoted 1 line

You have a number of strange special characters here.

Please try and

Quoted 1 line

restrict yourself to plain ASCII text in normal C comments.

I checked the patch that I send across and associated source code too. I didn?t find the above special chars in it I am using git-send-email to send the patches and vim as my editor I wonder how these special characters appeared in the patch !!!! I will check this issue with my system admin

Hi Wolfgang Denk
We have discovered the root cause of this problem
I was using apostrophes, those were getting converted to weird
characters by the mailer software (just a guess).
I have replaced then with strings (i.e. "1's" with "ones" and "0's" with "zeros") Of course I will not release a new patch (V11) for this :-)
but I have corrected at my end and will reflect in next patch after review feedback for V10

Thanks for pointing this...

Regards..
Prafulla . .

#20 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

In reply to Prafulla Wadaskar

Hi Prafulla,

Quoted 2 lines · On Tuesday 19 May 2009 22:07:58 Prafulla Wadaskar wrote:

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

I would like to give your Kirkwood support a try and start compiling the latest version before trying to port a custom board. Now I'm failing to compile the latest version posted on the list. Most likely I missed some patches or applied them to the wrong git repository.

I tried it on u-boot/next and on u-boot-arm/next. Both failed. I applied those patches:

[PATCH v8] Marvell Kirkwood family SOC support [PATCH v9] Marvell MV88F6281GTW_GE Board support [PATCH v3] Gbe Controller driver support for kirkwood SOCs

It would be great if you could tell me what I am missing here (additional patches or wrong repository?).

Here the error messages from building with those 3 patches on top of u-boot- arm/next:

[stefan at stefan-desktop u-boot-arm (kirkwood)]$ ./MAKEALL mv88f6281gtw_ge Configuring for mv88f6281gtw_ge board...
mpp.c: In function 'kirkwood_mpp_conf':
mpp.c:53: warning: unused variable 'gpio_mode'
kirkwood_egiga.c: In function 'smi_reg_read':
kirkwood_egiga.c:66: warning: implicit declaration of function 'readl' kirkwood_egiga.c:98: warning: implicit declaration of function 'writel' kirkwood_egiga.c: In function 'set_dram_access':
kirkwood_egiga.c:451: warning: implicit declaration of function 'kw_sdram_bar' kirkwood_egiga.c:452: warning: implicit declaration of function 'kw_sdram_bs' kirkwood_egiga.c: In function 'kirkwood_egiga_initialize':
kirkwood_egiga.c:1593: error: 'KW_EGIGA0_BASE' undeclared (first use in this function)
kirkwood_egiga.c:1593: error: (Each undeclared identifier is reported only once
kirkwood_egiga.c:1593: error: for each function it appears in.) kirkwood_egiga.c:1597: error: 'KW_EGIGA1_BASE' undeclared (first use in this function)
kirkwood_egiga.c:1610: warning: implicit declaration of function 'get_random_hex'

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#21 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Quoted 13 lines

-----Original Message-----
From: Stefan Roese [mailto:sr at denx.de]
Sent: Wednesday, May 20, 2009 5:40 PM
To: u-boot at lists.denx.de
Cc: Prafulla Wadaskar; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

Hi Prafulla,

On Tuesday 19 May 2009 22:07:58 Prafulla Wadaskar wrote:

Quoted 8 lines
Quoted 2 lines

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

I would like to give your Kirkwood support a try and start compiling the latest version before trying to port a custom board. Now I'm failing to compile the latest version posted on the list. Most likely I missed some patches or applied them to the wrong git repository.

Thanks Stefan, your efforts will help me a lot

Quoted 2 lines

I tried it on u-boot/next and on u-boot-arm/next. Both

I have used u-boot-arm/next pls use the same.

Quoted 9 lines

failed. I applied those
patches:

[PATCH v8] Marvell Kirkwood family SOC support [PATCH v9] Marvell MV88F6281GTW_GE Board support [PATCH v3] Gbe Controller driver support for kirkwood SOCs

It would be great if you could tell me what I am missing here (additional patches or wrong repository?).

You will need additional two patches as mentioned below
http://git.denx.de/?p=u-boot/u-boot-blackfin.git;a=commit;h=12cedeb9589ef1203e3308e80b11e5ee73261ced
http://lists.denx.de/pipermail/u-boot/2009-May/052905.html

Apart from this pls add below line to drivers/net/kirkwood_egiga.c remove below mentioned errors #include <asm/arch/kirkwood.h>

I hope build will be through... Best of Luck

Regards..
Prafulla . .

Quoted 44 lines

Here the error messages from building with those 3 patches on top of u-boot-
arm/next:

[stefan at stefan-desktop u-boot-arm (kirkwood)]$ ./MAKEALL mv88f6281gtw_ge Configuring for mv88f6281gtw_ge board... mpp.c: In function 'kirkwood_mpp_conf':
mpp.c:53: warning: unused variable 'gpio_mode' kirkwood_egiga.c: In function 'smi_reg_read':
kirkwood_egiga.c:66: warning: implicit declaration of function 'readl' kirkwood_egiga.c:98: warning: implicit declaration of function 'writel'
kirkwood_egiga.c: In function 'set_dram_access':
kirkwood_egiga.c:451: warning: implicit declaration of function 'kw_sdram_bar'
kirkwood_egiga.c:452: warning: implicit declaration of function 'kw_sdram_bs'
kirkwood_egiga.c: In function 'kirkwood_egiga_initialize':
kirkwood_egiga.c:1593: error: 'KW_EGIGA0_BASE' undeclared (first use in this
function)
kirkwood_egiga.c:1593: error: (Each undeclared identifier is reported only once
kirkwood_egiga.c:1593: error: for each function it appears in.) kirkwood_egiga.c:1597: error: 'KW_EGIGA1_BASE' undeclared (first use in this
function)
kirkwood_egiga.c:1610: warning: implicit declaration of function 'get_random_hex'

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email:
office at denx.de
=====================================================================

#22 lore raw

PATCH v8 1/1 Marvell Kirkwood family SOC support

Quoted 7 lines · On Wednesday 20 May 2009 15:40:00 Prafulla Wadaskar wrote:
Quoted 5 lines

I would like to give your Kirkwood support a try and start compiling the latest version before trying to port a custom board. Now I'm failing to compile the latest version posted on the list. Most likely I missed some patches or applied them to the wrong git repository.

Thanks Stefan, your efforts will help me a lot

Sure. I'll try to help out if possible. But I'm only starting into this project right now. So please don't expect any "real output" soon. But I definitely can give some feedback...

Quoted 3 lines
Quoted 1 line

I tried it on u-boot/next and on u-boot-arm/next. Both

I have used u-boot-arm/next pls use the same.

OK, understood.

Quoted 15 lines
Quoted 9 lines

failed. I applied those
patches:

[PATCH v8] Marvell Kirkwood family SOC support [PATCH v9] Marvell MV88F6281GTW_GE Board support [PATCH v3] Gbe Controller driver support for kirkwood SOCs

It would be great if you could tell me what I am missing here (additional patches or wrong repository?).

You will need additional two patches as mentioned below
http://git.denx.de/?p=u-boot/u-boot-blackfin.git;a=commit;h=12cedeb9589ef12
03e3308e80b11e5ee73261ced
http://lists.denx.de/pipermail/u-boot/2009-May/052905.html

Quoted 4 lines

Apart from this pls add below line to drivers/net/kirkwood_egiga.c remove below mentioned errors #include <asm/arch/kirkwood.h>

I hope build will be through... Best of Luck

Yes, this works. Thanks a lot.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#23 lore raw

PATCH 1/1 Marvell Kirkwood family SOC support

In reply to Prafulla Wadaskar

Kirkwood family controllers are highly integrated SOCs based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

SOC versions supported:-
1) 88F6281-A0 define CONFIG_KW88F6281_A0
2) 88F6192-A0 define CONFIG_KW88F6192_A0

Other supported features:-
1) get_random_hex() fucntion
2) SPI port controller driver
3) PCI Express port initialization

Contributors:
Yotam Admon <[email protected]>
Michael Blostein <michaelbl at marvell.com

---
Change log:
v2: crated arch-kirkwood and moved some header files there renamed and moved spi.c to drivers/spi/
renamed and moved serial.c to drivers/serial/ doimage utility removed
soc_init.S renamed as lowlevel_init.S
debug prints removed

v3: lowlevel_init.S converted to lowlevel_init.c removed BITxx macros, removed entire assembly code Added CONFIG_ARCH_LOWLEVE_INIT support for arm926ejs core updated as per review commens for v2

v4: updated as per review comments for v3 print_cpuinfo used to display Soc info arch_misc_init support created and used for lib_arm mandatory readl/write macros used
asm/cache.h asm/arch/spi.h asm//arch/serial.h created and used

v5: updated as per review comments for v4
cosmetic updates, arch_misc_init and arch_cpu_init used
start.S updated to call arch_lowlevel_init in case if lowlevl_init is skipped bug fix in cpu.c

v6: lowlevel_init.S removed code moved under arch_cpu_init

v7: include <asm/arch/kirkwood.h> added to each c file reference removed from include/asm/config.h arch_misc_init defination kept as it is in include/common.h bugfixed in get_random_hex function

v7.1: u-boot.lds moved from board specific to kirkwood

 cpu/arm926ejs/kirkwood/Makefile           |   48 +++++
 cpu/arm926ejs/kirkwood/config.mk          |    2 +
 cpu/arm926ejs/kirkwood/cpu.c              |  297 +++++++++++++++++++++++++++++
 cpu/arm926ejs/kirkwood/cpu.h              |  103 ++++++++++
 cpu/arm926ejs/kirkwood/dram.c             |   58 ++++++
 cpu/arm926ejs/kirkwood/timer.c            |  160 ++++++++++++++++
 cpu/arm926ejs/kirkwood/u-boot.lds         |   51 +++++
 drivers/serial/Makefile                   |    1 +
 drivers/serial/kirkwood_serial.c          |  129 +++++++++++++
 drivers/spi/Makefile                      |    1 +
 drivers/spi/kirkwood_spi.c                |  168 ++++++++++++++++
 include/asm-arm/arch-kirkwood/kirkwood.h  |  117 +++++++++++
 include/asm-arm/arch-kirkwood/kw88f6192.h |   37 ++++
 include/asm-arm/arch-kirkwood/kw88f6281.h |   37 ++++
 include/asm-arm/arch-kirkwood/serial.h    |   89 +++++++++
 include/asm-arm/arch-kirkwood/spi.h       |   39 ++++
 include/asm-arm/cache.h                   |   41 ++++
 include/common.h                          |    1 +
 lib_arm/board.c                           |    4 +
 19 files changed, 1383 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/kirkwood/Makefile
 create mode 100644 cpu/arm926ejs/kirkwood/config.mk
 create mode 100644 cpu/arm926ejs/kirkwood/cpu.c
 create mode 100644 cpu/arm926ejs/kirkwood/cpu.h
 create mode 100644 cpu/arm926ejs/kirkwood/dram.c
 create mode 100644 cpu/arm926ejs/kirkwood/timer.c
 create mode 100644 cpu/arm926ejs/kirkwood/u-boot.lds
 create mode 100644 drivers/serial/kirkwood_serial.c
 create mode 100644 drivers/spi/kirkwood_spi.c
 create mode 100644 include/asm-arm/arch-kirkwood/kirkwood.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6192.h
 create mode 100644 include/asm-arm/arch-kirkwood/kw88f6281.h
 create mode 100644 include/asm-arm/arch-kirkwood/serial.h
 create mode 100644 include/asm-arm/arch-kirkwood/spi.h
 create mode 100644 include/asm-arm/cache.h
cpu/arm926ejs/kirkwood/Makefile new file +48 -0
new file mode 100644
index 0000000..ef1176e
@@ -0,0 +1,48 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <[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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS-y	= dram.o
+COBJS-y	+= cpu.o
+COBJS-y	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm926ejs/kirkwood/config.mk new file +2 -0
new file mode 100644
index 0000000..b8d9824
@@ -0,0 +1,2 @@
+PLATFORM_CPPFLAGS += -march=armv5te
+LDSCRIPT := $(SRCTREE)/cpu/arm926ejs/kirkwood/u-boot.lds
cpu/arm926ejs/kirkwood/cpu.c new file +297 -0

297 lines not on this page · raw message

cpu/arm926ejs/kirkwood/cpu.h new file +103 -0

103 lines not on this page · raw message

cpu/arm926ejs/kirkwood/dram.c new file +58 -0

58 lines not on this page · raw message

cpu/arm926ejs/kirkwood/timer.c new file +160 -0

160 lines not on this page · raw message

cpu/arm926ejs/kirkwood/u-boot.lds new file +51 -0

51 lines not on this page · raw message

drivers/serial/Makefile +1 -0
index 14c818d..9174ec6 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libserial.a
 COBJS-$(CONFIG_ARM_DCC) += arm_dcc.o
 COBJS-$(CONFIG_AT91RM9200_USART) += at91rm9200_usart.o
 COBJS-$(CONFIG_ATMEL_USART) += atmel_usart.o
+COBJS-$(CONFIG_KIRKWOOD_SERIAL) += kirkwood_serial.o
 COBJS-$(CONFIG_MCFUART) += mcfuart.o
 COBJS-$(CONFIG_NS9750_UART) += ns9750_serial.o
 COBJS-$(CONFIG_SYS_NS16550) += ns16550.o
drivers/serial/kirkwood_serial.c new file +129 -0

129 lines not on this page · raw message

drivers/spi/Makefile +1 -0
index 1350f3e..7ffa47d 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi.a
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
drivers/spi/kirkwood_spi.c new file +168 -0

168 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kirkwood.h new file +117 -0

117 lines not on this page · raw message

include/asm-arm/arch-kirkwood/kw88f6192.h new file +37 -0
new file mode 100644
index 0000000..000fc16
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6192 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CONFIG_KW88F6192_H
+#define _CONFIG_KW88F6192_H
+
+/* SOC specific definations */
+#define KW88F6192_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6192_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination */
+#define CONFIG_SYS_TCLK         166000000 /* 166MHz */
+
+#endif /* _CONFIG_KW88F6192_H */
include/asm-arm/arch-kirkwood/kw88f6281.h new file +37 -0
new file mode 100644
index 0000000..270d931
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6281 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _ASM_ARCH_KW88F6281_H
+#define _ASM_ARCH_KW88F6281_H
+
+/* SOC specific definations */
+#define KW88F6281_REGS_PHYS_BASE	0xf1000000
+#define KW_REGS_PHY_BASE		KW88F6281_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination*/
+#define CONFIG_SYS_TCLK         200000000 /* 200MHz */
+
+#endif /* _ASM_ARCH_KW88F6281_H */
include/asm-arm/arch-kirkwood/serial.h new file +89 -0

89 lines not on this page · raw message

include/asm-arm/arch-kirkwood/spi.h new file +39 -0
new file mode 100644
index 0000000..d8fcb86
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Derived from drivers/spi/mpc8xxx_spi.c
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef __KW_SPI_H__
+#define __KW_SPI_H__
+
+/* SPI Registers on kirkwood SOC */
+#define KW_REG_SPI_CTRL		KW_REGISTER(0x10600)
+#define KW_REG_SPI_CONFIG	KW_REGISTER(0x10604)
+#define KW_REG_SPI_DATA_OUT	KW_REGISTER(0x10608)
+#define KW_REG_SPI_DATA_IN	KW_REGISTER(0x1060c)
+#define KW_REG_SPI_IRQ_CAUSE	KW_REGISTER(0x10610)
+#define KW_REG_SPI_IRQ_MASK	KW_REGISTER(0x10614)
+
+#define KW_SPI_TIMEOUT		10000
+#endif /* __KW_SPI_H__ */
include/asm-arm/cache.h new file +41 -0

41 lines not on this page · raw message

include/common.h +1 -0
index 30fff7d..9e4b859 100644
@@ -294,6 +294,7 @@ void	pciinfo	      (int, int);
 #endif
 #endif
 
+int	arch_misc_init (void);
 int	misc_init_f   (void);
 int	misc_init_r   (void);
 
lib_arm/board.c +4 -0
index 5d05d9b..b8db60d 100644
@@ -393,6 +393,10 @@ void start_armboot (void)
 
 	console_init_r ();	/* fully init console as a device */
 
+#if defined(CONFIG_ARCH_MISC_INIT)
+	/* miscellaneous arch dependent initialisations */
+	arch_misc_init ();
+#endif
 #if defined(CONFIG_MISC_INIT_R)
 	/* miscellaneous platform dependent initialisations */
 	misc_init_r ();
Signature · 1 line
1.5.3.3
#24 lore raw

PATCH 1/1 Marvell Kirkwood family SOC support

Quoted 3 lines

v7.1: u-boot.lds moved from board specific to kirkwood

you can remove the u-boot.lds
and it's reference in cpu/arm926ejs/config.mk as you use the same as the cpu/arm926ejs/u-boot.lds

Best Regards,
J.

#25 lore raw

PATCH v6 1/1 Marvell Kirkwood family SOC support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 9 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/include/asm-arm/config.h index

Quoted 7 lines

049c44e..5d52f15 100644

include/asm-arm/config.h +0 -0
@@ -21,4 +21,8 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
Quoted 5 lines

include/asm-arm/config.h line 26

Quoted 3 lines
include/asm-arm/config.h +3 -0
+#if defined (CONFIG_KIRKWOOD)
+#include <asm-arm/arch-kirkwood/kirkwood.h>
+#endif /* CONFIG_KIRKWOOD */

a header must only be include in the file that need it please remove from here

asm/config.h is included in include/common.h which is automatically generated by make
It makes no sense to keep include/asm-arm/config.h empty.

Regards..
Prafulla . .