-
-
Save 987123879113/7209720cf35694d4cad8e8f177d57e82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* SPDX-License-Identifier: Apache-2.0 */ | |
#include <stdbool.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <types.h> | |
#include <log.h> | |
#include <common.h> | |
#include <mmu.h> | |
#include <cli.h> | |
#include <cli_shell.h> | |
#include <cli_termesc.h> | |
#include <sys-dram.h> | |
#include <sys-gpio.h> | |
#include <sys-i2c.h> | |
#include <sys-sdcard.h> | |
#include <sys-sid.h> | |
#include <sys-spi.h> | |
#include <sys-uart.h> | |
extern sunxi_serial_t uart_dbg; | |
extern sunxi_i2c_t i2c_pmu; | |
extern sunxi_sdhci_t sdhci2; | |
extern uint32_t dram_para[32]; | |
static uint32_t *offset_ptr = (uint32_t*)(0x40000 + 0x4a50); | |
static uint32_t *offset_ptr2 = (uint32_t*)(0x40000 + 0x4a54); | |
static uint8_t *read_buffer_start = (uint8_t*)(0x40000 + 0x4a50 + 0x9b0); | |
static uint8_t *read_buffer = (uint8_t*)(0x40000 + 0x4a50 + 0x9b4); | |
#define LOOP_CNT 16 | |
int cmd_read() { | |
if (*offset_ptr2 != 0x57357357) { | |
*offset_ptr2 = 0x57357357; | |
*offset_ptr = 0; | |
} | |
memset(read_buffer, 0x57, 512 * LOOP_CNT); | |
*read_buffer_start = *offset_ptr; | |
for (int i = 0; i < LOOP_CNT; i++) { | |
uint32_t cur_block = *offset_ptr; | |
sdmmc_blk_read(&card0, read_buffer + (512 * i), cur_block, 1); | |
cur_block++; | |
*offset_ptr = cur_block; | |
} | |
return 0; | |
} | |
int main(void) { | |
// sunxi_serial_init(&uart_dbg); | |
// show_banner(); | |
sunxi_clk_init(); | |
sunxi_clk_dump(); | |
sunxi_i2c_init(&i2c_pmu); | |
pmu_axp1530_init(&i2c_pmu); | |
enable_sram_a3(); | |
printk_info("DRAM: DRAM Size = %dMB\n", sunxi_dram_init(&dram_para)); | |
sunxi_clk_dump(); | |
/* Initialize the SD host controller. */ | |
if (sunxi_sdhci_init(&sdhci2) != 0) { | |
printk_error("SMHC: %s controller init failed\n", sdhci2.name); | |
} else { | |
printk_info("SMHC: %s controller initialized\n", sdhci2.name); | |
} | |
/* Initialize the SD card and check if initialization is successful. */ | |
if (sdmmc_init(&card0, &sdhci2) != 0) { | |
printk_warning("SMHC: init failed\n"); | |
} else { | |
printk_debug("Card OK!\n"); | |
} | |
cmd_read(); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/board/avaota-a1/board.c b/board/avaota-a1/board.c | |
index d7f8d5e..58db661 100644 | |
--- a/board/avaota-a1/board.c | |
+++ b/board/avaota-a1/board.c | |
@@ -155,17 +155,7 @@ const char *dram_para_name[2] = { | |
}; | |
void neon_enable(void) { | |
- /* set NSACR, both Secure and Non-secure access are allowed to NEON */ | |
- asm volatile("MRC p15, 0, r0, c1, c1, 2"); | |
- asm volatile("ORR r0, r0, #(0x3<<10) @ enable fpu/neon"); | |
- asm volatile("MCR p15, 0, r0, c1, c1, 2"); | |
- /* Set the CPACR for access to CP10 and CP11*/ | |
- asm volatile("LDR r0, =0xF00000"); | |
- asm volatile("MCR p15, 0, r0, c1, c0, 2"); | |
- /* Set the FPEXC EN bit to enable the FPU */ | |
- asm volatile("MOV r3, #0x40000000"); | |
- /*@VMSR FPEXC, r3*/ | |
- asm volatile("MCR p10, 7, r3, c8, c0, 0"); | |
+ return; | |
} | |
void gicr_set_waker(void) { | |
diff --git a/board/avaota-a1/start.S b/board/avaota-a1/start.S | |
index 32d1785..b000722 100644 | |
--- a/board/avaota-a1/start.S | |
+++ b/board/avaota-a1/start.S | |
@@ -59,7 +59,7 @@ | |
_start: | |
b reset | |
- | |
+ | |
.align 5 | |
_vector: | |
b reset | |
@@ -87,84 +87,18 @@ _fiq: | |
.word fiq | |
reset: | |
- /* Enter svc mode cleanly and mask interrupts */ | |
- mrs r0, cpsr | |
- bic r0, r0, #ARMV7_MODE_MASK | |
- orr r0, r0, #ARMV7_SVC_MODE | |
- orr r0, r0, #(ARMV7_IRQ_MASK | ARMV7_FIQ_MASK) | |
- bic r0, r0, #(1<<9) @set little-endian | |
- msr cpsr_c, r0 | |
- | |
- /* Set vector base address register */ | |
- ldr r0, =_vector | |
- mcr p15, 0, r0, c12, c0, 0 | |
- mrc p15, 0, r0, c1, c0, 0 | |
- bic r0, #(1 << 13) | |
- mcr p15, 0, r0, c1, c0, 0 | |
- | |
- mrc p15, 0, r0, c1, c0, 0 | |
- bic r0, r0, #0x00002000 @ clear bits 13 (--V-) | |
- bic r0, r0, #0x00000007 @ clear bits 2:0 (-CAM) | |
- orr r0, r0, #0x00000800 @ set bit 11 (Z---) BTB | |
- bic r0, r0, #0x00001000 @ clear bit 12 (I) I-cache | |
- mcr p15, 0, r0, c1, c0, 0 | |
- | |
- /* Set stack pointer */ | |
- /* Initialize UND stacks */ | |
- mrs r0, cpsr | |
- bic r0, r0, #ARMV7_MODE_MASK | |
- orr r1, r0, #ARMV7_UND_MODE | |
- msr cpsr_cxsf, r1 | |
- ldr sp, _stack_und_end | |
- | |
- /* Initialize ABT stacks */ | |
- mrs r0, cpsr | |
- bic r0, r0, #ARMV7_MODE_MASK | |
- orr r1, r0, #ARMV7_ABT_MODE | |
- msr cpsr_cxsf, r1 | |
- ldr sp, _stack_abt_end | |
- | |
- /* Initialize IRQ stacks */ | |
- mrs r0, cpsr | |
- bic r0, r0, #ARMV7_MODE_MASK | |
- orr r1, r0, #ARMV7_IRQ_MODE | |
- msr cpsr_cxsf, r1 | |
- ldr sp, _stack_irq_end | |
- | |
- /* Initialize FIQ stacks */ | |
- mrs r0, cpsr | |
- bic r0, r0, #ARMV7_MODE_MASK | |
- orr r1, r0, #ARMV7_FIQ_MODE | |
- msr cpsr_cxsf, r1 | |
- ldr sp, _stack_fiq_end | |
- | |
- /* Initialize SVC stacks */ | |
- mrs r0, cpsr | |
- bic r0, r0, #ARMV7_MODE_MASK | |
- orr r1, r0, #ARMV7_SVC_MODE | |
- msr cpsr_cxsf, r1 | |
- ldr sp, _stack_srv_end | |
+ push { lr } | |
bl clear_bss | |
- /* | |
- * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode, | |
- * except if in HYP mode already | |
- */ | |
- mrs r0, cpsr | |
- and r1, r0, #ARMV7_MODE_MASK @ mask mode bits | |
- teq r1, #0x1a @ test for HYP mode | |
- bicne r0, r0, #ARMV7_MODE_MASK @ clear all mode bits | |
- orrne r0, r0, #ARMV7_SVC_MODE @ set SVC mode | |
- orr r0, r0, #0xc0 @ disable FIQ and IRQ | |
- msr cpsr,r0 | |
- | |
bl set_timer_count | |
bl neon_enable | |
bl main | |
+ pop { pc } | |
+ | |
clear_bss: | |
ldr r0, =_sbss | |
ldr r1, =_ebss | |
diff --git a/cmake/board/avaota-a1.cmake b/cmake/board/avaota-a1.cmake | |
index aed12ec..c9dce7f 100644 | |
--- a/cmake/board/avaota-a1.cmake | |
+++ b/cmake/board/avaota-a1.cmake | |
@@ -31,7 +31,7 @@ set(CROSS_COMPILE ${CROSS_COMPILE} CACHE STRING "CROSS_COMPILE Toolchain") | |
set(CMAKE_C_COMPILER "${CROSS_COMPILE}gcc") | |
set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") | |
-set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -Os -march=armv8.2-a -mthumb-interwork -fno-common -ffunction-sections -fno-builtin -fno-stack-protector -ffreestanding -mthumb -mfpu=neon -mfloat-abi=softfp -pipe") | |
+set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -Os -march=armv8.2-a -mthumb-interwork -fno-common -ffunction-sections -fno-builtin -fno-stack-protector -ffreestanding -mthumb -mfloat-abi=softfp -pipe") | |
# Disable specific warning flags for C and C++ compilers | |
set(CMAKE_C_DISABLE_WARN_FLAGS "-Wno-int-to-pointer-cast -Wno-implicit-function-declaration -Wno-discarded-qualifiers") | |
diff --git a/include/log.h b/include/log.h | |
index af997ba..7f29a7a 100644 | |
--- a/include/log.h | |
+++ b/include/log.h | |
@@ -32,7 +32,7 @@ extern "C" { | |
#elif defined TRACE_MODE | |
#define LOG_LEVEL_DEFAULT LOG_LEVEL_TRACE | |
#else | |
-#define LOG_LEVEL_DEFAULT LOG_LEVEL_INFO | |
+#define LOG_LEVEL_DEFAULT LOG_LEVEL_MUTE | |
#endif// DEBUG_MODE | |
#endif// LOG_LEVEL_DEFAULT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/soc_info.c b/soc_info.c | |
index 264d5bc..3c36511 100644 | |
--- a/soc_info.c | |
+++ b/soc_info.c | |
@@ -618,6 +618,7 @@ soc_info_t soc_info_table[] = { | |
.sid_sections = generic_2k_sid_maps, | |
.rvbar_reg = 0x08000040, | |
.watchdog = &wd_a523_compat, | |
+ .icache_fix = true, | |
},{ | |
.swap_buffers = NULL /* End of the table */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment