nds32: add header files support for nds32
Subsystems (4)
PATCH v7 1/10 nds32: add header files support for nds32
Add generic header files support for nds32 architecture. Cache, ptregs, 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.
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 | 22 ++ arch/nds32/include/asm/ptregs.h | 81 +++++++ 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 +++ 18 files changed, 1406 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/ptregs.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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (C) 2011 Andes Technology Corporation +* Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com) +* Copyright (C) 2011 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 +81 -0
81 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
@@ -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
PATCH v7 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
@@ -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
PATCH v7 3/10 nds32/core N1213: NDS32 N12 core family N1213
In reply to Macpaul LinAdd 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
@@ -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
PATCH v7 4/10 nds32/ag101: dev offset header of SoC ag101
In reply to Macpaul LinAdd 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
@@ -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
PATCH v7 5/10 nds32/ag101: lowlevel_init.S of ag101
In reply to Macpaul Linlowlevel_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
@@ -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
PATCH v7 5/10 nds32/ag101: lowlevel_init.S of ag101
HI Wolfgang and all,
2011/4/7 Macpaul Lin <[email protected]>:
Quoted 5 lines
lowlevel_init.Sis 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.
I'm so sorry there is really a need to setup the timing related parameters in assembly because the poor of hardware design.
Without the correct timing parameters, we cannot read/write dram. Even we couldn't use it to store the initial stack,
I have posted the spec of related timing parameter of memory controller as following
(which is connected to the first bank of DRAM).
Hope you can understand the problem from the hardware (register) spec.
example:FTSMC020_BANK0_TPR (control the dram)
value: 0x00151151
20 , RBE, set to (b'1), R/W Read byte-enable.
If this bit is set to '1?, byte-enable will be pulled LOW when read. Otherwise, byte-enable will be pulled LOW only for write operation.
19-18, AST, R/W, set to (b'01),
Address setup time.
This register specifies the latency needed to assert
chip-enable after address assertion.
17-16, CTW, R/W, set to (b'01),
Chip-select to write-enable delay.
This register specifies the latency needed to assert
write-enable after chip-enable assertion.
15-12, AT1, R/W, set to (b'0001),
Access time 1.
This register specifies the latency to latch (read) or change
data (write)
after write-enable assertion when general asynchronous device
is specified.
The value must be larger than zero. Setting this register to zero is acceptable but the behavior will be un-predictable.
If device is specified as burst ROM, this register indicates
the read/write latency of first data.
If BNK_TYPE1 is set as ?1? (synchronous devices),
this register indicates the depth of late-write and the maximum
value of this value is 2 (value exceeding 2 will be reset to zero). 11-10, Reserved, set to (b'00)
Writing data to this register takes no effect and zero will be
returned when read.
9-8, AT2, R/W, set to (b'01)
Access time 2.
This register specifies the latency needed to latch the burst read data. This register is only used when device type is specified as burst ROM.
7-6, WTC, R/W, set to (b'01)
Write-enable to chip-select delay.
This register specifies the latency needed to de-assert
chip-enable after write-enable de-assertion.
5-4, AHT, R/W, set to (b'01)
Address hold time.
This register specifies the latency needed to de-assert address
after chip-select de-assertion.
3-0, TRNA, R/W, set to (b'0001)
Turn-around time. This register specifies the latency needed to
re-drive data bus.
PATCH v7 6/10 nds32/ag101: cpu and init funcs of SoC ag101
In reply to Macpaul LinAdd 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
@@ -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
PATCH v7 7/10 nds32/lib: add generic funcs in NDS32 lib
In reply to Macpaul LinAdd 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.
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
@@ -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
PATCH v7 8/10 nds32: standalone support
In reply to Macpaul LinAdd 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
@@ -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
@@ -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
@@ -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) registervolatile xxx_t *pq asm("r8" );#elif defined(__mips__) registervolatile xxx_t *pq asm("k0" ); +#elif defined(__nds32__) + registervolatile xxx_t *pq asm("$r16" );#endif char buf[32 ];
Signature · 1 line
1.7.3.5
PATCH v7 9/10 nds32: common bdinfo, bootm, image support
In reply to Macpaul LinAdd 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v7 10/10 adp-ag101: add board adp-ag101 support
In reply to Macpaul LinAdd adp-ag101.c board config and related settings.
Add evaluation board "adp-ag101" configuration file adp-ag101.h. Add board adp-ag101 into boards.cfg
---
Changes for v1-v4:
- code clean up
Changes for v5-v6:
- adp-ag101.h
- 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
@@ -1113,5 +1113,16 @@ Anton Shurpin <[email protected]> BF561-ACVILON BF561 ######################################################################### +# NDS32 Systems: # +# # +# Maintainer Name, Email Address # +# Board CPU # +######################################################################### + +Macpaul Lin <[email protected]> + + ADP-AG101 N1213 (AG101 SoC) + +######################################################################### # End of MAINTAINERS list # #########################################################################
MAKEALL +6 -0
@@ -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
@@ -242,6 +242,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
PATCH v7 1/10 nds32: add header files support for nds32
In reply to Macpaul LinDear Macpaul Lin,
Quoted 4 lines · In message <[email protected]> you wrote:
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>
Checkpatch complains a lot about "do not add new typedefs".
...
Quoted 1 line
+#define PTREGS(reg) [reg]
This also triggers an erro-r from checkpatch, and indeed this is a strange define.
Quoted 28 lines
arch/nds32/include/asm/ptregs.h new file +28
-0+#define R0 uregs[1]/* R0 */ +#define R1 uregs[2] +#define R2 uregs[3] +#define R3 uregs[4] +#define R4 uregs[5] +#define R5 uregs[6] +#define R6 uregs[7] +#define R7 uregs[8] +#define R8 uregs[9] +#define R9 uregs[10] +#define R10 uregs[11] +#define R11 uregs[12] +#define R12 uregs[13] +#define R13 uregs[14] +#define R14 uregs[15] +#define R15 uregs[16] +#define R16 uregs[17] +#define R17 uregs[18] +#define R18 uregs[19] +#define R19 uregs[20] +#define R20 uregs[21] +#define R21 uregs[22] +#define R22 uregs[23] +#define R23 uregs[24] +#define R24 uregs[25] +#define R25 uregs[26] +#define R26 uregs[27] +#define R27 uregs[28]
arch/nds32/include/asm/ptregs.h line 71
Quoted 10 lines
arch/nds32/include/asm/ptregs.h new file +10
-0+#define FP uregs[29]/* R28 */ +#define GP uregs[30]/* R29 */ +#define RA uregs[31]/* R30 */ +#define SP uregs[32]/* R31 */ +#define D0HI uregs[33] +#define D0LO uregs[34] +#define D1HI uregs[35] +#define D1LO uregs[36] +#define PSW uregs[37]/* IR0 */ +#define PC uregs[38]/* PC */
NAK. Please use a C struct instead.
...
Quoted 14 lines
arch/nds32/include/asm/u-boot.h new file +8
-0@@ -0,0 +1,63 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* +* Copyright (C) 2011 Andes Technology Corporation +* Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com) +* Copyright (C) 2011 Macpaul Lin (macpaul at andestech.com)
...
Quoted 16 lines
arch/nds32/include/asm/u-boot.h new file +16
-0+#ifndef _U_BOOT_H_ +#define _U_BOOT_H_ 1 + +#include <environment.h> + +typedef struct bd_info { + int bi_baudrate; /* serial console baudrate */ + unsigned long bi_ip_addr; /* IP Address */ + unsigned char bi_enetaddr[6]; /* Ethernet adress */ + + env_t *bi_env; + unsigned long bi_arch_number; /* unique id for this board */ + unsigned long bi_boot_params; /* where this board expects params */ + + unsigned long bi_memstart; /* start of DRAM memory */ + unsigned long bi_memsize; /* size of DRAM memory in bytes */
arch/nds32/include/asm/u-boot.h line 61
Quoted 10 lines
arch/nds32/include/asm/u-boot.h new file +10
-0+unsigned long bi_flashstart;/* start of FLASH memory */ +unsigned long bi_flashsize;/* size of FLASH memory */ +unsigned long bi_flashoffset;/* reserved area for startup monitor */ + +struct /* RAM configuration */ + { +unsigned long start; +unsigned long size; + } bi_dram[CONFIG_NR_DRAM_BANKS ]; +} bd_t;
I wonder which part of this file would be (C) by any of the folks listed above?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Time is an illusion perpetrated by the manufacturers of space.
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v7 1/10 nds32: add header files support for nds32
Hi Wolfgang,
2011/4/7 Wolfgang Denk <[email protected]>:
Dear Macpaul Lin,
Quoted 6 lines
Quoted 4 lines
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>Checkpatch complains a lot about "do not add new typedefs".
Indeed, but this seems is special for Linux Kernel,
I've checked some of the "typedefs" from other architecture code in u-boot. Most of them are specific for u-boot only.
Even GD is one of them.
I did check typedefs one by one by myself in hand and eye checking. If some thing is not suitable for using "typedefs" please let me know.
Quoted 5 lines
...
Quoted 1 line
+#define PTREGS(reg) ?[reg]
This also triggers an erro-r from checkpatch, and indeed this is a strange define.
It was strange for me, too.
However, it looks like I must use PTREGS define for ptregs for API compatibility.
Please refer to the ARM code and MIPS, etc.
Quoted 32 lines
+#define R0 ? ? ? ? ? uregs[1] ? ? ? ?/* R0 */
Quoted 31 lines
(quoted diff) +31
-0+#define R1 ? ? ? ? ? uregs[2] +#define R2 ? ? ? ? ? uregs[3] +#define R3 ? ? ? ? ? uregs[4] +#define R4 ? ? ? ? ? uregs[5] +#define R5 ? ? ? ? ? uregs[6] +#define R6 ? ? ? ? ? uregs[7] +#define R7 ? ? ? ? ? uregs[8] +#define R8 ? ? ? ? ? uregs[9] +#define R9 ? ? ? ? ? uregs[10] +#define R10 ? ? ? ? ?uregs[11] +#define R11 ? ? ? ? ?uregs[12] +#define R12 ? ? ? ? ?uregs[13] +#define R13 ? ? ? ? ?uregs[14] +#define R14 ? ? ? ? ?uregs[15] +#define R15 ? ? ? ? ?uregs[16] +#define R16 ? ? ? ? ?uregs[17] +#define R17 ? ? ? ? ?uregs[18] +#define R18 ? ? ? ? ?uregs[19] +#define R19 ? ? ? ? ?uregs[20] +#define R20 ? ? ? ? ?uregs[21] +#define R21 ? ? ? ? ?uregs[22] +#define R22 ? ? ? ? ?uregs[23] +#define R23 ? ? ? ? ?uregs[24] +#define R24 ? ? ? ? ?uregs[25] +#define R25 ? ? ? ? ?uregs[26] +#define R26 ? ? ? ? ?uregs[27] +#define R27 ? ? ? ? ?uregs[28] +#define FP ? ? ? ? ? uregs[29] ? ? ? /* R28 */ +#define GP ? ? ? ? ? uregs[30] ? ? ? /* R29 */ +#define RA ? ? ? ? ? uregs[31] ? ? ? /* R30 */ +#define SP ? ? ? ? ? uregs[32] ? ? ? /* R31 */
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+#define D0HI ? ? ? ? uregs[33] +#define D0LO ? ? ? ? uregs[34] +#define D1HI ? ? ? ? uregs[35] +#define D1LO ? ? ? ? uregs[36] +#define PSW ? ? ? ? ?uregs[37] ? ? ? /* IR0 */ +#define PC ? ? ? ? ? uregs[38] ? ? ? /* PC */NAK. ?Please use a C struct instead.
Other architecture use specific ARM_XXX_R0 or MIPS_XXX _R. Since most of NDS32 registers could be used as general register, hence we have such format in define.
If you have better idea, please give me a suggestion of the code to the correspoded
And I think this part is specific for the API ?to ptregs.h. Other architecture gose the similar format instead C structure. If use C structure to present a set of CPU registers is adapable for ptregs related API is workable, please give me such a hint and I will try.
However, the define of PC or PSW for ptregs related feature I guess it is required somehow.
Please give a suggestion if my knowledge of ptregs related APIs is wrong.
Quoted 37 lines
...
Quoted 14 lines
arch/nds32/include/asm/u-boot.h new file +8
-0@@ -0,0 +1,63 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* +* Copyright (C) 2011 Andes Technology Corporation +* Copyright (C) 2010 Shawn Lin (nobuhiro at andestech.com) +* Copyright (C) 2011 Macpaul Lin (macpaul at andestech.com) ...
Quoted 21 lines
arch/nds32/include/asm/u-boot.h new file +21
-0+#ifndef _U_BOOT_H_ +#define _U_BOOT_H_ ? 1 + +#include <environment.h> + +typedef struct bd_info { + ? ? int ? ? ? ? ? ? bi_baudrate; ? ?/* serial console baudrate */ + ? ? unsigned long ? bi_ip_addr; ? ? /* IP Address */ + ? ? unsigned char ? bi_enetaddr[6]; /* Ethernet adress */ + + ? ? env_t ? ? ? ? ? *bi_env; + ? ? unsigned long ? bi_arch_number; /* unique id for this board */ + ? ? unsigned long ? bi_boot_params; /* where this board expects params */ + + ? ? unsigned long ? bi_memstart; ? ?/* start of DRAM memory */ + ? ? unsigned long ? bi_memsize; ? ? /* size ?of DRAM memory in bytes */ + ? ? unsigned long ? bi_flashstart; ?/* start of FLASH memory */ + ? ? unsigned long ? bi_flashsize; ? /* size ?of FLASH memory */ + ? ? unsigned long ? bi_flashoffset; /* reserved area for startup monitor */ + + ? ? struct ? ? ? ? ? ? ? ? ? ? ? ? ?/* RAM configuration */
Quoted 8 lines
Quoted 5 lines
+ ? ? {
+ ? ? ? ? ? ? unsigned long start;
+ ? ? ? ? ? ? unsigned long size;
+ ? ? } bi_dram[CONFIG_NR_DRAM_BANKS];
+}bd_t;I wonder which part of this file would be (C) by any of the folks listed above?
Because I'm not in the office (this is not office hour in asia). I'll check it in the office tommorrow.
Thanks a lot.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v7 1/10 nds32: add header files support for nds32
In reply to a message not in the archiveDear Macpaul Lin,
Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines
Checkpatch complains a lot about "do not add new typedefs".
Indeed, but this seems is special for Linux Kernel,
Not really. This is Linux CodingStyle policy, which we usually adapt.
Quoted 1 line
I've checked some of the "typedefs" from other architecture code in u-boot.
This does not mean much. Yes, there are tons of typedef's in U-Boot, but this is old code that has not been cleaned up yet. At least we now try not to add to that pool.
Quoted 2 lines
I did check typedefs one by one by myself in hand and eye checking. If some thing is not suitable for using "typedefs" please let me know.
Please don't add any new typedef's.
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
+#define PTREGS(reg) [reg]
This also triggers an erro-r from checkpatch, and indeed this is a strange define.
It was strange for me, too.
However, it looks like I must use PTREGS define for ptregs for API compatibility.
Please refer to the ARM code and MIPS, etc.
I did check. There is not any code anywhere that references anything like "ptreg" or similar.
Quoted 3 lines
Quoted 1 line
NAK. Please use a C struct instead.
Other architecture use specific
ARM_XXX_R0orMIPS_XXX_R.
I'm not sure what you might be referring to. The only other file which I can find which has similar code is arch/arm/include/asm/proc-armv/ptrace.h, and this indeed should be cleaned up, too.
Sorry, sometimes such things slip through the reviews.
Quoted 1 line
And I think this part is specific for the API to
ptregs.h.
It appears this is something no other architecture needs in U-Boot?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Every time history repeats itself the price goes up.
PATCH v7 1/10 nds32: add header files support for nds32
Hi Wolfgang,
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Checkpatch complains a lot about "do not add new typedefs".
Indeed, but this seems is special for Linux Kernel,
Not really. ?This is Linux CodingStyle policy, which we usually adapt.
Quoted 1 line
I've checked some of the "typedefs" from other architecture code in u-boot.
Quoted 9 lines
This does not mean much. ?Yes, there are tons of typedef's in U-Boot, but this is old code that has not been cleaned up yet. ?At least we now try not to add to that pool.
Quoted 2 lines
I did check typedefs one by one by myself in hand and eye checking. If some thing is not suitable for using "typedefs" please let me know.
Please don't add any new typedef's.
I think we still have to discuss about the typedef's. What does the "new" typedef means?
According to the checkpatch result, "typedef" warning exists in 4 files. arch/nds32/include/asm/posix_types.h arch/nds32/include/asm/types.h arch/nds32/include/asm/global_data.h arch/nds32/include/asm/u-boot.h.
File arch/nds32/include/asm/posix_types.h and arch/nds32/include/asm/types.h come from the Linux kernel. Which is usually used for posix compatibility for Linux Kernel.
Which should be "old" features for posix and compatibility. However, you cannot say for a new architecture to support posix and other compatibility as
"new" typedef.
I've checked the latest kernel (2.6.38.1), arm, mips, avr32, powerpc consist these posix_types.h and types.h with "typedef".
It looks the kernel is not going to fix the "old" typedef for posix_types.h and types.h
I think they say "please do not add any new typedef" might mean to those typedef
used in drivers or protocols.
In the other 2 files arch/nds32/include/asm/global_data.h and arch/nds32/include/asm/u-boot.h,
typedef was used for
#449: FILE: arch/nds32/include/asm/global_data.h:46:
+typedef struct global_data {
+} gd_t;
#1505: FILE: arch/nds32/include/asm/u-boot.h:41:
+typedef struct bd_info {
+} bd_t;
I don't know if you have any idea of fixing it in u-boot.
If you have an explicit way to fix it, for example,
"we must declare bd_t in each function before we use it",
I'll very glad to do it for fixing up the coding style. Otherwise I'm afraid of the fixing "typedef" here in these 2 file might lead function or other problem in u-boot build with nds32.
Thanks.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v7 1/10 nds32: add header files support for nds32
Hi Wolfgang,
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
I did check typedefs one by one by myself in hand and eye checking. If some thing is not suitable for using "typedefs" please let me know.
Please don't add any new typedef's.
Quoted 9 lines
I think we still have to discuss about the typedef's. What does the "new" typedef means?
According to the checkpatch result, "typedef" warning exists in 4 files.
arch/nds32/include/asm/posix_types.harch/nds32/include/asm/types.harch/nds32/include/asm/global_data.harch/nds32/include/asm/u-boot.h.
I've found the origin purpose of adding typedef check to checkpatch.pl from the author "apw".
Please refer to url "http://lkml.indiana.edu/hypermail/linux/kernel/0801.0/0354.html" I quote his words as below.
Andy Whitcroft (apw said..)
"It is checkpatch's role to point out things which are likely to be wrong. There will always be exceptions. Lines which are much more readable if they spill over 80 characters, typedefs which do make sense. atomic_t's for example. This may well be a valid use of them. Note that this is mentioned as a WARNING not an ERROR. As is stated in the patch submission notes, you are meant to be comfortable with everything which checkpatch is still reporting.
checkpatch is a style _guide_, not the be all and end all. It is meant to carry a preferred style to try and maintain some consistency kernel wide."
There is also a section of the coding style which related to "typedef" in Linux Kernel's Documents.
Please also refer to "Chapter 5, typedef" in "Documentation/CodingStyle".
Hope this information is helping other patch submitters. Thanks.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v7 1/10 nds32: add header files support for nds32
In reply to Macpaul LinDear Macpaul Lin,
Quoted 3 lines · In message <[email protected]> you wrote:
I think we still have to discuss about the typedef's. What does the "new" typedef means?
It means adding any new code to U-Boot which includes "typedef"s.
Quoted 9 lines
According to the checkpatch result, "typedef" warning exists in 4 files.
arch/nds32/include/asm/posix_types.harch/nds32/include/asm/types.harch/nds32/include/asm/global_data.harch/nds32/include/asm/u-boot.h.File
arch/nds32/include/asm/posix_types.handarch/nds32/include/asm/types.hcome from the Linux kernel. Which is usually used for posix compatibility for Linux Kernel.
So these files should be fixed in Linux, too, because it is the Linux checkpatch tool which throws this warning.
I don't think this affects POSIX compatibility. Which typedef's are required by POSIX?
Quoted 6 lines
Which should be "old" features for posix and compatibility. However, you cannot say for a new architecture to support posix and other compatibility as
"new" typedef.
I've checked the latest kernel (2.6.38.1), arm, mips, avr32, powerpc consist theseposix_types.handtypes.hwith "typedef".
Maybe this is old code that was added before checkpatch existed?
Quoted 2 lines
It looks the kernel is not going to fix the "old" typedef for
posix_types.handtypes.h
Eventually they would not add these files as is any more today.
Quoted 3 lines
I think they say "please do not add any new typedef" might mean to those typedef
used in drivers or protocols.
I mean all of them.
arch/nds32/include/asm/u-boot.h line 61
Quoted 9 lines
In the other 2 files
arch/nds32/include/asm/global_data.handarch/nds32/include/asm/u-boot.h,
typedef was used for
#449: FILE:arch/nds32/include/asm/global_data.h:46:arch/nds32/include/asm/global_data.h new file +2
-0+typedef struct global_data { +}gd_t ;#1505: FILE:
arch/nds32/include/asm/u-boot.h:41:arch/nds32/include/asm/u-boot.h new file +2
-0+typedef struct bd_info { +}bd_t ;
Ouch. You got me there... :-(
Quoted 1 line
I don't know if you have any idea of fixing it in u-boot.
Well, the fix is basicly straightforward - replace all ocurrences of gd_t and bd_t in the U-Boot code. But this is a bigger issue and more work than I dare to push on you. I'm grinding my teeth, but I will accept these.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If ignorance is bliss, why aren't there more happy people?
PATCH v7 1/10 nds32: add header files support for nds32
Quoted 25 lines · Wolfgang Denk
Dear Macpaul Lin,
Quoted 3 lines · In message <[email protected]> you wrote:
I think we still have to discuss about the typedef's. What does the "new" typedef means?
It means adding any new code to U-Boot which includes "typedef"s.
Quoted 9 lines
According to the checkpatch result, "typedef" warning exists in 4 files.
arch/nds32/include/asm/posix_types.harch/nds32/include/asm/types.harch/nds32/include/asm/global_data.harch/nds32/include/asm/u-boot.h.File
arch/nds32/include/asm/posix_types.h?andarch/nds32/include/asm/types.hcome from the Linux kernel. Which is usually used for posix compatibility for Linux Kernel.So these files should be fixed in Linux, too, because it is the Linux checkpatch tool which throws this warning.
I don't think this affects POSIX compatibility. Which typedef's are required by POSIX?
Quoted 9 lines
Quoted 6 lines
Which should be "old" features for posix and compatibility. However, you cannot say for a new architecture to support posix and other compatibility as
"new" typedef.
I've checked the latest kernel (2.6.38.1), arm, mips, avr32, powerpc consist theseposix_types.handtypes.hwith "typedef".Maybe this is old code that was added before checkpatch existed?
In Linux "CodingStyle"
" Chapter 5: Typedefs
Please don't use things like "vps_t".
It's a _mistake_ to use typedef for structures and pointers." [skip]
"Lots of people think that typedefs "help readability". Not so. They are useful only for:"
[skip]
" (b) Clear integer types, where the abstraction _helps_ avoid confusion
whether it is "int" or "long".
u8/u16/u32 are perfectly fine typedefs, although they fit into category (d) better than here.
NOTE! Again - there needs to be a _reason_ for this. If something is "unsigned long", then there's no reason to do
typedef unsigned long myflags_t;
but if there is a clear reason for why it under certain circumstances might be an "unsigned int" and under other configurations might be "unsigned long", then by all means go ahead and use a typedef."
I think posix_types may be an example of this case. nds32 have some types different from
what has been defined in <asm-generic/posix_types.h>
As for commit time, the latest update for checkpatch.pl is in 2009-01-06653d4876 (Andy Whitcroft 2007-06-23 17:16:34 -0700 1891)
if ($line =~ /\btypedef\s/ &&8054576d (Andy Whitcroft 2009-01-06 14:41:26 -0800 1892)
$line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
c45dcabd (Andy Whitcroft 2008-06-05 22:46:01 -0700 1893)
$line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
8ed22cad (Andy Whitcroft 2008-10-15 22:02:32 -0700 1894)
$line !~ /\b$typeTypedefs\b/ &&
653d4876 (Andy Whitcroft 2007-06-23 17:16:34 -0700 1895)
$line !~ /\b__bitwise(?:__|)\b/) {
de7d4f0e (Andy Whitcroft 2007-07-15 23:37:22 -0700 1896)
WARN("do not add new typedefs\n" . $herecurr);0a920b5b (Andy Whitcroft 2007-06-01 00:46:48 -0700 1897) }
But Michal Simek's commit, which added posix_types.h is adapted in 2009-03-27. You can reference it by 6d9c3f208580 in Linux repo
Quoted 44 lines
Quoted 2 lines
It looks the kernel is not going to fix the "old" typedef for
posix_types.handtypes.hEventually they would not add these files as is any more today.
Quoted 3 lines
I think they say "please do not add any new typedef" might mean to those typedef
used in drivers or protocols.I mean all of them.
arch/nds32/include/asm/u-boot.h line 61
Quoted 9 lines
In the other 2 files
arch/nds32/include/asm/global_data.handarch/nds32/include/asm/u-boot.h,
typedef was used for
#449: FILE:arch/nds32/include/asm/global_data.h:46:(quoted diff) +2
-0+typedef ? ? ? ?struct global_data { +} gd_t;#1505: FILE:
arch/nds32/include/asm/u-boot.h:41:arch/nds32/include/asm/u-boot.h new file +2
-0+typedef struct bd_info { +}bd_t ;Ouch. You got me there... :-(
Quoted 1 line
I don't know if you have any idea of fixing it in u-boot.
Well, the fix is basicly straightforward - replace all ocurrences of
gd_tandbd_tin the U-Boot code. ?But this is a bigger issue and more work than I dare to push on you. ?I'm grinding my teeth, but I will accept these.Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If ignorance is bliss, why aren't there more happy people?
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v7 1/10 nds32: add header files support for nds32
In reply to Wolfgang DenkHi Wolfgang,
2011/4/30 Wolfgang Denk <[email protected]>:
Quoted 14 lines
Dear Macpaul Lin,
It means adding any new code to U-Boot which includes "typedef"s.
Quoted 9 lines
According to the checkpatch result, "typedef" warning exists in 4 files.
arch/nds32/include/asm/posix_types.harch/nds32/include/asm/types.harch/nds32/include/asm/global_data.harch/nds32/include/asm/u-boot.h.File
arch/nds32/include/asm/posix_types.h?andarch/nds32/include/asm/types.hcome from the Linux kernel. Which is usually used for posix compatibility for Linux Kernel.
Quoted 5 lines
So these files should be fixed in Linux, too, because it is the Linux checkpatch tool which throws this warning.
I don't think this affects POSIX compatibility. Which typedef's are required by POSIX?
1. posix_types.h
I cannot say I'm sure that the posix_types.h is not necessary for u-boot. If this posix_types.h won't be used any more, should we keep it in u-boot?
I listed the required typedef for POSIX compatibility in Linux kernel as follows which
are also support by other architectures.
typedef unsigned short __kernel_dev_t;
typedef unsigned long __kernel_ino_t;
typedef unsigned short __kernel_mode_t;
typedef unsigned short __kernel_nlink_t;
typedef long __kernel_off_t;
typedef int __kernel_pid_t;
typedef unsigned short __kernel_ipc_pid_t;
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
typedef long __kernel_suseconds_t;
typedef long __kernel_clock_t;
typedef int __kernel_daddr_t;
typedef char *__kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
typedef unsigned int __kernel_uid32_t;
typedef unsigned int __kernel_gid32_t;
typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;
typedef long long __kernel_loff_t;
typedef struct {
#if defined(__KERNEL__) || defined(__USE_ALL)
int val[2];
#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
int __val[2];#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ } __kernel_fsid_t;
Quoted 7 lines
Maybe this is old code that was added before checkpatch existed?
Quoted 2 lines
It looks the kernel is not going to fix the "old" typedef for
posix_types.handtypes.hEventually they would not add these files as is any more today.
Even though kernel would not add these files with "typedef" for implementing POSIX,
however, any new architecture want to be commit to Linux kernel must implementing
the old "typedef" code for POSIX compatibility support unless they want to rewrite all
POSIX interfaces.
2. types.h
typedef unsigned short umode_t;
typedef unsigned long phys_addr_t;
typedef unsigned long phys_size_t;
Take phys_addr_t as example, the following code in u-boot will use it.
include/common.h:223:phys_size_t initdram (int) will use such typedef.
../include/lmb.h:40:extern phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align);../include/addr_map.h:27: phys_size_t
size, int idx);
../include/image.h:455:phys_size_t getenv_bootm_size(void);
This file will use umode_t../fs/ubifs/ubifs.h:115: umode_t i_mode;
Quoted 18 lines
Quoted 3 lines
I think they say "please do not add any new typedef" might mean to those typedef
used in drivers or protocols.I mean all of them.
arch/nds32/include/asm/u-boot.h line 61
Quoted 9 lines
In the other 2 files
arch/nds32/include/asm/global_data.handarch/nds32/include/asm/u-boot.h,
typedef was used for
#449: FILE:arch/nds32/include/asm/global_data.h:46:(quoted diff) +2
-0+typedef ? ? ? ?struct global_data { +} gd_t;#1505: FILE:
arch/nds32/include/asm/u-boot.h:41:arch/nds32/include/asm/u-boot.h new file +2
-0+typedef struct bd_info { +}bd_t ;Ouch. You got me there... :-(
Quoted 6 lines
Quoted 1 line
I don't know if you have any idea of fixing it in u-boot.
Well, the fix is basicly straightforward - replace all ocurrences of
gd_tandbd_tin the U-Boot code. ?But this is a bigger issue and more work than I dare to push on you. ?I'm grinding my teeth, but I will accept these.
Okay, well then, according to the list above I think the problem of typedefs in global_data.h and u-boot.h is similar to types.h. I don't know if you agree with it?
If posix_types.h won't be used in u-boot, I'll suggest u-boot remove it. However, I've found that if I have removed posix_types.h in arch/nds32/includes/asm
will lead the following compilation fail.
/home/macpaul/u-boot/u-boot-nds32/include/linux/posix_types.h:46:29:asm/posix_types.h: No such file or directory
In file included from /home/macpaul/u-boot/u-boot-nds32/include/linux/types.h:8,
from /home/macpaul/u-boot/u-boot-nds32/include/common.h:40,
from lib/asm-offsets.c:18:/home/macpaul/u-boot/u-boot-nds32/include/linux/posix_types.h:46:29:asm/posix_types.h: No such file or directory /home/macpaul/u-boot/u-boot-nds32/include/linux/types.h:14: error:
parse error before "dev_t" /home/macpaul/u-boot/u-boot-nds32/include/linux/types.h:14: warning:
type defaults to int' in declaration of dev_t' /home/macpaul/u-boot/u-boot-nds32/include/linux/types.h:14: warning:
data definition has no type or storage class /home/macpaul/u-boot/u-boot-nds32/include/linux/types.h:15: error:
parse error before "ino_t" /home/macpaul/u-boot/u-boot-nds32/include/linux/types.h:15: warning:
type defaults to int' in declaration of ino_t' /home/macpaul/u-boot/u-boot-nds32/include/linux/types.h:15: warning:
data definition has no type or storage class /home/macpaul/u-boot/u-boot-nds32/include/linux/types.h:16: error:
parse error before "mode_t"
... and more.
These are indeed related to typedef in posix_types.h
According to Chao's informations, I think the files of these typedef we've send is comfort to Linux's coding styles.
Thanks.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v9 1/10 nds32: add header files support for nds32
In reply to Macpaul LinAdd generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v9 2/10 nds32: add NDS32 support into common header file
In reply to Macpaul LinAdd NDS32 support into common header file.
Changes for v1-v7:
- No change
Changes for v8:
- Fix the patch according to dependency of x86's Fix
Changes for v9:
- No change
--- include/common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
@@ -275,6 +275,10 @@ int setenv (char *, char *);#ifdef CONFIG_X86 /* x86 version to be fixed! */ # include <asm/u-boot-x86.h> #endif /* CONFIG_X86 */ +#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
PATCH v9 3/10 nds32/core N1213: NDS32 N12 core family N1213
In reply to Macpaul LinAdd 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.
Changes v1 to v6:
- Style clean up and reorganize code
Changes v7-v9:
- No Change.
--- 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
@@ -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
PATCH v9 4/10 nds32/ag101: dev offset header of SoC ag101
In reply to Macpaul LinAdd 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.
Changes for v1-v6:
- Code clean up and style formatting.
Changes for v7-v9:
- No change.
--- 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
@@ -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
PATCH v9 5/10 nds32/ag101: lowlevel_init.S of ag101
In reply to Macpaul Linlowlevel_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.
Changes from v1-v4:
- Code clean up and formatting style.
Changes 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.
Changes for v7-v9:
- No change.
--- 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
@@ -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
PATCH v9 5/10 nds32/ag101: lowlevel_init.S of ag101
Dear Macpaul Lin,
Quoted 11 lines · In message <[email protected]> you wrote:
lowlevel_init.Sis 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.Salso replace hardcode value by MARCO defines from the GPL version andesboot for better code quality.Signed-off-by Macpaul Lin <[email protected]>
Quoted 13 lines
Changes from v1-v4:
- Code clean up and formatting style.
Changes from v5-v6
- Change hard code value into MARCO definitions.
- ftsmc010
- FixFTSMC020_TPR_AT2from 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.
Changes for v7-v9:
- No change.
---
Patch changelog belongs _below_ the "---" line, not above.
Quoted 3 lines
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
This file alone makes no sense. Pluease submit as a single commit together with the other board code.
...
Quoted 6 lines
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +6
-0+ /* + * relocation, copy ROM code to SDRAM (current at 0x10000000) + */ + li $r4, CONFIG_SYS_RELO_ADDR ! 0x10000000 + li $r5, 0x0 + la $r1, relo_base
arch/nds32/cpu/n1213/ag101/lowlevel_init.S line 129
Quoted 10 lines
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +10
-0+ 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
You are using non-standard and completely undocumented CONFIG option here, CONFIG_SYS_RELO_ADDR. Please don't. I think when adding new architecture support we should avaid errors done with other architectures in the past (see ARM, MIPS, ...).
Please implement proper relocation to a dynamically determined address at the upper end of RAM. Keep in mind that the intention is to have only a single lib/board.c isnatead of a collection of slightly different arch-specific arch/*/board.c versions.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de In an organization, each person rises to the level of his own incom- petency - The Peter Principle
PATCH v9 5/10 nds32/ag101: lowlevel_init.S of ag101
Hi Wolfgang,
Quoted 1 line
Patch changelog belongs _below_ the "---" line, not above.
Sorry for this mistaken, will fix in Patch v10
Quoted 6 lines
Quoted 3 lines
?arch/nds32/cpu/n1213/ag101/lowlevel_init.S | ?160 ++++++++++++++++++++++++++++ ?1 files changed, 160 insertions(+), 0 deletions(-)
?create mode 100644arch/nds32/cpu/n1213/ag101/lowlevel_init.SThis file alone makes no sense. ?Pluease submit as a single commit together with the other board code.
The single file is intend to be reviewed and fix up easyly because I know there must be some problem of this lowlevel_init.S.
I think this should go with the SoC. So I will merge it into ag101 SoC level related code.
Quoted 18 lines
...
Quoted 8 lines
+ ? ? /*
+ ? ? ?* relocation, copy ROM code to SDRAM (current at0x10000000)
+ ? ? ?*/
+ ? ? li ? ? ?$r4,CONFIG_SYS_RELO_ADDR? ? ? ? ? ? ? !0x10000000
+ ? ? li ? ? ?$r5,0x0
+ ? ? la ? ? ?$r1,relo_base
+ ? ? sub ? ? $r2, $r0, $r1
+ ? ? sethi ? $r6,hi20(andesboot_end)Quoted 8 lines
+ ? ? 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
Quoted 4 lines
You are using ?non-standard and completely undocumented CONFIG option here,
CONFIG_SYS_RELO_ADDR. ?Please don't. ?I think when adding new architecture support we should avaid errors done with other architectures in the past (see ARM, MIPS, ...).
Sure.
Quoted 8 lines
Please implement proper relocation to a dynamically determined address at the upper end of RAM. Keep in mind that the intention is to have only a single
lib/board.cisnatead of a collection of slightly different arch-specificarch/*/board.cversions.Best regards,
Wolfgang Denk
Will try to fix it soon.
Thanks.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v9 6/10 nds32/ag101: cpu and init funcs of SoC ag101
In reply to Macpaul LinAdd 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 v1-v4:
- Code clean up.
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.
Changes for v8-v9:
- No change.
--- 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
@@ -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
PATCH v9 7/10 nds32/lib: add generic funcs in NDS32 lib
In reply to Macpaul LinAdd 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.
Changes for v9:
- support CONFIG_STANDALONE_LOAD_ADDR in config.mk
--- 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
@@ -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- + +CONFIG_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
PATCH v9 8/10 nds32: standalone support
In reply to Macpaul LinAdd standalone program related support for nds32 architecture.
Changes for v1-v6:
- code clean up.
Changes for v7-v9:
- No change.
--- 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
@@ -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
@@ -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
@@ -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) registervolatile xxx_t *pq asm("r8" );#elif defined(__mips__) registervolatile xxx_t *pq asm("k0" ); +#elif defined(__nds32__) + registervolatile xxx_t *pq asm("$r16" );#endif char buf[32 ];
Signature · 1 line
1.7.3.5
PATCH v9 9/10 nds32: common bdinfo, bootm, image support
In reply to Macpaul LinAdd support of NDS32 to common commands bdinfo, bootm, and image format.
Changes for v1-v6:
- Code clean up
Changes for v7-v9:
- No Change.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v9 10/10 adp-ag101: add board adp-ag101 support
In reply to Macpaul LinAdd 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:
- clean up.
- Move CONFIG_SYS_TEXT_BASE from board/config.mk.
- Fix Makefile and remove config.mk
Changes for v8:
- No change.
Changes for v9:
- Fix because other boards has been added into boards.cfg and broken this patch.
--- 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
@@ -1138,5 +1138,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
@@ -612,6 +612,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
@@ -261,6 +261,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
PATCH v9 10/10 adp-ag101: add board adp-ag101 support
Dear Macpaul Lin,
Quoted 3 lines · In message <[email protected]> you wrote:
Add evaluation board "adp-ag101" aconfiguration file
adp-ag101.h. Addadp-ag101.cboard config and related settings.
Add board adp-ag101 into boards.cfg
...
board/AndesTech/adp-ag101/adp-ag101.c line 62
Quoted 3 lines
board/AndesTech/adp-ag101/adp-ag101.c new file +3
-0+if (expected_size != actual_size) +printf ("Warning: Only %lu of %lu MiB SDRAM is working\n" , + actual_size >>20 , expected_size >>20 );
Please use braces around multi-line statements.
board/AndesTech/adp-ag101/adp-ag101.c line 80
Quoted 7 lines
board/AndesTech/adp-ag101/adp-ag101.c new file +7
-0+if (banknum ==0 ) {/* non-CFI boot flash */ + info->portwidth =FLASH_CFI_8BIT ; + info->chipwidth =FLASH_CFI_BY8 ; + info->interface =FLASH_CFI_X8 ; +return 1 ; + }else +return 0 ;
Use braces in both branches.
...
Quoted 1 line
+#define
CONFIG_SYS_NS16550_COM1CONFIG_FTUART010_02_BASE/*0x99600000*/
Line too long. Please fix globally.
...
include/configs/adp-ag101.h line 201
Quoted 2 lines
include/configs/adp-ag101.h new file +2
-0+#define CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6 (FTAHBC020S_SLAVE_BSR_BASE(CONFIG_SYS_FTAHBC020S_SLAVE_BSR_BASE) | \ + FTAHBC020S_SLAVE_BSR_SIZE(FTAHBC020S_SLAVE_BSR_SIZE_2G))
Ditto.
include/configs/adp-ag101.h line 275
Quoted 3 lines
include/configs/adp-ag101.h new file +3
-0+/* memtest works on 63 MB in DRAM */ +#define CONFIG_SYS_MEMTEST_START 0x00000000 +#define CONFIG_SYS_MEMTEST_END 0x00200000
Comments and code are not in sync.
include/configs/adp-ag101.h line 376
Quoted 2 lines
include/configs/adp-ag101.h new file +2
-0+/* relocation parameters */ +#define CONFIG_SYS_RELO_ADDR 0x10000000
This should go, too. See previous message.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "There are some good people in it, but the orchestra as a whole is equivalent to a gang bent on destruction." - John Cage, composer
PATCH v10 1/8 nds32: add header files support for nds32
In reply to Macpaul LinAdd generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
Changes for v10:
- macro.h: add writel and setbf macros
- u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
- config.h: add manual relocation support as default.
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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 410 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 53 +++++ arch/nds32/include/asm/u-boot.h | 63 +++++ arch/nds32/include/asm/unaligned.h | 31 +++ 18 files changed, 1499 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/macro.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
@@ -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
@@ -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 +28 -0
@@ -0,0 +1,28 @@ +/* +* 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_ + +#define CONFIG_NEEDS_MANUAL_RELOC + +#endif
arch/nds32/include/asm/global_data.h new file +89 -0
89 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
@@ -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/macro.h new file +96 -0
96 lines not on this page · raw message
arch/nds32/include/asm/memory.h new file +19 -0
@@ -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
@@ -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 +53 -0
53 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
@@ -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
PATCH v10 1/8 nds32: add header files support for nds32
Quoted 24 lines · On Wednesday, August 31, 2011 06:25:53 Macpaul Lin wrote:
arch/nds32/include/asm/unaligned.h new file +5
-0@@ -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.
+ */arch/nds32/include/asm/unaligned.h new file +13
-0+ +#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
arch/nds32/include/asm/unaligned.h line 31
Quoted 10 lines
arch/nds32/include/asm/unaligned.h new file +10
-0+#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 */
cant you just include asm-generic/unaligned.h ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110831/dd903403/attachment.pgp
PATCH v10 1/8 nds32: add header files support for nds32
In reply to Macpaul Lin(just picking this e-mail because there is no patch summary to reply to)
your nds32 port doesnt update the top level README or doc/README.standalone or add a doc/README.nds32. please add some documentation for your port ;). -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110831/8cd809f6/attachment.pgp
PATCH v10 2/8 nds32: add NDS32 support into common header file
In reply to Macpaul LinAdd NDS32 support into common header file.
---
Changes for v1-v7:
- No change
Changes for v8:
- Fix the patch according to dependency of x86's Fix
Changes for v9-v10:
- No change
include/common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
@@ -281,6 +281,10 @@ int setenv (const char *, const char *);#ifdef CONFIG_X86 /* x86 version to be fixed! */ # include <asm/u-boot-x86.h> #endif /* CONFIG_X86 */ +#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
PATCH v10 3/8 nds32/core N1213: NDS32 N12 core family N1213
In reply to Macpaul LinAdd 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.
---
Changes v1 to v6:
- Style clean up and reorganize code
Changes v7-v9:
- No Change.
Changes v10:
- start.S of N1213 CPU has been rewrote for relocation support.
- u-boot.lds:
- Add got and *(.got.plt) section for support GCC 4 toolchain
- Modified for relocation implementation.
arch/nds32/cpu/n1213/Makefile | 50 ++++ arch/nds32/cpu/n1213/start.S | 523 +++++++++++++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/u-boot.lds | 72 ++++++ 3 files changed, 645 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
@@ -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 +523 -0
523 lines not on this page · raw message
arch/nds32/cpu/n1213/u-boot.lds new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v10 3/8 nds32/core N1213: NDS32 N12 core family N1213
arch/nds32/cpu/n1213/Makefile line 41
Quoted 7 lines · On Wednesday, August 31, 2011 06:25:55 Macpaul Lin wrote:
arch/nds32/cpu/n1213/Makefile new file +4
-0+LIB = $(obj)lib$(CPU).o + +$(LIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS)
all your makefiles that call $(AR) are broken. they need to use $(call cmd_link_o_target,...). i see this in multiple nds32 patches here.
see arch/blackfin/lib/Makefile as a simple example
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110831/1042d58b/attachment.pgp
PATCH v10 4/8 nds32/ag101: cpu and init funcs of SoC ag101
In reply to Macpaul LinSoC ag101 is the first chip using NDS32 N1213 cpu core. Add header file of device offset support for SoC ag101. 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.
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.
---
Changes for v1-v4:
- Code clean up.
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().
- lowlevel_init.S
- 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.
Changes for v7:
- clean up.
Changes for v8-v9:
- No change.
Changes for v10:
- asm-offset.c: file added for ag101 use only.
- ag101/Makefile: add gen-asm-offset support to ag101 for lowlevel_init.S.
- Makefile: add gen-asm-offset support for NDS32 based core and SoCs.
- cpu.c: remove unused cpu_init().
- lowlevel_init.S
- Introduce SoC specific gen-asm-offset.h to lowlevel_init.S
- Replace routings by macros to made code much easier to understand.
- Add debug LED support.
- Add CONFIG_MEM_REMAP for those boards must do memort remapping.
Makefile | 3 +- arch/nds32/cpu/n1213/ag101/Makefile | 70 ++++++++ arch/nds32/cpu/n1213/ag101/asm-offsets.c | 43 +++++ arch/nds32/cpu/n1213/ag101/cpu.c | 200 +++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/lowlevel_init.S | 238 ++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/timer.c | 204 ++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/watchdog.S | 48 ++++++ arch/nds32/include/asm/arch-ag101/ag101.h | 68 ++++++++ 8 files changed, 873 insertions(+), 1 deletions(-) create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile create mode 100644 arch/nds32/cpu/n1213/ag101/asm-offsets.c create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c create mode 100644 arch/nds32/cpu/n1213/ag101/lowlevel_init.S create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c create mode 100644 arch/nds32/cpu/n1213/ag101/watchdog.S create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
Makefile +2 -1
@@ -1019,7 +1019,8 @@ clean: $(obj)board/armltd/{integratorap,integratorcp}/u-boot.lds \ $(obj)u-boot.lds \ $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \ - $(obj)arch/blackfin/cpu/init.{lds,elf} + $(obj)arch/blackfin/cpu/init.{lds,elf} \ + $(obj)arch/nds32/cpu/$(CPU)/$(SOC)/gen-asm-offsets.[chs] @rm -f $(obj)include/bmp_logo.h @rm -f $(obj)lib/asm-offsets.s @rm -f $(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
arch/nds32/cpu/n1213/ag101/Makefile new file +70 -0
70 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/asm-offsets.c new file +43 -0
43 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/cpu.c new file +200 -0
200 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +238 -0
238 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
arch/nds32/include/asm/arch-ag101/ag101.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v10 5/8 nds32/lib: add generic funcs in NDS32 lib
In reply to Macpaul LinAdd 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.
Changes for v9:
- support CONFIG_STANDALONE_LOAD_ADDR in config.mk
Changes for v10:
- config.mk:
- add -fpie flag.
- replace -ffixed-8 to -ffixed-10.
- add -mrelax and --gc-sections to LDFLAG
- board.c:
- fix lib/board.c for relocation.
- fix dram init for relocation.
arch/nds32/config.mk | 37 ++++ arch/nds32/lib/Makefile | 52 +++++ arch/nds32/lib/board.c | 453 +++++++++++++++++++++++++++++++++++++++++++ arch/nds32/lib/bootm.c | 241 +++++++++++++++++++++++ arch/nds32/lib/interrupts.c | 131 +++++++++++++ 5 files changed, 914 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 +37 -0
@@ -0,0 +1,37 @@ +# +# (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- + +CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T nds32.lds + +PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax +PLATFORM_RELFLAGS += -gdwarf-2 +PLATFORM_CPPFLAGS += -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-10 -fpie + +LDFLAGS_u-boot = --gc-sections --relax + +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 +453 -0
453 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
PATCH v10 6/8 nds32: standalone support
In reply to Macpaul LinAdd standalone program related support for nds32 architecture.
---
Changes for v1-v6:
- code clean up.
Changes for v7-v10:
- No change.
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
@@ -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
@@ -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
@@ -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) registervolatile xxx_t *pq asm("r8" );#elif defined(__mips__) registervolatile xxx_t *pq asm("k0" ); +#elif defined(__nds32__) + registervolatile xxx_t *pq asm("$r16" );#endif char buf[32 ];
Signature · 1 line
1.7.3.5
PATCH v10 7/8 nds32: common bdinfo, bootm, image support
In reply to Macpaul LinAdd support of NDS32 to common commands bdinfo, bootm, and image format.
---
Changes for v1-v6:
- Code clean up
Changes for v7-v9:
- No Change.
Changes for v10:
- fix up according to the changes in master tree.
common/cmd_bdinfo.c | 26 ++++++++++++++++++++++++++ common/cmd_bootm.c | 2 ++ common/image.c | 1 + include/image.h | 5 +++++ 4 files changed, 34 insertions(+), 0 deletions(-)
common/cmd_bdinfo.c +26 -0
@@ -413,6 +413,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
@@ -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
@@ -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
@@ -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
@@ -506,6 +507,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
@@ -658,6 +661,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
PATCH v10 8/8 adp-ag101: add board adp-ag101 support
In reply to Macpaul LinAdd evaluation board "adp-ag101" configuration 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:
- clean up.
- Move CONFIG_SYS_TEXT_BASE from board/config.mk.
- Fix Makefile and remove config.mk
Changes for v8:
- No change.
Changes for v9:
- Fix because other boards has been added into boards.cfg and broken this patch.
Changes for v10:
- adp-ag101.h
- Fix lines over 80 characters.
- Fix for introducing gen-asm-offset.
- Add mmc support for FTSDC010 SD/MMC Controller.
- fix flash init.
- fix ftsmc010 configuraion for flash probing.
- Add SP_INIT related configurations for supporting relocation.
- Fix CONFIG_TEXT_BASE for relocation.
- Add CONFIG_MEM_REMAP for some hardware boards and non-OS application.
- adp-ag101.c
- Clean up for braces according to Wolfgang's suggestion.
- Add mmc support for FTSDC010 SD/MMC Controller.
- fix dram init(), made this more simpler.
MAINTAINERS | 11 + MAKEALL | 6 + board/AndesTech/adp-ag101/Makefile | 57 +++++ board/AndesTech/adp-ag101/adp-ag101.c | 89 +++++++ boards.cfg | 1 + include/configs/adp-ag101.h | 411 +++++++++++++++++++++++++++++++++ 6 files changed, 575 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
@@ -1162,5 +1162,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
@@ -600,6 +600,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 +89 -0
89 lines not on this page · raw message
boards.cfg +1 -0
@@ -308,6 +308,7 @@ vct_platinumavc_small mips mips32 vct microna 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 nios2-generic nios2 nios2 nios2-generic altera +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 +411 -0
411 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v11 1/9 nds32: add header files support for nds32
In reply to Macpaul LinAdd generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
Changes for v10:
- macro.h: add writel and setbf macros
- u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
- config.h: add manual relocation support as default.
Changes for v11:
- unaligned.h: replace asm/unaligned.h with asm-generic/unaligned.h
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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 410 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 53 +++++ arch/nds32/include/asm/u-boot.h | 63 +++++ arch/nds32/include/asm/unaligned.h | 1 + 18 files changed, 1469 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/macro.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
@@ -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
@@ -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 +28 -0
@@ -0,0 +1,28 @@ +/* +* 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_ + +#define CONFIG_NEEDS_MANUAL_RELOC + +#endif
arch/nds32/include/asm/global_data.h new file +89 -0
89 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
@@ -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/macro.h new file +96 -0
96 lines not on this page · raw message
arch/nds32/include/asm/memory.h new file +19 -0
@@ -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
@@ -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 +53 -0
53 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 +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>
Signature · 1 line
1.7.3.5
PATCH v11 1/9 nds32: add header files support for nds32
arch/nds32/include/asm/memory.h line 19
Quoted 6 lines · On Thursday, September 01, 2011 01:52:42 Macpaul Lin wrote:
arch/nds32/include/asm/memory.h new file +4
-0+#ifndef __ASM_NDS_MEMORY_H +#define __ASM_NDS_MEMORY_H + +#endif /* __ASM_NDS_MEMORY_H */
this header doesnt define anything, and common code doesnt require asm/memory.h, so looks like you should just punt this
arch/nds32/include/asm/u-boot.h line 46
Quoted 8 lines
arch/nds32/include/asm/u-boot.h new file +3
-0+#include <environment.h> +typedef struct bd_info { + env_t *bi_env;
this is pretty unusual. why do you need a board-specific point to the env ? no other arch needs this ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110901/f8df99b4/attachment.pgp
PATCH v11 2/9 nds32: add NDS32 support into common header file
In reply to Macpaul LinAdd NDS32 support into common header file.
---
Changes for v1-v7:
- No change
Changes for v8:
- Fix the patch according to dependency of x86's Fix
Changes for v9-v11:
- No change
include/common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
@@ -281,6 +281,10 @@ int setenv (const char *, const char *);#ifdef CONFIG_X86 /* x86 version to be fixed! */ # include <asm/u-boot-x86.h> #endif /* CONFIG_X86 */ +#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
PATCH v11 3/9 nds32/core N1213: NDS32 N12 core family N1213
In reply to Macpaul LinAdd 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.
---
Changes v1 to v6:
- Style clean up and reorganize code
Changes v7-v9:
- No Change.
Changes v10:
- start.S of N1213 CPU has been rewrote for relocation support.
- u-boot.lds:
- Add got and *(.got.plt) section for support GCC 4 toolchain
- Modified for relocation implementation.
Changes v11:
- arch/nds32/cpu/n1213/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
arch/nds32/cpu/n1213/Makefile | 50 ++++ arch/nds32/cpu/n1213/start.S | 523 +++++++++++++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/u-boot.lds | 72 ++++++ 3 files changed, 645 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
@@ -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) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/nds32/cpu/n1213/start.S new file +523 -0
523 lines not on this page · raw message
arch/nds32/cpu/n1213/u-boot.lds new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v11 3/9 nds32/core N1213: NDS32 N12 core family N1213
arch/nds32/cpu/n1213/u-boot.lds line 33
Quoted 6 lines · On Thursday, September 01, 2011 01:52:44 Macpaul Lin wrote:
arch/nds32/cpu/n1213/u-boot.lds new file +3
-0+SECTIONS +{ + . = 0x00000000;
shouldnt this be CONFIG_SYS_TEXT_BASE or CONFIG_SYS_MONITOR_BASE or something other than 0 ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110901/5fac95ab/attachment.pgp
PATCH v11 3/9 nds32/core N1213: NDS32 N12 core family N1213
Hi Mike and Albert,
2011/9/1 Mike Frysinger <[email protected]>:
Quoted 11 lines · On Thursday, September 01, 2011 01:52:44 Macpaul Lin wrote:
arch/nds32/cpu/n1213/u-boot.lds
Quoted 6 lines
arch/nds32/cpu/n1213/u-boot.lds new file +3
-0+SECTIONS +{ + ? ? . = 0x00000000;shouldnt this be
CONFIG_SYS_TEXT_BASEorCONFIG_SYS_MONITOR_BASEor something other than 0 ?
-mike
After checking the binary with NDS32 architecture, I've found the dominate parameter isCONFIG_SYS_TEXT_BASE or CONFIG_SYS_MONITOR_BASE.
So this line is not necessary.
However I also found there are the same configurations in ARM's linker script. I just curios about is this a necessity for ARM?
I'll remove this in PATCH v12. Thanks.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v11 3/9 nds32/core N1213: NDS32 N12 core family N1213
In reply to Macpaul Linarch/nds32/include/asm/u-boot-nds32.h
Quoted 5 lines · On Thursday, September 01, 2011 01:52:42 you wrote:
arch/nds32/include/asm/u-boot-nds32.h new file +2
-0+/* cpu/.../timer.c */ +int timer_init (void );
this is taken care of by common.h already, so you can just delete this -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110901/25349df0/attachment.pgp
PATCH v11 4/9 nds32/ag101: cpu and init funcs of SoC ag101
In reply to Macpaul LinSoC ag101 is the first chip using NDS32 N1213 cpu core. Add header file of device offset support for SoC ag101. 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.
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.
---
Changes for v1-v4:
- Code clean up.
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().
- lowlevel_init.S
- 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.
Changes for v7:
- clean up.
Changes for v8-v9:
- No change.
Changes for v10:
- asm-offset.c: file added for ag101 use only.
- ag101/Makefile: add gen-asm-offset support to ag101 for lowlevel_init.S.
- Makefile: add gen-asm-offset support for NDS32 based core and SoCs.
- cpu.c: remove unused cpu_init().
- lowlevel_init.S
- Introduce SoC specific gen-asm-offset.h to lowlevel_init.S
- Replace routings by macros to made code much easier to understand.
- Add debug LED support.
- Add CONFIG_MEM_REMAP for those boards must do memort remapping.
Changes for v11:
- arch/nds32/cpu/n1213/ag101/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Makefile | 3 +- arch/nds32/cpu/n1213/ag101/Makefile | 70 ++++++++ arch/nds32/cpu/n1213/ag101/asm-offsets.c | 43 +++++ arch/nds32/cpu/n1213/ag101/cpu.c | 200 +++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/lowlevel_init.S | 238 ++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/timer.c | 204 ++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/watchdog.S | 48 ++++++ arch/nds32/include/asm/arch-ag101/ag101.h | 68 ++++++++ 8 files changed, 873 insertions(+), 1 deletions(-) create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile create mode 100644 arch/nds32/cpu/n1213/ag101/asm-offsets.c create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c create mode 100644 arch/nds32/cpu/n1213/ag101/lowlevel_init.S create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c create mode 100644 arch/nds32/cpu/n1213/ag101/watchdog.S create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
Makefile +2 -1
@@ -1019,7 +1019,8 @@ clean: $(obj)board/armltd/{integratorap,integratorcp}/u-boot.lds \ $(obj)u-boot.lds \ $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \ - $(obj)arch/blackfin/cpu/init.{lds,elf} + $(obj)arch/blackfin/cpu/init.{lds,elf} \ + $(obj)arch/nds32/cpu/$(CPU)/$(SOC)/gen-asm-offsets.[chs] @rm -f $(obj)include/bmp_logo.h @rm -f $(obj)lib/asm-offsets.s @rm -f $(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
arch/nds32/cpu/n1213/ag101/Makefile new file +70 -0
70 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/asm-offsets.c new file +43 -0
43 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/cpu.c new file +200 -0
200 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +238 -0
238 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
arch/nds32/include/asm/arch-ag101/ag101.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v11 5/9 nds32/lib: add generic funcs in NDS32 lib
In reply to Macpaul LinAdd 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.
Changes for v9:
- support CONFIG_STANDALONE_LOAD_ADDR in config.mk
Changes for v10:
- config.mk:
- add -fpie flag.
- replace -ffixed-8 to -ffixed-10.
- add -mrelax and --gc-sections to LDFLAG
- board.c:
- fix lib/board.c for relocation.
- fix dram init for relocation.
Changes for v11:
- arch/nds32/lib/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
arch/nds32/config.mk | 37 ++++ arch/nds32/lib/Makefile | 52 +++++ arch/nds32/lib/board.c | 453 +++++++++++++++++++++++++++++++++++++++++++ arch/nds32/lib/bootm.c | 241 +++++++++++++++++++++++ arch/nds32/lib/interrupts.c | 131 +++++++++++++ 5 files changed, 914 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 +37 -0
@@ -0,0 +1,37 @@ +# +# (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- + +CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T nds32.lds + +PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax +PLATFORM_RELFLAGS += -gdwarf-2 +PLATFORM_CPPFLAGS += -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-10 -fpie + +LDFLAGS_u-boot = --gc-sections --relax + +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 +453 -0
453 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
PATCH v11 5/9 nds32/lib: add generic funcs in NDS32 lib
arch/nds32/config.mk
Quoted 4 lines · On Thursday, September 01, 2011 01:52:46 Macpaul Lin wrote:
arch/nds32/config.mk new file +1
-0+LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
the top level logic tries hard to find a good LDSCRIPT default. do you need to set this yourself anymore ?
arch/nds32/lib/board.c
Quoted 4 lines
arch/nds32/lib/board.c new file +1
-0+extern ulong __bss_end;
if this is coming from the linker script, then it should be:
extern char __bss_end[];
arch/nds32/lib/board.c line 50
Quoted 6 lines
arch/nds32/lib/board.c new file +6
-0+#ifndef CONFIG_IDENT_STRING +#define CONFIG_IDENT_STRING "" +#endif + +const char version_string[] = +U_BOOT_VERSION " (" U_BOOT_DATE " - " U_BOOT_TIME ")" CONFIG_IDENT_STRING ;
pretty sure you dont need this anymore as common/cmd_version.c takes care of it. so just delete this code.
arch/nds32/lib/board.c line 211
Quoted 10 lines
arch/nds32/lib/board.c new file +9
-0+void board_init_f (ulong bootflag) +{ +/* Pointer is writable since we allocated a register for it */ + gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR ) & ~0x07 ); + +/* compiler optimization barrier needed for GCC >= 3.4 */ + __asm__ __volatile__("" : : :"memory" ); + +memset ((void *)gd,0 ,sizeof (gd_t));
err, is that barrier really needed ? sounds like a bug in your compiler.
as for the memset, it should be:memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
arch/nds32/lib/board.c line 272
Quoted 1 line
arch/nds32/lib/board.c new file +1
-0+ addr_sp -=sizeof (bd_t);
sizeof(bd_t) -> GENERATED_BD_INFO_SIZE
this shows up multiple times
also, did i miss something, or do you not zero out your board info ?
arch/nds32/lib/board.c line 278
Quoted 1 line
arch/nds32/lib/board.c new file +1
-0+ addr_sp -=sizeof (gd_t);
sizeof(gd_t) -> GENERATED_GBL_DATA_SIZE
this shows up multiple times
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110901/a9507364/attachment.pgp
PATCH v11 5/9 nds32/lib: add generic funcs in NDS32 lib
Hi, Mike and Wolfgang,
2011/9/1 Mike Frysinger <[email protected]>:
Quoted 1 line · On Thursday, September 01, 2011 01:52:46 Macpaul Lin wrote:
[... skipped and will discuss these later]
Quoted 4 lines
Quoted 4 lines
arch/nds32/lib/board.c new file +3
-0+void board_init_f (ulong bootflag) +{ + ? ? /* Pointer is writable since we allocated a register for it */
Quoted 8 lines
Review
Quoted 6 lines
+ ? ? gd = (
gd_t*) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);(quoted diff) +5
-0+ + ? ? /* compiler optimization barrier needed for GCC >= 3.4 */ + ? ? __asm__ __volatile__("" : : : "memory"); + + ? ? memset((void *)gd, 0, sizeof(gd_t));err, is that barrier really needed ? ?sounds like a bug in your compiler.
I'm not sure if this is really a bug which has been fixed or this is still a common problem.
I've found there are architectures x86, mips, m68k, nios2, powerpc have this code to do
optimization barrier.
I'll try to verify this with our toolchain department, but I think this might be a common problem.
Could someone give a comment on this?
Quoted 2 lines
as for the memset, it should be:
memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
It's the similar case.
Since we have generated header file for global data, this code might be good. However, there are other architecture remain the same code which do memset with sizeof(gd_t).
Included m68k, sparc, arm, avr32 and powerpc.
Do I miss something of the discussion before in the mailing list? Should these also be a clean up for other architectures, too?
Quoted 7 lines
Quoted 2 lines
+ ? ?
addr_sp-=sizeof(bd_t);
sizeof(bd_t)->GENERATED_BD_INFO_SIZEthis shows up multiple times
Quoted 9 lines
also, did i miss something, or do you not zero out your board info ?
Quoted 1 line
+ ? ?
addr_sp-=sizeof(gd_t);
sizeof(gd_t)->GENERATED_GBL_DATA_SIZEthis shows up multiple times
-mike
No, I didn't zero out the board info just like the implementation of other architecture.
Dose this lead a problem?
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v11 5/9 nds32/lib: add generic funcs in NDS32 lib
Quoted 15 lines · On Tuesday, September 06, 2011 02:41:47 ??? wrote:
2011/9/1 Mike Frysinger <[email protected]>:
Quoted 5 lines · On Thursday, September 01, 2011 01:52:46 Macpaul Lin wrote:
Quoted 4 lines
arch/nds32/lib/board.c new file +3
-0+void board_init_f (ulong bootflag) +{ +/* Pointer is writable since we allocated a register for it */ Quoted 8 lines
arch/nds32/lib/board.c line 211
Quoted 6 lines
arch/nds32/lib/board.c new file +6
-0+ gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR ) & ~0x07 ); + +/* compiler optimization barrier needed for GCC >= 3.4 */ + __asm__ __volatile__("" : : :"memory" ); + +memset ((void *)gd,0 ,sizeof (gd_t));err, is that barrier really needed ? sounds like a bug in your compiler.
Quoted 8 lines
I'm not sure if this is really a bug which has been fixed or this is still a common problem.
I've found there are architectures x86, mips, m68k, nios2, powerpc have this code to do
optimization barrier.
I'll try to verify this with our toolchain department, but I think this might be a common problem.
Could someone give a comment on this?
unless you know you need it, i'd refrain from copying warts from other people. might want to look at git log to see why the other arches actually have it.
Quoted 10 lines
Quoted 2 lines
as for the memset, it should be:
memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);It's the similar case.
Since we have generated header file for global data, this code might be good. However, there are other architecture remain the same code which do memset withsizeof(gd_t).
Included m68k, sparc, arm, avr32 and powerpc.
Do I miss something of the discussion before in the mailing list? Should these also be a clean up for other architectures, too?
i think it's a matter of those arches havent updated. the generated header is a new feature compared to these arches.
Quoted 5 lines
Quoted 1 line
also, did i miss something, or do you not zero out your board info ?
No, I didn't zero out the board info just like the implementation of other architecture.
Dose this lead a problem?
i think it depends purely on the arch/board setup. if the arch knows the board data is going to be coming from a zeroed location (like bss), or it knows it initializes all the members, then you can skip it. otherwise, you should be calling memset() on it to make sure things are in a sane state. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110906/e8e4bdd6/attachment.pgp
PATCH v12 1/9 nds32: add header files support for nds32
In reply to 馬克泡Add generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
Changes for v10:
- macro.h: add writel and setbf macros
- u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
- config.h: add manual relocation support as default.
Changes for v11:
- unaligned.h: replace asm/unaligned.h with asm-generic/unaligned.h
Changes for v12:
- remove no used memory.h
- remove seldom used bi_env parameter
- u-boot-nds32.h:
- remove duplicate timer_init()
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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 409 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 60 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1444 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/macro.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
@@ -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
@@ -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 +28 -0
@@ -0,0 +1,28 @@ +/* +* 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_ + +#define CONFIG_NEEDS_MANUAL_RELOC + +#endif
arch/nds32/include/asm/global_data.h new file +89 -0
89 lines not on this page · raw message
arch/nds32/include/asm/io.h new file +409 -0
409 lines not on this page · raw message
arch/nds32/include/asm/mach-types.h new file +29 -0
@@ -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/macro.h new file +96 -0
96 lines not on this page · raw message
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
@@ -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 +51 -0
51 lines not on this page · raw message
arch/nds32/include/asm/u-boot.h new file +60 -0
60 lines not on this page · raw message
arch/nds32/include/asm/unaligned.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>
Signature · 1 line
1.7.3.5
PATCH v12 2/9 nds32: add NDS32 support into common header file
In reply to 馬克泡Add NDS32 support into common header file.
---
Changes for v1-v7:
- No change
Changes for v8:
- Fix the patch according to dependency of x86's Fix
Changes for v9-v12:
- No change
include/common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
@@ -281,6 +281,10 @@ int setenv (const char *, const char *);#ifdef CONFIG_X86 /* x86 version to be fixed! */ # include <asm/u-boot-x86.h> #endif /* CONFIG_X86 */ +#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
PATCH v12 3/9 nds32/core N1213: NDS32 N12 core family N1213
In reply to 馬克泡Add N1213 cpu core (N12 Core family) support for NDS32 arch. This patch includes start.S for the initialize procedure of N1213.
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.
---
Changes v1 to v6:
- Style clean up and reorganize code
Changes v7-v9:
- No Change.
Changes v10:
- start.S of N1213 CPU has been rewrote for relocation support.
- u-boot.lds:
- Add got and *(.got.plt) section for support GCC 4 toolchain
- Modified for relocation implementation.
Changes v11:
- arch/nds32/cpu/n1213/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes v12:
- u-boot.lds
- Remove the 0x00000000 base address in linker script.
The base address of the binary will be determined by CONFIG_SYS_TEXT_BASE
- Remove the CPU features in commit log and add to README in later patches.
arch/nds32/cpu/n1213/Makefile | 50 ++++ arch/nds32/cpu/n1213/start.S | 501 +++++++++++++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/u-boot.lds | 70 ++++++ 3 files changed, 621 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
@@ -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) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/nds32/cpu/n1213/start.S new file +501 -0
501 lines not on this page · raw message
arch/nds32/cpu/n1213/u-boot.lds new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v12 4/9 nds32/ag101: cpu and init funcs of SoC ag101
In reply to 馬克泡SoC ag101 is the first chip using NDS32 N1213 cpu core. Add header file of device offset support for SoC ag101. Add main function of SoC ag101 based on NDS32 n1213 core. Add lowlevel_init.S and other periphal related code.
This version of lowlevel_init.S also replace hardcode value by MARCO defines from the GPL version andesboot for better code quality.
---
Changes for v1-v4:
- Code clean up.
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().
- lowlevel_init.S
- 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.
Changes for v7:
- clean up.
Changes for v8-v9:
- No change.
Changes for v10:
- asm-offset.c: file added for ag101 use only.
- ag101/Makefile: add gen-asm-offset support to ag101 for lowlevel_init.S.
- Makefile: add gen-asm-offset support for NDS32 based core and SoCs.
- cpu.c: remove unused cpu_init().
- lowlevel_init.S
- Introduce SoC specific gen-asm-offset.h to lowlevel_init.S
- Replace routings by macros to made code much easier to understand.
- Add debug LED support.
- Add CONFIG_MEM_REMAP for those boards must do memort remapping.
Changes for v11:
- arch/nds32/cpu/n1213/ag101/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes for v12:
- Simplify the commit log about the part of lowlevel_init.S.
Makefile | 3 +- arch/nds32/cpu/n1213/ag101/Makefile | 70 ++++++++ arch/nds32/cpu/n1213/ag101/asm-offsets.c | 43 +++++ arch/nds32/cpu/n1213/ag101/cpu.c | 200 +++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/lowlevel_init.S | 238 ++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/timer.c | 204 ++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/watchdog.S | 48 ++++++ arch/nds32/include/asm/arch-ag101/ag101.h | 68 ++++++++ 8 files changed, 873 insertions(+), 1 deletions(-) create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile create mode 100644 arch/nds32/cpu/n1213/ag101/asm-offsets.c create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c create mode 100644 arch/nds32/cpu/n1213/ag101/lowlevel_init.S create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c create mode 100644 arch/nds32/cpu/n1213/ag101/watchdog.S create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
Makefile +2 -1
@@ -936,7 +936,8 @@ clean: $(obj)board/voiceblue/eeprom \ $(obj)u-boot.lds \ $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \ - $(obj)arch/blackfin/cpu/init.{lds,elf} + $(obj)arch/blackfin/cpu/init.{lds,elf} \ + $(obj)arch/nds32/cpu/$(CPU)/$(SOC)/gen-asm-offsets.[chs] @rm -f $(obj)include/bmp_logo.h @rm -f $(obj)lib/asm-offsets.s @rm -f $(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
arch/nds32/cpu/n1213/ag101/Makefile new file +70 -0
70 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/asm-offsets.c new file +43 -0
43 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/cpu.c new file +200 -0
200 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +238 -0
238 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
arch/nds32/include/asm/arch-ag101/ag101.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v12 4/9 nds32/ag101: cpu and init funcs of SoC ag101
Makefile clean: · line 940
Quoted 9 lines · On Tuesday, September 06, 2011 22:27:15 Macpaul Lin wrote:
Makefile +2
-1@@ -936,7 +936,8 @@ clean: $(obj)board/voiceblue/eeprom \ $(obj)u-boot.lds \ $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \ - $(obj)arch/blackfin/cpu/init.{lds,elf} + $(obj)arch/blackfin/cpu/init.{lds,elf} \ + $(obj)arch/nds32/cpu/$(CPU)/$(SOC)/gen-asm-offsets.[chs]
i think the recently merged asm-offsets unification patch takes care of this for you, so you can drop this change
arch/nds32/cpu/n1213/ag101/Makefile line 41
Quoted 10 lines
arch/nds32/cpu/n1213/ag101/Makefile new file +7
-0+ifndef CONFIG_SKIP_LOWLEVEL_INIT +SOBJS := lowlevel_init.o +endif + +ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG +SOBJS += watchdog.o +endif
the CONFIG_SKIP_xxx is a bit backwards. seems like you should invert the logic, have your arch asm/config.h define them by default, and then have the boards which want to skip it do an #undef on them.
otherwise, you can unify this with:
SOBJS- :=
SOBJS-$(CONFIG_SKIP_LOWLEVEL_INIT) += lowlevel_init.o SOBJS-$(CONFIG_SKIP_TRUNOFF_WATCHDOG) += watchdog.o
and then use $(SOBJS-) ...
arch/nds32/cpu/n1213/ag101/Makefile line 61
Quoted 11 lines
+$(OBJS): $(obj)gen-asm-offsets.h
+$(obj)gen-asm-offsets.h: $(TOPDIR)/include/autoconf.mk.dep \arch/nds32/cpu/n1213/ag101/Makefile new file +9
-0+ $(obj)gen-asm-offsets.s + @echo Generating $@ ; \ + $(SRCTREE)/tools/scripts/make-asm-offsets $(obj)gen-asm-offsets.s $@ + +$(obj)gen-asm-offsets.s: $(TOPDIR)/include/autoconf.mk.dep \ + $(src)asm-offsets.c + @mkdir -p $(obj)b + $(CC) -DDO_DEPS_ONLY \ + $(CFLAGS) -o $@ $(src)asm-offsets.c -c -S
pretty sure the recent unification of this in the top level Makefile means you can drop this now
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110908/ab0359c2/attachment.pgp
PATCH v12 4/9 nds32/ag101: cpu and init funcs of SoC ag101
Hi Mike,
2011/9/9 Mike Frysinger <[email protected]>
Quoted 4 lines · On Tuesday, September 06, 2011 22:27:15 Macpaul Lin wrote:
Makefile
Quoted 2 lines
Makefile +0
-0
Thanks for your reviewing.
I'll be on vacation for 1 week.
So I'll continue on this after the vacation is finished.
Thanks!
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v12 4/9 nds32/ag101: cpu and init funcs of SoC ag101
In reply to Mike FrysingerHi Mike,
Quoted 16 lines
---
/dev/nullarch/nds32/cpu/n1213/ag101/Makefile line 41
Quoted 9 lines
+++ b/arch/nds32/cpu/n1213/ag101/Makefile
arch/nds32/cpu/n1213/ag101/Makefile new file +7
-0+ifndef CONFIG_SKIP_LOWLEVEL_INIT +SOBJS := lowlevel_init.o +endif + +ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG +SOBJS += watchdog.o +endifthe
CONFIG_SKIP_xxxis a bit backwards. seems like you should invert the logic, have your archasm/config.hdefine them by default, and then have the
boards which want to skip it do an #undef on them.
Our evaluation boards has an another boot loader loaded before u-boot is loaded.
However, we do not suggest our customer use this boot loader on their product if 2 different boot loaders was required.
Which means, only u-boot with lowlevel_init should be shipped on customers' own platforms.
This kind of switchable definition is designed for helping customers to get familiar with the
evaluation boards.
Hence CONFIG_SKIP_LOWLEVEL_INIT shouldn't be exist on customers' platforms. Which means lowlevel_init should be executed by default.
This also means
"SOBJS-$(CONFIG_SKIP_LOWLEVEL_INIT) += lowlevel_init.o" won't work under this case.
If we defined CONFIG_SKIP_LOWLEVEL_INIT as yes, then lowlevel_init.o will be included
which is not the correct result.
The same situation is also applied on CONFIG_SKIP_TRUNOFF_WATCHDOG.
Quoted 8 lines
otherwise, you can unify this with:
SOBJS- :=
SOBJS-$(CONFIG_SKIP_LOWLEVEL_INIT) += lowlevel_init.o SOBJS-$(CONFIG_SKIP_TRUNOFF_WATCHDOG) += watchdog.oand then use $(SOBJS-) ...
Hence I disagree with this. If SOBJS- could work with NOT (inverse) logic for object files, I'll
glad to make this stuffs to get more simple.
Quoted 13 lines
arch/nds32/cpu/n1213/ag101/Makefile
Quoted 5 lines
+$(OBJS): $(obj)gen-asm-offsets.h
+$(obj)gen-asm-offsets.h: $(TOPDIR)/include/autoconf.mk.dep \arch/nds32/cpu/n1213/ag101/Makefile new file +3
-0+ $(obj)gen-asm-offsets.s + @echo Generating $@ ; \ + $(SRCTREE)/tools/scripts/make-asm-offsets $(obj)gen-asm-offsets.s$@
arch/nds32/cpu/n1213/ag101/Makefile line 61
Quoted 6 lines
arch/nds32/cpu/n1213/ag101/Makefile new file +6
-0+ +$(obj)gen-asm-offsets.s: $(TOPDIR)/include/autoconf.mk.dep \ + $(src)asm-offsets.c + @mkdir -p $(obj)b + $(CC) -DDO_DEPS_ONLY \ + $(CFLAGS) -o $@ $(src)asm-offsets.c -c -S
Quoted 5 lines
pretty sure the recent unification of this in the top level
Makefilemeans you
can drop this now
-mike
Other suggestion for changes are agreed and tested to be adopted in PATCH v13
Thanks!
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v13 1/9 nds32: add header files support for nds32
In reply to Macpaul LinAdd generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
Changes for v10:
- macro.h: add writel and setbf macros
- u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
- config.h: add manual relocation support as default.
Changes for v11:
- unaligned.h: replace asm/unaligned.h with asm-generic/unaligned.h
Changes for v12:
- remove no used memory.h
- remove seldom used bi_env parameter
- u-boot-nds32.h:
- remove duplicate timer_init()
Changes for v13:
- No change.
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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 409 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 60 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1444 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/macro.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
@@ -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
@@ -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 +28 -0
@@ -0,0 +1,28 @@ +/* +* 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_ + +#define CONFIG_NEEDS_MANUAL_RELOC + +#endif
arch/nds32/include/asm/global_data.h new file +89 -0
89 lines not on this page · raw message
arch/nds32/include/asm/io.h new file +409 -0
409 lines not on this page · raw message
arch/nds32/include/asm/mach-types.h new file +29 -0
@@ -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/macro.h new file +96 -0
96 lines not on this page · raw message
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
@@ -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 +51 -0
51 lines not on this page · raw message
arch/nds32/include/asm/u-boot.h new file +60 -0
60 lines not on this page · raw message
arch/nds32/include/asm/unaligned.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>
Signature · 1 line
1.7.3.5
PATCH v13 1/9 nds32: add header files support for nds32
HI all,
2011/9/21 Macpaul Lin <[email protected]>
Quoted 5 lines
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>
Sorry, it is my fault.
I've forgot to fix only a single line from PATCH v12 to PATCH v13. Hence please forget PATCH v13 away.
I'll fix it later and send PATCH v14 ASAP.
So you will see both PATCH v13 and PATCH v14 in your mailbox, please forget PATCH v13.
Please review PATCH v14 only.
Thanks.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v14 1/9 nds32: add header files support for nds32
In reply to Macpaul LinAdd generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
Changes for v10:
- macro.h: add writel and setbf macros
- u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
- config.h: add manual relocation support as default.
Changes for v11:
- unaligned.h: replace asm/unaligned.h with asm-generic/unaligned.h
Changes for v12:
- remove no used memory.h
- remove seldom used bi_env parameter
- u-boot-nds32.h:
- remove duplicate timer_init()
Changes for v13-v14:
- No change.
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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 409 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 60 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1444 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/macro.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
@@ -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
@@ -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 +28 -0
@@ -0,0 +1,28 @@ +/* +* 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_ + +#define CONFIG_NEEDS_MANUAL_RELOC + +#endif
arch/nds32/include/asm/global_data.h new file +89 -0
89 lines not on this page · raw message
arch/nds32/include/asm/io.h new file +409 -0
409 lines not on this page · raw message
arch/nds32/include/asm/mach-types.h new file +29 -0
@@ -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/macro.h new file +96 -0
96 lines not on this page · raw message
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
@@ -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 +51 -0
51 lines not on this page · raw message
arch/nds32/include/asm/u-boot.h new file +60 -0
60 lines not on this page · raw message
arch/nds32/include/asm/unaligned.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>
Signature · 1 line
1.7.3.5
PATCH v14 1/9 nds32: add header files support for nds32
Dear Macpaul Lin,
Quoted 71 lines · In message <[email protected]> you wrote:
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>---
Changes for v1-v4:
- Code cleanup and style formatting.
Changes for v5-v6:
- This patch also updated the following changes against thechange after master tree (v2010.12-rc1).- fix upper case definitions in
cache.h
- SupportGD_FLG_ENV_READYandenv_bufvars in nds32global_data.h.
- Add readsb, writesb functions intoio.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: removebd_info_extbi_ext
-bitops.h: add accessor function to bit operation with volatile var.
-system.h: addsystem.hforlocal_irqoperation with flag.
Changes for v8:
-ptrace.h: rewrite thept_regstructure, and mergeptregs.h.
-ptregs.h: removed
Changes for v9:
- No change.
Changes for v10:
-macro.h: add writel and setbf macros
-u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
-config.h: add manual relocation support as default.
Changes for v11:
-unaligned.h: replaceasm/unaligned.hwithasm-generic/unaligned.h
Changes for v12:
- remove no usedmemory.h
- remove seldom usedbi_envparameter
-u-boot-nds32.h:
- remove duplicatetimer_init()
Changes for v13-v14:
- No change.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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 409 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 60 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1444 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/macro.h create mode 100644 arch/nds32/include/asm/posix_types.h
Quoted 8 lines
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
Checkpatch says:
total: 8 errors, 58 warnings, 1444 lines checked
Please clean up and resubmit. Thanks.
PATCH v14 2/9 nds32: add NDS32 support into common header file
In reply to Macpaul LinAdd NDS32 support into common header file.
---
Changes for v1-v7:
- No change
Changes for v8:
- Fix the patch according to dependency of x86's Fix
Changes for v9-v14:
- No change
include/common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
@@ -302,6 +302,10 @@ int setenv (const char *, const char *);#ifdef CONFIG_X86 /* x86 version to be fixed! */ # include <asm/u-boot-x86.h> #endif /* CONFIG_X86 */ +#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
PATCH v14 3/9 nds32/core N1213: NDS32 N12 core family N1213
In reply to Macpaul LinAdd N1213 cpu core (N12 Core family) support for NDS32 arch. This patch includes start.S for the initialize procedure of N1213.
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.
---
Changes v1 to v6:
- Style clean up and reorganize code
Changes v7-v9:
- No Change.
Changes v10:
- start.S of N1213 CPU has been rewrote for relocation support.
- u-boot.lds:
- Add got and *(.got.plt) section for support GCC 4 toolchain
- Modified for relocation implementation.
Changes v11:
- arch/nds32/cpu/n1213/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes v12:
- u-boot.lds
- Remove the 0x00000000 base address in linker script.
The base address of the binary will be determined by CONFIG_SYS_TEXT_BASE
- Remove the CPU features in commit log and add to README in later patches.
Changes v13-v14:
- No change.
arch/nds32/cpu/n1213/Makefile | 50 ++++ arch/nds32/cpu/n1213/start.S | 501 +++++++++++++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/u-boot.lds | 70 ++++++ 3 files changed, 621 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
@@ -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) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/nds32/cpu/n1213/start.S new file +501 -0
501 lines not on this page · raw message
arch/nds32/cpu/n1213/u-boot.lds new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v14 3/9 nds32/core N1213: NDS32 N12 core family N1213
Dear Macpaul Lin,
Quoted 30 lines · In message <[email protected]> you wrote:
Add N1213 cpu core (N12 Core family) support for NDS32 arch. This patch includes
start.Sfor the initialize procedure of N1213.Start procedure:
start.Swill start up the N1213 CPU core at first, then jump to SoC dependent "lowlevel_init.S" and "watchdog.S" to configure peripheral devices.Signed-off-by Macpaul Lin <[email protected]>---
Changes v1 to v6:
- Style clean up and reorganize code
Changes v7-v9:
- No Change.
Changes v10:
-start.Sof N1213 CPU has been rewrote for relocation support.
-u-boot.lds:
- Add got and *(.got.plt) section for support GCC 4 toolchain
- Modified for relocation implementation.
Changes v11:
-arch/nds32/cpu/n1213/Makefile
- replace $(AR) $(callcmd_link_o_target,...)
Changes v12:
-u-boot.lds
- Remove the0x00000000base address in linker script.
The base address of the binary will be determined byCONFIG_SYS_TEXT_BASE
- Remove the CPU features in commit log and add to README in later patches.
Changes v13-v14:
- No change.
Quoted 7 lines
arch/nds32/cpu/n1213/Makefile | 50 ++++ arch/nds32/cpu/n1213/start.S | 501 +++++++++++++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/u-boot.lds | 70 ++++++ 3 files changed, 621 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
Checkpatch says:
total: 0 errors, 7 warnings, 621 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Niklaus Wirth has lamented that, whereas Europeans pronounce his name correctly (Ni-klows Virt), Americans invariably mangle it into (Nick-les Worth). Which is to say that Europeans call him by name, but Americans call him by value.
PATCH v14 4/9 nds32/ag101: cpu and init funcs of SoC ag101
In reply to Macpaul LinSoC ag101 is the first chip using NDS32 N1213 cpu core. Add header file of device offset support for SoC ag101. Add main function of SoC ag101 based on NDS32 n1213 core. Add lowlevel_init.S and other periphal related code.
This version of lowlevel_init.S also replace hardcode value by MARCO defines from the GPL version andesboot for better code quality.
---
Changes for v1-v4:
- Code clean up.
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().
- lowlevel_init.S
- 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.
Changes for v7:
- clean up.
Changes for v8-v9:
- No change.
Changes for v10:
- asm-offset.c: file added for ag101 use only.
- ag101/Makefile: add gen-asm-offset support to ag101 for lowlevel_init.S.
- Makefile: add gen-asm-offset support for NDS32 based core and SoCs.
- cpu.c: remove unused cpu_init().
- lowlevel_init.S
- Introduce SoC specific gen-asm-offset.h to lowlevel_init.S
- Replace routings by macros to made code much easier to understand.
- Add debug LED support.
- Add CONFIG_MEM_REMAP for those boards must do memort remapping.
Changes for v11:
- arch/nds32/cpu/n1213/ag101/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes for v12:
- Simplify the commit log about the part of lowlevel_init.S.
Changes for v13:
- arch/nds32/cpu/n1213/ag101/Makefile: remove unused gen-asm-offset.
- Makefile: remove unused gen-asm-offset because merged asm-offsets.
Changes for v14:
- lowlevel_init.S: fix include path of <generated/asm-offsets.h>
arch/nds32/cpu/n1213/ag101/Makefile | 58 +++++++ arch/nds32/cpu/n1213/ag101/asm-offsets.c | 43 +++++ arch/nds32/cpu/n1213/ag101/cpu.c | 200 +++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/lowlevel_init.S | 238 ++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/timer.c | 204 ++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/watchdog.S | 48 ++++++ arch/nds32/include/asm/arch-ag101/ag101.h | 68 ++++++++ 7 files changed, 859 insertions(+), 0 deletions(-) create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile create mode 100644 arch/nds32/cpu/n1213/ag101/asm-offsets.c create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c create mode 100644 arch/nds32/cpu/n1213/ag101/lowlevel_init.S create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c create mode 100644 arch/nds32/cpu/n1213/ag101/watchdog.S create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
arch/nds32/cpu/n1213/ag101/Makefile new file +58 -0
@@ -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) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/nds32/cpu/n1213/ag101/asm-offsets.c new file +43 -0
43 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/cpu.c new file +200 -0
200 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +238 -0
238 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
arch/nds32/include/asm/arch-ag101/ag101.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v14 4/9 nds32/ag101: cpu and init funcs of SoC ag101
Dear Macpaul Lin,
Quoted 50 lines · In message <[email protected]> you wrote:
SoC ag101 is the first chip using NDS32 N1213 cpu core. Add header file of device offset support for SoC ag101. Add main function of SoC ag101 based on NDS32 n1213 core. Add
lowlevel_init.Sand other periphal related code.This version of
lowlevel_init.Salso replace hardcode value by MARCO defines from the GPL version andesboot for better code quality.Signed-off-by Macpaul Lin <[email protected]>---
Changes for v1-v4:
- Code clean up.
Changes for v5-v6:
- Splitwatchdog.Sfromlowlevel_init.S.
- Fix hardware reset by using watchdog reset indo_reset()incpu.c.
-reset_cpuwas remove insidedo_reset().
-lowlevel_init.S
- Change hard code value into MARCO definitions.
- ftsmc010
- FixFTSMC020_TPR_AT2from 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.
Changes for v7:
- clean up.
Changes for v8-v9:
- No change.
Changes for v10:
-asm-offset.c: file added for ag101 use only.
- ag101/Makefile: add gen-asm-offset support to ag101 forlowlevel_init.S.
-Makefile: add gen-asm-offset support for NDS32 based core and SoCs.
-cpu.c: remove unusedcpu_init().
-lowlevel_init.S
- Introduce SoC specificgen-asm-offset.htolowlevel_init.S
- Replace routings by macros to made code much easier to understand.
- Add debug LED support.
- AddCONFIG_MEM_REMAPfor those boards must do memort remapping.
Changes for v11:
-arch/nds32/cpu/n1213/ag101/Makefile
- replace $(AR) $(callcmd_link_o_target,...)
Changes for v12:
- Simplify the commit log about the part oflowlevel_init.S.
Changes for v13:
-arch/nds32/cpu/n1213/ag101/Makefile: remove unused gen-asm-offset.
-Makefile: remove unused gen-asm-offset because merged asm-offsets.
Changes for v14:
-lowlevel_init.S: fix include path of <generated/asm-offsets.h>
Quoted 15 lines
arch/nds32/cpu/n1213/ag101/Makefile | 58 +++++++ arch/nds32/cpu/n1213/ag101/asm-offsets.c | 43 +++++ arch/nds32/cpu/n1213/ag101/cpu.c | 200 +++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/lowlevel_init.S | 238 ++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/timer.c | 204 ++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/watchdog.S | 48 ++++++ arch/nds32/include/asm/arch-ag101/ag101.h | 68 ++++++++ 7 files changed, 859 insertions(+), 0 deletions(-) create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile create mode 100644 arch/nds32/cpu/n1213/ag101/asm-offsets.c create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c create mode 100644 arch/nds32/cpu/n1213/ag101/lowlevel_init.S create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c create mode 100644 arch/nds32/cpu/n1213/ag101/watchdog.S create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
Checkpatch says:
total: 0 errors, 15 warnings, 859 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Real programmers can write assembly code in any language. :-)
- Larry Wall in <[email protected]>PATCH v14 5/9 nds32/lib: add generic funcs in NDS32 lib
In reply to Macpaul LinAdd 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.
Changes for v9:
- support CONFIG_STANDALONE_LOAD_ADDR in config.mk
Changes for v10:
- config.mk:
- add -fpie flag.
- replace -ffixed-8 to -ffixed-10.
- add -mrelax and --gc-sections to LDFLAG
- board.c:
- fix lib/board.c for relocation.
- fix dram init for relocation.
Changes for v11:
- arch/nds32/lib/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes for v12:
- config.mk
- remove $(SRCTREE)/$(CPUDIR)/u-boot.lds
- board.c:
- remove obsolelte version_string.
- remove declaration "extern __bss_end" which is not need.
- replace sizeof(gd_t) and sizeof(bd_t) to GENERATED_GBL_DATA_SIZE and GENERATED_BD_INFO_SIZE
- add memset to board info (bd)
- remove compiler optimization barrier which is not need.
Changes for v13:
- board.c: remove unused CONFIG_IDENT_STRING.
- arch/nds32/lib/Makefile: remove unused clean and distclean.
Changes for v14:
- No change.
arch/nds32/config.mk | 35 ++++ arch/nds32/lib/Makefile | 46 +++++ arch/nds32/lib/board.c | 443 +++++++++++++++++++++++++++++++++++++++++++ arch/nds32/lib/bootm.c | 241 +++++++++++++++++++++++ arch/nds32/lib/interrupts.c | 131 +++++++++++++ 5 files changed, 896 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
@@ -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- + +CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T nds32.lds + +PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax +PLATFORM_RELFLAGS += -gdwarf-2 +PLATFORM_CPPFLAGS += -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-10 -fpie + +LDFLAGS_u-boot = --gc-sections --relax
arch/nds32/lib/Makefile new file +46 -0
46 lines not on this page · raw message
arch/nds32/lib/board.c new file +443 -0
443 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
PATCH v14 5/9 nds32/lib: add generic funcs in NDS32 lib
Dear Macpaul Lin,
Quoted 52 lines · In message <[email protected]> you wrote:
Add
Makefile,board.c,interrupts.candbootm.cfunctions to nds32 architecture.Signed-off-by Macpaul Lin <[email protected]>---
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)
- RemoveCONFIG_SOFT_I2Cwhich hasn't been support.
- RemoveCONFIG_FSL_ESDHCwhich hasn't been support.
- clean up.
Changes for v7:
- clean up.
- move single file patcharch/nds32/config.mkto this commit.
-interrupts.crefine origin interrupt enable and disable.
Changes for v8:
-interrups.c: fix up for newptraces.h.
Changes for v9:
- supportCONFIG_STANDALONE_LOAD_ADDRin config.mk
Changes for v10:
- config.mk:
- add -fpie flag.
- replace -ffixed-8 to -ffixed-10.
- add -mrelax and --gc-sections to LDFLAG
-board.c:
- fixlib/board.cfor relocation.
- fix dram init for relocation.
Changes for v11:
-arch/nds32/lib/Makefile
- replace $(AR) $(callcmd_link_o_target,...)
Changes for v12:
- config.mk
- remove $(SRCTREE)/$(CPUDIR)/u-boot.lds
-board.c:
- remove obsolelteversion_string.
- remove declaration "extern__bss_end" which is not need.
- replacesizeof(gd_t)andsizeof(bd_t)toGENERATED_GBL_DATA_SIZEandGENERATED_BD_INFO_SIZE
- add memset to board info (bd)
- remove compiler optimization barrier which is not need.
Changes for v13:
-board.c: remove unusedCONFIG_IDENT_STRING.
-arch/nds32/lib/Makefile: remove unused clean and distclean.
Changes for v14:
- No change.
Quoted 11 lines
arch/nds32/config.mk | 35 ++++ arch/nds32/lib/Makefile | 46 +++++ arch/nds32/lib/board.c | 443 +++++++++++++++++++++++++++++++++++++++++++ arch/nds32/lib/bootm.c | 241 +++++++++++++++++++++++ arch/nds32/lib/interrupts.c | 131 +++++++++++++ 5 files changed, 896 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
Checkpatch says:
total: 0 errors, 8 warnings, 896 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Accident: A condition in which presence of mind is good, but absence of body is better.
PATCH v14 6/9 nds32: standalone support
In reply to Macpaul LinAdd standalone program related support for nds32 architecture.
---
Changes for v1-v6:
- code clean up.
Changes for v7-v11:
- No change.
Changes for v12:
- clean up for linker script.
Changes for v13-v14:
- No change.
examples/standalone/nds32.lds | 56 +++++++++++++++++++++++++++++++++++++ examples/standalone/stubs.c | 17 ++++++++++- examples/standalone/x86-testapp.c | 12 ++++++++ 3 files changed, 84 insertions(+), 1 deletions(-) create mode 100644 examples/standalone/nds32.lds
examples/standalone/nds32.lds new file +56 -0
@@ -0,0 +1,56 @@ +/* + * 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 +{ + . = ALIGN(4); + .text : + { + *(.text) + } + + . = 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 = .; +}
examples/standalone/stubs.c +16 -1
@@ -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
@@ -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) registervolatile xxx_t *pq asm("r8" );#elif defined(__mips__) registervolatile xxx_t *pq asm("k0" ); +#elif defined(__nds32__) + registervolatile xxx_t *pq asm("$r16" );#endif char buf[32 ];
Signature · 1 line
1.7.3.5
PATCH v14 6/9 nds32: standalone support
Dear Macpaul Lin,
Quoted 13 lines · In message <[email protected]> you wrote:
Add standalone program related support for nds32 architecture.
Signed-off-by Macpaul Lin <[email protected]>---
Changes for v1-v6:
- code clean up.
Changes for v7-v11:
- No change.
Changes for v12:
- clean up for linker script.
Changes for v13-v14:
- No change.
Quoted 5 lines
examples/standalone/nds32.lds | 56 +++++++++++++++++++++++++++++++++++++ examples/standalone/stubs.c | 17 ++++++++++- examples/standalone/x86-testapp.c | 12 ++++++++ 3 files changed, 84 insertions(+), 1 deletions(-) create mode 100644 examples/standalone/nds32.lds
Checkpatch says:
total: 0 errors, 2 warnings, 104 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 9 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Software entities are more complex for their size than perhaps any
other human construct because no two parts are alike. If they are, we
make the two similar parts into a subroutine -- open or closed. In
this respect, software systems differ profoundly from computers,
buildings, or automobiles, where repeated elements abound.
- Fred Brooks, Jr.PATCH v14 7/9 nds32: common bdinfo, bootm, image support
In reply to Macpaul LinAdd support of NDS32 to common commands bdinfo, bootm, and image format.
---
Changes for v1-v6:
- Code clean up
Changes for v7-v9:
- No Change.
Changes for v10:
- fix up according to the changes in master tree.
Changes for v11:
- No Change.
Changes for v12:
- remove seldom used bi_env parameter.
Changes for v13-v14:
- No change.
common/cmd_bdinfo.c | 25 +++++++++++++++++++++++++ common/cmd_bootm.c | 2 ++ common/image.c | 1 + include/image.h | 5 +++++ 4 files changed, 33 insertions(+), 0 deletions(-)
common/cmd_bdinfo.c +25 -0
@@ -413,6 +413,31 @@ 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 ("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
@@ -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
@@ -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
@@ -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
@@ -506,6 +507,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
@@ -658,6 +661,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
PATCH v14 8/9 adp-ag101: add board adp-ag101 support
In reply to Macpaul LinAdd evaluation board "adp-ag101" configuration 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:
- clean up.
- Move CONFIG_SYS_TEXT_BASE from board/config.mk.
- Fix Makefile and remove config.mk
Changes for v8:
- No change.
Changes for v9:
- Fix because other boards has been added into boards.cfg and broken this patch.
Changes for v10:
- adp-ag101.h
- Fix lines over 80 characters.
- Fix for introducing gen-asm-offset.
- Add mmc support for FTSDC010 SD/MMC Controller.
- fix flash init.
- fix ftsmc010 configuraion for flash probing.
- Add SP_INIT related configurations for supporting relocation.
- Fix CONFIG_TEXT_BASE for relocation.
- Add CONFIG_MEM_REMAP for some hardware boards and non-OS application.
- adp-ag101.c
- Clean up for braces according to Wolfgang's suggestion.
- Add mmc support for FTSDC010 SD/MMC Controller.
- fix dram init(), made this more simpler.
Changes for v11:
- No change.
Changes for v12:
- adp-ag101.h
- fix address when enable CONFIG_SKIP_LOWLEVEL_INIT
Changes for v13:
- board/AndesTech/adp-ag101/Makefile: remove unused clean and distclean.
Changes for v14:
- No change.
MAINTAINERS | 11 + MAKEALL | 6 + board/AndesTech/adp-ag101/Makefile | 45 ++++ board/AndesTech/adp-ag101/adp-ag101.c | 89 +++++++ boards.cfg | 1 + include/configs/adp-ag101.h | 407 +++++++++++++++++++++++++++++++++ 6 files changed, 559 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
@@ -1126,5 +1126,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
@@ -480,6 +480,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 +45 -0
45 lines not on this page · raw message
board/AndesTech/adp-ag101/adp-ag101.c new file +89 -0
89 lines not on this page · raw message
boards.cfg +1 -0
@@ -298,6 +298,7 @@ vct_platinumavc_small mips mips32 vct microna 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 nios2-generic nios2 nios2 nios2-generic altera +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 +407 -0
407 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v14 9/9 doc/README: documents and readme for NDS32 arch
In reply to Macpaul LinDocuments and READMEs for NDS32 architecture.
It patch also provides usage of SoC AG101 and board ADP-AG101.
---
Changes for v1-v10:
- The patch of documentation was not included.
Changes for v11:
- Add the documents of NDS32, ag101, N1213.
Changes for v12-v14:
- No change.
README | 24 ++++++++++++++-- doc/README.N1213 | 55 ++++++++++++++++++++++++++++++++++++ doc/README.NDS32 | 41 +++++++++++++++++++++++++++ doc/README.ag101 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ doc/README.standalone | 1 + 5 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 doc/README.N1213 create mode 100644 doc/README.NDS32 create mode 100644 doc/README.ag101
README +21 -3
@@ -182,6 +182,10 @@ Directory Hierarchy: /cpu CPU specific files /mips32 Files specific to MIPS32 CPUs /lib Architecture specific library files + /nds32 Files generic to NDS32 architecture + /cpu CPU specific files + /n1213 Files specific to Andes Technology N1213 CPUs + /lib Architecture specific library files /nios2 Files generic to Altera NIOS2 architecture /cpu CPU specific files /lib Architecture specific library files
@@ -3103,7 +3107,7 @@ Low Level (hardware related) configuration options: globally (CONFIG_CMD_MEM). - CONFIG_SKIP_LOWLEVEL_INIT - [ARM, MIPS only] If this variable is defined, then certain + [ARM, NDS32, MIPS only] If this variable is defined, then certain low level initializations (like setting up the memory controller) are omitted and/or U-Boot does not relocate itself into RAM.
@@ -3653,8 +3657,8 @@ details; basically, the header defines the following image properties: Currently supported: Linux, NetBSD, VxWorks, QNX, RTEMS, LynxOS, INTEGRITY). * Target CPU Architecture (Provisions for Alpha, ARM, AVR32, Intel x86, - IA64, MIPS, Nios II, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit; - Currently supported: ARM, AVR32, Intel x86, MIPS, Nios II, PowerPC). + IA64, MIPS, NDS32, Nios II, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit; + Currently supported: ARM, AVR32, Intel x86, MIPS, NDS32, Nios II, PowerPC). * Compression Type (uncompressed, gzip, bzip2) * Load Address * Entry Point
@@ -4347,6 +4351,20 @@ On Nios II, the ABI is documented here: Note: on Nios II, we give "-G0" option to gcc and don't use gp to access small data sections, so gp is free. +On NDS32, the following registers are used: + + R0-R1: argument/return + R2-R5: argument + R15: temporary register for assembler + R16: trampoline register + R28: frame pointer (FP) + R29: global pointer (GP) + R30: link register (LP) + R31: stack pointer (SP) + PC: program counter (PC) + + ==> U-Boot will use R10 to hold a pointer to the global data + NOTE: DECLARE_GLOBAL_DATA_PTR must be used with file-global scope, or current versions of GCC may "optimize" the code too much.
doc/README.N1213 new file +55 -0
55 lines not on this page · raw message
doc/README.NDS32 new file +41 -0
41 lines not on this page · raw message
doc/README.ag101 new file +74 -0
74 lines not on this page · raw message
doc/README.standalone +1 -0
@@ -56,6 +56,7 @@ Design Notes on Exporting U-Boot Functions to Standalone Applications: ARM 0x0c100000 0x0c100000 MIPS 0x80200000 0x80200000 Blackfin 0x00001000 0x00001000 + NDS32 0x00300000 0x00300000 Nios II 0x02000000 0x02000000 For example, the "hello world" application may be loaded and
Signature · 1 line
1.7.3.5
PATCH v13 2/9 nds32: add NDS32 support into common header file
In reply to Macpaul LinAdd NDS32 support into common header file.
---
Changes for v1-v7:
- No change
Changes for v8:
- Fix the patch according to dependency of x86's Fix
Changes for v9-v13:
- No change
include/common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
@@ -302,6 +302,10 @@ int setenv (const char *, const char *);#ifdef CONFIG_X86 /* x86 version to be fixed! */ # include <asm/u-boot-x86.h> #endif /* CONFIG_X86 */ +#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
PATCH v13 3/9 nds32/core N1213: NDS32 N12 core family N1213
In reply to Macpaul LinAdd N1213 cpu core (N12 Core family) support for NDS32 arch. This patch includes start.S for the initialize procedure of N1213.
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.
---
Changes v1 to v6:
- Style clean up and reorganize code
Changes v7-v9:
- No Change.
Changes v10:
- start.S of N1213 CPU has been rewrote for relocation support.
- u-boot.lds:
- Add got and *(.got.plt) section for support GCC 4 toolchain
- Modified for relocation implementation.
Changes v11:
- arch/nds32/cpu/n1213/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes v12:
- u-boot.lds
- Remove the 0x00000000 base address in linker script.
The base address of the binary will be determined by CONFIG_SYS_TEXT_BASE
- Remove the CPU features in commit log and add to README in later patches.
Changes v13:
- No change.
arch/nds32/cpu/n1213/Makefile | 50 ++++ arch/nds32/cpu/n1213/start.S | 501 +++++++++++++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/u-boot.lds | 70 ++++++ 3 files changed, 621 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
@@ -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) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/nds32/cpu/n1213/start.S new file +501 -0
501 lines not on this page · raw message
arch/nds32/cpu/n1213/u-boot.lds new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v13 4/9 nds32/ag101: cpu and init funcs of SoC ag101
In reply to Macpaul LinSoC ag101 is the first chip using NDS32 N1213 cpu core. Add header file of device offset support for SoC ag101. Add main function of SoC ag101 based on NDS32 n1213 core. Add lowlevel_init.S and other periphal related code.
This version of lowlevel_init.S also replace hardcode value by MARCO defines from the GPL version andesboot for better code quality.
---
Changes for v1-v4:
- Code clean up.
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().
- lowlevel_init.S
- 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.
Changes for v7:
- clean up.
Changes for v8-v9:
- No change.
Changes for v10:
- asm-offset.c: file added for ag101 use only.
- ag101/Makefile: add gen-asm-offset support to ag101 for lowlevel_init.S.
- Makefile: add gen-asm-offset support for NDS32 based core and SoCs.
- cpu.c: remove unused cpu_init().
- lowlevel_init.S
- Introduce SoC specific gen-asm-offset.h to lowlevel_init.S
- Replace routings by macros to made code much easier to understand.
- Add debug LED support.
- Add CONFIG_MEM_REMAP for those boards must do memort remapping.
Changes for v11:
- arch/nds32/cpu/n1213/ag101/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes for v12:
- Simplify the commit log about the part of lowlevel_init.S.
Changes for v13:
- arch/nds32/cpu/n1213/ag101/Makefile: remove unused gen-asm-offset.
- Makefile: remove unused gen-asm-offset because merged asm-offsets.
arch/nds32/cpu/n1213/ag101/Makefile | 58 +++++++ arch/nds32/cpu/n1213/ag101/asm-offsets.c | 43 +++++ arch/nds32/cpu/n1213/ag101/cpu.c | 200 +++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/lowlevel_init.S | 238 ++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/timer.c | 204 ++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/watchdog.S | 48 ++++++ arch/nds32/include/asm/arch-ag101/ag101.h | 68 ++++++++ 7 files changed, 859 insertions(+), 0 deletions(-) create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile create mode 100644 arch/nds32/cpu/n1213/ag101/asm-offsets.c create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c create mode 100644 arch/nds32/cpu/n1213/ag101/lowlevel_init.S create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c create mode 100644 arch/nds32/cpu/n1213/ag101/watchdog.S create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
arch/nds32/cpu/n1213/ag101/Makefile new file +58 -0
@@ -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) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/nds32/cpu/n1213/ag101/asm-offsets.c new file +43 -0
43 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/cpu.c new file +200 -0
200 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +238 -0
238 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
arch/nds32/include/asm/arch-ag101/ag101.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v13 5/9 nds32/lib: add generic funcs in NDS32 lib
In reply to Macpaul LinAdd 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.
Changes for v9:
- support CONFIG_STANDALONE_LOAD_ADDR in config.mk
Changes for v10:
- config.mk:
- add -fpie flag.
- replace -ffixed-8 to -ffixed-10.
- add -mrelax and --gc-sections to LDFLAG
- board.c:
- fix lib/board.c for relocation.
- fix dram init for relocation.
Changes for v11:
- arch/nds32/lib/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes for v12:
- config.mk
- remove $(SRCTREE)/$(CPUDIR)/u-boot.lds
- board.c:
- remove obsolelte version_string.
- remove declaration "extern __bss_end" which is not need.
- replace sizeof(gd_t) and sizeof(bd_t) to GENERATED_GBL_DATA_SIZE and GENERATED_BD_INFO_SIZE
- add memset to board info (bd)
- remove compiler optimization barrier which is not need.
Changes for v13:
- board.c: remove unused CONFIG_IDENT_STRING.
- arch/nds32/lib/Makefile: remove unused clean and distclean.
--- arch/nds32/config.mk | 35 ++++ arch/nds32/lib/Makefile | 46 +++++ arch/nds32/lib/board.c | 443 +++++++++++++++++++++++++++++++++++++++++++ arch/nds32/lib/bootm.c | 241 +++++++++++++++++++++++ arch/nds32/lib/interrupts.c | 131 +++++++++++++ 5 files changed, 896 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
@@ -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- + +CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T nds32.lds + +PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax +PLATFORM_RELFLAGS += -gdwarf-2 +PLATFORM_CPPFLAGS += -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-10 -fpie + +LDFLAGS_u-boot = --gc-sections --relax
arch/nds32/lib/Makefile new file +46 -0
46 lines not on this page · raw message
arch/nds32/lib/board.c new file +443 -0
443 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
PATCH v13 6/9 nds32: standalone support
In reply to Macpaul LinAdd standalone program related support for nds32 architecture.
Changes for v1-v6:
- code clean up.
Changes for v7-v11:
- No change.
Changes for v12:
- clean up for linker script.
Changes for v13:
- No change.
--- examples/standalone/nds32.lds | 56 +++++++++++++++++++++++++++++++++++++ examples/standalone/stubs.c | 17 ++++++++++- examples/standalone/x86-testapp.c | 12 ++++++++ 3 files changed, 84 insertions(+), 1 deletions(-) create mode 100644 examples/standalone/nds32.lds
examples/standalone/nds32.lds new file +56 -0
@@ -0,0 +1,56 @@ +/* + * 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 +{ + . = ALIGN(4); + .text : + { + *(.text) + } + + . = 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 = .; +}
examples/standalone/stubs.c +16 -1
@@ -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
@@ -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) registervolatile xxx_t *pq asm("r8" );#elif defined(__mips__) registervolatile xxx_t *pq asm("k0" ); +#elif defined(__nds32__) + registervolatile xxx_t *pq asm("$r16" );#endif char buf[32 ];
Signature · 1 line
1.7.3.5
PATCH v13 7/9 nds32: common bdinfo, bootm, image support
In reply to Macpaul LinAdd support of NDS32 to common commands bdinfo, bootm, and image format.
Changes for v1-v6:
- Code clean up
Changes for v7-v9:
- No Change.
Changes for v10:
- fix up according to the changes in master tree.
Changes for v11:
- No Change.
Changes for v12:
- remove seldom used bi_env parameter.
Changes for v13:
- No change.
--- common/cmd_bdinfo.c | 25 +++++++++++++++++++++++++ common/cmd_bootm.c | 2 ++ common/image.c | 1 + include/image.h | 5 +++++ 4 files changed, 33 insertions(+), 0 deletions(-)
common/cmd_bdinfo.c +25 -0
@@ -413,6 +413,31 @@ 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 ("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
@@ -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
@@ -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
@@ -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
@@ -506,6 +507,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
@@ -658,6 +661,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
PATCH v13 8/9 adp-ag101: add board adp-ag101 support
In reply to Macpaul LinAdd evaluation board "adp-ag101" configuration 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:
- clean up.
- Move CONFIG_SYS_TEXT_BASE from board/config.mk.
- Fix Makefile and remove config.mk
Changes for v8:
- No change.
Changes for v9:
- Fix because other boards has been added into boards.cfg and broken this patch.
Changes for v10:
- adp-ag101.h
- Fix lines over 80 characters.
- Fix for introducing gen-asm-offset.
- Add mmc support for FTSDC010 SD/MMC Controller.
- fix flash init.
- fix ftsmc010 configuraion for flash probing.
- Add SP_INIT related configurations for supporting relocation.
- Fix CONFIG_TEXT_BASE for relocation.
- Add CONFIG_MEM_REMAP for some hardware boards and non-OS application.
- adp-ag101.c
- Clean up for braces according to Wolfgang's suggestion.
- Add mmc support for FTSDC010 SD/MMC Controller.
- fix dram init(), made this more simpler.
Changes for v11:
- No Change.
Changes for v12:
- adp-ag101.h
- fix address when enable CONFIG_SKIP_LOWLEVEL_INIT
Changes for v13:
- board/AndesTech/adp-ag101/Makefile: remove unused clean and distclean.
--- MAINTAINERS | 11 + MAKEALL | 6 + board/AndesTech/adp-ag101/Makefile | 45 ++++ board/AndesTech/adp-ag101/adp-ag101.c | 89 +++++++ boards.cfg | 1 + include/configs/adp-ag101.h | 407 +++++++++++++++++++++++++++++++++ 6 files changed, 559 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
@@ -1126,5 +1126,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
@@ -480,6 +480,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 +45 -0
45 lines not on this page · raw message
board/AndesTech/adp-ag101/adp-ag101.c new file +89 -0
89 lines not on this page · raw message
boards.cfg +1 -0
@@ -298,6 +298,7 @@ vct_platinumavc_small mips mips32 vct microna 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 nios2-generic nios2 nios2 nios2-generic altera +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 +407 -0
407 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v13 9/9 doc/README: documents and readme for NDS32 arch
In reply to Macpaul LinDocuments and READMEs for NDS32 architecture.
It patch also provides usage of SoC AG101 and board ADP-AG101.
Changes for v1-v10:
- The patch of documentation was not included.
Changes for v11:
- Add the documents of NDS32, ag101, N1213.
Changes for v12-v13:
- No change.
--- README | 24 ++++++++++++++-- doc/README.N1213 | 55 ++++++++++++++++++++++++++++++++++++ doc/README.NDS32 | 41 +++++++++++++++++++++++++++ doc/README.ag101 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ doc/README.standalone | 1 + 5 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 doc/README.N1213 create mode 100644 doc/README.NDS32 create mode 100644 doc/README.ag101
README +21 -3
@@ -182,6 +182,10 @@ Directory Hierarchy: /cpu CPU specific files /mips32 Files specific to MIPS32 CPUs /lib Architecture specific library files + /nds32 Files generic to NDS32 architecture + /cpu CPU specific files + /n1213 Files specific to Andes Technology N1213 CPUs + /lib Architecture specific library files /nios2 Files generic to Altera NIOS2 architecture /cpu CPU specific files /lib Architecture specific library files
@@ -3103,7 +3107,7 @@ Low Level (hardware related) configuration options: globally (CONFIG_CMD_MEM). - CONFIG_SKIP_LOWLEVEL_INIT - [ARM, MIPS only] If this variable is defined, then certain + [ARM, NDS32, MIPS only] If this variable is defined, then certain low level initializations (like setting up the memory controller) are omitted and/or U-Boot does not relocate itself into RAM.
@@ -3653,8 +3657,8 @@ details; basically, the header defines the following image properties: Currently supported: Linux, NetBSD, VxWorks, QNX, RTEMS, LynxOS, INTEGRITY). * Target CPU Architecture (Provisions for Alpha, ARM, AVR32, Intel x86, - IA64, MIPS, Nios II, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit; - Currently supported: ARM, AVR32, Intel x86, MIPS, Nios II, PowerPC). + IA64, MIPS, NDS32, Nios II, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit; + Currently supported: ARM, AVR32, Intel x86, MIPS, NDS32, Nios II, PowerPC). * Compression Type (uncompressed, gzip, bzip2) * Load Address * Entry Point
@@ -4347,6 +4351,20 @@ On Nios II, the ABI is documented here: Note: on Nios II, we give "-G0" option to gcc and don't use gp to access small data sections, so gp is free. +On NDS32, the following registers are used: + + R0-R1: argument/return + R2-R5: argument + R15: temporary register for assembler + R16: trampoline register + R28: frame pointer (FP) + R29: global pointer (GP) + R30: link register (LP) + R31: stack pointer (SP) + PC: program counter (PC) + + ==> U-Boot will use R10 to hold a pointer to the global data + NOTE: DECLARE_GLOBAL_DATA_PTR must be used with file-global scope, or current versions of GCC may "optimize" the code too much.
doc/README.N1213 new file +55 -0
55 lines not on this page · raw message
doc/README.NDS32 new file +41 -0
41 lines not on this page · raw message
doc/README.ag101 new file +74 -0
74 lines not on this page · raw message
doc/README.standalone +1 -0
@@ -56,6 +56,7 @@ Design Notes on Exporting U-Boot Functions to Standalone Applications: ARM 0x0c100000 0x0c100000 MIPS 0x80200000 0x80200000 Blackfin 0x00001000 0x00001000 + NDS32 0x00300000 0x00300000 Nios II 0x02000000 0x02000000 For example, the "hello world" application may be loaded and
Signature · 1 line
1.7.3.5
PATCH v15 1/9 nds32: add header files support for nds32
In reply to Macpaul LinAdd generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
Changes for v10:
- macro.h: add writel and setbf macros
- u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
- config.h: add manual relocation support as default.
Changes for v11:
- unaligned.h: replace asm/unaligned.h with asm-generic/unaligned.h
Changes for v12:
- remove no used memory.h
- remove seldom used bi_env parameter
- u-boot-nds32.h:
- remove duplicate timer_init()
Changes for v13-v14:
- No change.
Changes for v15:
- u-boot.h: fix for new image.h according to Mike's contribution.
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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 409 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 63 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1447 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/macro.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
@@ -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
@@ -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 +28 -0
@@ -0,0 +1,28 @@ +/* +* 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_ + +#define CONFIG_NEEDS_MANUAL_RELOC + +#endif
arch/nds32/include/asm/global_data.h new file +89 -0
89 lines not on this page · raw message
arch/nds32/include/asm/io.h new file +409 -0
409 lines not on this page · raw message
arch/nds32/include/asm/mach-types.h new file +29 -0
@@ -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/macro.h new file +96 -0
96 lines not on this page · raw message
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
@@ -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 +51 -0
51 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 +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>
Signature · 1 line
1.7.3.5
PATCH v15 1/9 nds32: add header files support for nds32
Dear Macpaul Lin,
Quoted 73 lines · In message <[email protected]> you wrote:
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>---
Changes for v1-v4:
- Code cleanup and style formatting.
Changes for v5-v6:
- This patch also updated the following changes against thechange after master tree (v2010.12-rc1).- fix upper case definitions in
cache.h
- SupportGD_FLG_ENV_READYandenv_bufvars in nds32global_data.h.
- Add readsb, writesb functions intoio.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: removebd_info_extbi_ext
-bitops.h: add accessor function to bit operation with volatile var.
-system.h: addsystem.hforlocal_irqoperation with flag.
Changes for v8:
-ptrace.h: rewrite thept_regstructure, and mergeptregs.h.
-ptregs.h: removed
Changes for v9:
- No change.
Changes for v10:
-macro.h: add writel and setbf macros
-u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
-config.h: add manual relocation support as default.
Changes for v11:
-unaligned.h: replaceasm/unaligned.hwithasm-generic/unaligned.h
Changes for v12:
- remove no usedmemory.h
- remove seldom usedbi_envparameter
-u-boot-nds32.h:
- remove duplicatetimer_init()
Changes for v13-v14:
- No change.
Changes for v15:
-u-boot.h: fix for newimage.haccording to Mike's contribution.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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 409 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 63 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1447 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/macro.h create mode 100644 arch/nds32/include/asm/posix_types.h
Quoted 8 lines
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
Checkpatch says:
total: 8 errors, 58 warnings, 1447 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The easiest way to figure the cost of living is to take your income and add ten percent.
PATCH v15 1/9 nds32: add header files support for nds32
Dear Wolfgang,
2011/10/7 Wolfgang Denk <[email protected]>:
Quoted 7 lines
Dear Macpaul Lin,
Quoted 4 lines · In message <[email protected]> you wrote:
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>
...
Quoted 2 lines
Quoted 2 lines
Changes for v15:
? -u-boot.h: fix for newimage.haccording to Mike's contribution.
I believe you must be exhausted for reviewing these patches again and again.
However, we've discussed before, to support a new architecture, there are some definitions
and codes which the checkpatch rules cannot be adapted. For example, some typedefs definitions, special asm syntax, and those special cases described
in Linux documents, and u-boot's typedef global structures.
ex: http://www.mail-archive.com/u-boot at lists.denx.de/msg52083.html
We've also discussed that Linux documents said checkpatch is just a reference rule,
you still need to have human examination.
I guess you just forget that because the patch "works" is too heavy and patch check
automation didn't help on special case much.
When we discuss about those was about NDS32 patch v7, and now is patch v15. We've to a lot of fix, includes relocation.
So, could you please tell me now, should I resend the patch v16 or you still have my v15
patches and kindly tell me which part need to be fixed? Thanks!
Quoted 11 lines
Checkpatch says:
total: 8 errors, 58 warnings, 1447 lines checked
Please clean up and resubmit. ?Thanks.
Best regards,
Wolfgang Denk
Note:
The 8 errors is due to the new assembly march.h added. Only 2 new cases introduced.
ERROR: space prohibited before open square bracket '[' #1032: FILE: arch/nds32/include/asm/macro.h:66:
+ lwi $r5, [$r4]
This is to load a 32bit from the address x, while the value of address x is stored in $r4, and load it into $r5
ERROR: spaces required around that ':' (ctx:VxE)
#1055: FILE: arch/nds32/include/asm/macro.h:89:
+1:
^
The original form is like this:
.macro wait_timer, time
li $r4, time
1: <--------Checkpatch indicates error here. However this should be checkpatch's fault.
nop
addi $r4, $r4, -1
bnez $r4, 1b.endm
Thanks!
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v15 1/9 nds32: add header files support for nds32
Dear =?UTF-8?B?6aas5YWL5rOh?=,
Quoted 2 lines · In message <CACCg+XM0r0z0Xm1C9zu9Zc4bJ+sX5b2Gv3w_v5eBjOVX9AsTbA@mail.gmail.com>…
I believe you must be exhausted for reviewing these patches again and again.
Not yet - actually I'm playing with doing such things in a mostly automated way.
Quoted 3 lines
However, we've discussed before, to support a new architecture, there are some definitions
and codes which the checkpatch rules cannot be adapted.
First, we can adapt chackpatch rules. It just needs to be done.
Quoted 2 lines
We've also discussed that Linux documents said checkpatch is just a reference rule,
I'dlike to see checkpatch customized for our needs. The tools to do that are in place now.
Quoted 1 line
you still need to have human examination.
Indeed.
Quoted 3 lines
I guess you just forget that because the patch "works" is too heavy and patch check
automation didn't help on special case much.
I manually inspected all output before actually sending any messages out.
Quoted 6 lines
When we discuss about those was about NDS32 patch v7, and now is patch v15. We've to a lot of fix, includes relocation.
So, could you please tell me now, should I resend the patch v16 or you still have my v15
patches and kindly tell me which part need to be fixed? Thanks!
There is a large number of WARNING: Use of volatile is usually wrong; I think you bit macros and I/O accessors should be cleaned up. I don;t want to see volatile there.
WARNING: line over 80 characters needs to be fixed, obviously.
Quoted 9 lines
The 8 errors is due to the new assembly
march.hadded. Only 2 new cases introduced.ERROR: space prohibited before open square bracket '[' #1032: FILE:
arch/nds32/include/asm/macro.h:66:
+ lwi $r5, [$r4]
This is to load a 32bit from the address x, while the value of address x is stored in $r4, and load it into $r5
Quoted 4 lines
ERROR: spaces required around that ':' (ctx:VxE)
#1055: FILE:arch/nds32/include/asm/macro.h:89:
+1:
^
I agree that we can ignore these (or rather try and add exception rules).
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "The number of Unix installations has grown to 10, with more expected." - The Unix Programmer's Manual, 2nd Edition, June, 1972
PATCH v15 1/9 nds32: add header files support for nds32
Dear Wolfgang,
2011/10/7 Wolfgang Denk <[email protected]>:
Quoted 6 lines
Dear =?UTF-8?B?6aas5YWL5rOh?=,
Quoted 3 lines
However, we've discussed before, to support a new architecture, there are some definitions
and codes which the checkpatch rules cannot be adapted.
Quoted 8 lines
First, we can adapt chackpatch rules. ?It just needs to be done.
Quoted 2 lines
We've also discussed that Linux documents said checkpatch is just a reference rule,
I'dlike to see checkpatch customized for our needs. ?The tools to do that are in place now.
Agreed.
Quoted 14 lines
Quoted 1 line
you still need to have human examination.
Indeed.
Quoted 3 lines
I guess you just forget that because the patch "works" is too heavy and patch check
automation didn't help on special case much.I manually inspected all output before actually sending any messages out.
Quoted 3 lines
When we discuss about those was about NDS32 patch v7, and now is patch v15. We've to a lot of fix, includes relocation.
Quoted 7 lines
Quoted 3 lines
So, could you please tell me now, should I resend the patch v16 or you still have my v15
patches and kindly tell me which part need to be fixed? Thanks!There is a large number of WARNING: Use of volatile is usually wrong; I think you bit macros and I/O accessors should be cleaned up. I don;t want to see volatile there.
About the volatiles and IO accessors, as said and we've discussed before according to "Documentation/volatile-considered-harmful.txt". There are still four kinds of volatiles are still
necessary. Let me copy the exceptions from "Documentation/volatile-considered-harmful.txt" as follows.
Please give comment on volatiles which are need and should not be get rid of these. Thanks!
"There are still a few rare situations where volatile makes sense in the kernel:
- The above-mentioned accessor functions might use volatile on architectures where direct I/O memory access does work. Essentially, each accessor call becomes a little critical section on its own and ensures that the access happens as expected by the programmer.
- Inline assembly code which changes memory, but which has no other visible side effects, risks being deleted by GCC. Adding the volatile keyword to asm statements will prevent this removal.
- The jiffies variable is special in that it can have a different value every time it is referenced, but it can be read without any special locking. So jiffies can be volatile, but the addition of other variables of this type is strongly frowned upon. Jiffies is considered to be a "stupid legacy" issue (Linus's words) in this regard; fixing it would be more trouble than it is worth.
- Pointers to data structures in coherent memory which might be modified by I/O devices can, sometimes, legitimately be volatile. A ring buffer used by a network adapter, where that adapter changes pointers to indicate which descriptors have been processed, is an example of this type of situation."
I think volatiles which like the following should be necessary according to the 4 exceptions listed in the document "Documentation/volatile-considered-harmful.txt".
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #124: FILE: arch/nds32/include/asm/bitops.h:31:
+extern void set_bit(int nr, volatile void *addr);
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #126: FILE: arch/nds32/include/asm/bitops.h:33:
+static inline void __set_bit(int nr, volatile void *addr)
WARNING: Use of volatile is usually wrong: seeDocumentation/volatile-considered-harmful.txt
#594: FILE: arch/nds32/include/asm/io.h:78:
+#define __arch_getw(a) (*(volatile unsigned short *)(a))
WARNING: Use of volatile is usually wrong: seeDocumentation/volatile-considered-harmful.txt
#142: FILE: examples/standalone/x86-testapp.c:86:
+ register volatile xxx_t *pq asm("$r16");
Quoted 2 lines
WARNING: line over 80 characters needs to be fixed, obviously.
Sorry about this, but the 80 characters formatting is for human reading. To fix some of the lines exceeds
80 characters made me feel the code has become less human readable. For example:
WARNING: line over 80 characters
#824: FILE: arch/nds32/include/asm/io.h:308:
+#define readw(c) ({ unsigned int __v = le16_to_cpu(__raw_readw(__mem_pci(c))); __v; })
WARNING: line over 80 characters
#932: FILE: arch/nds32/include/asm/arch-ag101/ag101.h:26:
+#define CONFIG_FTSMC020_BASE 0x90200000 /* Static
Memory Controller (SRAM) */
WARNING: line over 80 characters (Comment and offset for a SoC). #933: FILE: arch/nds32/include/asm/arch-ag101/ag101.h:27:
+#define CONFIG_FTSDMC021_BASE 0x90300000 /*
FTSDMC020/021 SDRAM Controller */
WARNING: line over 80 characters (to made this align with other architectures). #132: FILE: examples/standalone/x86-testapp.c:63:
+ : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void
*)) : "$r16");
I can do fix for these lines over 80 characters but I think the add-on codes might be less readable.
Quoted 21 lines
Quoted 9 lines
The 8 errors is due to the new assembly
march.hadded. Only 2 new cases introduced.ERROR: space prohibited before open square bracket '[' #1032: FILE:
arch/nds32/include/asm/macro.h:66:
+ ? ? ? lwi ? ? $r5, [$r4]
This is to load a 32bit from the address x, while the value of address x is stored in $r4, and load it into $r5Quoted 4 lines
ERROR: spaces required around that ':' (ctx:VxE)
#1055: FILE:arch/nds32/include/asm/macro.h:89:
+1:
? ^I agree that we can ignore these (or rather try and add exception rules).
Best regards,
Wolfgang Denk
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v15 1/9 nds32: add header files support for nds32
Dear =?UTF-8?B?6aas5YWL5rOh?=,
Quoted 10 lines · In message <CACCg+XMDNyxa5-rAdvj=oG8yhmFAkiD8OZzhZE+-ThFXcT6sfQ@mail.gmail.com>…
I think volatiles which like the following should be necessary according to the 4 exceptions listed in the document "
Documentation/volatile-considered-harmful.txt".WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt#124: FILE:arch/nds32/include/asm/bitops.h:31:
+extern voidset_bit(int nr, volatile void *addr);
Quoted 4 lines
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt#126: FILE:arch/nds32/include/asm/bitops.h:33:
+static inline void__set_bit(int nr, volatile void *addr)
If you look at the implementations of these functions, they need explicit casts to actually get rid of the "volatile" attribute. So why would there be any need to pass it in the first place?
Quoted 4 lines
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#594: FILE:arch/nds32/include/asm/io.h:78:
+#define__arch_getw(a)(*(volatile unsigned short *)(a))
I disagree with this code for several reasons.
First, it should be turned into a (inline) function, so the compiler can actually verify the type of the argument and make sure it is indeed a 16 bit pointer.
Second, please check and re-check if there is really no kind of memry barrier instruction needed here. And even if there is no such need, I tend belive that adding some __iormb(); similar to whay is done for example in "arch/arm/include/asm/io.h" would still be a good idea.
If the actual access goes through dereferencing a volatile pointer, this should be hidden at the lowest level of the implementation.
Quoted 4 lines
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#142: FILE:examples/standalone/x86-testapp.c:86:
+ register volatilexxx_t*pqasm("$r16");
I don;t know this code, so I cannot comment onthis.
Quoted 5 lines
Quoted 1 line
WARNING: line over 80 characters needs to be fixed, obviously.
Sorry about this, but the 80 characters formatting is for human reading. To fix some of the lines exceeds
80 characters made me feel the code has become less human readable.
If you don't fix it, then the text will wrap around in a completely uncontrolled way depending on the window width. This is even worse.
Quoted 5 lines
For example:
WARNING: line over 80 characters
#824: FILE:arch/nds32/include/asm/io.h:308:
+#define readw(c) ({ unsigned int__v=
le16_to_cpu(__raw_readw(__mem_pci(c)));__v; })
#define readw(c) ({ \
unsigned int __v \
\
__v = le16_to_cpu(__raw_readw(__mem_pci(c))) \
})Quoted 4 lines
WARNING: line over 80 characters
#932: FILE:arch/nds32/include/asm/arch-ag101/ag101.h:26:
+#defineCONFIG_FTSMC020_BASE0x90200000/* Static
Memory Controller (SRAM) */
/* Static Memory Controller (SRAM) */
#define CONFIG_FTSMC020_BASE 0x90200000
etc.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It's certainly convenient the way the crime (or condition) of
stupidity carries with it its own punishment, automatically
admisistered without remorse, pity, or prejudice. :-)
-- Tom Christiansen in <[email protected]>PATCH v15 1/9 nds32: add header files support for nds32
Hi Wolfgang,
2011/10/11 Wolfgang Denk <[email protected]>:
Quoted 13 lines
Dear =?UTF-8?B?6aas5YWL5rOh?=,
Quoted 10 lines · In message <CACCg+XMDNyxa5-rAdvj=oG8yhmFAkiD8OZzhZE+-ThFXcT6sfQ@mail.gmail.com>…
I think volatiles which like the following should be necessary according to the 4 exceptions listed in the document "
Documentation/volatile-considered-harmful.txt".WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt#124: FILE:arch/nds32/include/asm/bitops.h:31:
+extern voidset_bit(int nr, volatile void *addr);
Quoted 9 lines
Quoted 4 lines
WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt#126: FILE:arch/nds32/include/asm/bitops.h:33:
+static inline void__set_bit(int nr, volatile void *addr)If you look at the implementations of these functions, they need explicit casts to actually get rid of the "volatile" attribute. So why would there be any need to pass it in the first place?
[deleted]
Understood, will fix them in the next series of patches. Thanks.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v16 1/9 nds32: add header files support for nds32
In reply to Wolfgang DenkAdd generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
Changes for v10:
- macro.h: add writel and setbf macros
- u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
- config.h: add manual relocation support as default.
Changes for v11:
- unaligned.h: replace asm/unaligned.h with asm-generic/unaligned.h
Changes for v12:
- remove no used memory.h
- remove seldom used bi_env parameter
- u-boot-nds32.h:
- remove duplicate timer_init()
Changes for v13-v14:
- No change.
Changes for v15:
- u-boot.h: fix for new image.h according to Mike's contribution.
Changes for v16:
- asm/io.h:
- fix line over 80 characters.
- remove volatiles for __arch_getb
- asm/bitops.h: remove volatiles for inline __set_bit()
- asm/global_data.h: fix line over 80 characters.
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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 412 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 63 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1450 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/macro.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
@@ -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,void *addr); + +static inline void __set_bit (int nr,void *addr) +{ +int *a = (int *)addr; +int mask; + + a += nr >>5 ; + mask =1 << (nr &0x1f ); + *a |= mask; +} + +extern void clear_bit (int nr,void *addr); + +static inline void __clear_bit (int nr,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,void *addr); + +static inline void __change_bit (int nr,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,void *addr); + +static inline int __test_and_set_bit (int nr,void *addr) +{ +int mask, retval; +unsigned int *a = (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,void *addr); + +static inline int __test_and_clear_bit (int nr,void *addr) +{ +int mask, retval; +unsigned int *a = (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,void *addr); + +static inline int __test_and_change_bit (int nr,void *addr) +{ +int mask, retval; +unsigned int *a = (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
@@ -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 +28 -0
@@ -0,0 +1,28 @@ +/* +* 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_ + +#define CONFIG_NEEDS_MANUAL_RELOC + +#endif
arch/nds32/include/asm/global_data.h new file +89 -0
89 lines not on this page · raw message
arch/nds32/include/asm/io.h new file +412 -0
412 lines not on this page · raw message
arch/nds32/include/asm/mach-types.h new file +29 -0
@@ -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/macro.h new file +96 -0
96 lines not on this page · raw message
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
@@ -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 +51 -0
51 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 +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>
Signature · 1 line
1.7.3.5
PATCH v16 1/9 nds32: add header files support for nds32
Hi Wolfgang,
2011/10/12 Macpaul Lin <[email protected]>:
Quoted 4 lines
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>
Just wondering if you have comment to these patch v16.
I've fixed volatiles which complained by checkpatch.pl in v16. However, now I have to fix patch v16 to patch v17 because architecture Sandbox has
been add into mainline. And now I'm waiting for if Sandbox if they have more thing need
to be added in common/image.c.
Hope you can give comment for patch v16 hence I can to fix within patch v17.
Thanks!
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v16 1/9 nds32: add header files support for nds32
Hi,
Quoted 8 lines · ???
Hi Wolfgang,
2011/10/12 Macpaul Lin <[email protected]>:
Quoted 4 lines
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>
Quoted 7 lines
Just wondering if you have comment to these patch v16.
I've fixed volatiles which complained ?by checkpatch.pl in v16. However, now I have to fix patch v16 to patch v17 because architecture Sandbox has
been add into mainline. And now I'm waiting for if Sandbox if they have more thing need
to be added incommon/image.c.
No plans to do so at present - please go ahead.
Regards,
Simon
Quoted 9 lines
Hope you can give comment for patch v16 hence I can to fix within patch v17.
Thanks!
--
Best regards,
Macpaul Lin
PATCH v16 2/9 nds32: add NDS32 support into common header file
In reply to Wolfgang DenkAdd NDS32 support into common header file.
---
Changes for v1-v7:
- No change
Changes for v8:
- Fix the patch according to dependency of x86's Fix
Changes for v9-v16:
- No change
include/common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
@@ -302,6 +302,10 @@ int setenv (const char *, const char *);#ifdef CONFIG_X86 /* x86 version to be fixed! */ # include <asm/u-boot-x86.h> #endif /* CONFIG_X86 */ +#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
PATCH v16 3/9 nds32/core N1213: NDS32 N12 core family N1213
In reply to Wolfgang DenkAdd N1213 cpu core (N12 Core family) support for NDS32 arch. This patch includes start.S for the initialize procedure of N1213.
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.
---
Changes v1 to v6:
- Style clean up and reorganize code
Changes v7-v9:
- No Change.
Changes v10:
- start.S of N1213 CPU has been rewrote for relocation support.
- u-boot.lds:
- Add got and *(.got.plt) section for support GCC 4 toolchain
- Modified for relocation implementation.
Changes v11:
- arch/nds32/cpu/n1213/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes v12:
- u-boot.lds
- Remove the 0x00000000 base address in linker script.
The base address of the binary will be determined by CONFIG_SYS_TEXT_BASE
- Remove the CPU features in commit log and add to README in later patches.
Changes v13-v14:
- No change.
Changes v15:
- start.S: fix exception vector aligment (add setivb in reset vector).
Changes v16:
- start.S: remove lines over 80 characters.
arch/nds32/cpu/n1213/Makefile | 50 ++++ arch/nds32/cpu/n1213/start.S | 529 +++++++++++++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/u-boot.lds | 70 +++++ 3 files changed, 649 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
@@ -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) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/nds32/cpu/n1213/start.S new file +529 -0
529 lines not on this page · raw message
arch/nds32/cpu/n1213/u-boot.lds new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v16 4/9 nds32/ag101: cpu and init funcs of SoC ag101
In reply to Wolfgang DenkSoC ag101 is the first chip using NDS32 N1213 cpu core. Add header file of device offset support for SoC ag101. Add main function of SoC ag101 based on NDS32 n1213 core. Add lowlevel_init.S and other periphal related code.
This version of lowlevel_init.S also replace hardcode value by MARCO defines from the GPL version andesboot for better code quality.
---
Changes for v1-v4:
- Code clean up.
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().
- lowlevel_init.S
- 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.
Changes for v7:
- clean up.
Changes for v8-v9:
- No change.
Changes for v10:
- asm-offset.c: file added for ag101 use only.
- ag101/Makefile: add gen-asm-offset support to ag101 for lowlevel_init.S.
- Makefile: add gen-asm-offset support for NDS32 based core and SoCs.
- cpu.c: remove unused cpu_init().
- lowlevel_init.S
- Introduce SoC specific gen-asm-offset.h to lowlevel_init.S
- Replace routings by macros to made code much easier to understand.
- Add debug LED support.
- Add CONFIG_MEM_REMAP for those boards must do memort remapping.
Changes for v11:
- arch/nds32/cpu/n1213/ag101/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes for v12:
- Simplify the commit log about the part of lowlevel_init.S.
Changes for v13:
- arch/nds32/cpu/n1213/ag101/Makefile: remove unused gen-asm-offset.
- Makefile: remove unused gen-asm-offset because merged asm-offsets.
Changes for v14:
- lowlevel_init.S: fix include path of <generated/asm-offsets.h>
Changes for v15:
- fix sleep delay.
Changes for v16:
- arch/nds32/include/asm/arch-ag101/ag101.h: fix lines over 80 characters
- arch/nds32/cpu/n1213/ag101/lowlevel_init.S: fix lines over 80 characters
- arch/nds32/cpu/n1213/ag101/timer.c: fix line over 80 characters
arch/nds32/cpu/n1213/ag101/Makefile | 58 +++++++ arch/nds32/cpu/n1213/ag101/asm-offsets.c | 43 +++++ arch/nds32/cpu/n1213/ag101/cpu.c | 200 +++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/lowlevel_init.S | 238 ++++++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/timer.c | 205 ++++++++++++++++++++++++ arch/nds32/cpu/n1213/ag101/watchdog.S | 48 ++++++ arch/nds32/include/asm/arch-ag101/ag101.h | 103 ++++++++++++ 7 files changed, 895 insertions(+), 0 deletions(-) create mode 100644 arch/nds32/cpu/n1213/ag101/Makefile create mode 100644 arch/nds32/cpu/n1213/ag101/asm-offsets.c create mode 100644 arch/nds32/cpu/n1213/ag101/cpu.c create mode 100644 arch/nds32/cpu/n1213/ag101/lowlevel_init.S create mode 100644 arch/nds32/cpu/n1213/ag101/timer.c create mode 100644 arch/nds32/cpu/n1213/ag101/watchdog.S create mode 100644 arch/nds32/include/asm/arch-ag101/ag101.h
arch/nds32/cpu/n1213/ag101/Makefile new file +58 -0
@@ -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) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/nds32/cpu/n1213/ag101/asm-offsets.c new file +43 -0
43 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/cpu.c new file +200 -0
200 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/lowlevel_init.S new file +238 -0
238 lines not on this page · raw message
arch/nds32/cpu/n1213/ag101/timer.c new file +205 -0
205 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
arch/nds32/include/asm/arch-ag101/ag101.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v16 5/9 nds32/lib: add generic funcs in NDS32 lib
In reply to Wolfgang DenkAdd 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.
Changes for v9:
- support CONFIG_STANDALONE_LOAD_ADDR in config.mk
Changes for v10:
- config.mk:
- add -fpie flag.
- replace -ffixed-8 to -ffixed-10.
- add -mrelax and --gc-sections to LDFLAG
- board.c:
- fix lib/board.c for relocation.
- fix dram init for relocation.
Changes for v11:
- arch/nds32/lib/Makefile
- replace $(AR) $(call cmd_link_o_target,...)
Changes for v12:
- config.mk
- remove $(SRCTREE)/$(CPUDIR)/u-boot.lds
- board.c:
- remove obsolelte version_string.
- remove declaration "extern __bss_end" which is not need.
- replace sizeof(gd_t) and sizeof(bd_t) to GENERATED_GBL_DATA_SIZE and GENERATED_BD_INFO_SIZE
- add memset to board info (bd)
- remove compiler optimization barrier which is not need.
Changes for v13:
- board.c: remove unused CONFIG_IDENT_STRING.
- arch/nds32/lib/Makefile: remove unused clean and distclean.
Changes for v14:
- No change.
Changes for v15:
- lib/board.c:
- remove duplicate pci init
- drop NET_MULTI
Changes for v16:
- No changes.
arch/nds32/config.mk | 35 ++++ arch/nds32/lib/Makefile | 46 +++++ arch/nds32/lib/board.c | 439 +++++++++++++++++++++++++++++++++++++++++++ arch/nds32/lib/bootm.c | 241 ++++++++++++++++++++++++ arch/nds32/lib/interrupts.c | 129 +++++++++++++ 5 files changed, 890 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
@@ -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- + +CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T nds32.lds + +PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax +PLATFORM_RELFLAGS += -gdwarf-2 +PLATFORM_CPPFLAGS += -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-10 -fpie + +LDFLAGS_u-boot = --gc-sections --relax
arch/nds32/lib/Makefile new file +46 -0
46 lines not on this page · raw message
arch/nds32/lib/board.c new file +439 -0
439 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 +129 -0
129 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v16 6/9 nds32: standalone support
In reply to Wolfgang DenkAdd standalone program related support for nds32 architecture.
---
Changes for v1-v6:
- code clean up.
Changes for v7-v11:
- No change.
Changes for v12:
- clean up for linker script.
Changes for v13-v15:
- No change.
Changes for v16:
- x86-testapp.c: fix line over 80 characters.
examples/standalone/nds32.lds | 56 +++++++++++++++++++++++++++++++++++++ examples/standalone/stubs.c | 17 ++++++++++- examples/standalone/x86-testapp.c | 13 ++++++++ 3 files changed, 85 insertions(+), 1 deletions(-) create mode 100644 examples/standalone/nds32.lds
examples/standalone/nds32.lds new file +56 -0
@@ -0,0 +1,56 @@ +/* + * 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 +{ + . = ALIGN(4); + .text : + { + *(.text) + } + + . = 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 = .; +}
examples/standalone/stubs.c +16 -1
@@ -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 +13 -0
@@ -52,6 +52,17 @@ 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 +83,8 @@ int main(void) registervolatile xxx_t *pq asm("r8" );#elif defined(__mips__) registervolatile xxx_t *pq asm("k0" ); +#elif defined(__nds32__) + registervolatile xxx_t *pq asm("$r16" );#endif char buf[32 ];
Signature · 1 line
1.7.3.5
PATCH v16 7/9 nds32: common bdinfo, bootm, image support
In reply to Wolfgang DenkAdd support of NDS32 to common commands bdinfo, bootm, and image format.
---
Changes for v1-v6:
- Code clean up
Changes for v7-v9:
- No Change.
Changes for v10:
- fix up according to the changes in master tree.
Changes for v11:
- No Change.
Changes for v12:
- remove seldom used bi_env parameter.
Changes for v13-v14:
- No change.
Changes for v15:
- cmd_bootm.c and image.h
- Fix for new image.h according to Mike's Contribute.
Changes for v16:
- No change.
common/cmd_bdinfo.c | 25 +++++++++++++++++++++++++ common/image.c | 1 + include/image.h | 1 + 3 files changed, 27 insertions(+), 0 deletions(-)
common/cmd_bdinfo.c +25 -0
@@ -413,6 +413,31 @@ 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 ("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/image.c +1 -0
@@ -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 +1 -0
@@ -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
Signature · 1 line
1.7.3.5
PATCH v16 8/9 adp-ag101: add board adp-ag101 support
In reply to Wolfgang DenkAdd evaluation board "adp-ag101" configuration 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:
- clean up.
- Move CONFIG_SYS_TEXT_BASE from board/config.mk.
- Fix Makefile and remove config.mk
Changes for v8:
- No change.
Changes for v9:
- Fix because other boards has been added into boards.cfg and broken this patch.
Changes for v10:
- adp-ag101.h
- Fix lines over 80 characters.
- Fix for introducing gen-asm-offset.
- Add mmc support for FTSDC010 SD/MMC Controller.
- fix flash init.
- fix ftsmc010 configuraion for flash probing.
- Add SP_INIT related configurations for supporting relocation.
- Fix CONFIG_TEXT_BASE for relocation.
- Add CONFIG_MEM_REMAP for some hardware boards and non-OS application.
- adp-ag101.c
- Clean up for braces according to Wolfgang's suggestion.
- Add mmc support for FTSDC010 SD/MMC Controller.
- fix dram init(), made this more simpler.
Changes for v11:
- No change.
Changes for v12:
- adp-ag101.h
- fix address when enable CONFIG_SKIP_LOWLEVEL_INIT
Changes for v13:
- board/AndesTech/adp-ag101/Makefile: remove unused clean and distclean.
Changes for v14:
- No change.
Changes for v15:
- adp-ag101.h: drop NET_MULTI
- Makefile: clean up Makefile
Changes for v16:
- No change.
MAINTAINERS | 11 + MAKEALL | 6 + board/AndesTech/adp-ag101/Makefile | 44 ++++ board/AndesTech/adp-ag101/adp-ag101.c | 89 +++++++ boards.cfg | 1 + include/configs/adp-ag101.h | 406 +++++++++++++++++++++++++++++++++ 6 files changed, 557 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
@@ -1120,5 +1120,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
@@ -481,6 +481,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 +44 -0
44 lines not on this page · raw message
board/AndesTech/adp-ag101/adp-ag101.c new file +89 -0
89 lines not on this page · raw message
boards.cfg +1 -0
@@ -303,6 +303,7 @@ vct_platinumavc_small mips mips32 vct microna 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 nios2-generic nios2 nios2 nios2-generic altera +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 +406 -0
406 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v16 9/9 doc/README: documents and readme for NDS32 arch
In reply to Wolfgang DenkDocuments and READMEs for NDS32 architecture.
It patch also provides usage of SoC AG101 and board ADP-AG101.
---
Changes for v1-v10:
- The patch of documentation was not included.
Changes for v11:
- Add the documents of NDS32, ag101, N1213.
Changes for v12-v16:
- No change.
README | 24 ++++++++++++++-- doc/README.N1213 | 55 ++++++++++++++++++++++++++++++++++++ doc/README.NDS32 | 41 +++++++++++++++++++++++++++ doc/README.ag101 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ doc/README.standalone | 1 + 5 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 doc/README.N1213 create mode 100644 doc/README.NDS32 create mode 100644 doc/README.ag101
README +21 -3
@@ -182,6 +182,10 @@ Directory Hierarchy: /cpu CPU specific files /mips32 Files specific to MIPS32 CPUs /lib Architecture specific library files + /nds32 Files generic to NDS32 architecture + /cpu CPU specific files + /n1213 Files specific to Andes Technology N1213 CPUs + /lib Architecture specific library files /nios2 Files generic to Altera NIOS2 architecture /cpu CPU specific files /lib Architecture specific library files
@@ -3154,7 +3158,7 @@ Low Level (hardware related) configuration options: globally (CONFIG_CMD_MEM). - CONFIG_SKIP_LOWLEVEL_INIT - [ARM, MIPS only] If this variable is defined, then certain + [ARM, NDS32, MIPS only] If this variable is defined, then certain low level initializations (like setting up the memory controller) are omitted and/or U-Boot does not relocate itself into RAM.
@@ -3702,8 +3706,8 @@ details; basically, the header defines the following image properties: Currently supported: Linux, NetBSD, VxWorks, QNX, RTEMS, LynxOS, INTEGRITY). * Target CPU Architecture (Provisions for Alpha, ARM, AVR32, Intel x86, - IA64, MIPS, Nios II, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit; - Currently supported: ARM, AVR32, Intel x86, MIPS, Nios II, PowerPC). + IA64, MIPS, NDS32, Nios II, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit; + Currently supported: ARM, AVR32, Intel x86, MIPS, NDS32, Nios II, PowerPC). * Compression Type (uncompressed, gzip, bzip2) * Load Address * Entry Point
@@ -4396,6 +4400,20 @@ On Nios II, the ABI is documented here: Note: on Nios II, we give "-G0" option to gcc and don't use gp to access small data sections, so gp is free. +On NDS32, the following registers are used: + + R0-R1: argument/return + R2-R5: argument + R15: temporary register for assembler + R16: trampoline register + R28: frame pointer (FP) + R29: global pointer (GP) + R30: link register (LP) + R31: stack pointer (SP) + PC: program counter (PC) + + ==> U-Boot will use R10 to hold a pointer to the global data + NOTE: DECLARE_GLOBAL_DATA_PTR must be used with file-global scope, or current versions of GCC may "optimize" the code too much.
doc/README.N1213 new file +55 -0
55 lines not on this page · raw message
doc/README.NDS32 new file +41 -0
41 lines not on this page · raw message
doc/README.ag101 new file +74 -0
74 lines not on this page · raw message
doc/README.standalone +1 -0
@@ -56,6 +56,7 @@ Design Notes on Exporting U-Boot Functions to Standalone Applications: ARM 0x0c100000 0x0c100000 MIPS 0x80200000 0x80200000 Blackfin 0x00001000 0x00001000 + NDS32 0x00300000 0x00300000 Nios II 0x02000000 0x02000000 For example, the "hello world" application may be loaded and
Signature · 1 line
1.7.3.5
PATCH v17 1/9 nds32: add header files support for nds32
In reply to Wolfgang DenkAdd generic header files support for nds32 architecture. Cache, ptregs, 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
Changes for v9:
- No change.
Changes for v10:
- macro.h: add writel and setbf macros
- u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
- config.h: add manual relocation support as default.
Changes for v11:
- unaligned.h: replace asm/unaligned.h with asm-generic/unaligned.h
Changes for v12:
- remove no used memory.h
- remove seldom used bi_env parameter
- u-boot-nds32.h:
- remove duplicate timer_init()
Changes for v13-v14:
- No change.
Changes for v15:
- u-boot.h: fix for new image.h according to Mike's contribution.
Changes for v16:
- asm/io.h:
- fix line over 80 characters.
- remove volatiles for __arch_getb
- asm/bitops.h: remove volatiles for inline __set_bit()
- asm/global_data.h: fix line over 80 characters.
Changes for v17:
- No Change.
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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 412 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 63 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1450 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/macro.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
@@ -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,void *addr); + +static inline void __set_bit (int nr,void *addr) +{ +int *a = (int *)addr; +int mask; + + a += nr >>5 ; + mask =1 << (nr &0x1f ); + *a |= mask; +} + +extern void clear_bit (int nr,void *addr); + +static inline void __clear_bit (int nr,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,void *addr); + +static inline void __change_bit (int nr,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,void *addr); + +static inline int __test_and_set_bit (int nr,void *addr) +{ +int mask, retval; +unsigned int *a = (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,void *addr); + +static inline int __test_and_clear_bit (int nr,void *addr) +{ +int mask, retval; +unsigned int *a = (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,void *addr); + +static inline int __test_and_change_bit (int nr,void *addr) +{ +int mask, retval; +unsigned int *a = (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
@@ -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 +28 -0
@@ -0,0 +1,28 @@ +/* +* 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_ + +#define CONFIG_NEEDS_MANUAL_RELOC + +#endif
arch/nds32/include/asm/global_data.h new file +89 -0
89 lines not on this page · raw message
arch/nds32/include/asm/io.h new file +412 -0
412 lines not on this page · raw message
arch/nds32/include/asm/mach-types.h new file +29 -0
@@ -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/macro.h new file +96 -0
96 lines not on this page · raw message
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
@@ -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 +51 -0
51 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 +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/unaligned.h>
Signature · 1 line
1.7.3.5
Wolfgang Denk
AppliedPATCH v17 1/9 nds32: add header files support for nds32
Dear Macpaul Lin,
Quoted 81 lines · In message <[email protected]> you wrote:
Add generic header files support for nds32 architecture. Cache, ptregs, data type and other definitions are included.
Signed-off-by Macpaul Lin <[email protected]>---
Changes for v1-v4:
- Code cleanup and style formatting.
Changes for v5-v6:
- This patch also updated the following changes against thechange after master tree (v2010.12-rc1).- fix upper case definitions in
cache.h
- SupportGD_FLG_ENV_READYandenv_bufvars in nds32global_data.h.
- Add readsb, writesb functions intoio.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: removebd_info_extbi_ext
-bitops.h: add accessor function to bit operation with volatile var.
-system.h: addsystem.hforlocal_irqoperation with flag.
Changes for v8:
-ptrace.h: rewrite thept_regstructure, and mergeptregs.h.
-ptregs.h: removed
Changes for v9:
- No change.
Changes for v10:
-macro.h: add writel and setbf macros
-u-boot-nds32.h:
- Remove obsolete andesboot_* symbols for relocation.
- Add _bss_*_offset symbols for relocation.
-config.h: add manual relocation support as default.
Changes for v11:
-unaligned.h: replaceasm/unaligned.hwithasm-generic/unaligned.h
Changes for v12:
- remove no usedmemory.h
- remove seldom usedbi_envparameter
-u-boot-nds32.h:
- remove duplicatetimer_init()
Changes for v13-v14:
- No change.
Changes for v15:
-u-boot.h: fix for newimage.haccording to Mike's contribution.
Changes for v16:
-asm/io.h:
- fix line over 80 characters.
- remove volatiles for__arch_getb
-asm/bitops.h: remove volatiles for inline__set_bit()
-asm/global_data.h: fix line over 80 characters.
Changes for v17:
- No Change.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 | 28 +++ arch/nds32/include/asm/global_data.h | 89 +++++++ arch/nds32/include/asm/io.h | 412 +++++++++++++++++++++++++++++++++ arch/nds32/include/asm/mach-types.h | 29 +++ arch/nds32/include/asm/macro.h | 96 ++++++++ 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 | 51 ++++ arch/nds32/include/asm/u-boot.h | 63 +++++ arch/nds32/include/asm/unaligned.h | 1 + 17 files changed, 1450 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/macro.h create mode 100644 arch/nds32/include/asm/posix_types.h
Quoted 8 lines
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
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Open the pod bay doors, HAL." - Dave Bowman, 2001
PATCH v17 1/9 nds32: add header files support for nds32
Hi Wolfgang,
2011/10/22 Wolfgang Denk <[email protected]>:
Quoted 9 lines
Dear Macpaul Lin,
Quoted 1 line
Changes for v17:
Applied, thanks.
Best regards,
Wolfgang Denk
Great Thanks to Wolfgang, Mike, Po-Yu, Greentime, CM Chao and other people contributed to u-boot.
Signature · 2 lines
Best regards, Macpaul Lin
PATCH v17 2/9 nds32: add NDS32 support into common header file
In reply to Wolfgang DenkAdd NDS32 support into common header file.
---
Changes for v1-v7:
- No change
Changes for v8:
- Fix the patch according to dependency of x86's Fix
Changes for v9-v16:
- No change
Changes for v17:
- Fix for arch Sandbox has been committed.
include/common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/common.h +4 -0
@@ -314,6 +314,10 @@ int setenv (const char *, const char *);#ifdef CONFIG_SANDBOX # include <asm/u-boot-sandbox.h> /* TODO(sjg) what needs to be fixed? */ #endif +#ifdef CONFIG_NDS32 +# include <asm/mach-types.h> +# include <asm/u-boot-nds32.h> +#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