2 * Copyright (C) 2011 Andes Technology Corporation
3 * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
4 * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
6 * SPDX-License-Identifier: GPL-2.0+
16 #include <asm/macro.h>
17 #include <generated/asm-offsets.h>
20 * parameters for the SDRAM controller
22 #define SDMC_TP1_A (CONFIG_FTSDMC021_BASE + FTSDMC021_TP1)
23 #define SDMC_TP2_A (CONFIG_FTSDMC021_BASE + FTSDMC021_TP2)
24 #define SDMC_CR1_A (CONFIG_FTSDMC021_BASE + FTSDMC021_CR1)
25 #define SDMC_CR2_A (CONFIG_FTSDMC021_BASE + FTSDMC021_CR2)
26 #define SDMC_B0_BSR_A (CONFIG_FTSDMC021_BASE + FTSDMC021_BANK0_BSR)
27 #define SDMC_B1_BSR_A (CONFIG_FTSDMC021_BASE + FTSDMC021_BANK1_BSR)
29 #define SDMC_TP1_D CONFIG_SYS_FTSDMC021_TP1
30 #define SDMC_TP2_D CONFIG_SYS_FTSDMC021_TP2
31 #define SDMC_CR1_D CONFIG_SYS_FTSDMC021_CR1
32 #define SDMC_CR2_D CONFIG_SYS_FTSDMC021_CR2
34 #define SDMC_B0_BSR_D CONFIG_SYS_FTSDMC021_BANK0_BSR
35 #define SDMC_B1_BSR_D CONFIG_SYS_FTSDMC021_BANK1_BSR
39 * for Orca and Emerald
41 #define BOARD_ID_REG 0x104
42 #define BOARD_ID_FAMILY_MASK 0xfff000
43 #define BOARD_ID_FAMILY_V5 0x556000
44 #define BOARD_ID_FAMILY_K7 0x74b000
47 * parameters for the static memory controller
49 #define SMC_BANK0_CR_A (CONFIG_FTSMC020_BASE + FTSMC020_BANK0_CR)
50 #define SMC_BANK0_TPR_A (CONFIG_FTSMC020_BASE + FTSMC020_BANK0_TPR)
52 #define SMC_BANK0_CR_D FTSMC020_BANK0_LOWLV_CONFIG
53 #define SMC_BANK0_TPR_D FTSMC020_BANK0_LOWLV_TIMING
56 * for Orca and Emerald
58 #define AHBC_BSR4_A (CONFIG_FTAHBC020S_BASE + FTAHBC020S_SLAVE_BSR_4)
59 #define AHBC_BSR6_D CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6
62 * parameters for the pmu controoler
64 #define PMU_PDLLCR0_A (CONFIG_FTPMU010_BASE + FTPMU010_PDLLCR0)
67 * numeric 7 segment display
70 write32 CONFIG_DEBUG_LED, \num
74 * Waiting for SDRAM to set up
77 li $r0, CONFIG_FTSDMC021_BASE
79 lwi $r1, [$r0+FTSDMC021_CR2]
86 li $r0, SMC_BANK0_CR_A
98 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
104 #if (defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP))
114 #ifdef CONFIG_MEM_REMAP
119 lmw.bim $r12, [$r5], $r19
120 smw.bim $r12, [$r4], $r19
122 #endif /* #ifdef CONFIG_MEM_REMAP */
129 * Some of Andes CPU version support FPU coprocessor, if so,
130 * and toolchain support FPU instruction set, we should enable it.
132 #if (defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP))
134 mfsr $r0, $CPU_VER /* enable FPU if it exists */
137 beqz $r0, 1f /* skip if no COP */
138 mfsr $r0, $FUCOP_EXIST
140 beqz $r0, 1f /* skip if no FPU */
148 #endif /* #ifndef CONFIG_SKIP_LOWLEVEL_INIT */