Skip to contentSkip to conversation

NDS32: Add NDS32 architecture support to u-boot.

PATCH Superseded Macpaul Lin 2 participants 11 messages Aug 5, 2010 – Aug 6, 2010

Subsystems (5)

v2 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

v2 cover NDS32: Add NDS32 architecture support to u-boot.

NDS32 is a new 32-bit RISC architecture invented by andestech.com.

It has a 16-bit/32-bit mixed-length instruction set to achieve optimal system performance, code density, and power efficiency.

NDS32 also provide N9, N10, N12 different CPU core families for soft-core and hard-core SoC design.

Macpaul Lin (8):
nds32: add support of general functions in arch lib
nds32: add cpu support for nds32 arch
nds32: add header files support for nds32
nds32: add header files support for soc ag101
nds32: add standalone related support for nds32
nds32: add common support for nds32
nds32: add board adp-ag101 support
ftrtc010.c : enhance code according to original datasheet

 MAINTAINERS                                   |   11 +
 MAKEALL                                       |    9 +
 Makefile                                      |   10 +
 arch/nds32/config.mk                          |   34 ++
 arch/nds32/cpu/Makefile                       |   52 ++
 arch/nds32/cpu/cpu.c                          |  197 +++++++
 arch/nds32/cpu/lowlevel_init.S                |  159 +++++
 arch/nds32/cpu/n1213/Makefile                 |   51 ++
 arch/nds32/cpu/n1213/ag101/Makefile           |   50 ++
 arch/nds32/cpu/n1213/ag101/cpu.c              |  197 +++++++
 arch/nds32/cpu/n1213/ag101/ftsmc020.c         |   51 ++
 arch/nds32/cpu/n1213/ag101/timer.c            |  213 +++++++
 arch/nds32/cpu/n1213/lowlevel_init.S          |  159 +++++
 arch/nds32/cpu/n1213/start.S                  |  447 ++++++++++++++
 arch/nds32/cpu/n1213/u-boot.lds               |   68 +++
 arch/nds32/cpu/start.S                        |  447 ++++++++++++++
 arch/nds32/include/asm/andesboot.h            |  242 ++++++++
 arch/nds32/include/asm/arch-ag101/ag101.h     |   44 ++
 arch/nds32/include/asm/arch-ag101/chipset.h   |  782 +++++++++++++++++++++++++
 arch/nds32/include/asm/arch-ag101/ftpmu010.h  |  146 +++++
 arch/nds32/include/asm/arch-ag101/ftsdmc020.h |  103 ++++
 arch/nds32/include/asm/arch-ag101/ftsmc020.h  |   79 +++
 arch/nds32/include/asm/arch-ag101/fttmr010.h  |   73 +++
 arch/nds32/include/asm/bitops.h               |  150 +++++
 arch/nds32/include/asm/byteorder.h            |   36 ++
 arch/nds32/include/asm/config.h               |   26 +
 arch/nds32/include/asm/global_data.h          |   76 +++
 arch/nds32/include/asm/io.h                   |  348 +++++++++++
 arch/nds32/include/asm/mach-types.h           |   29 +
 arch/nds32/include/asm/memory.h               |   19 +
 arch/nds32/include/asm/posix_types.h          |   84 +++
 arch/nds32/include/asm/processor.h            |   25 +
 arch/nds32/include/asm/ptrace.h               |   22 +
 arch/nds32/include/asm/ptregs.h               |   82 +++
 arch/nds32/include/asm/setup.h                |  272 +++++++++
 arch/nds32/include/asm/string.h               |   57 ++
 arch/nds32/include/asm/types.h                |   67 +++
 arch/nds32/include/asm/u-boot-nds32.h         |   76 +++
 arch/nds32/include/asm/u-boot.h               |   69 +++
 arch/nds32/include/asm/unaligned.h            |   31 +
 arch/nds32/lib/Makefile                       |   52 ++
 arch/nds32/lib/board.c                        |  452 ++++++++++++++
 arch/nds32/lib/bootm.c                        |  240 ++++++++
 arch/nds32/lib/interrupts.c                   |  126 ++++
 board/AndesTech/adp-ag101/Makefile            |   51 ++
 board/AndesTech/adp-ag101/adp-ag101.c         |   77 +++
 board/AndesTech/adp-ag101/config.mk           |   42 ++
 common/cmd_bdinfo.c                           |   26 +
 common/cmd_bootm.c                            |    2 +
 common/image.c                                |    1 +
 drivers/rtc/ftrtc010.c                        |   11 +
 examples/standalone/nds32.lds                 |   64 ++
 examples/standalone/stubs.c                   |   17 +-
 examples/standalone/x86-testapp.c             |   12 +
 include/common.h                              |   13 +
 include/configs/adp-ag101.h                   |  319 ++++++++++
 include/image.h                               |    5 +
 include/nds32_common.h                        |  203 +++++++
 58 files changed, 6806 insertions(+), 1 deletions(-)
 create mode 100644 arch/nds32/config.mk
 create mode 100644 arch/nds32/cpu/Makefile
 create mode 100644 arch/nds32/cpu/cpu.c
 create mode 100644 arch/nds32/cpu/lowlevel_init.S
 create mode 100644 arch/nds32/cpu/n1213/Makefile
 create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile
 create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c
 create mode 100644 arch/nds32/cpu/n1213/ag101/ftsmc020.c
 create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c
 create mode 100644 arch/nds32/cpu/n1213/lowlevel_init.S
 create mode 100644 arch/nds32/cpu/n1213/start.S
 create mode 100644 arch/nds32/cpu/n1213/u-boot.lds
 create mode 100644 arch/nds32/cpu/start.S
 create mode 100644 arch/nds32/include/asm/andesboot.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/chipset.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/ftpmu010.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/ftsdmc020.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/ftsmc020.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/fttmr010.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/mach-types.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-nds32.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 arch/nds32/lib/interrupts.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 examples/standalone/nds32.lds
 create mode 100644 include/configs/adp-ag101.h
 create mode 100644 include/nds32_common.h
