Skip to contentSkip to conversation

nds32: add header files support for nds32

PATCH Superseded Macpaul Lin 1 participant 10 messages Apr 11, 2011

Subsystems (3)

v8 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

PATCH v8 1/10 nds32: add header files support for nds32

Add generic header files support for nds32 architecture. Cache, ptrace, data type and other definitions are included.

---
Changes for v1-v4:
- Code cleanup and style formatting.

Changes for v5-v6:
- This patch also updated the following changes against the

     change after master tree (v2010.12-rc1).

- fix upper case definitions in cache.h
- Support GD_FLG_ENV_READY and env_buf vars in nds32 global_data.h.
- Add readsb, writesb functions into io.h.

Changes for v7:
- clean up
- volatile:
- types.h
- remove typedef volatile unsigned char vuchar;
- remove typedef volatile unsigned long vulong;
- remove typedef volatile unsigned short vushort;
- u-boot.h: remove bd_info_ext bi_ext
- bitops.h: add accessor function to bit operation with volatile var.
- system.h: add system.h for local_irq operation with flag.

Changes for v8:
- ptrace.h: rewrite the pt_reg structure, and merge ptregs.h.
- ptregs.h: removed

 arch/nds32/include/asm/bitops.h       |  186 +++++++++++++++
 arch/nds32/include/asm/byteorder.h    |   36 +++
 arch/nds32/include/asm/cache.h        |   54 +++++
 arch/nds32/include/asm/config.h       |   26 ++
 arch/nds32/include/asm/global_data.h  |   82 +++++++
 arch/nds32/include/asm/io.h           |  410 +++++++++++++++++++++++++++++++++
 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       |   88 +++++++
 arch/nds32/include/asm/string.h       |   57 +++++
 arch/nds32/include/asm/system.h       |   88 +++++++
 arch/nds32/include/asm/types.h        |   63 +++++
 arch/nds32/include/asm/u-boot-nds32.h |   50 ++++
 arch/nds32/include/asm/u-boot.h       |   63 +++++
 arch/nds32/include/asm/unaligned.h    |   31 +++
 17 files changed, 1391 insertions(+), 0 deletions(-)
 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/cache.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/string.h
 create mode 100644 arch/nds32/include/asm/system.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/bitops.h new file +186 -0
