Skip to contentSkip to conversation

NDS32: add NDS32 architecture support to u-boot.

PATCH Superseded Macpaul Lin 4 participants 15 messages Jun 11, 2010 – Jun 19, 2010

Subsystems (5)

v1 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

cover NDS32: add NDS32 architecture support to u-boot.

*** BLURB HERE ***

Macpaul Lin (10):
nds32: add nds32 arch with cpu support
nds32: add nds32 arch with include support Add nds32 architecture
with include header files support.
nds32: add nds32 arch with lib support Add nds32 architecture
with generic lib C files support.
nds32: add nds32 board with ag101 support
nds32: add nds32 board with common support Add nds32 based common
board related support.
nds32: add nds32 board with include support Add nds32 based board
with include header files support.
nds32: add nds32 with common support Add nds32 support in generic
u-boot common functions.
nds32: add nds32 with examples support Add nds32 with examples
standalone program support.
nds32: add nds32 with include support Add nds32 support in
generic u-boot and board include header files.
nds32: add nds32 with Makefile support Add nds32 support in
u-boot Makefile.

 Makefile                              |   10 +
 arch/nds32/config.mk                  |   32 ++
 arch/nds32/cpu/Makefile               |   52 ++
 arch/nds32/cpu/config.mk              |   28 ++
 arch/nds32/cpu/cpu.c                  |  171 +++++++
 arch/nds32/cpu/interrupts.c           |  293 +++++++++++
 arch/nds32/cpu/lowlevel_init.S        |  192 ++++++++
 arch/nds32/cpu/n1213s/Makefile        |   53 ++
 arch/nds32/cpu/n1213s/ag101/Makefile  |   50 ++
 arch/nds32/cpu/n1213s/ag101/cpu.c     |  171 +++++++
 arch/nds32/cpu/n1213s/config.mk       |   28 ++
 arch/nds32/cpu/n1213s/interrupts.c    |   27 +
 arch/nds32/cpu/n1213s/lowlevel_init.S |   27 +
 arch/nds32/cpu/n1213s/start.S         |   27 +
 arch/nds32/cpu/start.S                |  456 ++++++++++++++++++
 arch/nds32/cpu/u-boot.lds             |   67 +++
 arch/nds32/include/asm/andesboot.h    |  224 +++++++++
 arch/nds32/include/asm/atomic.h       |  121 +++++
 arch/nds32/include/asm/bitops.h       |  148 ++++++
 arch/nds32/include/asm/byteorder.h    |   36 ++
 arch/nds32/include/asm/config.h       |   24 +
 arch/nds32/include/asm/global_data.h  |   84 ++++
 arch/nds32/include/asm/io.h           |  352 ++++++++++++++
 arch/nds32/include/asm/memory.h       |  141 ++++++
 arch/nds32/include/asm/posix_types.h  |   85 ++++
 arch/nds32/include/asm/processor.h    |  145 ++++++
 arch/nds32/include/asm/ptrace.h       |   51 ++
 arch/nds32/include/asm/ptregs.h       |   83 ++++
 arch/nds32/include/asm/setup.h        |  274 +++++++++++
 arch/nds32/include/asm/string.h       |   57 +++
 arch/nds32/include/asm/types.h        |   84 ++++
 arch/nds32/include/asm/u-boot.h       |   72 +++
 arch/nds32/include/asm/unaligned.h    |   35 ++
 arch/nds32/lib/Makefile               |   53 ++
 arch/nds32/lib/board.c                |  341 +++++++++++++
 arch/nds32/lib/bootm.c                |  209 ++++++++
 board/AndesTech/adp-ag101/Makefile    |   60 +++
 board/AndesTech/adp-ag101/adp-ag101.c |  144 ++++++
 board/AndesTech/adp-ag101/config.mk   |   46 ++
 board/AndesTech/common/env.c          |  138 ++++++
 board/AndesTech/common/flash.c        |  621 ++++++++++++++++++++++++
 board/AndesTech/common/flib_flash.c   |  721 ++++++++++++++++++++++++++++
 board/AndesTech/common/flib_serial.c  |  373 ++++++++++++++
 board/AndesTech/common/fotg2xx.c      |   60 +++
 board/AndesTech/common/ftmac100.c     |  766 +++++++++++++++++++++++++++++
 board/AndesTech/common/ftpci100.c     |  712 +++++++++++++++++++++++++++
 board/AndesTech/common/serial.c       |  141 ++++++
 board/AndesTech/include/andes.h       |   51 ++
 board/AndesTech/include/chipset.h     |  852 +++++++++++++++++++++++++++++++++
 board/AndesTech/include/flib_flash.h  |   87 ++++
 board/AndesTech/include/ftmac100.h    |  257 ++++++++++
 board/AndesTech/include/ftpci100.h    |  238 +++++++++
 board/AndesTech/include/porting.h     |   60 +++
 board/AndesTech/include/serial.h      |  175 +++++++
 board/AndesTech/include/symbol.h      |  107 ++++
 common/cmd_bootm.c                    |    2 +
 common/image.c                        |    1 +
 examples/standalone/nds32.lds         |   64 +++
 examples/standalone/stubs.c           |   17 +-
 examples/standalone/x86-testapp.c     |   12 +
 include/common.h                      |   10 +
 include/configs/adp-ag101.h           |   33 ++
 include/configs/ag101.h               |  265 ++++++++++
 include/image.h                       |    5 +
 include/nds32_common.h                |  214 +++++++++
 include/nds32_n10.h                   |   30 ++
 include/nds32_n12.h                   |   30 ++
 include/nds32_n9.h                    |   30 ++
 68 files changed, 10624 insertions(+), 1 deletions(-)
 create mode 100644 arch/nds32/config.mk
 create mode 100644 arch/nds32/cpu/Makefile
 create mode 100644 arch/nds32/cpu/config.mk
 create mode 100644 arch/nds32/cpu/cpu.c
 create mode 100644 arch/nds32/cpu/interrupts.c
 create mode 100644 arch/nds32/cpu/lowlevel_init.S
 create mode 100644 arch/nds32/cpu/n1213s/Makefile
 create mode 100644 arch/nds32/cpu/n1213s/ag101/Makefile
 create mode 100644 arch/nds32/cpu/n1213s/ag101/cpu.c
 create mode 100644 arch/nds32/cpu/n1213s/config.mk
 create mode 100644 arch/nds32/cpu/n1213s/interrupts.c
 create mode 100644 arch/nds32/cpu/n1213s/lowlevel_init.S
 create mode 100644 arch/nds32/cpu/n1213s/start.S
 create mode 100644 arch/nds32/cpu/start.S
 create mode 100644 arch/nds32/cpu/u-boot.lds
 create mode 100644 arch/nds32/include/asm/andesboot.h
 create mode 100644 arch/nds32/include/asm/atomic.h
 create mode 100644 arch/nds32/include/asm/bitops.h
 create mode 100644 arch/nds32/include/asm/byteorder.h
 create mode 100644 arch/nds32/include/asm/config.h
 create mode 100644 arch/nds32/include/asm/global_data.h
 create mode 100644 arch/nds32/include/asm/io.h
 create mode 100644 arch/nds32/include/asm/memory.h
 create mode 100644 arch/nds32/include/asm/posix_types.h
 create mode 100644 arch/nds32/include/asm/processor.h
 create mode 100644 arch/nds32/include/asm/ptrace.h
 create mode 100644 arch/nds32/include/asm/ptregs.h
 create mode 100644 arch/nds32/include/asm/setup.h
 create mode 100644 arch/nds32/include/asm/string.h
 create mode 100644 arch/nds32/include/asm/types.h
 create mode 100644 arch/nds32/include/asm/u-boot.h
 create mode 100644 arch/nds32/include/asm/unaligned.h
 create mode 100644 arch/nds32/lib/Makefile
 create mode 100644 arch/nds32/lib/board.c
 create mode 100644 arch/nds32/lib/bootm.c
 create mode 100644 board/AndesTech/adp-ag101/Makefile
 create mode 100644 board/AndesTech/adp-ag101/adp-ag101.c
 create mode 100644 board/AndesTech/adp-ag101/config.mk
 create mode 100644 board/AndesTech/common/env.c
 create mode 100644 board/AndesTech/common/flash.c
 create mode 100644 board/AndesTech/common/flib_flash.c
 create mode 100644 board/AndesTech/common/flib_serial.c
 create mode 100644 board/AndesTech/common/fotg2xx.c
 create mode 100644 board/AndesTech/common/ftmac100.c
 create mode 100644 board/AndesTech/common/ftpci100.c
 create mode 100644 board/AndesTech/common/serial.c
 create mode 100644 board/AndesTech/include/andes.h
 create mode 100644 board/AndesTech/include/chipset.h
 create mode 100644 board/AndesTech/include/flib_flash.h
 create mode 100644 board/AndesTech/include/ftmac100.h
 create mode 100644 board/AndesTech/include/ftpci100.h
 create mode 100644 board/AndesTech/include/porting.h
 create mode 100644 board/AndesTech/include/serial.h
 create mode 100644 board/AndesTech/include/symbol.h
 create mode 100644 examples/standalone/nds32.lds
 create mode 100644 include/configs/adp-ag101.h
 create mode 100644 include/configs/ag101.h
 create mode 100644 include/nds32_common.h
 create mode 100644 include/nds32_n10.h
 create mode 100644 include/nds32_n12.h
 create mode 100644 include/nds32_n9.h