#1 lore raw

PATCH v2 1/8 nds32: add support of general functions in arch lib

Add Makefile, board.c, interrupts.c and bootm.c functions to nds32 architecture.

---
 arch/nds32/lib/Makefile     |   52 +++++
 arch/nds32/lib/board.c      |  452 +++++++++++++++++++++++++++++++++++++++++++
 arch/nds32/lib/bootm.c      |  240 +++++++++++++++++++++++
 arch/nds32/lib/interrupts.c |  126 ++++++++++++
 4 files changed, 870 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
 create mode 100644 arch/nds32/lib/interrupts.c
arch/nds32/lib/Makefile new file +52 -0
new file mode 100644
index 0000000..22748ce
@@ -0,0 +1,52 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# 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
+#
+#
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(ARCH).a
+
+OBJS	:= board.o bootm.o interrupts.o
+
+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 +452 -0

452 lines not on this page · raw message

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

240 lines not on this page · raw message

arch/nds32/lib/interrupts.c new file +126 -0

126 lines not on this page · raw message

Signature · 1 line
1.6.4.1
#2 lore raw

PATCH v2 2/8 nds32: add cpu support for nds32 arch

In reply to Macpaul Lin

Add cpu support for nds32 arch.
Included support of common cpu setting, core n1213, SoC ag101.

---
 arch/nds32/config.mk                  |   34 +++
 arch/nds32/cpu/Makefile               |   52 ++++
 arch/nds32/cpu/cpu.c                  |  197 +++++++++++++++
 arch/nds32/cpu/lowlevel_init.S        |  159 ++++++++++++
 arch/nds32/cpu/n1213/Makefile         |   51 ++++
 arch/nds32/cpu/n1213/ag101/Makefile   |   50 ++++
 arch/nds32/cpu/n1213/ag101/cpu.c      |  197 +++++++++++++++
 arch/nds32/cpu/n1213/ag101/ftsmc020.c |   51 ++++
 arch/nds32/cpu/n1213/ag101/timer.c    |  213 ++++++++++++++++
 arch/nds32/cpu/n1213/lowlevel_init.S  |  159 ++++++++++++
 arch/nds32/cpu/n1213/start.S          |  447 +++++++++++++++++++++++++++++++++
 arch/nds32/cpu/n1213/u-boot.lds       |   68 +++++
 arch/nds32/cpu/start.S                |  447 +++++++++++++++++++++++++++++++++
 13 files changed, 2125 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/config.mk
 create mode 100644 arch/nds32/cpu/Makefile
 create mode 100644 arch/nds32/cpu/cpu.c
 create mode 100644 arch/nds32/cpu/lowlevel_init.S
 create mode 100644 arch/nds32/cpu/n1213/Makefile
 create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile
 create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c
 create mode 100644 arch/nds32/cpu/n1213/ag101/ftsmc020.c
 create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c
 create mode 100644 arch/nds32/cpu/n1213/lowlevel_init.S
 create mode 100644 arch/nds32/cpu/n1213/start.S
 create mode 100644 arch/nds32/cpu/n1213/u-boot.lds
 create mode 100644 arch/nds32/cpu/start.S
arch/nds32/config.mk new file +34 -0
new file mode 100644
index 0000000..89568c2
@@ -0,0 +1,34 @@
+#
+# (C) Copyright 2000-2002
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2010
+# 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
+
+LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
arch/nds32/cpu/Makefile new file +52 -0

52 lines not on this page · raw message

arch/nds32/cpu/cpu.c new file +197 -0

197 lines not on this page · raw message

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

159 lines not on this page · raw message

arch/nds32/cpu/n1213/Makefile new file +51 -0

51 lines not on this page · raw message

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

50 lines not on this page · raw message

arch/nds32/cpu/n1213/ag101/cpu.c new file +197 -0

197 lines not on this page · raw message

arch/nds32/cpu/n1213/ag101/ftsmc020.c new file +51 -0

51 lines not on this page · raw message

arch/nds32/cpu/n1213/ag101/timer.c new file +213 -0

213 lines not on this page · raw message

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