new file mode 100644
index 0000000..c56f04b
@@ -0,0 +1,186 @@
+/*
+ * Copyright 1995, Russell King.
+ * Various bits and pieces copyrights include:
+ *  Linus Torvalds (test_bit).
+ *
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <[email protected]>
+ *
+ * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
+ *
+ * Please note that the code in this file should never be included
+ * from user space.  Many of these are not implemented in assembler
+ * since they would be too costly.  Also, they require priviledged
+ * instructions (which are not available from user mode) to ensure
+ * that they are atomic.
+ */
+
+#ifndef __ASM_NDS_BITOPS_H
+#define __ASM_NDS_BITOPS_H
+
+#ifdef __KERNEL__
+
+#include <asm/system.h>
+
+#define smp_mb__before_clear_bit()	do { } while (0)
+#define smp_mb__after_clear_bit()	do { } while (0)
+
+/*
+ * Function prototypes to keep gcc -Wall happy.
+ */
+extern void set_bit(int nr, volatile void *addr);
+
+static inline void __set_bit(int nr, volatile void *addr)
+{
+	int *a = (int *)addr;
+	int mask;
+
+	a += nr >> 5;
+	mask = 1 << (nr & 0x1f);
+	*a |= mask;
+}
+
+extern void clear_bit(int nr, volatile void *addr);
+
+static inline void __clear_bit(int nr, volatile void *addr)
+{
+	int *a = (int *)addr;
+	int mask;
+	unsigned long flags;
+
+	a += nr >> 5;
+	mask = 1 << (nr & 0x1f);
+	local_irq_save(flags);
+	*a &= ~mask;
+	local_irq_restore(flags);
+}
+
+extern void change_bit(int nr, volatile void *addr);
+
+static inline void __change_bit(int nr, volatile void *addr)
+{
+	int mask;
+	unsigned long *ADDR = (unsigned long *)addr;
+
+	ADDR += nr >> 5;
+	mask = 1 << (nr & 31);
+	*ADDR ^= mask;
+}
+
+extern int test_and_set_bit(int nr, volatile void *addr);
+
+static inline int __test_and_set_bit(int nr, volatile void *addr)
+{
+	int mask, retval;
+	volatile unsigned int *a = (volatile unsigned int *)addr;
+
+	a += nr >> 5;
+	mask = 1 << (nr & 0x1f);
+	retval = (mask & *a) != 0;
+	*a |= mask;
+	return retval;
+}
+
+extern int test_and_clear_bit(int nr, volatile void *addr);
+
+static inline int __test_and_clear_bit(int nr, volatile void *addr)
+{
+	int mask, retval;
+	volatile unsigned int *a = (volatile unsigned int *)addr;
+
+	a += nr >> 5;
+	mask = 1 << (nr & 0x1f);
+	retval = (mask & *a) != 0;
+	*a &= ~mask;
+	return retval;
+}
+
+extern int test_and_change_bit(int nr, volatile void *addr);
+
+static inline int __test_and_change_bit(int nr, volatile void *addr)
+{
+	int mask, retval;
+	volatile unsigned int *a = (volatile unsigned int *)addr;
+
+	a += nr >> 5;
+	mask = 1 << (nr & 0x1f);
+	retval = (mask & *a) != 0;
+	*a ^= mask;
+	return retval;
+}
+
+extern int find_first_zero_bit(void *addr, unsigned size);
+extern int find_next_zero_bit(void *addr, int size, int offset);
+
+/*
+ * This routine doesn't need to be atomic.
+ */
+static inline int test_bit(int nr, const void *addr)
+{
+	return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7));
+}
+
+/*
+ * ffz = Find First Zero in word. Undefined if no zero exists,
+ * so code should check against ~0UL first..
+ */
+static inline unsigned long ffz(unsigned long word)
+{
+	int k;
+
+	word = ~word;
+	k = 31;
+	if (word & 0x0000ffff) {
+		k -= 16; word <<= 16;
+	}
+	if (word & 0x00ff0000) {
+		k -= 8;  word <<= 8;
+	}
+	if (word & 0x0f000000) {
+		k -= 4;  word <<= 4;
+	}
+	if (word & 0x30000000) {
+		k -= 2;  word <<= 2;
+	}
+	if (word & 0x40000000)
+		k -= 1;
+
+	return k;
+}
+
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+/*
+ * redefined in include/linux/bitops.h
+ * #define ffs(x) generic_ffs(x)
+ */
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+#define ext2_set_bit			test_and_set_bit
+#define ext2_clear_bit			test_and_clear_bit
+#define ext2_test_bit			test_bit
+#define ext2_find_first_zero_bit	find_first_zero_bit
+#define ext2_find_next_zero_bit		find_next_zero_bit
+
+/* Bitmap functions for the minix filesystem. */
+#define minix_test_and_set_bit(nr, addr)	test_and_set_bit(nr, addr)
+#define minix_set_bit(nr, addr)			set_bit(nr, addr)
+#define minix_test_and_clear_bit(nr, addr)	test_and_clear_bit(nr, addr)
+#define minix_test_bit(nr, addr)		test_bit(nr, addr)
+#define minix_find_first_zero_bit(addr, size)	find_first_zero_bit(addr, size)
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_NDS_BITOPS_H */
arch/nds32/include/asm/byteorder.h new file +36 -0
new file mode 100644
index 0000000..39fd9ed
@@ -0,0 +1,36 @@
+/*
+ *  linux/include/asm-arm/byteorder.h
+ *
+ * Copyright (C) 2011 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/cache.h new file +54 -0

54 lines not on this page · raw message

arch/nds32/include/asm/config.h new file +26 -0
new file mode 100644
index 0000000..23421b7
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com)
+ * Copyright (C) 2011 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 +82 -0

82 lines not on this page · raw message

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

410 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..5bcc4e1
@@ -0,0 +1,19 @@
+/*
+ *  linux/include/asm-arm/memory.h
+ *
+ * Copyright (C) 2000-2002 Russell King
+ *
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com)
+ * Copyright (C) 2011 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..e5d186c
@@ -0,0 +1,25 @@
+/*
+ * linux/include/asm-arm/processor.h
+ *
+ * Copyright (C) 1995-2002 Russell King
+ *
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com)
+ * Copyright (C) 2011 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 +88 -0

88 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/system.h new file +88 -0

88 lines not on this page · raw message

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

63 lines not on this page · raw message

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

50 lines not on this page · raw message

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

63 lines not on this page · raw message

arch/nds32/include/asm/unaligned.h new file +31 -0
new file mode 100644
index 0000000..ffa7e30
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2016 Andes Technology Corporation
+ * Copyright (C) 2011 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.7.3.5
#1 lore raw

PATCH v8 2/10 nds32: add NDS32 support into common header file

Add NDS32 support into common header file.

---
 include/common.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
index 54503ed..423bbd8 100644
@@ -273,6 +273,10 @@ int	setenv	     (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/u-boot-nds32.h>	/* NDS32 version to be fixed! */
+#endif /* CONFIG_NDS32 */
 
 #ifdef CONFIG_AUTO_COMPLETE
 int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