#1 lore raw

PATCH 1/10 nds32: add nds32 arch with cpu support

Add nds32 architecture with generic cpu core support. Add nds32 architecture with n1213s cpu core support.

---
 arch/nds32/config.mk                  |   32 +++
 arch/nds32/cpu/Makefile               |   52 ++++
 arch/nds32/cpu/config.mk              |   28 ++
 arch/nds32/cpu/cpu.c                  |  171 ++++++++++++
 arch/nds32/cpu/interrupts.c           |  293 +++++++++++++++++++++
 arch/nds32/cpu/lowlevel_init.S        |  192 ++++++++++++++
 arch/nds32/cpu/n1213s/Makefile        |   53 ++++
 arch/nds32/cpu/n1213s/ag101/Makefile  |   50 ++++
 arch/nds32/cpu/n1213s/ag101/cpu.c     |  171 ++++++++++++
 arch/nds32/cpu/n1213s/config.mk       |   28 ++
 arch/nds32/cpu/n1213s/interrupts.c    |   27 ++
 arch/nds32/cpu/n1213s/lowlevel_init.S |   27 ++
 arch/nds32/cpu/n1213s/start.S         |   27 ++
 arch/nds32/cpu/start.S                |  456 +++++++++++++++++++++++++++++++++
 arch/nds32/cpu/u-boot.lds             |   67 +++++
 15 files changed, 1674 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/config.mk
 create mode 100644 arch/nds32/cpu/Makefile
 create mode 100644 arch/nds32/cpu/config.mk
 create mode 100644 arch/nds32/cpu/cpu.c
 create mode 100644 arch/nds32/cpu/interrupts.c
 create mode 100644 arch/nds32/cpu/lowlevel_init.S
 create mode 100644 arch/nds32/cpu/n1213s/Makefile
 create mode 100644 arch/nds32/cpu/n1213s/ag101/Makefile
 create mode 100644 arch/nds32/cpu/n1213s/ag101/cpu.c
 create mode 100644 arch/nds32/cpu/n1213s/config.mk
 create mode 100644 arch/nds32/cpu/n1213s/interrupts.c
 create mode 100644 arch/nds32/cpu/n1213s/lowlevel_init.S
 create mode 100644 arch/nds32/cpu/n1213s/start.S
 create mode 100644 arch/nds32/cpu/start.S
 create mode 100644 arch/nds32/cpu/u-boot.lds
arch/nds32/config.mk new file +32 -0
new file mode 100644
index 0000000..e88e516
@@ -0,0 +1,32 @@
+#
+# (C) Copyright 2000-2002
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2006
+# Shawn Lin, Andes Technology Corporation <[email protected]>
+# Macpaul Lin, Andes Technology Corporation <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+
+CROSS_COMPILE ?= nds32le-linux-
+
+STANDALONE_LOAD_ADDR = 0x300000 -T nds32.lds
+
+PLATFORM_RELFLAGS	+= -fno-strict-aliasing -fno-common
+PLATFORM_CPPFLAGS	+= -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-8
arch/nds32/cpu/Makefile new file +52 -0

52 lines not on this page · raw message

arch/nds32/cpu/config.mk new file +28 -0
new file mode 100644
index 0000000..316332e
@@ -0,0 +1,28 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# Copyright (C) 2006 Andes Technology Corporation
+# Shawn Lin, Andes Technology Corporation <[email protected]>
+# Macpaul Lin, Andes Technology Corporation <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+PLATFORM_CPPFLAGS +=
arch/nds32/cpu/cpu.c new file +171 -0

171 lines not on this page · raw message

arch/nds32/cpu/interrupts.c new file +293 -0

293 lines not on this page · raw message

arch/nds32/cpu/lowlevel_init.S new file +192 -0

192 lines not on this page · raw message

arch/nds32/cpu/n1213s/Makefile new file +53 -0

53 lines not on this page · raw message

arch/nds32/cpu/n1213s/ag101/Makefile new file +50 -0

50 lines not on this page · raw message

arch/nds32/cpu/n1213s/ag101/cpu.c new file +171 -0

171 lines not on this page · raw message

arch/nds32/cpu/n1213s/config.mk new file +28 -0
new file mode 100644
index 0000000..316332e
@@ -0,0 +1,28 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# Copyright (C) 2006 Andes Technology Corporation
+# Shawn Lin, Andes Technology Corporation <[email protected]>
+# Macpaul Lin, Andes Technology Corporation <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+PLATFORM_CPPFLAGS +=
arch/nds32/cpu/n1213s/interrupts.c new file +27 -0
new file mode 100644
index 0000000..a115a72
@@ -0,0 +1,27 @@
+/*
+ *	Andesboot - Startup Code for Whitiger core
+ *
+ *	Copyright (C) 2010 	Andes Technology Corporation
+ *	Copyright (C) 2010	Macpaul <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include "../interrupts.c"
+
arch/nds32/cpu/n1213s/lowlevel_init.S new file +27 -0
new file mode 100644
index 0000000..26e0727
@@ -0,0 +1,27 @@
+/*
+ *	Andesboot - Startup Code for Whitiger core
+ *
+ *	Copyright (C) 2010	Andes Technology Corporation
+ *	Copyright (C) 2010	Macpaul <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include "../lowlevel_init.S"
+
arch/nds32/cpu/n1213s/start.S new file +27 -0
new file mode 100644
index 0000000..e93d048
@@ -0,0 +1,27 @@
+/*
+ *	Andesboot - Startup Code for Whitiger core
+ *
+ *	Copyright (C) 2010	Andes Technology Corporation
+ *	Copyright (C) 2010	Macpaul <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include "../start.S"
+
arch/nds32/cpu/start.S new file +456 -0

456 lines not on this page · raw message

arch/nds32/cpu/u-boot.lds new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH 1/10 nds32: add nds32 arch with cpu support

Dear Macpaul Lin,

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

--===============1276623933==

Add nds32 architecture with generic cpu core support. Add nds32 architecture with n1213s cpu core support.

Please do not send patches as attachments, send them inline. Try using "git format-patch" to create the patches and "git send-email" to send them.

Don't indent the commit messages like that.

arch/nds32/config.mk line 7

Quoted 13 lines
arch/nds32/config.mk new file +7 -0
new file mode 100644
index 0000000..e88e516
@@ -0,0 +1,32 @@
+#
+# (C) Copyright 2000-2002
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2006
+# Shawn Lin, Andes Technology Corporation <[email protected]>
+# Macpaul Lin, Andes Technology Corporation <[email protected]>

So no work has been done on this in the last 4 years? I guess you want to update your Copyright messages - all of them.

...

arch/nds32/config.mk line 9

Quoted 2 lines
arch/nds32/config.mk new file +2 -0
+START	= start.o
+COBJS	= interrupts.o cpu.o

Please keep all such lists sorted. 'c' < 'i'.

...

arch/nds32/config.mk line 15

Quoted 6 lines
arch/nds32/config.mk new file +6 -0
+void do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
+{
+	extern void reset_cpu(ulong addr);
+
+	disable_interrupts();
+//	reset_cpu(0);	FIXME: -by Shawn, currently no ROM loader at addr 0

No C++ comments allowd. Please fix globally.

arch/nds32/config.mk line 22

Quoted 7 lines
arch/nds32/config.mk new file +7 -0
+void  flush_cache (unsigned long dummy1, unsigned long dummy2)
+{
+/*
+	unsigned long u32IfRun = 0;
+
+	if(u32IfRun)  return;
+	u32IfRun = 1;

We do not allow CamelCase identifiers in U-Boot. Please fix globally. Also, pay attentiuon to indentation rules, the "return" belongs on a new line, indented by a TAB.

arch/nds32/config.mk line 25

Quoted 3 lines
arch/nds32/config.mk new file +3 -0
+	reset_cpu((unsigned long)flush_cache);
+	return;
+*/

Please do not add dead code. Remove it. Please fix globally.

Quoted 2 lines
arch/nds32/cpu/interrupts.c new file +0 -0

