From: Rick Chen <r...@andestech.com>

Andes has rearranged the product combinations.
nx25 and ax25 both are RISC-V architecture cpu core.
But ax25 has MMU unit inside, and nx25 is not.

Cpu nx25 and platform ae250 are arranged in pairs.
Cpu ax25 and platform ae350 are arranged in pairs.

This patch will rename
nx25 as ax25
ae250 as ae350
nx25-ae250 as ax25-ae350
including filename, variable, string and definition.

Then u-boot can boot linux kernel in ae350
platform reasonably.

Signed-off-by: Rick Chen <r...@andestech.com>
Signed-off-by: Rick Chen <rickche...@gmail.com>
Cc: Greentime Hu <green...@gmail.com>
---
 arch/riscv/Kconfig                  |   6 +-
 arch/riscv/cpu/ax25/Makefile        |  10 ++
 arch/riscv/cpu/ax25/cpu.c           |  33 ++++
 arch/riscv/cpu/ax25/start.S         | 293 ++++++++++++++++++++++++++++++++++++
 arch/riscv/cpu/ax25/u-boot.lds      |  85 +++++++++++
 arch/riscv/cpu/nx25/Makefile        |  10 --
 arch/riscv/cpu/nx25/cpu.c           |  33 ----
 arch/riscv/cpu/nx25/start.S         | 293 ------------------------------------
 arch/riscv/cpu/nx25/u-boot.lds      |  85 -----------
 arch/riscv/dts/Makefile             |   2 +-
 arch/riscv/dts/ae250.dts            |  97 ------------
 arch/riscv/dts/ae350.dts            |  97 ++++++++++++
 arch/riscv/include/asm/mach-types.h |  10 +-
 13 files changed, 527 insertions(+), 527 deletions(-)
 create mode 100644 arch/riscv/cpu/ax25/Makefile
 create mode 100644 arch/riscv/cpu/ax25/cpu.c
 create mode 100644 arch/riscv/cpu/ax25/start.S
 create mode 100644 arch/riscv/cpu/ax25/u-boot.lds
 delete mode 100644 arch/riscv/cpu/nx25/Makefile
 delete mode 100644 arch/riscv/cpu/nx25/cpu.c
 delete mode 100644 arch/riscv/cpu/nx25/start.S
 delete mode 100644 arch/riscv/cpu/nx25/u-boot.lds
 delete mode 100644 arch/riscv/dts/ae250.dts
 create mode 100644 arch/riscv/dts/ae350.dts

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c50be37..20a43d8 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -8,12 +8,12 @@ choice
        prompt "Target select"
        optional
 
-config TARGET_NX25_AE250
-       bool "Support nx25-ae250"
+config TARGET_AX25_AE350
+       bool "Support ax25-ae350"
 
 endchoice
 
-source "board/AndesTech/nx25-ae250/Kconfig"
+source "board/AndesTech/ax25-ae350/Kconfig"
 
 choice
        prompt "CPU selection"
diff --git a/arch/riscv/cpu/ax25/Makefile b/arch/riscv/cpu/ax25/Makefile
new file mode 100644
index 0000000..5fcf100
--- /dev/null
+++ b/arch/riscv/cpu/ax25/Makefile
@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2017 Andes Technology Corporation
+# Rick Chen, Andes Technology Corporation <r...@andestech.com>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+extra-y        = start.o
+
+obj-y  := cpu.o
diff --git a/arch/riscv/cpu/ax25/cpu.c b/arch/riscv/cpu/ax25/cpu.c
new file mode 100644
index 0000000..79bd2d2
--- /dev/null
+++ b/arch/riscv/cpu/ax25/cpu.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017 Andes Technology Corporation
+ * Rick Chen, Andes Technology Corporation <r...@andestech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+/* CPU specific code */
+#include <common.h>
+#include <command.h>
+#include <watchdog.h>
+#include <asm/cache.h>
+
+/*
+ * cleanup_before_linux() is called just before we call linux
+ * it prepares the processor for linux
+ *
+ * we disable interrupt and caches.
+ */
+int cleanup_before_linux(void)
+{
+       disable_interrupts();
+
+       /* turn off I/D-cache */
+
+       return 0;
+}
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       disable_interrupts();
+       panic("ax25-ae350 wdt not support yet.\n");
+}
diff --git a/arch/riscv/cpu/ax25/start.S b/arch/riscv/cpu/ax25/start.S
new file mode 100644
index 0000000..cd0a663
--- /dev/null
+++ b/arch/riscv/cpu/ax25/start.S
@@ -0,0 +1,293 @@
+/*
+ * Startup Code for RISC-V Core
+ *
+ * Copyright (c) 2017 Microsemi Corporation.
+ * Copyright (c) 2017 Padmarao Begari <padmarao.beg...@microsemi.com>
+ *
+ * Copyright (C) 2017 Andes Technology Corporation
+ * Rick Chen, Andes Technology Corporation <r...@andestech.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <asm-offsets.h>
+#include <config.h>
+#include <common.h>
+#include <elf.h>
+#include <asm/encoding.h>
+
+#ifdef CONFIG_32BIT
+#define LREG                   lw
+#define SREG                   sw
+#define REGBYTES               4
+#define RELOC_TYPE             R_RISCV_32
+#define SYM_INDEX              0x8
+#define SYM_SIZE               0x10
+#else
+#define LREG                   ld
+#define SREG                   sd
+#define REGBYTES               8
+#define RELOC_TYPE             R_RISCV_64
+#define SYM_INDEX              0x20
+#define SYM_SIZE               0x18
+#endif
+
+.section      .text
+.globl _start
+_start:
+       j handle_reset
+
+nmi_vector:
+       j nmi_vector
+
+trap_vector:
+       j trap_entry
+
+.global trap_entry
+handle_reset:
+       li t0, CONFIG_SYS_SDRAM_BASE
+       SREG a2, 0(t0)
+       la t0, trap_entry
+       csrw mtvec, t0
+       csrwi mstatus, 0
+       csrwi mie, 0
+
+/*
+ * Do CPU critical regs init only at reboot,
+ * not when booting from ram
+ */
+#ifdef CONFIG_INIT_CRITICAL
+       jal cpu_init_crit       /* Do CPU critical regs init */
+#endif
+
+/*
+ * Set stackpointer in internal/ex RAM to call board_init_f
+ */
+call_board_init_f:
+       li  t0, -16
+       li  t1, CONFIG_SYS_INIT_SP_ADDR
+       and sp, t1, t0  /* force 16 byte alignment */
+
+#ifdef CONFIG_DEBUG_UART
+       jal     debug_uart_init
+#endif
+
+call_board_init_f_0:
+       mv      a0, sp
+       jal     board_init_f_alloc_reserve
+       mv      sp, a0
+       jal     board_init_f_init_reserve
+
+       mv  a0, zero    /* a0 <-- boot_flags = 0 */
+       la t5, board_init_f
+       jr t5           /* jump to board_init_f() */
+
+/*
+ * void relocate_code (addr_sp, gd, addr_moni)
+ *
+ * This "function" does not return, instead it continues in RAM
+ * after relocating the monitor code.
+ *
+ */
+.globl relocate_code
+relocate_code:
+       mv  s2, a0      /* save addr_sp */
+       mv  s3, a1      /* save addr of gd */
+       mv  s4, a2      /* save addr of destination */
+
+/*
+ *Set up the stack
+ */
+stack_setup:
+       mv sp, s2
+       la t0, _start
+       sub t6, s4, t0  /* t6 <- relocation offset */
+       beq t0, s4, clear_bss   /* skip relocation */
+
+       mv t1, s4       /* t1 <- scratch for copy_loop */
+       la t3, __bss_start
+       sub t3, t3, t0  /* t3 <- __bss_start_ofs */
+       add t2, t0, t3  /* t2 <- source end address */
+
+copy_loop:
+       LREG t5, 0(t0)
+       addi t0, t0, REGBYTES
+       SREG t5, 0(t1)
+       addi t1, t1, REGBYTES
+       blt t0, t2, copy_loop
+
+/*
+ * Update dynamic relocations after board_init_f
+ */
+fix_rela_dyn:
+       la  t1, __rel_dyn_start
+       la  t2, __rel_dyn_end
+       beq t1, t2, clear_bss
+       add t1, t1, t6                  /* t1 <- rela_dyn_start in RAM */
+       add t2, t2, t6                  /* t2 <- rela_dyn_end in RAM */
+
+/*
+ * skip first reserved entry: address, type, addend
+ */
+       bne t1, t2, 7f
+
+6:
+       LREG  t5, -(REGBYTES*2)(t1)     /* t5 <-- relocation info:type */
+       li  t3, R_RISCV_RELATIVE        /* reloc type R_RISCV_RELATIVE */
+       bne t5, t3, 8f                  /* skip non-RISCV_RELOC entries */
+       LREG t3, -(REGBYTES*3)(t1)
+       LREG t5, -(REGBYTES)(t1)        /* t5 <-- addend */
+       add t5, t5, t6                  /* t5 <-- location to fix up in RAM */
+       add t3, t3, t6                  /* t3 <-- location to fix up in RAM */
+       SREG t5, 0(t3)
+7:
+       addi t1, t1, (REGBYTES*3)
+       ble t1, t2, 6b
+
+8:
+       la  t4, __dyn_sym_start
+       add t4, t4, t6
+
+9:
+       LREG  t5, -(REGBYTES*2)(t1)     /* t5 <-- relocation info:type */
+       srli t0, t5, SYM_INDEX          /* t0 <--- sym table index */
+       andi t5, t5, 0xFF               /* t5 <--- relocation type */
+       li  t3, RELOC_TYPE
+       bne t5, t3, 10f                 /* skip non-addned entries */
+
+       LREG t3, -(REGBYTES*3)(t1)
+       li t5, SYM_SIZE
+       mul t0, t0, t5
+       add s1, t4, t0
+       LREG t5, REGBYTES(s1)
+       add t5, t5, t6                  /* t5 <-- location to fix up in RAM */
+       add t3, t3, t6                  /* t3 <-- location to fix up in RAM */
+       SREG t5, 0(t3)
+10:
+       addi t1, t1, (REGBYTES*3)
+       ble t1, t2, 9b
+
+/*
+ * trap update
+*/
+       la t0, trap_entry
+       add t0, t0, t6
+       csrw mtvec, t0
+
+clear_bss:
+       la t0, __bss_start              /* t0 <- rel __bss_start in FLASH */
+       add t0, t0, t6                  /* t0 <- rel __bss_start in RAM */
+       la t1, __bss_end                /* t1 <- rel __bss_end in FLASH */
+       add t1, t1, t6                  /* t1 <- rel __bss_end in RAM */
+       li t2, 0x00000000               /* clear */
+       beq t0, t1, call_board_init_r
+
+clbss_l:
+       SREG t2, 0(t0)                  /* clear loop... */
+       addi t0, t0, REGBYTES
+       bne t0, t1, clbss_l
+
+/*
+ * We are done. Do not return, instead branch to second part of board
+ * initialization, now running from RAM.
+ */
+call_board_init_r:
+       la t0, board_init_r
+       mv t4, t0                       /* offset of board_init_r() */
+       add t4, t4, t6                  /* real address of board_init_r() */
+/*
+ * setup parameters for board_init_r
+ */
+       mv a0, s3                       /* gd_t */
+       mv a1, s4                       /* dest_addr */
+
+/*
+ * jump to it ...
+ */
+       jr t4                           /* jump to board_init_r() */
+
+/*
+ * trap entry
+ */
+trap_entry:
+       addi sp, sp, -32*REGBYTES
+       SREG x1, 1*REGBYTES(sp)
+       SREG x2, 2*REGBYTES(sp)
+       SREG x3, 3*REGBYTES(sp)
+       SREG x4, 4*REGBYTES(sp)
+       SREG x5, 5*REGBYTES(sp)
+       SREG x6, 6*REGBYTES(sp)
+       SREG x7, 7*REGBYTES(sp)
+       SREG x8, 8*REGBYTES(sp)
+       SREG x9, 9*REGBYTES(sp)
+       SREG x10, 10*REGBYTES(sp)
+       SREG x11, 11*REGBYTES(sp)
+       SREG x12, 12*REGBYTES(sp)
+       SREG x13, 13*REGBYTES(sp)
+       SREG x14, 14*REGBYTES(sp)
+       SREG x15, 15*REGBYTES(sp)
+       SREG x16, 16*REGBYTES(sp)
+       SREG x17, 17*REGBYTES(sp)
+       SREG x18, 18*REGBYTES(sp)
+       SREG x19, 19*REGBYTES(sp)
+       SREG x20, 20*REGBYTES(sp)
+       SREG x21, 21*REGBYTES(sp)
+       SREG x22, 22*REGBYTES(sp)
+       SREG x23, 23*REGBYTES(sp)
+       SREG x24, 24*REGBYTES(sp)
+       SREG x25, 25*REGBYTES(sp)
+       SREG x26, 26*REGBYTES(sp)
+       SREG x27, 27*REGBYTES(sp)
+       SREG x28, 28*REGBYTES(sp)
+       SREG x29, 29*REGBYTES(sp)
+       SREG x30, 30*REGBYTES(sp)
+       SREG x31, 31*REGBYTES(sp)
+       csrr a0, mcause
+       csrr a1, mepc
+       mv a2, sp
+       jal handle_trap
+       csrw mepc, a0
+
+/*
+ * Remain in M-mode after mret
+ */
+       li t0, MSTATUS_MPP
+       csrs mstatus, t0
+       LREG x1, 1*REGBYTES(sp)
+       LREG x2, 2*REGBYTES(sp)
+       LREG x3, 3*REGBYTES(sp)
+       LREG x4, 4*REGBYTES(sp)
+       LREG x5, 5*REGBYTES(sp)
+       LREG x6, 6*REGBYTES(sp)
+       LREG x7, 7*REGBYTES(sp)
+       LREG x8, 8*REGBYTES(sp)
+       LREG x9, 9*REGBYTES(sp)
+       LREG x10, 10*REGBYTES(sp)
+       LREG x11, 11*REGBYTES(sp)
+       LREG x12, 12*REGBYTES(sp)
+       LREG x13, 13*REGBYTES(sp)
+       LREG x14, 14*REGBYTES(sp)
+       LREG x15, 15*REGBYTES(sp)
+       LREG x16, 16*REGBYTES(sp)
+       LREG x17, 17*REGBYTES(sp)
+       LREG x18, 18*REGBYTES(sp)
+       LREG x19, 19*REGBYTES(sp)
+       LREG x20, 20*REGBYTES(sp)
+       LREG x21, 21*REGBYTES(sp)
+       LREG x22, 22*REGBYTES(sp)
+       LREG x23, 23*REGBYTES(sp)
+       LREG x24, 24*REGBYTES(sp)
+       LREG x25, 25*REGBYTES(sp)
+       LREG x26, 26*REGBYTES(sp)
+       LREG x27, 27*REGBYTES(sp)
+       LREG x28, 28*REGBYTES(sp)
+       LREG x29, 29*REGBYTES(sp)
+       LREG x30, 30*REGBYTES(sp)
+       LREG x31, 31*REGBYTES(sp)
+       addi sp, sp, 32*REGBYTES
+       mret
+
+#ifdef CONFIG_INIT_CRITICAL
+cpu_init_crit:
+    ret
+#endif
diff --git a/arch/riscv/cpu/ax25/u-boot.lds b/arch/riscv/cpu/ax25/u-boot.lds
new file mode 100644
index 0000000..1bbddde
--- /dev/null
+++ b/arch/riscv/cpu/ax25/u-boot.lds
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2017 Andes Technology Corporation
+ * Rick Chen, Andes Technology Corporation <r...@andestech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+OUTPUT_ARCH("riscv")
+ENTRY(_start)
+
+SECTIONS
+{
+       . = ALIGN(4);
+       .text :
+       {
+               arch/riscv/cpu/ax25/start.o     (.text)
+               *(.text)
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+       . = ALIGN(4);
+       .data : {
+               __global_pointer$ = . + 0x800;
+               *(.data*)
+       }
+       . = ALIGN(4);
+
+       .got : {
+          __got_start = .;
+          *(.got.plt) *(.got)
+          __got_end = .;
+    }
+
+       . = ALIGN(4);
+
+       .u_boot_list : {
+               KEEP(*(SORT(.u_boot_list*)));
+       }
+
+       . = ALIGN(4);
+
+       .efi_runtime : {
+                __efi_runtime_start = .;
+               *(efi_runtime_text)
+               *(efi_runtime_data)
+                __efi_runtime_stop = .;
+       }
+
+       .efi_runtime_rel : {
+                __efi_runtime_rel_start = .;
+               *(.relaefi_runtime_text)
+               *(.relaefi_runtime_data)
+                __efi_runtime_rel_stop = .;
+       }
+
+    . = ALIGN(4);
+
+    /DISCARD/ : { *(.rela.plt*) }
+    .rela.dyn : {
+        __rel_dyn_start = .;
+        *(.rela*)
+        __rel_dyn_end = .;
+    }
+
+    . = ALIGN(4);
+
+    .dynsym : {
+        __dyn_sym_start = .;
+        *(.dynsym)
+        __dyn_sym_end = .;
+    }
+
+    . = ALIGN(4);
+
+       _end = .;
+
+       .bss : {
+        __bss_start = .;
+        *(.bss)
+               . = ALIGN(4);
+               __bss_end = .;
+       }
+
+}
diff --git a/arch/riscv/cpu/nx25/Makefile b/arch/riscv/cpu/nx25/Makefile
deleted file mode 100644
index 5fcf100..0000000
--- a/arch/riscv/cpu/nx25/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Copyright (C) 2017 Andes Technology Corporation
-# Rick Chen, Andes Technology Corporation <r...@andestech.com>
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-extra-y        = start.o
-
-obj-y  := cpu.o
diff --git a/arch/riscv/cpu/nx25/cpu.c b/arch/riscv/cpu/nx25/cpu.c
deleted file mode 100644
index 5478f4f..0000000
--- a/arch/riscv/cpu/nx25/cpu.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2017 Andes Technology Corporation
- * Rick Chen, Andes Technology Corporation <r...@andestech.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/* CPU specific code */
-#include <common.h>
-#include <command.h>
-#include <watchdog.h>
-#include <asm/cache.h>
-
-/*
- * cleanup_before_linux() is called just before we call linux
- * it prepares the processor for linux
- *
- * we disable interrupt and caches.
- */
-int cleanup_before_linux(void)
-{
-       disable_interrupts();
-
-       /* turn off I/D-cache */
-
-       return 0;
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-       disable_interrupts();
-       panic("nx25-ae250 wdt not support yet.\n");
-}
diff --git a/arch/riscv/cpu/nx25/start.S b/arch/riscv/cpu/nx25/start.S
deleted file mode 100644
index cd0a663..0000000
--- a/arch/riscv/cpu/nx25/start.S
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Startup Code for RISC-V Core
- *
- * Copyright (c) 2017 Microsemi Corporation.
- * Copyright (c) 2017 Padmarao Begari <padmarao.beg...@microsemi.com>
- *
- * Copyright (C) 2017 Andes Technology Corporation
- * Rick Chen, Andes Technology Corporation <r...@andestech.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <asm-offsets.h>
-#include <config.h>
-#include <common.h>
-#include <elf.h>
-#include <asm/encoding.h>
-
-#ifdef CONFIG_32BIT
-#define LREG                   lw
-#define SREG                   sw
-#define REGBYTES               4
-#define RELOC_TYPE             R_RISCV_32
-#define SYM_INDEX              0x8
-#define SYM_SIZE               0x10
-#else
-#define LREG                   ld
-#define SREG                   sd
-#define REGBYTES               8
-#define RELOC_TYPE             R_RISCV_64
-#define SYM_INDEX              0x20
-#define SYM_SIZE               0x18
-#endif
-
-.section      .text
-.globl _start
-_start:
-       j handle_reset
-
-nmi_vector:
-       j nmi_vector
-
-trap_vector:
-       j trap_entry
-
-.global trap_entry
-handle_reset:
-       li t0, CONFIG_SYS_SDRAM_BASE
-       SREG a2, 0(t0)
-       la t0, trap_entry
-       csrw mtvec, t0
-       csrwi mstatus, 0
-       csrwi mie, 0
-
-/*
- * Do CPU critical regs init only at reboot,
- * not when booting from ram
- */
-#ifdef CONFIG_INIT_CRITICAL
-       jal cpu_init_crit       /* Do CPU critical regs init */
-#endif
-
-/*
- * Set stackpointer in internal/ex RAM to call board_init_f
- */
-call_board_init_f:
-       li  t0, -16
-       li  t1, CONFIG_SYS_INIT_SP_ADDR
-       and sp, t1, t0  /* force 16 byte alignment */
-
-#ifdef CONFIG_DEBUG_UART
-       jal     debug_uart_init
-#endif
-
-call_board_init_f_0:
-       mv      a0, sp
-       jal     board_init_f_alloc_reserve
-       mv      sp, a0
-       jal     board_init_f_init_reserve
-
-       mv  a0, zero    /* a0 <-- boot_flags = 0 */
-       la t5, board_init_f
-       jr t5           /* jump to board_init_f() */
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- */
-.globl relocate_code
-relocate_code:
-       mv  s2, a0      /* save addr_sp */
-       mv  s3, a1      /* save addr of gd */
-       mv  s4, a2      /* save addr of destination */
-
-/*
- *Set up the stack
- */
-stack_setup:
-       mv sp, s2
-       la t0, _start
-       sub t6, s4, t0  /* t6 <- relocation offset */
-       beq t0, s4, clear_bss   /* skip relocation */
-
-       mv t1, s4       /* t1 <- scratch for copy_loop */
-       la t3, __bss_start
-       sub t3, t3, t0  /* t3 <- __bss_start_ofs */
-       add t2, t0, t3  /* t2 <- source end address */
-
-copy_loop:
-       LREG t5, 0(t0)
-       addi t0, t0, REGBYTES
-       SREG t5, 0(t1)
-       addi t1, t1, REGBYTES
-       blt t0, t2, copy_loop
-
-/*
- * Update dynamic relocations after board_init_f
- */
-fix_rela_dyn:
-       la  t1, __rel_dyn_start
-       la  t2, __rel_dyn_end
-       beq t1, t2, clear_bss
-       add t1, t1, t6                  /* t1 <- rela_dyn_start in RAM */
-       add t2, t2, t6                  /* t2 <- rela_dyn_end in RAM */
-
-/*
- * skip first reserved entry: address, type, addend
- */
-       bne t1, t2, 7f
-
-6:
-       LREG  t5, -(REGBYTES*2)(t1)     /* t5 <-- relocation info:type */
-       li  t3, R_RISCV_RELATIVE        /* reloc type R_RISCV_RELATIVE */
-       bne t5, t3, 8f                  /* skip non-RISCV_RELOC entries */
-       LREG t3, -(REGBYTES*3)(t1)
-       LREG t5, -(REGBYTES)(t1)        /* t5 <-- addend */
-       add t5, t5, t6                  /* t5 <-- location to fix up in RAM */
-       add t3, t3, t6                  /* t3 <-- location to fix up in RAM */
-       SREG t5, 0(t3)
-7:
-       addi t1, t1, (REGBYTES*3)
-       ble t1, t2, 6b
-
-8:
-       la  t4, __dyn_sym_start
-       add t4, t4, t6
-
-9:
-       LREG  t5, -(REGBYTES*2)(t1)     /* t5 <-- relocation info:type */
-       srli t0, t5, SYM_INDEX          /* t0 <--- sym table index */
-       andi t5, t5, 0xFF               /* t5 <--- relocation type */
-       li  t3, RELOC_TYPE
-       bne t5, t3, 10f                 /* skip non-addned entries */
-
-       LREG t3, -(REGBYTES*3)(t1)
-       li t5, SYM_SIZE
-       mul t0, t0, t5
-       add s1, t4, t0
-       LREG t5, REGBYTES(s1)
-       add t5, t5, t6                  /* t5 <-- location to fix up in RAM */
-       add t3, t3, t6                  /* t3 <-- location to fix up in RAM */
-       SREG t5, 0(t3)
-10:
-       addi t1, t1, (REGBYTES*3)
-       ble t1, t2, 9b
-
-/*
- * trap update
-*/
-       la t0, trap_entry
-       add t0, t0, t6
-       csrw mtvec, t0
-
-clear_bss:
-       la t0, __bss_start              /* t0 <- rel __bss_start in FLASH */
-       add t0, t0, t6                  /* t0 <- rel __bss_start in RAM */
-       la t1, __bss_end                /* t1 <- rel __bss_end in FLASH */
-       add t1, t1, t6                  /* t1 <- rel __bss_end in RAM */
-       li t2, 0x00000000               /* clear */
-       beq t0, t1, call_board_init_r
-
-clbss_l:
-       SREG t2, 0(t0)                  /* clear loop... */
-       addi t0, t0, REGBYTES
-       bne t0, t1, clbss_l
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-call_board_init_r:
-       la t0, board_init_r
-       mv t4, t0                       /* offset of board_init_r() */
-       add t4, t4, t6                  /* real address of board_init_r() */
-/*
- * setup parameters for board_init_r
- */
-       mv a0, s3                       /* gd_t */
-       mv a1, s4                       /* dest_addr */
-
-/*
- * jump to it ...
- */
-       jr t4                           /* jump to board_init_r() */
-
-/*
- * trap entry
- */
-trap_entry:
-       addi sp, sp, -32*REGBYTES
-       SREG x1, 1*REGBYTES(sp)
-       SREG x2, 2*REGBYTES(sp)
-       SREG x3, 3*REGBYTES(sp)
-       SREG x4, 4*REGBYTES(sp)
-       SREG x5, 5*REGBYTES(sp)
-       SREG x6, 6*REGBYTES(sp)
-       SREG x7, 7*REGBYTES(sp)
-       SREG x8, 8*REGBYTES(sp)
-       SREG x9, 9*REGBYTES(sp)
-       SREG x10, 10*REGBYTES(sp)
-       SREG x11, 11*REGBYTES(sp)
-       SREG x12, 12*REGBYTES(sp)
-       SREG x13, 13*REGBYTES(sp)
-       SREG x14, 14*REGBYTES(sp)
-       SREG x15, 15*REGBYTES(sp)
-       SREG x16, 16*REGBYTES(sp)
-       SREG x17, 17*REGBYTES(sp)
-       SREG x18, 18*REGBYTES(sp)
-       SREG x19, 19*REGBYTES(sp)
-       SREG x20, 20*REGBYTES(sp)
-       SREG x21, 21*REGBYTES(sp)
-       SREG x22, 22*REGBYTES(sp)
-       SREG x23, 23*REGBYTES(sp)
-       SREG x24, 24*REGBYTES(sp)
-       SREG x25, 25*REGBYTES(sp)
-       SREG x26, 26*REGBYTES(sp)
-       SREG x27, 27*REGBYTES(sp)
-       SREG x28, 28*REGBYTES(sp)
-       SREG x29, 29*REGBYTES(sp)
-       SREG x30, 30*REGBYTES(sp)
-       SREG x31, 31*REGBYTES(sp)
-       csrr a0, mcause
-       csrr a1, mepc
-       mv a2, sp
-       jal handle_trap
-       csrw mepc, a0
-
-/*
- * Remain in M-mode after mret
- */
-       li t0, MSTATUS_MPP
-       csrs mstatus, t0
-       LREG x1, 1*REGBYTES(sp)
-       LREG x2, 2*REGBYTES(sp)
-       LREG x3, 3*REGBYTES(sp)
-       LREG x4, 4*REGBYTES(sp)
-       LREG x5, 5*REGBYTES(sp)
-       LREG x6, 6*REGBYTES(sp)
-       LREG x7, 7*REGBYTES(sp)
-       LREG x8, 8*REGBYTES(sp)
-       LREG x9, 9*REGBYTES(sp)
-       LREG x10, 10*REGBYTES(sp)
-       LREG x11, 11*REGBYTES(sp)
-       LREG x12, 12*REGBYTES(sp)
-       LREG x13, 13*REGBYTES(sp)
-       LREG x14, 14*REGBYTES(sp)
-       LREG x15, 15*REGBYTES(sp)
-       LREG x16, 16*REGBYTES(sp)
-       LREG x17, 17*REGBYTES(sp)
-       LREG x18, 18*REGBYTES(sp)
-       LREG x19, 19*REGBYTES(sp)
-       LREG x20, 20*REGBYTES(sp)
-       LREG x21, 21*REGBYTES(sp)
-       LREG x22, 22*REGBYTES(sp)
-       LREG x23, 23*REGBYTES(sp)
-       LREG x24, 24*REGBYTES(sp)
-       LREG x25, 25*REGBYTES(sp)
-       LREG x26, 26*REGBYTES(sp)
-       LREG x27, 27*REGBYTES(sp)
-       LREG x28, 28*REGBYTES(sp)
-       LREG x29, 29*REGBYTES(sp)
-       LREG x30, 30*REGBYTES(sp)
-       LREG x31, 31*REGBYTES(sp)
-       addi sp, sp, 32*REGBYTES
-       mret
-
-#ifdef CONFIG_INIT_CRITICAL
-cpu_init_crit:
-    ret
-#endif
diff --git a/arch/riscv/cpu/nx25/u-boot.lds b/arch/riscv/cpu/nx25/u-boot.lds
deleted file mode 100644
index 508fa7e..0000000
--- a/arch/riscv/cpu/nx25/u-boot.lds
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2017 Andes Technology Corporation
- * Rick Chen, Andes Technology Corporation <r...@andestech.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-OUTPUT_ARCH("riscv")
-ENTRY(_start)
-
-SECTIONS
-{
-       . = ALIGN(4);
-       .text :
-       {
-               arch/riscv/cpu/nx25/start.o     (.text)
-               *(.text)
-       }
-
-       . = ALIGN(4);
-       .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
-
-       . = ALIGN(4);
-       .data : {
-               __global_pointer$ = . + 0x800;
-               *(.data*)
-       }
-       . = ALIGN(4);
-
-       .got : {
-          __got_start = .;
-          *(.got.plt) *(.got)
-          __got_end = .;
-    }
-
-       . = ALIGN(4);
-
-       .u_boot_list : {
-               KEEP(*(SORT(.u_boot_list*)));
-       }
-
-       . = ALIGN(4);
-
-       .efi_runtime : {
-                __efi_runtime_start = .;
-               *(efi_runtime_text)
-               *(efi_runtime_data)
-                __efi_runtime_stop = .;
-       }
-
-       .efi_runtime_rel : {
-                __efi_runtime_rel_start = .;
-               *(.relaefi_runtime_text)
-               *(.relaefi_runtime_data)
-                __efi_runtime_rel_stop = .;
-       }
-
-    . = ALIGN(4);
-
-    /DISCARD/ : { *(.rela.plt*) }
-    .rela.dyn : {
-        __rel_dyn_start = .;
-        *(.rela*)
-        __rel_dyn_end = .;
-    }
-
-    . = ALIGN(4);
-
-    .dynsym : {
-        __dyn_sym_start = .;
-        *(.dynsym)
-        __dyn_sym_end = .;
-    }
-
-    . = ALIGN(4);
-
-       _end = .;
-
-       .bss : {
-        __bss_start = .;
-        *(.bss)
-               . = ALIGN(4);
-               __bss_end = .;
-       }
-
-}
diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile
index 718b99f..d42ca60 100644
--- a/arch/riscv/dts/Makefile
+++ b/arch/riscv/dts/Makefile
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-dtb-$(CONFIG_TARGET_NX25_AE250) += ae250.dtb
+dtb-$(CONFIG_TARGET_AX25_AE350) += ae350.dtb
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
diff --git a/arch/riscv/dts/ae250.dts b/arch/riscv/dts/ae250.dts
deleted file mode 100644
index 9a38345..0000000
--- a/arch/riscv/dts/ae250.dts
+++ /dev/null
@@ -1,97 +0,0 @@
-/dts-v1/;
-/ {
-       compatible = "riscv32 nx25";
-       #address-cells = <1>;
-       #size-cells = <1>;
-       interrupt-parent = <&intc>;
-
-       aliases {
-               uart0 = &serial0;
-               ethernet0 = &mac0;
-               spi0 = &spi;
-       } ;
-
-       chosen {
-               bootargs = "console=ttyS0,38400n8 
earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7";
-               stdout-path = "uart0:38400n8";
-               tick-timer = &timer0;
-       };
-
-       memory@0 {
-               device_type = "memory";
-               reg = <0x00000000 0x40000000>;
-       };
-
-       spiclk: virt_100mhz {
-               #clock-cells = <0>;
-               compatible = "fixed-clock";
-               clock-frequency = <100000000>;
-       };
-
-       cpus {
-               #address-cells = <1>;
-               #size-cells = <0>;
-               cpu@0 {
-                       compatible = "andestech,n13";
-                       reg = <0>;
-                       /* FIXME: to fill correct frqeuency */
-                       clock-frequency = <60000000>;
-               };
-       };
-
-       intc: interrupt-controller {
-               compatible = "andestech,atnointc010";
-               #interrupt-cells = <1>;
-               interrupt-controller;
-       };
-
-       serial0: serial@f0300000 {
-               compatible = "andestech,uart16550", "ns16550a";
-               reg = <0xf0300000 0x1000>;
-               interrupts = <7 4>;
-               clock-frequency = <19660800>;
-               reg-shift = <2>;
-               reg-offset = <32>;
-               no-loopback-test = <1>;
-       };
-
-       timer0: timer@f0400000 {
-               compatible = "andestech,atcpit100";
-               reg = <0xf0400000 0x1000>;
-               interrupts = <2 4>;
-               clock-frequency = <40000000>;
-       };
-
-       mac0: mac@e0100000 {
-               compatible = "andestech,atmac100";
-               reg = <0xe0100000 0x1000>;
-               interrupts = <25 4>;
-       };
-
-       mmc0: mmc@f0e00000 {
-               compatible = "andestech,atsdc010";
-               max-frequency = <100000000>;
-               fifo-depth = <0x10>;
-               reg = <0xf0e00000 0x1000>;
-               interrupts = <17 4>;
-               cap-sd-highspeed;
-       };
-
-       spi: spi@f0b00000 {
-               compatible = "andestech,atcspi200";
-               reg = <0xf0b00000 0x1000>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-               num-cs = <1>;
-               clocks = <&spiclk>;
-               interrupts = <3 4>;
-                       flash@0 {
-                       compatible = "spi-flash";
-                       spi-max-frequency = <50000000>;
-                       reg = <0>;
-                       spi-cpol;
-                       spi-cpha;
-               };
-       };
-
-};
diff --git a/arch/riscv/dts/ae350.dts b/arch/riscv/dts/ae350.dts
new file mode 100644
index 0000000..4bfb876
--- /dev/null
+++ b/arch/riscv/dts/ae350.dts
@@ -0,0 +1,97 @@
+/dts-v1/;
+/ {
+       compatible = "riscv32 ax25";
+       #address-cells = <1>;
+       #size-cells = <1>;
+       interrupt-parent = <&intc>;
+
+       aliases {
+               uart0 = &serial0;
+               ethernet0 = &mac0;
+               spi0 = &spi;
+       } ;
+
+       chosen {
+               bootargs = "console=ttyS0,38400n8 
earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7";
+               stdout-path = "uart0:38400n8";
+               tick-timer = &timer0;
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x00000000 0x40000000>;
+       };
+
+       spiclk: virt_100mhz {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <100000000>;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               cpu@0 {
+                       compatible = "andestech,n13";
+                       reg = <0>;
+                       /* FIXME: to fill correct frqeuency */
+                       clock-frequency = <60000000>;
+               };
+       };
+
+       intc: interrupt-controller {
+               compatible = "andestech,atnointc010";
+               #interrupt-cells = <1>;
+               interrupt-controller;
+       };
+
+       serial0: serial@f0300000 {
+               compatible = "andestech,uart16550", "ns16550a";
+               reg = <0xf0300000 0x1000>;
+               interrupts = <7 4>;
+               clock-frequency = <19660800>;
+               reg-shift = <2>;
+               reg-offset = <32>;
+               no-loopback-test = <1>;
+       };
+
+       timer0: timer@f0400000 {
+               compatible = "andestech,atcpit100";
+               reg = <0xf0400000 0x1000>;
+               interrupts = <2 4>;
+               clock-frequency = <40000000>;
+       };
+
+       mac0: mac@e0100000 {
+               compatible = "andestech,atmac100";
+               reg = <0xe0100000 0x1000>;
+               interrupts = <25 4>;
+       };
+
+       mmc0: mmc@f0e00000 {
+               compatible = "andestech,atsdc010";
+               max-frequency = <100000000>;
+               fifo-depth = <0x10>;
+               reg = <0xf0e00000 0x1000>;
+               interrupts = <17 4>;
+               cap-sd-highspeed;
+       };
+
+       spi: spi@f0b00000 {
+               compatible = "andestech,atcspi200";
+               reg = <0xf0b00000 0x1000>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               num-cs = <1>;
+               clocks = <&spiclk>;
+               interrupts = <3 4>;
+                       flash@0 {
+                       compatible = "spi-flash";
+                       spi-max-frequency = <50000000>;
+                       reg = <0>;
+                       spi-cpol;
+                       spi-cpha;
+               };
+       };
+
+};
diff --git a/arch/riscv/include/asm/mach-types.h 
b/arch/riscv/include/asm/mach-types.h
index f70b407..211d39a 100644
--- a/arch/riscv/include/asm/mach-types.h
+++ b/arch/riscv/include/asm/mach-types.h
@@ -13,18 +13,18 @@
 extern unsigned int __machine_arch_type;
 #endif
 
-#define MACH_TYPE_AE250                1
+#define MACH_TYPE_AE350                1
 
-#ifdef CONFIG_ARCH_AE250
+#ifdef CONFIG_ARCH_AE350
 # ifdef machine_arch_type
 #  undef machine_arch_type
 #  define machine_arch_type __machine_arch_type
 # else
-#  define machine_arch_type MACH_TYPE_AE250
+#  define machine_arch_type MACH_TYPE_AE350
 # endif
-# define machine_is_ae250() (machine_arch_type == MACH_TYPE_AE250)
+# define machine_is_ae350() (machine_arch_type == MACH_TYPE_AE350)
 #else
-# define machine_is_ae250() (1)
+# define machine_is_ae350() (1)
 #endif
 
 #endif /* __ASM_RISCV_MACH_TYPE_H */
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to