Signature · 1 line
1.7.3.5
#2 lore raw

PATCH v8 3/10 nds32/core N1213: NDS32 N12 core family N1213

In reply to Macpaul Lin

Add N1213 cpu core (N12 Core family) support for NDS32 arch. This patch includes start.S for the initialize procedure of N1213.

NDS32 Core N1213 has the following hardware features.

Core:
- 16-/32-bit mixable instruction format
- 32 general-purpose 32-bit registers
- 8-stage pipeline
- Dynamic branch prediction
- 32/64/128/256 BTB
- Return address stack (RAS)
- Vector interrupts for internal/external
- 3 HW-level nested interruptions
- User and super-user mode support
- Memory-mapped I/O
- Address space up to 4GB

Memory Management Unit:
- TLB
- Optional hardware page table walker
- Two groups of page size support

Memory Subsystem:
- I & D cache
- I & D local memory (LM)

Bus Interface:
- Synchronous/Asynchronous AHB bus: 0, 1 or 2 ports

Start procedure:
start.S will start up the N1213 CPU core at first, then jump to SoC dependent "lowlevel_init.S" and "watchdog.S" to configure peripheral devices.

---
 arch/nds32/cpu/n1213/Makefile   |   50 +++++
 arch/nds32/cpu/n1213/start.S    |  447 +++++++++++++++++++++++++++++++++++++++
 arch/nds32/cpu/n1213/u-boot.lds |   68 ++++++
 3 files changed, 565 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/cpu/n1213/Makefile
 create mode 100644 arch/nds32/cpu/n1213/start.S
 create mode 100644 arch/nds32/cpu/n1213/u-boot.lds
arch/nds32/cpu/n1213/Makefile new file +50 -0
new file mode 100644
index 0000000..111d14f
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# Copyright (C) 2011 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$(CPU).o
+
+START	= start.o
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(START) $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
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

Signature · 1 line
1.7.3.5
#3 lore raw

PATCH v8 4/10 nds32/ag101: dev offset header of SoC ag101

In reply to Macpaul Lin

Add header file of device offset support for SoC ag101.

SoC ag101 is the first chip using NDS32 N1213 cpu core.

Note:
Ag101 is actually use ftsdmc021 instead of ftsdmc020 as dram controller, which is probably wrong in the datasheet.

---
 arch/nds32/include/asm/arch-ag101/ag101.h |   68 +++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