159 lines not on this page · raw message

arch/nds32/cpu/n1213/start.S new file +447 -0

447 lines not on this page · raw message

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

68 lines not on this page · raw message

arch/nds32/cpu/start.S new file +447 -0

447 lines not on this page · raw message

Signature · 1 line
1.6.4.1
#3 lore raw

PATCH v2 2/8 nds32: add cpu support for nds32 arch

Dear Macpaul Lin,

2010/8/5 Macpaul Lin <[email protected]>:

Quoted 18 lines

Add cpu support for nds32 arch.
Included support of common cpu setting, core n1213, SoC ag101.

---

?arch/nds32/config.mk ? ? ? ? ? ? ? ? ?| ? 34 +++
?arch/nds32/cpu/Makefile ? ? ? ? ? ? ? | ? 52 ++++
?arch/nds32/cpu/cpu.c ? ? ? ? ? ? ? ? ?| ?197 +++++++++++++++
?arch/nds32/cpu/lowlevel_init.S ? ? ? ?| ?159 ++++++++++++
?arch/nds32/cpu/n1213/Makefile ? ? ? ? | ? 51 ++++
?arch/nds32/cpu/n1213/ag101/Makefile ? | ? 50 ++++
?arch/nds32/cpu/n1213/ag101/cpu.c ? ? ?| ?197 +++++++++++++++
?arch/nds32/cpu/n1213/ag101/ftsmc020.c | ? 51 ++++
?arch/nds32/cpu/n1213/ag101/timer.c ? ?| ?213 ++++++++++++++++
?arch/nds32/cpu/n1213/lowlevel_init.S ?| ?159 ++++++++++++
?arch/nds32/cpu/n1213/start.S ? ? ? ? ?| ?447 +++++++++++++++++++++++++++++++++
?arch/nds32/cpu/n1213/u-boot.lds ? ? ? | ? 68 +++++
?arch/nds32/cpu/start.S ? ? ? ? ? ? ? ?| ?447 +++++++++++++++++++++++++++++++++
Quoted 1 line

?13 files changed, 2125 insertions(+), 0 deletions(-)

arch/nds32/cpu/cpu.c is almost identical to arch/nds32/cpu/n1213/ag101/cpu.c. arch/nds32/cpu/lowlevel_init.S is identical to arch/nds32/cpu/n1213/lowlevel_init.S.
arch/nds32/cpu/start.S is identical to arch/nds32/cpu/n1213/start.S.

There must be better way to do them.

best regards,
Po-Yu Chuang

#4 lore raw

PATCH v2 3/8 nds32: add header files support for nds32

In reply to Macpaul Lin

Add generic header files support for nds32 architecture.

---
 arch/nds32/include/asm/andesboot.h    |  242 +++++++++++++++++++++++
 arch/nds32/include/asm/bitops.h       |  150 ++++++++++++++
 arch/nds32/include/asm/byteorder.h    |   36 ++++
 arch/nds32/include/asm/config.h       |   26 +++
 arch/nds32/include/asm/global_data.h  |   76 +++++++
 arch/nds32/include/asm/io.h           |  348 +++++++++++++++++++++++++++++++++
 arch/nds32/include/asm/mach-types.h   |   29 +++
 arch/nds32/include/asm/memory.h       |   19 ++
 arch/nds32/include/asm/posix_types.h  |   84 ++++++++
 arch/nds32/include/asm/processor.h    |   25 +++
 arch/nds32/include/asm/ptrace.h       |   22 ++
 arch/nds32/include/asm/ptregs.h       |   82 ++++++++
 arch/nds32/include/asm/setup.h        |  272 +++++++++++++++++++++++++
 arch/nds32/include/asm/string.h       |   57 ++++++
 arch/nds32/include/asm/types.h        |   67 +++++++
 arch/nds32/include/asm/u-boot-nds32.h |   76 +++++++
 arch/nds32/include/asm/u-boot.h       |   69 +++++++
 arch/nds32/include/asm/unaligned.h    |   31 +++
 18 files changed, 1712 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/include/asm/andesboot.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/mach-types.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-nds32.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 +242 -0
new file mode 100644
index 0000000..8d7a402
@@ -0,0 +1,242 @@
+/*
+ * (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) 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 _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/.../... */
+/*
+ * removed according to a320
+int board_init(bd_t *);
+int dram_init(bd_t *bd);
+*/
+
+/* common/display_options.c */
+/*
+ * removed according to a320
+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);
+
+/* cache */
+int	icache_status (void);
+void	icache_enable (void);
+void	icache_disable(void);
+int	dcache_status (void);
+void	dcache_enable (void);
+void	dcache_disable(void);
+
+#define DEFINE_GET_SYS_REG(reg) \
+	inline static unsigned long GET_##reg(void) { \
+		unsigned long val; \
+		__asm__ volatile ( "mfsr %0, $"#reg :"=&r" (val) ::"memory"); \
+		return val; \
+	}
+
+enum cache_t{ ICACHE, DCACHE};
+DEFINE_GET_SYS_REG( ICM_CFG);
+DEFINE_GET_SYS_REG( DCM_CFG);
+#define ICM_CFG_offISZ	6	/* I-cache line size */
+#define ICM_CFG_mskISZ	( 0x7UL << ICM_CFG_offISZ )
+#define DCM_CFG_offDSZ	6	/* D-cache line size */
+#define DCM_CFG_mskDSZ	( 0x7UL << DCM_CFG_offDSZ )
+
+/* 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 */
+/*
+ * removed according to a320
+void cpu_init(void);
+void cleanup_before_linux(void);
+*/
+
+extern ulong load_addr;
+
+/*
+ * STDIO based functions (can always be used)
+ */
+
+/* serial stuff */
+int	serial_printf (const char *fmt, ...);
+
+/* stdin */
+int	getc(void);
+int	tstc(void);
+
+/* stdout */
+void	putc(const char c);
+void	puts(const char *s);
+int	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
+
+int	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/bitops.h new file +150 -0

150 lines not on this page · raw message

arch/nds32/include/asm/byteorder.h new file +36 -0
new file mode 100644
index 0000000..0b48be4
@@ -0,0 +1,36 @@
+/*
+ *  linux/include/asm-arm/byteorder.h
+ *
+ * Copyright (C) 2010 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 +26 -0
new file mode 100644
index 0000000..213d18f
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2010 Andes Technology Corporation
+ * Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com)
+ * Copyright (C) 2010 Macpaul Lin (macpaul at andestech.com)
+ *
+ * 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 +76 -0

76 lines not on this page · raw message

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

348 lines not on this page · raw message

arch/nds32/include/asm/mach-types.h new file +29 -0
new file mode 100644
index 0000000..a6f1c93
@@ -0,0 +1,29 @@
+/*
+ * This was automagically generated from arch/nds/tools/mach-types!
+ * Do NOT edit
+ */
+
+#ifndef __ASM_NDS32_MACH_TYPE_H
+#define __ASM_NDS32_MACH_TYPE_H
+
+#ifndef __ASSEMBLY__
+/* The type of machine we're running on */
+extern unsigned int __machine_arch_type;
+#endif
+
+/* see arch/arm/kernel/arch.c for a description of these */
+#define MACH_TYPE_ADPAG101             0
+
+#ifdef CONFIG_ARCH_ADPAG101
+# ifdef machine_arch_type
+#  undef machine_arch_type
+#  define machine_arch_type	__machine_arch_type
+# else
+#  define machine_arch_type	MACH_TYPE_ADPAG101
+# endif
+# define machine_is_adpag101()	(machine_arch_type == MACH_TYPE_ADPAG101)
+#else
+# define machine_is_adpag101()	(0)
+#endif
+
+#endif /* __ASM_NDS32_MACH_TYPE_H */
arch/nds32/include/asm/memory.h new file +19 -0
new file mode 100644
index 0000000..b8cff9b
@@ -0,0 +1,19 @@
+/*
+ *  linux/include/asm-arm/memory.h
+ *
+ * Copyright (C) 2000-2002 Russell King
+ *
+ * Copyright (C) 2010 Andes Technology Corporation
+ * Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com)
+ * Copyright (C) 2010 Macpaul Lin (macpaul at andestech.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *  Note: this file should not be included by non-asm/.h files
+ */
+#ifndef __ASM_NDS_MEMORY_H
+#define __ASM_NDS_MEMORY_H
+
+#endif	/* __ASM_NDS_MEMORY_H */
arch/nds32/include/asm/posix_types.h new file +84 -0

84 lines not on this page · raw message

arch/nds32/include/asm/processor.h new file +25 -0
new file mode 100644
index 0000000..19fdcc0
@@ -0,0 +1,25 @@
+/*
+ * linux/include/asm-arm/processor.h
+ *
+ * Copyright (C) 1995-2002 Russell King
+ *
+ * Copyright (C) 2010 Andes Technology Corporation
+ * Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com)
+ * Copyright (C) 2010 Macpaul Lin (macpaul at andestech.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_NDS_PROCESSOR_H
+#define __ASM_NDS_PROCESSOR_H
+
+/**************************************************************
+ * CAUTION:
+ *   - do not implement for NDS32 Arch yet.
+ *   - so far some files include /asm/processor.h, but
+ *     no one uses the macros defined in this head file.
+ **************************************************************/
+
+#endif /* __ASM_ARM_PROCESSOR_H */
arch/nds32/include/asm/ptrace.h new file +22 -0
new file mode 100644
index 0000000..fb804cb
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 Andes Technology Corporation
+ * Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com)
+ * Copyright (C) 2010 Macpaul Lin ([email protected])
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * CAUTION:
+ *   - do not implement for NDS32 Arch yet.
+ *   - included in common.h
+ */
+
+#ifndef __ASM_NDS_PTRACE_H
+#define __ASM_NDS_PTRACE_H
+
+#include <asm/ptregs.h>
+
+#endif /* __ASM_NDS_PTRACE_H */
arch/nds32/include/asm/ptregs.h new file +82 -0

82 lines not on this page · raw message

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

272 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 +67 -0

67 lines not on this page · raw message

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

76 lines not on this page · raw message

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

69 lines not on this page · raw message

arch/nds32/include/asm/unaligned.h new file +31 -0
new file mode 100644
index 0000000..4160041
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2016 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
+ */
+#ifndef __NDSEB__
+#define get_unaligned	__get_unaligned_le
+#define put_unaligned	__put_unaligned_le
+#else
+#define get_unaligned	__get_unaligned_be
+#define put_unaligned	__put_unaligned_be
+#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.6.4.1
#5 lore raw

PATCH v2 4/8 nds32: add header files support for soc ag101

In reply to Macpaul Lin

Add header files support for SoC ag101.

---
 arch/nds32/include/asm/arch-ag101/ag101.h     |   44 ++
 arch/nds32/include/asm/arch-ag101/chipset.h   |  782 +++++++++++++++++++++++++
 arch/nds32/include/asm/arch-ag101/ftpmu010.h  |  146 +++++
 arch/nds32/include/asm/arch-ag101/ftsdmc020.h |  103 ++++
 arch/nds32/include/asm/arch-ag101/ftsmc020.h  |   79 +++
 arch/nds32/include/asm/arch-ag101/fttmr010.h  |   73 +++
 6 files changed, 1227 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/chipset.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/ftpmu010.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/ftsdmc020.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/ftsmc020.h
 create mode 100644 arch/nds32/include/asm/arch-ag101/fttmr010.h
arch/nds32/include/asm/arch-ag101/ag101.h new file +44 -0
new file mode 100644
index 0000000..e0f199e
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 Andes Technology Corporation
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __AG101_H
+#define __AG101_H
+
+/*
+ * Hardware register bases
+ */
+#define CONFIG_FTSMC020_BASE	0x90200000	/* Static Memory Controller */
+#define CONFIG_DEBUG_LED	0x902ffffc	/* Debug LED */
+#define CONFIG_FTSDMC020_BASE	0x90300000	/* SDRAM Controller */
+
+/* Ethernet */
+/*
+ * Comes from Faraday CPE_110 and CPE_120
+ * CPE_110:
+ * 	CONFIG_FTMAC100_BASE	0x96700000
+ * CPE_120: (AG101)
+ * 	CONFIG_FTMAC100_BASE	0x90900000
+ */
+#define CONFIG_FTMAC100_BASE	0x90900000
+
+#define CONFIG_FTPMU010_BASE	0x98100000	/* Power Management Unit */
+#define CONFIG_FTTMR010_BASE	0x98400000	/* Timer */
+#define CONFIG_FTRTC010_BASE	0x98600000	/* Real Time Clock*/
+
+#endif	/* __AG101_H */
arch/nds32/include/asm/arch-ag101/chipset.h new file +782 -0

782 lines not on this page · raw message

arch/nds32/include/asm/arch-ag101/ftpmu010.h new file +146 -0

146 lines not on this page · raw message

arch/nds32/include/asm/arch-ag101/ftsdmc020.h new file +103 -0

103 lines not on this page · raw message

arch/nds32/include/asm/arch-ag101/ftsmc020.h new file +79 -0

79 lines not on this page · raw message

arch/nds32/include/asm/arch-ag101/fttmr010.h new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
1.6.4.1
#6 lore raw

PATCH v2 5/8 nds32: add standalone related support for nds32

In reply to Macpaul Lin

Add standalone program related support for nds32 architecture.

---
 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..1a90873
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 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 2d2e709..a763d0d 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.6.4.1
#7 lore raw

PATCH v2 6/8 nds32: add common support for nds32

In reply to Macpaul Lin

Add support to common commands, features, image format, and common headers.

---
 common/cmd_bdinfo.c    |   26 ++++++
 common/cmd_bootm.c     |    2 +
 common/image.c         |    1 +
 include/common.h       |   13 +++
 include/image.h        |    5 +
 include/nds32_common.h |  203 ++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 250 insertions(+), 0 deletions(-)
 create mode 100644 include/nds32_common.h
common/cmd_bdinfo.c +26 -0
index fbe73f1..b65797b 100644
@@ -348,6 +348,32 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
+#elif defined(CONFIG_NDS32)
+
+int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	int i;
+	bd_t *bd = gd->bd;
+
+	print_num ("arch_number",	bd->bi_arch_number);
+	print_num ("env_t",		(ulong)bd->bi_env);
+	print_num ("boot_params",	(ulong)bd->bi_boot_params);
+
+	for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
+		print_num("DRAM bank",	i);
+		print_num("-> start",	bd->bi_dram[i].start);
+		print_num("-> size",	bd->bi_dram[i].size);
+	}
+
+#if defined(CONFIG_CMD_NET)
+	print_eth(0);
+	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+#endif
+	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
+
+	return 0;
+}
+
 #else
  #error "a case for this architecture does not exist!"
 #endif
common/cmd_bootm.c +2 -0
index adfa6cd..7fc2284 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 6d8833e..ce968e2 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,			"",		"",		},
 };
 
include/common.h +13 -0
index eddec22..8d9c36d 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,12 @@ 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/mach-types.h>
+# include <asm/setup.h>
+# include <asm/u-boot-nds32.h>	/* NDS32 version to be fixed! */
+# 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 +738,14 @@ int cpu_release(int nr, int argc, char * const 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/image.h +5 -0
index bcc08d1..17a673d 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 +203 -0

203 lines not on this page · raw message

Signature · 1 line
1.6.4.1
#8 lore raw

PATCH v2 7/8 nds32: add board adp-ag101 support

In reply to Macpaul Lin

Add adp-ag101 board related settings to u-boot.

---
 MAINTAINERS                           |   11 ++
 MAKEALL                               |    9 +
 Makefile                              |   10 +
 board/AndesTech/adp-ag101/Makefile    |   51 ++++++
 board/AndesTech/adp-ag101/adp-ag101.c |   77 ++++++++
 board/AndesTech/adp-ag101/config.mk   |   42 +++++
 include/configs/adp-ag101.h           |  319 +++++++++++++++++++++++++++++++++
 7 files changed, 519 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
 create mode 100644 include/configs/adp-ag101.h
MAINTAINERS +11 -0
index 4b91b0f..4783d93 100644
@@ -1039,5 +1039,16 @@ Brent Kandetzki <[email protected]>
 	IP04		BF532
 
 #########################################################################
+# NDS32 Systems:							#
+#									#
+# Maintainer Name, Email Address					#
+#	Board		CPU						#
+#########################################################################
+
+Macpaul Lin <[email protected]>
+
+	ADP-AG101	N1213 (AG101 SoC)
+
+#########################################################################
 # End of MAINTAINERS list						#
 #########################################################################
MAKEALL +9 -0
index 2133559..c288f7b 100755
@@ -959,6 +959,14 @@ LIST_sh="		\
 
 LIST_sparc="gr_xc3s_1500	gr_cpci_ax2000	gr_ep2s60	grsim	grsim_leon2"
 
+#########################################################################
+## NDS32 Systems
+#########################################################################
+
+LIST_nds32="		\
+	adp-ag101	\
+"
+
 #-----------------------------------------------------------------------
 
 #----- for now, just run PowerPC by default -----
@@ -1017,6 +1025,7 @@ do
 	|coldfire \
 	|microblaze \
 	|mips|mips_el \
+	|nds32|nds32el \
 	|nios2 \
 	|ppc|powerpc|5xx|5xxx|512x|8xx|8220|824x|8260|83xx|85xx|86xx|4xx|7xx|74xx|TSEC \
 	|sh|sh2|sh3|sh4 \
Makefile +10 -0
index 9cea069..dd03d38 100644
@@ -497,6 +497,16 @@ lcname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/')
 ucname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/')
 
 #========================================================================
+# ANDES
+#========================================================================
+
+#########################################################################
+## NDS32 adp-ag101 (n1213h hard core SoC)
+#########################################################################
+adp-ag101_config: unconfig
+	@$(MKCONFIG) $(@:_config=) nds32 n1213 $(@:_config=) AndesTech ag101
+
+#========================================================================
 # PowerPC
 #========================================================================
 
board/AndesTech/adp-ag101/Makefile new file +51 -0

51 lines not on this page · raw message

board/AndesTech/adp-ag101/adp-ag101.c new file +77 -0

77 lines not on this page · raw message

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

42 lines not on this page · raw message

include/configs/adp-ag101.h new file +319 -0

319 lines not on this page · raw message

Signature · 1 line
1.6.4.1
#9 lore raw

PATCH v2 7/8 nds32: add board adp-ag101 support

Dear Macpaul Lin,

2010/8/5 Macpaul Lin <[email protected]>:

Quoted 33 lines
board/AndesTech/adp-ag101/config.mk new file +27 -0
new file mode 100644
index 0000000..0b95960
@@ -0,0 +1,42 @@
+#
+# 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
+#
+
+# Faraday A320 board with FA526/FA626TE/ARM926EJ-S cpus
+#
+# see http://www.faraday-tech.com/ for more information

board/AndesTech/adp-ag101/config.mk line 37

Quoted 10 lines
board/AndesTech/adp-ag101/config.mk new file +10 -0
+
+# A320 has 1 bank of 64 MB DRAM
+#
+# 1000'0000 to 1400'0000
+#
+# Linux-Kernel is expected to be at 1000'8000, entry 1000'8000
+#
+# we load ourself to 13f8'0000
+#
+# download area is 1200'0000

You forgot to modify A320-related descriptions to your board.

Quoted 51 lines
board/AndesTech/adp-ag101/config.mk new file +5 -0
+
+PLATFORM_RELFLAGS += -gdwarf-2
+TEXT_BASE = 0x03200000
+LDSCRIPT := $(SRCTREE)/arch/$(ARCH)/cpu/$(CPU)/u-boot.lds
+EXTERN_LIB += $(shell $(CC) -print-file-name=include)/../static/el/libgcc.a
include/configs/adp-ag101.h new file +40 -0
new file mode 100644
index 0000000..311593f
@@ -0,0 +1,319 @@
+/*
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/arch/ag101.h>
+
+/*-----------------------------------------------------------------------
+ * CPU and Board Configuration Options
+ */
+#define CONFIG_ADP_AG101P
+
+#define CONFIG_USE_INTERRUPT
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+/*-----------------------------------------------------------------------
+ * Timer
+ */