...

arch/nds32/cpu/interrupts.c line 39

Quoted 2 lines
arch/nds32/cpu/interrupts.c new file +2 -0
+//#include <board/AndesTech/include/porting.h>
+#include "../../../board/AndesTech/include/porting.h"

This is fundeamentally flawed. Global code must never include any board specific header files.

arch/nds32/cpu/interrupts.c line 169

Quoted 5 lines
arch/nds32/cpu/interrupts.c new file +5 -0
+/*
+ * TimerBase[0] is a NULL entry
+ */
+fLib_TimerReg *TimerBase[] ={0, (fLib_TimerReg *) NDS32_COMMON_TIMER1_BASE,
+	(fLib_TimerReg *) NDS32_COMMON_TIMER2_BASE,(fLib_TimerReg *)NDS32_COMMON_TIMER3_BASE};

Lines too long. Please fix globally.

arch/nds32/cpu/interrupts.c line 271

Quoted 12 lines
arch/nds32/cpu/interrupts.c new file +12 -0
+ulong get_timer_masked(void)
+{
+	ulong now = Read_Timer_Counter(1);;
+
+	if (lastdec >= now)
+	{
+		/* normal mode */
+		timestamp += lastdec - now;
+	} else {
+		/* we have an overflow ... */
+		timestamp += lastdec + TIMER_LOAD_VAL - now;
+	}

Incorrect brace style. Please fix globally.

Please re-read the CodingStyle document!!!

...

Quoted 23 lines
arch/nds32/cpu/interrupts.c new file +23 -0
+uart_init:
+#! 1. fLib_SetSerialMode(DebugSerialPort, SERIAL_MDR_UART);
+	li      $r0, #0x99600000		!; CPE_UART4_BASE = 0x99600000
+	lwi     $r1, [$r0+#0x20]		!; mdr = mdr = inw(CPE_UART4_BASE + SERIAL_MDR)
+	li      $r2, #0xfffffffc		!; mdr &= ~(0x3) ; SERIAL_MDR_MODE_SEL = 0x3
+	and     $r1, $r1, $r2
+	swi     $r1, [$r0+#0x20]		!; outw(CPE_UART4_BASE + SERIAL_MDR, mdr | mode);
+#! 2. fLib_SerialInit(DebugSerialPort, (int)DEFAULT_HOST_BAUD, PARITY_NONE, 0, 8);
+#! dgbserialport = 0x99600000; baud = (UART_CLOCK / 614400) = 24; PARITY_NONE = 0; num = 0; len = 8;
+	li      $r0, #0x99600000		!;lcr = inw(port + SERIAL_LCR) & ~SERIAL_LCR_DLAB; SERIAL_LCR = 0x0c
+	lwi     $r1, [$r0+#0x0c]
+	li      $r2, #0xffffff7f		!; SERIAL_LCR_DLAB = 0x80
+	and     $r1, $r1, $r2
+	li      $r2, #0x80			!; outw(port + SERIAL_LCR,SERIAL_LCR_DLAB);
+	swi     $r2, [$r0+#0x0c]
+	li      $r2, #0				!; outw(port + SERIAL_DLM, ((baudrate & 0xf00) >> 8));
+	swi     $r2, [$r0+#0x4]
+#ifdef __NDS32_N1213_43U1H__    /* AG101 */
+	li      $r2, #60			!; outw(port + SERIAL_DLL, (baudrate & 0xff));
+#else
+	li      $r2, #24			!; outw(port + SERIAL_DLL, (baudrate & 0xff));
+#endif
+	swi     $r2, [$r0+#0x0]

arch/nds32/cpu/interrupts.c

Quoted 10 lines
arch/nds32/cpu/interrupts.c new file +10 -0
+	andi    $r1, $r1, #0xc0			!; lcr &= 0xc0;
+	li      $r2, #3				!; len-=5;
+	or      $r1, $r1, $r2			!; lcr|=len;
+	swi     $r1, [$r0+#0x0c]		!; outw(port+SERIAL_LCR,lcr);
+#! 3. fLib_SetSerialFifoCtrl(DebugSerialPort, 0, 0, ENABLE(1), ENABLE(1));
+	li      $r0, #0x99600000
+	li      $r1, #0x7			!; fcr = 0x7
+	swi     $r1, [$r0+#0x8]			!; SERIAL_FCR = 0x08; outw(port+SERIAL_FCR,fcr);
+
+	ret

Lines too long - why don't you implement uart_init() in C?

arch/nds32/cpu/interrupts.c

Quoted 12 lines
arch/nds32/cpu/interrupts.c new file +12 -0
+void cleanup_before_linux(void)
+{
+	/*
+	 * this function is called just before we call linux
+	 * it prepares the processor for linux
+	 *
+	 * we disable interrupt and caches.
+	 */
+
+#ifdef CONFIG_MMU
+	unsigned long i;
+#endif

Please move such block comments outside the functions. Functions should normally start with declarations. Please apply globally.

Quoted 5 lines
arch/nds32/cpu/n1213s/config.mk new file +0 -0
new file mode 100644
index 0000000..316332e

...

arch/nds32/cpu/n1213s/config.mk

Quoted 3 lines
arch/nds32/cpu/n1213s/config.mk new file +3 -0
+#
+
+PLATFORM_CPPFLAGS +=

This is a noop - why do we need this file?

Quoted 5 lines
arch/nds32/cpu/n1213s/interrupts.c new file +0 -0
new file mode 100644
index 0000000..a115a72

...

arch/nds32/cpu/n1213s/interrupts.c line 26

Quoted 3 lines

+ */

arch/nds32/cpu/n1213s/interrupts.c new file +2 -0
+
+#include "../interrupts.c"

Is this all? Then why do we need this file?

Quoted 5 lines
arch/nds32/cpu/n1213s/lowlevel_init.S new file +0 -0
new file mode 100644
index 0000000..26e0727

...

Quoted 1 line

+#include "../lowlevel_init.S"

Ditto?

Quoted 5 lines
arch/nds32/cpu/n1213s/start.S new file +0 -0
new file mode 100644
index 0000000..e93d048

...

Quoted 1 line

+#include "../start.S"

And again.

This makes no sense.

Please find a better way to use common code.

...

arch/nds32/cpu/n1213s/start.S

Quoted 5 lines
arch/nds32/cpu/n1213s/start.S new file +5 -0
+__start_andesboot:	.word start_andesboot
+
+
+
+!=========================================================================

Too many blank lines. absolute maximum is 2. Please fix globally.

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
The high cost of living hasn't affected its popularity.
#3 lore raw

PATCH 2/10 nds32: add nds32 arch with include support

In reply to Macpaul Lin

Add nds32 architecture with include header files support.

---
 arch/nds32/include/asm/andesboot.h   |  224 +++++++++++++++++++++
 arch/nds32/include/asm/atomic.h      |  121 ++++++++++++
 arch/nds32/include/asm/bitops.h      |  148 ++++++++++++++
 arch/nds32/include/asm/byteorder.h   |   36 ++++
 arch/nds32/include/asm/config.h      |   24 +++
 arch/nds32/include/asm/global_data.h |   84 ++++++++
 arch/nds32/include/asm/io.h          |  352 ++++++++++++++++++++++++++++++++++
 arch/nds32/include/asm/memory.h      |  141 ++++++++++++++
 arch/nds32/include/asm/posix_types.h |   85 ++++++++
 arch/nds32/include/asm/processor.h   |  145 ++++++++++++++
 arch/nds32/include/asm/ptrace.h      |   51 +++++
 arch/nds32/include/asm/ptregs.h      |   83 ++++++++
 arch/nds32/include/asm/setup.h       |  274 ++++++++++++++++++++++++++
 arch/nds32/include/asm/string.h      |   57 ++++++
 arch/nds32/include/asm/types.h       |   84 ++++++++
 arch/nds32/include/asm/u-boot.h      |   72 +++++++
 arch/nds32/include/asm/unaligned.h   |   35 ++++
 17 files changed, 2016 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/include/asm/andesboot.h
 create mode 100644 arch/nds32/include/asm/atomic.h
 create mode 100644 arch/nds32/include/asm/bitops.h
 create mode 100644 arch/nds32/include/asm/byteorder.h
 create mode 100644 arch/nds32/include/asm/config.h
 create mode 100644 arch/nds32/include/asm/global_data.h
 create mode 100644 arch/nds32/include/asm/io.h
 create mode 100644 arch/nds32/include/asm/memory.h
 create mode 100644 arch/nds32/include/asm/posix_types.h
 create mode 100644 arch/nds32/include/asm/processor.h
 create mode 100644 arch/nds32/include/asm/ptrace.h
 create mode 100644 arch/nds32/include/asm/ptregs.h
 create mode 100644 arch/nds32/include/asm/setup.h
 create mode 100644 arch/nds32/include/asm/string.h
 create mode 100644 arch/nds32/include/asm/types.h
 create mode 100644 arch/nds32/include/asm/u-boot.h
 create mode 100644 arch/nds32/include/asm/unaligned.h
arch/nds32/include/asm/andesboot.h new file +224 -0
new file mode 100644
index 0000000..d177099
@@ -0,0 +1,224 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <[email protected]>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Alex Zuepke <[email protected]>
+ *
+ * Copyright (C) 2006 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _ANDESBOOT_H_
+#define _ANDESBOOT_H_	1
+
+#undef	_LINUX_CONFIG_H
+#define _LINUX_CONFIG_H 1	/* avoid reading Linux autoconf.h file	*/
+#include <config.h>
+#include <asm/types.h>
+#include <asm/u-boot.h>
+#include <stdarg.h>
+#include <common.h>
+#include <flash.h>
+#include <image.h>
+
+#ifdef	DEBUG
+#define debug(fmt,args...)	printf (fmt ,##args)
+#else
+#define debug(fmt,args...)
+#endif
+
+/*
+ * The environment storages is simply a list of '\0'-terminated
+ * "name=value" strings, the end of the list marked by a double '\0'.
+ * New entries are always added at the end. Deleting an entry shifts
+ * the remaining entries to the front. Replacing an entry is a
+ * combination of deleting the old and adding the new value.
+ *
+ * The environment is preceeded by a 32 bit CRC over the data part.
+ */
+
+#define bi_env_data bi_env->data
+#define bi_env_crc  bi_env->crc
+
+/* common/crc32.c */
+//uint32_t crc32 (uint32_t, const unsigned char *, uint);
+//uint32_t crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len);
+
+/*
+ * Don't define some stuff private to andesboot target code
+ */
+#ifndef HOST_TOOLS
+
+/* board/.../env.c */
+int 	board_env_getchar(bd_t * bd, int index, uchar *c);
+int 	board_env_save	(bd_t * bd, env_t *data, int size);
+int 	board_env_copy 	(bd_t * bd, env_t *data, int size);
+uchar *	board_env_getaddr(bd_t * bd, int index);
+
+/*
+ * Function Prototypes
+ */
+void	hang	  	(void);
+void	start_andesboot	(void);
+void	main_loop	(void);
+int	run_command	(const char *cmd, int flag);
+int	readline	(const char *const prompt);
+void	reset_cmd_timeout(void);
+
+/* board/.../... */
+int board_init(bd_t *);
+int dram_init(bd_t *bd);
+
+/* common/display_options.c */
+void display_banner(bd_t *bd);
+void display_dram_config(bd_t *bd);
+void display_flash_config(ulong size);
+
+/* common/cmd_nvedit.c */
+//int 	env_init	(void);
+void	env_relocate	(void);
+char	*getenv		(char *);
+int  	setenv		(char *, char *);
+
+/* $(CPU)/serial.c */
+int 	serial_init	(void);
+void	serial_setbrg(void);
+void	serial_putc	(const char);
+void	serial_puts	(const char *);
+void	serial_addr	(unsigned int);
+int	serial_getc	(void);
+int	serial_tstc	(void);
+
+/* common/string.c */
+char *	strcpy		(char * dest,const char *src);
+char *	strncpy		(char * dest,const char *src, size_t count);
+size_t	strlen		(const char *);
+size_t	strnlen		(const char * s, size_t count);
+int	strncmp		(const char * cs, const char * ct, size_t count);
+int	strcmp		(const char * cs, const char * ct);
+void *	memcpy		(void * dest, const void *src, size_t count);
+int	memcmp		(const void * dest, const void *src, size_t count);
+void *	memset		(void * s, int c, size_t count);
+
+void *	memmove		(void * dest, const void *src, size_t count);
+char *	strchr		(const char * s, int c);
+
+/* common/vsprintf.c */
+ulong	simple_strtoul	(const char *cp,char **endp,unsigned int base);
+long	simple_strtol	(const char *cp,char **endp,unsigned int base);
+void	panic		(const char *fmt, ...);
+int	sprintf		(char * buf, const char *fmt, ...);
+int 	vsprintf	(char *buf, const char *fmt, va_list args);
+
+void	udelay		(unsigned long);
+
+int	ctrlc		(void);
+int	had_ctrlc 	(void);
+void	clear_ctrlc	(void);
+int	disable_ctrlc	(int);
+
+int	console_assign	(int file, char *devname);
+
+/* */
+int	icache_status (void);
+void	icache_enable (void);
+void	icache_disable(void);
+int	dcache_status (void);
+void	dcache_enable (void);
+void	dcache_disable(void);
+
+/* common/cmd_bootm.c */
+void print_image_hdr (image_header_t *hdr);
+
+/* cpu/.../interrupt.c */
+void	enable_interrupts	(void);
+int	disable_interrupts	(void);
+int 	interrupt_init		(void);
+void	reset_timer		(void);
+ulong	get_timer		(ulong base);
+void	set_timer		(ulong t);
+void	reset_timer_masked	(void);
+ulong	get_timer_masked	(void);
+void	udelay_masked		(unsigned long usec);
+
+/* cpu/.../cpu.c */
+void cpu_init(void);
+void cleanup_before_linux(void);
+
+extern ulong load_addr;
+
+/* for the following variables, see start.S */
+extern ulong _andesboot_start; /* code start */
+extern ulong _andesboot_end;   /* code end */
+extern ulong _andesboot_real_end; /* first usable RAM address */
+
+/*
+ * STDIO based functions (can always be used)
+ */
+
+/* serial stuff */
+void	serial_printf (const char *fmt, ...);
+
+/* stdin */
+int	getc(void);
+int	tstc(void);
+
+/* stdout */
+void	putc(const char c);
+void	puts(const char *s);
+void	printf(const char *fmt, ...);
+
+/* stderr */
+#define eputc(c)		fputc(stderr, c)
+#define eputs(s)		fputs(stderr, s)
+#define eprintf(fmt,args...)	fprintf(stderr,fmt ,##args)
+
+/*
+ * FILE based functions (can only be used AFTER relocation!)
+ */
+
+#define stdin		0
+#define stdout		1
+#define stderr		2
+#define MAX_FILES	3
+
+void	fprintf(int file, const char *fmt, ...);
+void	fputs(int file, const char *s);
+void	fputc(int file, const char c);
+int	ftstc(int file);
+int	fgetc(int file);
+
+/* Byte swapping stuff */
+#define SWAP16(x)	((((x) & 0xff) << 8) | ((x) >> 8))
+#define SWAP16c(x)	((((x) & 0xff) << 8) | ((x) >> 8))
+#define SWAP32(x)	( \
+			(((x) >> 24) & 0x000000ff) | \
+			(((x) >>  8) & 0x0000ff00) | \
+			(((x) <<  8) & 0x00ff0000) | \
+			(((x) << 24) & 0xff000000) )
+
+#endif /* HOST_TOOLS */
+
+#endif	/* _ANDESBOOT_H_ */
arch/nds32/include/asm/atomic.h new file +121 -0

121 lines not on this page · raw message

arch/nds32/include/asm/bitops.h new file +148 -0

148 lines not on this page · raw message

arch/nds32/include/asm/byteorder.h new file +36 -0
new file mode 100644
index 0000000..d41c5fa
@@ -0,0 +1,36 @@
+/*
+ *  linux/include/asm-arm/byteorder.h
+ *
+ * Copyright (C) 2006 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * ARM Endian-ness.  In little endian mode, the data bus is connected such
+ * that byte accesses appear as:
+ *  0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31
+ * and word accesses (data or instruction) appear as:
+ *  d0...d31
+ *
+ * When in big endian mode, byte accesses appear as:
+ *  0 = d24...d31, 1 = d16...d23, 2 = d8...d15, 3 = d0...d7
+ * and word accesses (data or instruction) appear as:
+ *  d0...d31
+ */
+
+#ifndef __ASM_NDS_BYTEORDER_H
+#define __ASM_NDS_BYTEORDER_H
+
+#include <asm/types.h>
+
+#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
+#  define __BYTEORDER_HAS_U64__
+#  define __SWAB_64_THRU_32__
+#endif
+
+#ifdef __NDSEB__
+#include <linux/byteorder/big_endian.h>
+#else
+#include <linux/byteorder/little_endian.h>
+#endif
+
+#endif
arch/nds32/include/asm/config.h new file +24 -0
new file mode 100644
index 0000000..0826f29
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2006 Andes Technology Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#ifndef _ASM_CONFIG_H_
+#define _ASM_CONFIG_H_
+
+#endif
arch/nds32/include/asm/global_data.h new file +84 -0

84 lines not on this page · raw message

arch/nds32/include/asm/io.h new file +352 -0

352 lines not on this page · raw message

arch/nds32/include/asm/memory.h new file +141 -0

141 lines not on this page · raw message

arch/nds32/include/asm/posix_types.h new file +85 -0

85 lines not on this page · raw message

arch/nds32/include/asm/processor.h new file +145 -0

145 lines not on this page · raw message

arch/nds32/include/asm/ptrace.h new file +51 -0

51 lines not on this page · raw message

arch/nds32/include/asm/ptregs.h new file +83 -0

83 lines not on this page · raw message

arch/nds32/include/asm/setup.h new file +274 -0

274 lines not on this page · raw message

arch/nds32/include/asm/string.h new file +57 -0

57 lines not on this page · raw message

arch/nds32/include/asm/types.h new file +84 -0

84 lines not on this page · raw message

arch/nds32/include/asm/u-boot.h new file +72 -0

72 lines not on this page · raw message

arch/nds32/include/asm/unaligned.h new file +35 -0
new file mode 100644
index 0000000..3524d06
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2006 Andes Technology Corporation
+ * Copyright (C) 2010 Macpaul Lin (macpaul at andestech.com)
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef _ASM_NDS_UNALIGNED_H
+#define _ASM_NDS_UNALIGNED_H
+
+#include <compiler.h>
+/*
+ * Select endianness
+ */
+//#if defined(__NDSEL__)
+#ifndef __NDSEB__
+#define get_unaligned	__get_unaligned_le
+#define put_unaligned	__put_unaligned_le
+//#elif defined(__NDSEB__)
+#else
+#define get_unaligned	__get_unaligned_be
+#define put_unaligned	__put_unaligned_be
+//#else
+//#error invalid endian
+#endif /* __NDSEB__ */
+
+#include <asm/byteorder.h>
+
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/generic.h>
+
+#endif /* _ASM_NDS_UNALIGNED_H */
Signature · 1 line
1.7.1
#4 lore raw

PATCH 3/10 nds32: add nds32 arch with lib support

In reply to Macpaul Lin

Add nds32 architecture with generic lib C files support.

---
 arch/nds32/lib/Makefile |   53 ++++++++
 arch/nds32/lib/board.c  |  341 +++++++++++++++++++++++++++++++++++++++++++++++
 arch/nds32/lib/bootm.c  |  209 +++++++++++++++++++++++++++++
 3 files changed, 603 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/lib/Makefile
 create mode 100644 arch/nds32/lib/board.c
 create mode 100644 arch/nds32/lib/bootm.c
arch/nds32/lib/Makefile new file +53 -0
new file mode 100644
index 0000000..0fe0351
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# Copyright (C) 2006 Andes Technology Corporation
+# Shawn Lin, Andes Technology Corporation <[email protected]>
+# Macpaul Lin, Andes Technology Corporation <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(ARCH).a
+
+OBJS	:= board.o  bootm.o
+SOBJS	:=
+
+all:	$(LIB)
+
+$(LIB):	$(OBJS) $(SOBJS)
+	$(AR) crv $@ $^
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/nds32/lib/board.c new file +341 -0

341 lines not on this page · raw message

arch/nds32/lib/bootm.c new file +209 -0

209 lines not on this page · raw message

Signature · 1 line
1.7.1
#5 lore raw

PATCH 4/10 nds32: add nds32 board with ag101 support

In reply to Macpaul Lin

Add nds32 based board adp-ag101 support.

---
 board/AndesTech/adp-ag101/Makefile    |   60 ++++++++++++++
 board/AndesTech/adp-ag101/adp-ag101.c |  144 +++++++++++++++++++++++++++++++++
 board/AndesTech/adp-ag101/config.mk   |   46 +++++++++++
 3 files changed, 250 insertions(+), 0 deletions(-)
 create mode 100644 board/AndesTech/adp-ag101/Makefile
 create mode 100644 board/AndesTech/adp-ag101/adp-ag101.c
 create mode 100644 board/AndesTech/adp-ag101/config.mk
board/AndesTech/adp-ag101/Makefile new file +60 -0
new file mode 100644
index 0000000..53d8592
@@ -0,0 +1,60 @@
+#
+# (C) Copyright 2002
+# Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+# Marius Groeger <[email protected]>
+#
+# Copyright (C) 2006 Andes Technology Corporation
+# Shawn Lin, Andes Tech Crop. <[email protected]>
+# Macpaul Lin, Andes Technology Corporation <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+OBJS-y += adp-ag101.o ../common/serial.o ../common/flib_serial.o \
+	../common/flash.o ../common/flib_flash.o ../common/env.o
+OBJS-$(CONFIG_DRIVER_FTMAC100) += ../common/ftmac100.o
+OBJS-$(CONFIG_DRIVER_FTPCI100) += ../common/ftpci100.o
+OBJS-$(CONFIG_DRIVER_FOTG2xx) += ../common/fotg2xx.o
+
+SOBJS	:=
+OBJS	:= $(OBJS-y)
+
+all:	$(LIB)
+
+$(LIB):	$(OBJS) $(SOBJS)
+	$(AR) crv $@ $^
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/AndesTech/adp-ag101/adp-ag101.c new file +144 -0

144 lines not on this page · raw message

board/AndesTech/adp-ag101/config.mk new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
1.7.1
#6 lore raw

PATCH 4/10 nds32: add nds32 board with ag101 support

Dear Macpaul Lin,

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

Add nds32 based board adp-ag101 support.

---
 board/AndesTech/adp-ag101/Makefile    |   60 ++++++++++++++
 board/AndesTech/adp-ag101/adp-ag101.c |  144 +++++++++++++++++++++++++++++++++
 board/AndesTech/adp-ag101/config.mk   |   46 +++++++++++
 3 files changed, 250 insertions(+), 0 deletions(-)
 create mode 100644 board/AndesTech/adp-ag101/Makefile
 create mode 100644 board/AndesTech/adp-ag101/adp-ag101.c
 create mode 100644 board/AndesTech/adp-ag101/config.mk

This makes no sense. You need to refactor your patches. Everything that logically belongs together should be within one patch only.

So please add ALL board support with a single commit.

Ditto for the CPU support.

Also,please note that entries to MAKEALL and MAINTAINERS files are missing.

Quoted 2 lines
board/AndesTech/adp-ag101/adp-ag101.c new file +0 -0

...

board/AndesTech/adp-ag101/adp-ag101.c line 31

Quoted 3 lines
board/AndesTech/adp-ag101/adp-ag101.c new file +3 -0
+#include <asm/andesboot.h>
+//#include <porting.h>
+#include "../include/porting.h"

Try do do without such "../include/porting.h" includes.

Quoted 23 lines
board/AndesTech/adp-ag101/adp-ag101.c new file +23 -0
+/*
+ *	bank_num ==> setting the config of which bank (0, 1st, 2nd, ..)
+ *	data_width ==> the width of the SDRAM module on the bank
+ *	sdram_size ==> the size of each module
+ *	bus_width ==> the width of data bus
+ *	bank_size ==> the total memory size of the bank (should be equal as "sdram_size * how many modules")
+ */
+#define SDRAM_MODULE_WIDTH_4			0
+#define SDRAM_MODULE_WIDTH_8			(1<<12)
+#define SDRAM_MODULE_WIDTH_16			(2<<12)
+#define SDRAM_MODULE_WIDTH_32			(3<<12)
+
+
+// 16M bit, 64M bit,...
+#define SDRAM_MODULE_SIZE_16M			0
+#define SDRAM_MODULE_SIZE_64M			(1<<8)
+#define SDRAM_MODULE_SIZE_128M			(2<<8)
+#define SDRAM_MODULE_SIZE_256M			(3<<8)
+
+#define SDRAM_BUS_WIDTH_8			0
+#define SDRAM_BUS_WIDTH_16			(1<<4)
+#define SDRAM_BUS_WIDTH_32			(2<<4)
+

board/AndesTech/adp-ag101/adp-ag101.c line 85

Quoted 10 lines
board/AndesTech/adp-ag101/adp-ag101.c new file +10 -0
+// 1M byte, 2M byte,...
+#define SDRAM_BANK_SIZE_1M			0
+#define SDRAM_BANK_SIZE_2M			1
+#define SDRAM_BANK_SIZE_4M			2
+#define SDRAM_BANK_SIZE_8M			3
+#define SDRAM_BANK_SIZE_16M			4
+#define SDRAM_BANK_SIZE_32M			5
+#define SDRAM_BANK_SIZE_64M			6
+#define SDRAM_BANK_SIZE_128M			7
+#define SDRAM_BANK_SIZE_256M			8

I don't like this; the resulting code will become unreadable because of too many too long macro names.

I stop reviewing your patches here. Most of my previous comments apply globally, i. e. please make sure to rework all your code. Then refactor the patches into logical, bisectable units, and resubmit.

Thanks.

Best regards,

Wolfgang Denk

Signature · 6 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 object to intellect without discipline;  I object to power without
constructive purpose.
	-- Spock, "The Squire of Gothos", stardate 2124.5
#7 lore raw

PATCH 5/10 nds32: add nds32 board with common support

In reply to Macpaul Lin

Add nds32 based common board related support.

---
 board/AndesTech/common/env.c         |  138 ++++++
 board/AndesTech/common/flash.c       |  621 +++++++++++++++++++++++++++
 board/AndesTech/common/flib_flash.c  |  721 ++++++++++++++++++++++++++++++++
 board/AndesTech/common/flib_serial.c |  373 +++++++++++++++++
 board/AndesTech/common/fotg2xx.c     |   60 +++
 board/AndesTech/common/ftmac100.c    |  766 ++++++++++++++++++++++++++++++++++
 board/AndesTech/common/ftpci100.c    |  712 +++++++++++++++++++++++++++++++
 board/AndesTech/common/serial.c      |  141 +++++++
 8 files changed, 3532 insertions(+), 0 deletions(-)
 create mode 100644 board/AndesTech/common/env.c
 create mode 100644 board/AndesTech/common/flash.c
 create mode 100644 board/AndesTech/common/flib_flash.c
 create mode 100644 board/AndesTech/common/flib_serial.c
 create mode 100644 board/AndesTech/common/fotg2xx.c
 create mode 100644 board/AndesTech/common/ftmac100.c
 create mode 100644 board/AndesTech/common/ftpci100.c
 create mode 100644 board/AndesTech/common/serial.c
board/AndesTech/common/env.c new file +138 -0
new file mode 100644
index 0000000..55e2b66
@@ -0,0 +1,138 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <[email protected]>
+ *
+ * Copyright (C) 2006 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <asm/andesboot.h>
+
+static int check_crc(bd_t *bd)
+{
+	/* need to calculate crc? */
+	if (bd->bi_ext.env_crc_valid == 0)
+	{
+		env_t *env = (env_t *)CONFIG_ENV_ADDR;
+
+		if (crc32(0, env->data, sizeof(env->data)) == env->crc)
+			bd->bi_ext.env_crc_valid = 1;
+		else
+			bd->bi_ext.env_crc_valid = -1;
+	}
+	return bd->bi_ext.env_crc_valid > 0;
+}
+
+
+/*
+ * save environment buffer back to flash
+ * returns -1 on error, 0 if ok
+ */
+int board_env_save(bd_t *bd, env_t *env, int size)
+{
+	int rc;
+	ulong start_addr, end_addr;
+
+
+//no CONFIG_ENV_ADDR_REDUND
+#if CONFIG_ENV_SIZE > CONFIG_ENV_SECT_SIZE /* modified: <= to >, by Hill, 20090313 */
+#error Make sure that CONFIG_ENV_SIZE <= CONFIG_ENV_SECT_SIZE
+#endif
+
+	start_addr = CONFIG_ENV_ADDR;
+	end_addr   = start_addr + CONFIG_ENV_SIZE - 1;
+
+	rc = flash_sect_protect(0, CONFIG_ENV_ADDR, end_addr);
+	if (rc < 0)
+		return rc;
+
+	rc = flash_sect_erase(start_addr, end_addr);
+	if (rc < 0) {
+		flash_sect_protect(1, start_addr, end_addr);
+		flash_perror(rc);
+		return rc;
+	}
+
+	printf("Saving Environment to Flash...");
+	rc = flash_write((uchar*)env, start_addr, size);
+	if (rc < 0)
+		flash_perror(rc);
+	else
+		printf("done.\n");
+
+	(void)flash_sect_protect(1, start_addr, end_addr);
+
+	return 0;
+}
+
+/*
+ * copy environment to memory
+ * returns -1 on error, 0 if ok
+ */
+int board_env_copy(bd_t *bd, env_t *data, int size)
+{
+	env_t *env = (env_t *)CONFIG_ENV_ADDR;
+
+	if (check_crc(bd)) {
+		memcpy(data, env, sizeof(env_t));
+		return 0;
+	}
+
+	return -1;
+}
+
+/*
+ * try to read env character@offset #index
+ *
+ * called before the environment is copied to ram
+ * returns -1 on error, 0 if ok
+ */
+int board_env_getchar(bd_t * bd, int index, uchar *c)
+{
+	env_t *env = (env_t *)CONFIG_ENV_ADDR;
+
+	/* check environment crc */
+	if (index < sizeof(env->data) && check_crc(bd)) {
+		*c = env->data[index];
+		return 0;
+	}
+
+	return -1;
+}
+
+/*
+ * try to read env character at offset #index
+ *
+ * called before the environment is copied to ram
+ * returns -1 on error, 0 if ok
+ */
+uchar *board_env_getaddr(bd_t * bd, int index)
+{
+	env_t *env = (env_t *)CONFIG_ENV_ADDR;
+
+	/* check environment crc */
+	if (index < sizeof(env->data) && check_crc(bd))
+		return &env->data[index];
+
+	return 0;
+}
board/AndesTech/common/flash.c new file +621 -0

621 lines not on this page · raw message

board/AndesTech/common/flib_flash.c new file +721 -0

721 lines not on this page · raw message

board/AndesTech/common/flib_serial.c new file +373 -0

373 lines not on this page · raw message

board/AndesTech/common/fotg2xx.c new file +60 -0

60 lines not on this page · raw message

board/AndesTech/common/ftmac100.c new file +766 -0

766 lines not on this page · raw message

board/AndesTech/common/ftpci100.c new file +712 -0

321 lines not on this page · raw message

board/AndesTech/common/serial.c new file +141 -0

141 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.1

Part of the diff is not shown here. View the raw message.

#8 lore raw

PATCH 5/10 nds32: add nds32 board with common support

Hello Macpaul,

Quoted 16 lines · Macpaul Lin

Add nds32 based common board related support.

---
 board/AndesTech/common/env.c         |  138 ++++++
 board/AndesTech/common/flash.c       |  621 +++++++++++++++++++++++++++
 board/AndesTech/common/flib_flash.c  |  721
++++++++++++++++++++++++++++++++
 board/AndesTech/common/flib_serial.c |  373 +++++++++++++++++
 board/AndesTech/common/fotg2xx.c     |   60 +++
 board/AndesTech/common/ftmac100.c    |  766
++++++++++++++++++++++++++++++++++
 board/AndesTech/common/ftpci100.c    |  712
+++++++++++++++++++++++++++++++
 board/AndesTech/common/serial.c      |  141 +++++++

Please respect the file hierarchy. Drivers go in the proper place (e.g. flib_serial.c should go in drivers/serial, ftmac100.c should go in drivers/net etc.)
<snip>

Quoted 48 lines
board/AndesTech/common/ftmac100.c new file +41 -0
new file mode 100644
index 0000000..825031d
@@ -0,0 +1,766 @@
+/*
+ * Copyright (C) 2009 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+// --------------------------------------------------------------------
+//     lmc83:  modified from smc91111.c (2002-11-29)
+// --------------------------------------------------------------------
+
+
+#include <common.h>
+#include <asm/andesboot.h>
+#include <malloc.h>
+#include <command.h>
+#include "../include/porting.h"
+#include "../include/ftmac100.h"
+#include <net.h>
+
+
+#ifdef CONFIG_DRIVER_FTMAC100
+
+// Use power-down feature of the chip
+#define POWER_DOWN     0
+
+static unsigned char ftmac100_mac_addr[] = {0x00, 0x41, 0x71, 0x99, 0x00,
Quoted 2 lines

0x00};

Please don't make assumptions like this.

Quoted 5 lines
board/AndesTech/common/ftmac100.c new file +3 -0
+
+static const char version[] =
+       "Faraday FTMAC100 Driver, (Linux Kernel 2.4) 10/18/02 - by

Faraday\n";

I don't think so.

board/AndesTech/common/ftmac100.c line 49

Quoted 6 lines
board/AndesTech/common/ftmac100.c new file +5 -0
+
+#define inl(addr)                      (*((volatile u32 *)(addr)))
+#define inw(addr)                      (*((volatile u16 *)(addr)))
+#define outl(value, addr)      (*((volatile u32 *)(addr)) = value)
+#define outb(value, addr)      (*((volatile u8 *)(addr)) = value)

This isn't the place to define these.

Quoted 31 lines
board/AndesTech/common/ftmac100.c new file +30 -0
+
+struct net_device dev_eth0;
+int tx_rx_cnt = 0;
+/*
+ *
+ * Configuration options, for the experienced user to change.
+ *
+ */
+/*
+ * DEBUGGING LEVELS
+ *
+ * 0 for normal operation
+ * 1 for slightly more details
+ * >2 for various levels of increasingly useless information
+ *     2 for interrupt tracking, status flags
+ *     3 for packet info
+ *     4 for complete packet dumps
+ */
+
+#define DO_PRINT(args...) printk(args)
+
+//#define FTMAC100_DEBUG 5 // Must be defined in makefile
+
+#if (FTMAC100_DEBUG > 2 )
+#define PRINTK3(args...) DO_PRINT(args)
+#else
+#define PRINTK3(args...)
+#endif
+
+#if FTMAC100_DEBUG > 1

board/AndesTech/common/ftmac100.c line 89

Quoted 10 lines
board/AndesTech/common/ftmac100.c new file +10 -0
+#define PRINTK2(args...) DO_PRINT(args)
+#else
+#define PRINTK2(args...)
+#endif
+
+#ifdef FTMAC100_DEBUG
+#define PRINTK(args...) DO_PRINT(args)
+#else
+#define PRINTK(args...)
+#endif

Please don't do this stuff. The standard debug() will suffice.

Quoted 11 lines
board/AndesTech/common/ftmac100.c new file +10 -0
+
+
+///#define FTMAC100_TIMER
+
+/*
+ *
+ * The internal workings of the driver.  If you are changing anything
+ * here with the SMC stuff, you should have the datasheet and know
+ * what you are doing.
+ *

board/AndesTech/common/ftmac100.c line 109

Quoted 10 lines
board/AndesTech/common/ftmac100.c new file +10 -0
+ */
+#define CARDNAME "FTMAC100"
+
+#ifdef FTMAC100_TIMER
+       static struct timer_list ftmac100_timer;
+#endif
+
+#define ETH_ZLEN 60
+
+#ifdef  CONFIG_SMC_USE_32_BIT

Please use your own CONFIG

board/AndesTech/common/ftmac100.c line 112

Quoted 4 lines
board/AndesTech/common/ftmac100.c new file +3 -0
+#define USE_32_BIT
+#else
+#undef USE_32_BIT

This sort of thing needs more namespace

board/AndesTech/common/ftmac100.c line 123

Quoted 12 lines
board/AndesTech/common/ftmac100.c new file +11 -0
+#endif
+/*
+ *
+ * The driver can be entered at any of the following entry points.
+ *
+ */
+
+extern int eth_init(bd_t *bd);
+extern void eth_halt(void);
+extern int eth_rx(void);
+extern int eth_send(volatile void *packet, int length);

You're using an API that's tagged as deprecated. Please read the documentation, update the driver to the appropriate API and then we'll proceed with the review.

regards,
Ben

#9 lore raw

PATCH 6/10 nds32: add nds32 board with include support

In reply to Macpaul Lin

Add nds32 based board with include header files support.

---
 board/AndesTech/include/andes.h      |   51 ++
 board/AndesTech/include/chipset.h    |  852 ++++++++++++++++++++++++++++++++++
 board/AndesTech/include/flib_flash.h |   87 ++++
 board/AndesTech/include/ftmac100.h   |  257 ++++++++++
 board/AndesTech/include/ftpci100.h   |  238 ++++++++++
 board/AndesTech/include/porting.h    |   60 +++
 board/AndesTech/include/serial.h     |  175 +++++++
 board/AndesTech/include/symbol.h     |  107 +++++
 8 files changed, 1827 insertions(+), 0 deletions(-)
 create mode 100644 board/AndesTech/include/andes.h
 create mode 100644 board/AndesTech/include/chipset.h
 create mode 100644 board/AndesTech/include/flib_flash.h
 create mode 100644 board/AndesTech/include/ftmac100.h
 create mode 100644 board/AndesTech/include/ftpci100.h
 create mode 100644 board/AndesTech/include/porting.h
 create mode 100644 board/AndesTech/include/serial.h
 create mode 100644 board/AndesTech/include/symbol.h
board/AndesTech/include/andes.h new file +51 -0
new file mode 100644
index 0000000..1ab103b
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2006 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * define version number
+ */
+#define VERSION_MAJOR_NUM	0
+#define VERSION_MINOR_NUM	16
+#define VERSION_CLOCK		SYSTEM_CLOCK
+
+/*
+ * define platform
+ */
+#define  CONFIG_ADP_AG101_120_PLATFORM
+//#define  CONFIG_ADP_AG101_110_PLATFORM
+
+/*
+ * define system clock
+ */
+//#define SYSTEM_CLOCK 	16000000	//16.000000 MHz
+//#define SYSTEM_CLOCK  18432000	//18.432000 MHz
+//#define SYSTEM_CLOCK 	22118400	//22.118400 MHz
+#define  SYSTEM_CLOCK	83000000	//83.000000 MHz
+//#define SYSTEM_CLOCK 	33000000	//83.000000 MHz
+//#define SYSTEM_CLOCK 	36864000	//36.864000 MHz
+
+/*
+ *  define flash bank
+ */
+#define CONFIG_FLASH_BANK 1  //bank 0,1,2,3,4,5,6,7
board/AndesTech/include/chipset.h new file +852 -0

852 lines not on this page · raw message

board/AndesTech/include/flib_flash.h new file +87 -0

87 lines not on this page · raw message

board/AndesTech/include/ftmac100.h new file +257 -0

257 lines not on this page · raw message

board/AndesTech/include/ftpci100.h new file +238 -0

238 lines not on this page · raw message

board/AndesTech/include/porting.h new file +60 -0

60 lines not on this page · raw message

board/AndesTech/include/serial.h new file +175 -0

175 lines not on this page · raw message

board/AndesTech/include/symbol.h new file +107 -0

107 lines not on this page · raw message

Signature · 1 line
1.7.1
#10 lore raw

PATCH 7/10 nds32: add nds32 with common support

In reply to Macpaul Lin

Add nds32 support in generic u-boot common functions.

---
 common/cmd_bootm.c |    2 ++
 common/image.c     |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
common/cmd_bootm.c +2 -0
index 8803202..3c92bec 100644
@@ -182,6 +182,8 @@ void arch_preboot_os(void) __attribute__((weak, alias("__arch_preboot_os")));
   #define IH_INITRD_ARCH IH_ARCH_SH
 #elif defined(__sparc__)
   #define IH_INITRD_ARCH IH_ARCH_SPARC
+#elif defined(__nds32__)
+  #define IH_INITRD_ARCH IH_ARCH_NDS32
 #else
 # error Unknown CPU type
 #endif
common/image.c +1 -0
index 2b6007e..531d455 100644
@@ -93,6 +93,7 @@ static table_entry_t uimage_arch[] = {
 	{	IH_ARCH_SPARC64,	"sparc64",	"SPARC 64 Bit",	},
 	{	IH_ARCH_BLACKFIN,	"blackfin",	"Blackfin",	},
 	{	IH_ARCH_AVR32,		"avr32",	"AVR32",	},
+	{	IH_ARCH_NDS32,		"nds32",	"NDS32",	},
 	{	-1,			"",		"",		},
 };
 
Signature · 1 line
1.7.1
#11 lore raw

PATCH 8/10 nds32: add nds32 with examples support

In reply to Macpaul Lin

Add nds32 with examples standalone program support.

---
 examples/standalone/nds32.lds     |   64 +++++++++++++++++++++++++++++++++++++
 examples/standalone/stubs.c       |   17 +++++++++-
 examples/standalone/x86-testapp.c |   12 +++++++
 3 files changed, 92 insertions(+), 1 deletions(-)
 create mode 100644 examples/standalone/nds32.lds
examples/standalone/nds32.lds new file +64 -0
new file mode 100644
index 0000000..1058e3a
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2006 Andes Technology Corporation
+ * Shawn Lin, Andes Tech Crop. <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_FORMAT("elf32-nds32", "elf32-nds32", "elf32-nds32")
+OUTPUT_ARCH(nds32)
+ENTRY(_start)
+SECTIONS
+{
+	. = 0x00000000;
+
+	. = ALIGN(4);
+	.text :
+	{
+		*(.text)
+	}
+
+	. = ALIGN(4);
+	.data : { *(.data) }
+
+	. = ALIGN(4);
+	.data : { *(.data) }
+
+	. = ALIGN(4);
+
+	.got : {
+		__got_start = .;
+		*(.got)
+		__got_end = .;
+	}
+
+	. = ALIGN(4);
+	__bss_start = .;
+	.bss : { *(.bss) }
+	__bss_end = .;
+
+	. = ALIGN(4);
+	.rela.text  : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
+
+	_end = .;
+
+	. = 0x02000000;
+	.u_boot_ohci_data_st : { *(.u_boot_ohci_data_st) }
+}
examples/standalone/stubs.c +16 -1
index f3e1ab5..a4c99f6 100644
@@ -167,8 +167,23 @@ gd_t *global_data;
 "	jmp %%g1\n"					\
 "	nop\n"						\
 	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
-
+#elif defined(CONFIG_NDS32)
+/*
+ * r16 holds the pointer to the global_data. gp is call clobbered.
+ * not support reduced register (16 GPR).
+ */
+#define EXPORT_FUNC(x) \
+	asm volatile (			\
+"	.globl " #x "\n"		\
+#x ":\n"				\
+"	lwi	$r16, [$gp + (%0)]\n"	\
+"	lwi	$r16, [$r16 + (%1)]\n"	\
+"	jr	$r16\n"			\
+	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "$r16" );
 #else
+/*"	addi	$sp, $sp, -24\n"	\
+"	br	$r16\n"			\*/
+
 #error stubs definition missing for this architecture
 #endif
 
examples/standalone/x86-testapp.c +12 -0
index e8603d9..9f80a5d 100644
@@ -52,6 +52,16 @@ asm volatile (						\
 "	lw	$25, %1($25)\n"				\
 "	jr	$25\n"					\
 	: : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "t9");
+#elif defined(__nds32__)
+#define EXPORT_FUNC(x)					\
+asm volatile (						\
+"	.globl mon_" #x "\n"				\
+"mon_" #x ":\n"						\
+"	lwi	$r16, [$gp + (%0)]\n"				\
+"	lwi	$r16, [$r16 + (%1)]\n"				\
+"	jr	$r16\n"					\
+	: : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "$r16");
+
 #else
 #error [No stub code for this arch]
 #endif
@@ -72,6 +82,8 @@ int main(void)
 	register volatile xxx_t *pq asm("r8");
 #elif defined(__mips__)
 	register volatile xxx_t *pq asm("k0");
+#elif defined(__nds32__)
+	register volatile xxx_t *pq asm("$r16");
 #endif
 	char buf[32];
 
Signature · 1 line
1.7.1
#12 lore raw

PATCH 9/10 nds32: add nds32 with include support

In reply to Macpaul Lin

Add nds32 support in generic u-boot and board include header files.

---
 include/common.h            |   10 ++
 include/configs/adp-ag101.h |   33 ++++++
 include/configs/ag101.h     |  265 +++++++++++++++++++++++++++++++++++++++++++
 include/image.h             |    5 +
 include/nds32_common.h      |  214 ++++++++++++++++++++++++++++++++++
 include/nds32_n10.h         |   30 +++++
 include/nds32_n12.h         |   30 +++++
 include/nds32_n9.h          |   30 +++++
 8 files changed, 617 insertions(+), 0 deletions(-)
 create mode 100644 include/configs/adp-ag101.h
 create mode 100644 include/configs/ag101.h
 create mode 100644 include/nds32_common.h
 create mode 100644 include/nds32_n10.h
 create mode 100644 include/nds32_n12.h
 create mode 100644 include/nds32_n9.h
include/common.h +10 -0
index 8bca04f..629ebd5 100644
@@ -43,6 +43,9 @@ typedef volatile unsigned char	vu_char;
 #if defined(CONFIG_PCI) && (defined(CONFIG_4xx) && !defined(CONFIG_AP1000))
 #include <pci.h>
 #endif
+#if defined(CONFIG_NDS32)
+#include <nds32_common.h> /* should be reference to <asm/somefile.h> */
+#endif
 #if defined(CONFIG_8xx)
 #include <asm/8xx_immap.h>
 #if defined(CONFIG_MPC852)	|| defined(CONFIG_MPC852T)	|| \
@@ -274,6 +277,9 @@ void	forceenv     (char *, char *);
 #ifdef CONFIG_I386		/* x86 version to be fixed! */
 # include <asm/u-boot-i386.h>
 #endif /* CONFIG_I386 */
+#ifdef CONFIG_NDS32
+# include <asm/andesboot.h>
+#endif /* CONFIG_NDS32 */
 
 #ifdef CONFIG_AUTO_COMPLETE
 int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
@@ -729,10 +735,14 @@ int cpu_release(int nr, int argc, char *argv[]);
 #define CONFIG_HAS_POST
 #endif
 
+/* CONFIG_INIT_CRITICAL is necessay to run cpu_init_crit in start.s,
+   or exception would rise*/
+#ifndef __nds32__
 #ifdef CONFIG_INIT_CRITICAL
 #error CONFIG_INIT_CRITICAL is deprecated!
 #error Read section CONFIG_SKIP_LOWLEVEL_INIT in README.
 #endif
+#endif
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
include/configs/adp-ag101.h new file +33 -0
new file mode 100644
index 0000000..bc2211a
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2006 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _CONFIG_ADP_AG101_H
+#define _CONFIG_ADP_AG101_H
+
+#define CONFIG_N1213S	1		/* which is in an n1213s core cou */
+#define CONFIG_AG101	1		/* which is in an ag101 based board */
+
+#include "ag101.h"
+
+#endif	/* _CONFIG_ADP_AG101_H */
include/configs/ag101.h new file +265 -0

265 lines not on this page · raw message

include/image.h +5 -0
index 294eba5..ac81dec 100644
@@ -105,6 +105,7 @@
 #define IH_ARCH_BLACKFIN	16	/* Blackfin	*/
 #define IH_ARCH_AVR32		17	/* AVR32	*/
 #define IH_ARCH_ST200	        18	/* STMicroelectronics ST200  */
+#define IH_ARCH_NDS32	        19	/* ANDES Technology - nds32  */
 
 /*
  * Image Types
@@ -500,6 +501,8 @@ static inline int image_check_target_arch (const image_header_t *hdr)
 	if (!image_check_arch (hdr, IH_ARCH_SH))
 #elif defined(__sparc__)
 	if (!image_check_arch (hdr, IH_ARCH_SPARC))
+#elif defined(__nds32__)
+	if (!image_check_arch (hdr, IH_ARCH_NDS32))
 #else
 # error Unknown CPU type
 #endif
@@ -652,6 +655,8 @@ static inline int fit_image_check_target_arch (const void *fdt, int node)
 	if (!fit_image_check_arch (fdt, node, IH_ARCH_SH))
 #elif defined(__sparc__)
 	if (!fit_image_check_arch (fdt, node, IH_ARCH_SPARC))
+#elif defined(__nds32__)
+	if (!fit_image_check_arch (fdt, node, IH_ARCH_NDS32))
 #else
 # error Unknown CPU type
 #endif
include/nds32_common.h new file +214 -0

214 lines not on this page · raw message

include/nds32_n10.h new file +30 -0
new file mode 100644
index 0000000..0a06f27
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2010 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __NDS32_N10_H
+#define __NDS32_N10_H
+
+#include <nds32_common.h>
+
+#endif
include/nds32_n12.h new file +30 -0
new file mode 100644
index 0000000..1aa0295
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2010 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __NDS32_N12_H
+#define __NDS32_N12_H
+
+#include <nds32_common.h>
+
+#endif
include/nds32_n9.h new file +30 -0
new file mode 100644
index 0000000..0358cac
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2010 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ * Macpaul Lin, Andes Technology Corporation <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __NDS32_N9_H
+#define __NDS32_N9_H
+
+#include <nds32_common.h>
+
+#endif
Signature · 1 line
1.7.1
#13 lore raw

PATCH 10/10 nds32: add nds32 with Makefile support

In reply to Macpaul Lin

Add nds32 support in u-boot Makefile.

---
 Makefile |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
Makefile +10 -0
index c26e491..c6424ad 100644
@@ -479,6 +479,16 @@ unconfig:
 	$(MAKE)
 
 #========================================================================
+# ANDES
+#========================================================================
+
+#########################################################################
+## NDS32 adp-ag101 (also for FPGA_X5)
+#########################################################################
+adp-ag101_config: unconfig
+	@$(MKCONFIG) $(@:_config=) nds32 n1213s $(@:_config=) AndesTech ag101
+
+#========================================================================
 # PowerPC
 #========================================================================
 
Signature · 1 line
1.7.1
#14 lore raw

cover NDS32: add NDS32 architecture support to u-boot.

In reply to Macpaul Lin
Quoted 1 line · On Friday, June 11, 2010 05:34:34 Macpaul Lin wrote:

*** BLURB HERE ***

where's your BLURB ? wtf is NDS32 ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100619/ad2ab2a0/attachment.pgp