arch/nds32/include/asm/arch-ag101/ag101.h new file +68 -0
new file mode 100644
index 0000000..011989a
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Nobuhiro 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __AG101_H
+#define __AG101_H
+
+/* Hardware register bases */
+#define CONFIG_FTAHBC020S_BASE		0x90100000	/* AHB Controller */
+#define CONFIG_FTSMC020_BASE		0x90200000	/* Static Memory Controller (SRAM) */
+#define CONFIG_FTSDMC021_BASE		0x90300000	/* FTSDMC020/021 SDRAM Controller */
+#define CONFIG_FTDMAC020_BASE		0x90400000	/* DMA Controller */
+#define CONFIG_FTAPBBRG020S_01_BASE	0x90500000	/* AHB-to-APB Bridge */
+#define CONFIG_FTLCDC100_BASE		0x90600000	/* LCD Controller */
+#define CONFIG_RESERVED_01_BASE		0x90700000	/* Reserved */
+#define CONFIG_RESERVED_02_BASE		0x90800000	/* Reserved */
+#define CONFIG_FTMAC100_BASE		0x90900000	/* Ethernet */
+#define CONFIG_EXT_USB_HOST_BASE	0x90A00000	/* External USB host */
+#define CONFIG_USB_DEV_BASE		0x90B00000	/* USB Device */
+#define CONFIG_EXT_AHBPCIBRG_BASE	0x90C00000	/* External AHB-to-PCI Bridge (FTPCI100 not exist in ag101) */
+#define CONFIG_RESERVED_03_BASE		0x90D00000	/* Reserved */
+#define CONFIG_EXT_AHBAPBBRG_BASE	0x90E00000	/* External AHB-to-APB Bridger (FTAPBBRG020S_02) */
+#define CONFIG_EXT_AHBSLAVE01_BASE	0x90F00000	/* External AHB slave1 (LCD) */
+
+#define CONFIG_EXT_AHBSLAVE02_BASE	0x92000000	/* External AHB slave2 (FUSBH200) */
+
+/* DEBUG LED */
+#define CONFIG_DEBUG_LED		0x902FFFFC	/* Debug LED */
+
+/* APB Device definitions */
+#define CONFIG_FTPMU010_BASE		0x98100000	/* Power Management Unit */
+#define CONFIG_FTUART010_01_BASE	0x98300000	/* BT UART 2/IrDA (UART 01 in Linux) */
+#define CONFIG_FTTMR010_BASE		0x98400000	/* Counter/Timers */
+#define CONFIG_FTWDT010_BASE		0x98500000	/* Watchdog Timer */
+#define CONFIG_FTRTC010_BASE		0x98600000	/* Real Time Clock */
+#define CONFIG_FTGPIO010_BASE		0x98700000	/* GPIO */
+#define CONFIG_FTINTC010_BASE		0x98800000	/* Interrupt Controller */
+#define CONFIG_FTIIC010_BASE		0x98A00000	/* I2C */
+#define CONFIG_RESERVED_04_BASE		0x98C00000	/* Reserved */
+#define CONFIG_FTCFC010_BASE		0x98D00000	/* Compat Flash Controller */
+#define CONFIG_FTSDC010_BASE		0x98E00000	/* SD Controller */
+
+#define CONFIG_FTSSP010_02_BASE		0x99400000	/* Synchronous Serial Port Controller (SSP) I2S/AC97 */
+#define CONFIG_FTUART010_02_BASE	0x99600000	/* ST UART ? SSP 02 (UART 02 in Linux) */
+
+/* The following address was not defined in Linux */
+#define CONFIG_FTUART010_03_BASE	0x98200000	/* FF UART 3 */
+#define CONFIG_FTSSP010_01_BASE		0x98B00000	/* Synchronous Serial Port Controller (SSP) 01 */
+#define CONFIG_IRDA_BASE		0x98900000	/* IrDA */
+#define CONFIG_PMW_BASE			0x99100000	/* PWM - Pulse Width Modulator Controller */
+
+#endif	/* __AG101_H */
Signature · 1 line
1.7.3.5
#4 lore raw

PATCH v8 5/10 nds32/ag101: lowlevel_init.S of ag101

In reply to Macpaul Lin

lowlevel_init.S is a peripheral initial procedure of ag101. It configures onboard dram, clock, and power settings. It also prepars the dram environment before moving u-boot from rom and flash into dram.

This version of lowlevel_init.S also replace hardcode value by MARCO defines from the GPL version andesboot for better code quality.

---
ChangeLog from v1-v4:
- Code clean up and formatting style.

ChangeLog from v5-v6
- Change hard code value into MARCO definitions.
- ftsmc010
- Fix FTSMC020_TPR_AT2 from 1 to 3 (0xff3ff)
- ftsdmc021
- Fix hardcoded address of CR1, CR2, TR1, TR2, BANK0 registers.
- Fix the default configuration value of FTSDMC and FTSMC controller.
- Remove some ftpmu010 and flash probe code to C functions.

 arch/nds32/cpu/n1213/ag101/lowlevel_init.S |  160 ++++++++++++++++++++++++++++
 1 files changed, 160 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/cpu/n1213/ag101/lowlevel_init.S
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +160 -0
new file mode 100644
index 0000000..96969ba
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2011 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
+ */
+
+.text
+
+#include <common.h>
+#include <config.h>
+
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+.globl	lowlevel_init
+lowlevel_init:
+	move	$r10, $lp
+	jal	mem_init
+	jal	remap
+
+	ret	$r10
+
+mem_init:
+	move	$r11, $lp
+
+	/*
+	 * mem_init:
+	 *	There are 2 bank connected to FTSMC020 on AG101
+	 *	BANK0: FLASH/ROM (SW5, J16), BANK1: OnBoard SDRAM.
+	 *	we need to set onboard SDRAM before remap and relocation.
+	 */
+	li	$r0, (CONFIG_FTSMC020_BASE+FTSMC020_BANK0_CR)
+	li	$r1, (FTSMC020_BANK1_CONFIG)			! 0x10000052
+	swi	$r1, [$r0]
+	li	$r1, (FTSMC020_BANK1_TIMING)			! 0x00151151
+	swi	$r1, [$r0+FTSMC020_BANK0_TPR]
+
+	/*
+	 * config AHB Controller
+	 */
+	li	$r0, (CONFIG_FTAHBC020S_BASE + FTAHBC020S_SLAVE_BSR_6)
+	li	$r1, (CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6)
+	swi	$r1, [$r0]
+
+	/*
+	 * config PMU
+	 */
+	li	$r0, (CONFIG_FTPMU010_BASE + FTPMU010_PDLLCR0)
+	lwi	$r1, [$r0]
+	! ftpmu010_dlldis_disable, must do it in lowleve_init
+	li	$r2, FTPMU010_PDLLCR0_DLLDIS			! 0x00010000
+	or	$r1, $r1, $r2
+	swi	$r1, [$r0]
+
+	/*
+	 * config SDRAM controller
+	 */
+	li	$r0, (CONFIG_FTSDMC021_BASE)
+	li	$r1, (CONFIG_SYS_FTSDMC021_TP1) ! 0x00011312
+	swi	$r1, [$r0]
+	li	$r1, (CONFIG_SYS_FTSDMC021_TP2) ! 0x00480180
+	swi	$r1, [$r0+FTSDMC021_OFFSET_TP2]
+	li	$r1, (CONFIG_SYS_FTSDMC021_CR1)	! 0x00002326
+	swi	$r1, [$r0+FTSDMC021_OFFSET_CR1]
+	li	$r1, (FTSDMC021_CR2_IPREC)	! 0x00000010
+	swi	$r1, [$r0+FTSDMC021_OFFSET_CR2]
+1:
+	lwi	$r1, [$r0+FTSDMC021_OFFSET_CR2]
+	andi	$r1, $r1, (CONFIG_SYS_FTSDMC021_CR2)	! 0x1C
+	bnez	$r1, 1b
+
+	li	$r1, (FTSDMC021_CR2_ISMR)	! 0x00000004
+	swi	$r1, [$r0+FTSDMC021_OFFSET_CR2]
+2:
+	lwi	$r1, [$r0+FTSDMC021_OFFSET_CR2]
+	bnez	$r1, 2b
+
+	li	$r1, (FTSDMC021_CR2_IREF)	! 0x00000008
+	swi	$r1, [$r0+FTSDMC021_OFFSET_CR2]
+3:
+	lwi	$r1, [$r0+FTSDMC021_OFFSET_CR2]
+	bnez	$r1, 3b
+
+	move	$lp, $r11
+	ret
+
+remap:
+	move	$r11, $lp
+#ifdef __NDS32_N1213_43U1H__	/* AG101 */
+	bal	2f
+relo_base:
+	move	$r0, $lp
+#else
+relo_base:
+	mfusr	$r0, $pc
+#endif
+
+	/*
+	 * relocation, copy ROM code to SDRAM (current at 0x10000000)
+	 */
+	li	$r4, CONFIG_SYS_RELO_ADDR		! 0x10000000
+	li	$r5, 0x0
+	la	$r1, relo_base
+	sub	$r2, $r0, $r1
+	sethi	$r6, hi20(andesboot_end)
+	ori	$r6, $r6, lo12(andesboot_end)
+	add	$r6, $r6, $r2
+1:
+	lwi	$r7, [$r5]
+	swi	$r7, [$r4]
+	addi	$r5, $r5, #4
+	addi	$r4, $r4, #4
+	blt	$r5, $r6, 1b
+
+	/*
+	 * Remapping
+	 */
+	li	$r0, (CONFIG_FTSDMC021_BASE + FTSDMC021_OFFSET_TP1)
+	li	$r1, (CONFIG_SYS_FTSDMC021_BANK0_BSR)	! 0x00001100
+	swi	$r1, [$r0+FTSDMC021_OFFSET_BANK0_BSR]
+	li	$r1, 0x0
+	swi	$r1, [$r0+FTSDMC021_OFFSET_BANK1_BSR]
+	swi	$r1, [$r0+FTSDMC021_OFFSET_BANK2_BSR]
+	swi	$r1, [$r0+FTSDMC021_OFFSET_BANK3_BSR]
+	li	$r1, (FTSDMC021_BANK_ENABLE)		! 0x00001000
+	swi	$r1, [$r0+FTSDMC021_OFFSET_BANK0_BSR]
+
+	li	$r0, (CONFIG_FTAHBC020S_BASE + FTAHBC020S_CR)
+	lwi	$r1, [$r0]
+	ori	$r1, $r1, FTAHBC020S_CR_REMAP		! 0x1
+	swi	$r1, [$r0]
+
+	li	$r0, (CONFIG_FTSMC020_BASE)
+
+	move	$lp, $r11
+2:
+	ret
+
+.globl show_led
+show_led:
+    li      $r8, (CONFIG_DEBUG_LED)
+    swi     $r7, [$r8]
+    ret
+#endif
Signature · 1 line
1.7.3.5
#5 lore raw