include/configs/adp-ag101.h line 50

Quoted 10 lines
include/configs/adp-ag101.h new file +10 -0
+/* a320evb: ? ?CONFIG_SYS_HZ: ? ? ? ? ?1000
+ * ag101: ? ? ?CONFIG_SYS_HZ: ? ? ? ? ?APB_CLK (ag101 original timer clock frequency)
+ *
+ * CONFIG_SYS_HZ = APB_CLK = SYS_CLK = CONFIG_SYS_CLK_FREQ /2
+ * the PWM Timer 4 uses a counter of 15625 for 10 ms, so we need
+ * it to wrap 100 times (total 1562500) to get 1 sec.
+ * #define CONFIG_HZ ? ? ? ? ? 1562500
+ * 1562500*25=3906250
+ */
+#define CONFIG_SYS_HZ ? ? ? ? ?APB_CLK ? ? ? ? /* ag101 original timer clock frequency */

CONFIG_SYS_HZ should be 1000.

http://lists.denx.de/pipermail/u-boot/2009-February/048403.html
http://lists.denx.de/pipermail/u-boot/2010-March/069293.html

Quoted 159 lines
include/configs/adp-ag101.h new file +159 -0
+#define VERSION_CLOCK ? ? ? ? ?CONFIG_SYS_CLK_FREQ
+
+/*
+ * System Clock
+ * Suggested frequency lists:
+ * ? ? 16000000 -> 16.000000 MHz
+ * ? ? 18432000 -> 18.432000 MHz
+ * ? ? 22118400 -> 22.118400 MHz
+ * ? ? 83000000 -> 83.000000 MHz
+ * ? ? 33000000 -> 33.000000 MHz
+ * ? ? 36864000 -> 36.864000 MHz
+ * ? ? 48000000 -> 48.000000 MHz CONFIG_ADP_AG101
+ * ? ? 40000000 -> 40.000000 MHz CONFIG_ADP_AG101P
+ */
+#ifdef CONFIG_ADP_AG101
+#define ?CONFIG_SYS_CLK_FREQ ? 48000000
+#endif
+
+#ifdef CONFIG_ADP_AG101P
+#define ?CONFIG_SYS_CLK_FREQ ? 39062500
+#endif
+
+/*
+ * Use Externel CLOCK or PCLK
+ */
+#undef CONFIG_EXT_CLK
+
+#ifndef CONFIG_EXT_CLK
+#define CONFIG_PCLK
+#endif
+
+#ifdef CONFIG_EXT_CLK
+#define TIMER_CLOCK ? ?32768 ? ? ? ? ? ? ? ? ? /* EXT_CLK */
+#else
+#define TIMER_CLOCK ? ?CONFIG_SYS_HZ ? ? ? ? ? /* PCLK */
+#endif
+
+#define TIMER_LOAD_VAL 0xffffffff
+
+/*-----------------------------------------------------------------------
+ * Real Time Clock
+ */
+#define CONFIG_RTC_FTRTC010
+
+/*
+ * Real Time Clock Divider
+ * RTC_DIV_COUNT ? ? ? ? ? ? ? ? ? ? ? (OSC_CLK/OSC_5MHZ)
+ */
+#ifdef CONFIG_ADP_AG101
+#define OSC_5MHZ ? ? ? ? ? ? ? ? ? ? ? (5*1000000)
+#define OSC_CLK ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(2*OSC_5MHZ)
+#define RTC_DIV_COUNT ? ? ? ? ? ? ? ? ?(OSC_CLK/OSC_5MHZ)
+#endif
+
+#ifdef CONFIG_ADP_AG101P
+#define OSC_5MHZ ? ? ? ? ? ? ? ? ? ? ? (5*1000000)
+#define OSC_CLK ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(4*OSC_5MHZ)
+#define RTC_DIV_COUNT ? ? ? ? ? ? ? ? ?(0.5) ? /* Why?? */
+#endif
+
+/*-----------------------------------------------------------------------
+ * Serial console configuration
+ */
+
+/* FTUART is a high speed NS 16C550A compatible UART */
+#define CONFIG_BAUDRATE ? ? ? ? ? ? ? ? ? ? ? ?38400
+#define CONFIG_CONS_INDEX ? ? ? ? ? ? ?1
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_COM1 ? ? ? ? ? ? ? ?0x99600000
+#define CONFIG_SYS_NS16550_REG_SIZE ? ?-4
+
+#ifdef CONFIG_ADP_AG101
+#define CONFIG_SYS_NS16550_CLK ? ? ? ? (46080000 * 20) / 25 /* AG101 */
+#endif
+
+#ifdef CONFIG_ADP_AG101P
+#define CONFIG_SYS_NS16550_CLK ? ? ? ? (18432000 * 20) / 25 /* AG101P */
+#endif
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE ? ? ?{ 9600, 19200, 38400, 57600, 115200 }
+
+/*-----------------------------------------------------------------------
+ * Ethernet
+ */
+#define CONFIG_NET_MULTI
+#define CONFIG_FTMAC100
+
+#define CONFIG_BOOTDELAY ? ? ? 3
+
+/*-----------------------------------------------------------------------
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_DATE
+#define CONFIG_CMD_PING
+
+/*-----------------------------------------------------------------------
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP ? ? ? ? ? ? ? ? ? ?/* undef to save memory */
+#define CONFIG_SYS_PROMPT ? ? ?"NDS32 # " ? ? ?/* Monitor Command Prompt */
+#define CONFIG_SYS_CBSIZE ? ? ?256 ? ? ? ? ? ? /* Console I/O Buffer Size */
+
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE ? ? ?\
+ ? ? ? (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+
+/* max number of command args */
+#define CONFIG_SYS_MAXARGS ? ? 16
+
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE ? ?CONFIG_SYS_CBSIZE
+
+/*-----------------------------------------------------------------------
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE ? ? ? (128 * 1024) ? ?/* regular stack */
+#ifdef CONFIG_USE_IRQ
+#define CONFIG_STACKSIZE_IRQ ? (4 * 1024) ? ? ?/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ ? (4 * 1024) ? ? ?/* FIQ stack */
+#endif
+
+/*-----------------------------------------------------------------------
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN ? ? ? ? ?(CONFIG_ENV_SIZE + 128 * 1024)
+
+/*-----------------------------------------------------------------------
+ * size in bytes reserved for initial data
+*/
+#define CONFIG_SYS_GBL_DATA_SIZE ? ? ? 128
+
+/*-----------------------------------------------------------------------
+ * SDRAM controller configuration
+ */
+#define CONFIG_SYS_FTSDMC020_TP0 ? ? ? (FTSDMC020_TP0_TRAS(2) ?| ? ? ? \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_TP0_TRP(1) ? | ? ? ? \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_TP0_TRCD(1) ?| ? ? ? \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_TP0_TRF(3) ? | ? ? ? \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_TP0_TWR(1) ? | ? ? ? \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_TP0_TCL(2))
+
+#define CONFIG_SYS_FTSDMC020_TP1 ? ? ? (FTSDMC020_TP1_INI_PREC(4) | ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_TP1_INI_REFT(8) | ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_TP1_REF_INTV(0x180))
+
+#define CONFIG_SYS_FTSDMC020_BANK0_BSR (FTSDMC020_BANK_ENABLE ? | ? ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_BANK_DDW_X16 ?| ? ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_BANK_DSZ_256M | ? ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_BANK_MBW_32 ? | ? ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FTSDMC020_BANK_SIZE_64M)
+
+/*-----------------------------------------------------------------------

include/configs/adp-ag101.h line 219

Quoted 10 lines
include/configs/adp-ag101.h new file +10 -0
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS ? 1 ? ? ? ? ? ? ? /* we have 1 bank of DRAM */
+#define PHYS_SDRAM_0 ? ? ? ? ? 0x00000000 ? ? ?/* SDRAM Bank #1 */
+#define PHYS_SDRAM_0_SIZE ? ? ?0x04000000 ? ? ?/* 64 MB */
+
+/*
+ * Load address and memory test area should agree with
+ * board/faraday/a320/config.mk. Be careful not to overwrite U-boot itself.
+ */

ditto.

best regards,
Po-Yu Chuang

#10 lore raw

PATCH v2 8/8 ftrtc010.c : enhance code according to original datasheet

In reply to Macpaul Lin

Add missing codes according to original datasheet.
This patch also makes ftrtc010 could be adapted to PCLK and EXT_CLK.

---
 drivers/rtc/ftrtc010.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/rtc/ftrtc010.c +11 -0
index 7738a7a..4569595 100644
@@ -34,6 +34,13 @@ struct ftrtc010 {
 	unsigned int alarm_hour;	/* 0x18 */
 	unsigned int record;		/* 0x1c */
 	unsigned int cr;		/* 0x20 */
+	unsigned int wsec;		/* 0x24 */
+	unsigned int wmin;		/* 0x28 */
+	unsigned int whour;		/* 0x2c */
+	unsigned int wday;		/* 0x30 */
+	unsigned int intr;		/* 0x34 */
+	unsigned int div;		/* 0x38 */
+	unsigned int rev;		/* 0x3c */
 };
 
 /*
@@ -85,7 +92,11 @@ int rtc_get(struct rtc_time *tmp)
 	debug("%s(): record register: %x\n",
 	      __func__, readl(&rtc->record));
 
+#ifdef CONFIG_PCLK
+	now = (ftrtc010_time() + readl(&rtc->record)) / RTC_DIV_COUNT;
+#else /* CONFIG_EXT_CLK */
 	now = ftrtc010_time() + readl(&rtc->record);
+#endif
 
 	to_tm(now, tmp);
 
Signature · 1 line
1.6.4.1