PATCH v8 6/10 nds32/ag101: cpu and init funcs of SoC ag101

In reply to Macpaul Lin

Add main function of SoC ag101 based on NDS32 n1213 core.

cpu.c
According to the bootstrap procedure in n1213 Core, to turn off watchdog timer is suggested after the cpu is in superuser mdoe.

1. bootstrap
1.1 reset - start of Andesboot
1.2 to superuser mode - as is when reset
1.3 Turn off watchdog timer

If you take look into the start.S in n1213, you will find that system will turn off watchdog after start.S has been retunred from lowlevel_init.

Since the watchdog device is depends on the SoC is choosed. It should be belonged to the SoC (ag101) folder.

watchdog.S:
If you've ran another bootloader before u-boot was started the watchdog might have been enabled already.

---
Changes for v5-v6:
- Split watchdog.S from lowlevel_init.S.
- Fix hardware reset by using watchdog reset in do_reset() in cpu.c.
- reset_cpu was remove inside do_reset().

Changes for v7:
- clean up.

 arch/nds32/cpu/n1213/ag101/Makefile   |   58 +++++++++
 arch/nds32/cpu/n1213/ag101/cpu.c      |  207 +++++++++++++++++++++++++++++++++
 arch/nds32/cpu/n1213/ag101/timer.c    |  204 ++++++++++++++++++++++++++++++++
 arch/nds32/cpu/n1213/ag101/watchdog.S |   48 ++++++++
 4 files changed, 517 insertions(+), 0 deletions(-)
 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/timer.c
 create mode 100644 arch/nds32/cpu/n1213/ag101/watchdog.S
arch/nds32/cpu/n1213/ag101/Makefile new file +58 -0
new file mode 100644
index 0000000..e96b1e4
@@ -0,0 +1,58 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <[email protected]>
+#
+# Copyright (C) 2011 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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).o
+
+COBJS-y	:= cpu.o timer.o
+
+ifndef CONFIG_SKIP_LOWLEVEL_INIT
+SOBJS	:= lowlevel_init.o
+endif
+
+ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG
+SOBJS	+= watchdog.o
+endif
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/nds32/cpu/n1213/ag101/cpu.c new file +207 -0

207 lines not on this page · raw message

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

204 lines not on this page · raw message

arch/nds32/cpu/n1213/ag101/watchdog.S new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
1.7.3.5
#6 lore raw

PATCH v8 7/10 nds32/lib: add generic funcs in NDS32 lib

In reply to Macpaul Lin

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

---
Changes for v1-v4:
- code clean up and formatting style.

Changes for v5-v6:
- board.c
- Do some clean up and add code
- Remove display banner which hasn't support.
- Add ftpmu010 related power management unit code.
- Remove useless LED related code.
- Move SDRAM init to board sepecific files. (ex. adp-ag101.c)
- Remove CONFIG_SOFT_I2C which hasn't been support.
- Remove CONFIG_FSL_ESDHC which hasn't been support.
- clean up.

Changes for v7:
- clean up.
- move single file patch arch/nds32/config.mk to this commit.
- interrupts.c refine origin interrupt enable and disable.

Changes for v8:
- interrups.c: fix up for new ptraces.h.

 arch/nds32/config.mk        |   35 +++++
 arch/nds32/lib/Makefile     |   52 +++++++
 arch/nds32/lib/board.c      |  346 +++++++++++++++++++++++++++++++++++++++++++
 arch/nds32/lib/bootm.c      |  241 ++++++++++++++++++++++++++++++
 arch/nds32/lib/interrupts.c |  131 ++++++++++++++++
 5 files changed, 805 insertions(+), 0 deletions(-)
 create mode 100644 arch/nds32/config.mk
 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/config.mk new file +35 -0
new file mode 100644
index 0000000..ac5d0cf
@@ -0,0 +1,35 @@
+#
+# (C) Copyright 2000-2002
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2011
+# 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_RELFLAGS	+= -gdwarf-2
+PLATFORM_CPPFLAGS	+= -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-8
+
+LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
arch/nds32/lib/Makefile new file +52 -0

52 lines not on this page · raw message

arch/nds32/lib/board.c new file +346 -0

346 lines not on this page · raw message

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

241 lines not on this page · raw message

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

131 lines not on this page · raw message

Signature · 1 line
1.7.3.5
#7 lore raw

PATCH v8 8/10 nds32: standalone support

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..c2ac107
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 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
+ */
+
+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..b711926 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..a4ac6f8 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.3.5
#8 lore raw

PATCH v8 9/10 nds32: common bdinfo, bootm, image support

In reply to Macpaul Lin

Add support of NDS32 to common commands bdinfo, bootm, and image format.

---
 common/cmd_bdinfo.c |   28 +++++++++++++++++++++++++++-
 common/cmd_bootm.c  |    2 ++
 common/image.c      |    1 +
 include/image.h     |    5 +++++
 4 files changed, 35 insertions(+), 1 deletions(-)
common/cmd_bdinfo.c +27 -1
index bba7374..908091d 100644
@@ -411,13 +411,39 @@ 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
 
 static void print_num(const char *name, ulong value)
 {
-	printf ("%-12s= 0x%08lX\n", name, value);
+	printf("%-12s= 0x%08lX\n", name, value);
 }
 
 #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET)
common/cmd_bootm.c +2 -0
index 18019d6..59fbc45 100644
@@ -187,6 +187,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 f63a2ff..afe5957 100644
@@ -93,6 +93,7 @@ static const 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/image.h +5 -0
index 005e0d2..1a2be5e 100644
@@ -106,6 +106,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
@@ -504,6 +505,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
@@ -656,6 +659,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
Signature · 1 line
1.7.3.5
#9 lore raw

PATCH v8 10/10 adp-ag101: add board adp-ag101 support

In reply to Macpaul Lin

Add evaluation board "adp-ag101" aconfiguration file adp-ag101.h. Add adp-ag101.c board config and related settings.
Add board adp-ag101 into boards.cfg

---
Changes for v1-v4:
- code clean up
Changes for v5-v6:
- Refine the definitions and parameters about CLK,
AHB controller, SDRAM controller, Static memory controllers.
- Add APB_CLK, AHB_CLK, SYS_CLK definitions for backward compatible.
- ftahbc010:
- Update include path of ftahbc010.
- ftsdmc021:
- Update include path of ftsdmc021.
- ftsmc020:
- Update include path of ftsmc020.
- ftwdt010:
- Fix WDT define and update include path.
- Fix ftwdt010 for hardware reset.
- ftpmu010:
- Remove duplicate PMU definitions.
- Add related configurations.
- Fix MAX malloc len and fix saveenv.
- clean up.
Changes for v7:
- adp-ag101.c
- Fix Makefile and remove config.mk
- adp-ag101.h:
- clean up.
- Move CONFIG_SYS_TEXT_BASE from board/config.mk.

 MAINTAINERS                           |   11 +
 MAKEALL                               |    6 +
 board/AndesTech/adp-ag101/Makefile    |   57 +++++
 board/AndesTech/adp-ag101/adp-ag101.c |   81 +++++++
 boards.cfg                            |    1 +
 include/configs/adp-ag101.h           |  378 +++++++++++++++++++++++++++++++++
 6 files changed, 534 insertions(+), 0 deletions(-)
 create mode 100644 board/AndesTech/adp-ag101/Makefile
 create mode 100644 board/AndesTech/adp-ag101/adp-ag101.c
 create mode 100644 include/configs/adp-ag101.h
MAINTAINERS +11 -0
index 8af9b09..0390c40 100644
@@ -1123,5 +1123,16 @@ Chong Huang <[email protected]>
 	bf525-ucr2	BF525
 
 #########################################################################
+# NDS32 Systems:							#
+#									#
+# Maintainer Name, Email Address					#
+#	Board		CPU						#
+#########################################################################
+
+Macpaul Lin <[email protected]>
+
+	ADP-AG101	N1213 (AG101 SoC)
+
+#########################################################################
 # End of MAINTAINERS list						#
 #########################################################################
MAKEALL +6 -0
index e1b928f..286d158 100755
@@ -610,6 +610,12 @@ LIST_sh="$(boards_by_arch sh)"
 
 LIST_sparc="$(boards_by_arch sparc)"
 
+#########################################################################
+## NDS32 Systems
+#########################################################################
+
+LIST_nds32="$(boards_by_arch nds32)"
+
 #-----------------------------------------------------------------------
 
 build_target() {
board/AndesTech/adp-ag101/Makefile new file +57 -0

57 lines not on this page · raw message

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

81 lines not on this page · raw message

boards.cfg +1 -0
index a45bd83..e3d1c16 100644
@@ -245,6 +245,7 @@ vct_platinumavc              mips        mips32      vct                 microna
 vct_platinumavc_small        mips        mips32      vct                 micronas       -           vct:VCT_PLATINUMAVC,VCT_SMALL_IMAGE
 vct_platinumavc_onenand      mips        mips32      vct                 micronas       -           vct:VCT_PLATINUMAVC,VCT_ONENAND
 vct_platinumavc_onenand_small mips       mips32      vct                 micronas       -           vct:VCT_PLATINUMAVC,VCT_ONENAND,VCT_SMALL_IMAGE
+adp-ag101                    nds32       n1213       adp-ag101           AndesTech      ag101
 PCI5441                      nios2       nios2       pci5441             psyent
 PK1C20                       nios2       nios2       pk1c20              psyent
 EVB64260                     powerpc     74xx_7xx    evb64260            -              -           EVB64260
include/configs/adp-ag101.h new file +378 -0

378 lines not on this page · raw message

Signature · 1 line
1.7.3.5