diff --git a/board/avaota-a1/init_dram/main.c b/board/avaota-a1/init_dram/main.c index dfa0d0a7..6e15b2ea 100644 --- a/board/avaota-a1/init_dram/main.c +++ b/board/avaota-a1/init_dram/main.c @@ -67,7 +67,7 @@ int main(void) { enable_sram_a3(); - uint32_t dram_size = sunxi_dram_init(&dram_para); + uint32_t dram_size = sunxi_dram_init(dram_para); arm32_mmu_enable(SDRAM_BASE, dram_size); printk_info("DRAM: DRAM Size = %dMB", dram_size); diff --git a/board/radxa-cubie-a7a/hello_world/main.c b/board/radxa-cubie-a7a/hello_world/main.c index 4e4404f1..a504ea32 100644 --- a/board/radxa-cubie-a7a/hello_world/main.c +++ b/board/radxa-cubie-a7a/hello_world/main.c @@ -8,6 +8,7 @@ #include #include +#include #include diff --git a/cmake/board/radxa-cubie-a7a.cmake b/cmake/board/radxa-cubie-a7a.cmake index 217ea862..22ccc254 100644 --- a/cmake/board/radxa-cubie-a7a.cmake +++ b/cmake/board/radxa-cubie-a7a.cmake @@ -17,13 +17,6 @@ add_definitions(-DCONFIG_CHIP_GPIO_V3) add_definitions(-DCONFIG_FATFS_CACHE_SIZE=0xFFFFFFF) add_definitions(-DCONFIG_FATFS_CACHE_ADDR=0x60000000) -set(CONFIG_USE_DRAM_PAYLOAD True) -set(CONFIG_USE_PREBUILT_DRAM_PAYLOAD True) -set(CONFIG_USE_DRAM_PAYLOAD_SOURCE_PATH "${CMAKE_SOURCE_DIR}/payloads/sun60iw2_libdram") -set(CONFIG_USE_DRAM_PAYLOAD_BIN_PATH "${CONFIG_USE_DRAM_PAYLOAD_SOURCE_PATH}/output/ddr.bin") -set(CONFIG_USE_DRAM_PAYLOAD_FILE_PATH "${CMAKE_SOURCE_DIR}/board/radxa-cubie-a7a/payloads/init_dram_bin.c") -set(CONFIG_USE_DRAM_PAYLOAD_SECTION "init_dram_bin") - # Set the cross-compile toolchain if(DEFINED ENV{LINARO_GCC_721_PATH}) file(TO_CMAKE_PATH $ENV{LINARO_GCC_721_PATH} LINARO_GCC_721_PATH) @@ -51,23 +44,3 @@ set(ARCH_BIN_SRAM_LENGTH "256K") set(ARCH_FEL_START_ADDRESS "0x00048c00") set(ARCH_FEL_SRAM_LENGTH "240K") - -if(NOT CONFIG_USE_PREBUILT_DRAM_PAYLOAD) - # Create an external project and build it - ExternalProject_Add( - init_dram - PREFIX init_dram - SOURCE_DIR "${CONFIG_USE_DRAM_PAYLOAD_SOURCE_PATH}" - INSTALL_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND make -C ${CONFIG_USE_DRAM_PAYLOAD_SOURCE_PATH} - BUILD_IN_SOURCE 1 - ) - - # Create inital init dram bin file for build - add_custom_command( - TARGET init_dram - POST_BUILD COMMAND ${CMAKE_BIN2ARRAY} ${CONFIG_USE_DRAM_PAYLOAD_BIN_PATH} ${CONFIG_USE_DRAM_PAYLOAD_FILE_PATH} ${CONFIG_USE_DRAM_PAYLOAD_SECTION} - COMMENT "Generate DRAM LIB Payload ${CONFIG_USE_DRAM_PAYLOAD_BIN_PATH} for ${CONFIG_USE_DRAM_PAYLOAD_FILE_PATH}" - ) -endif() diff --git a/include/drivers/sys-dram.h b/include/drivers/sys-dram.h index ca6654a4..224a0170 100644 --- a/include/drivers/sys-dram.h +++ b/include/drivers/sys-dram.h @@ -106,7 +106,7 @@ typedef struct { * * @return The size of the DRAM in bytes. */ -uint64_t sunxi_get_dram_size(); +uint32_t sunxi_get_dram_size(); /** * @brief Initialize the DRAM. diff --git a/src/drivers/chips/sun252iw1/sys-dram.c b/src/drivers/chips/sun252iw1/sys-dram.c index 59db326c..30e8f518 100644 --- a/src/drivers/chips/sun252iw1/sys-dram.c +++ b/src/drivers/chips/sun252iw1/sys-dram.c @@ -39,7 +39,7 @@ int set_ddr_voltage(unsigned int vol_val) { return 0; } -uint64_t sunxi_get_dram_size() { +uint32_t sunxi_get_dram_size() { return dram_size; } diff --git a/src/drivers/chips/sun55iw3/sys-dram.c b/src/drivers/chips/sun55iw3/sys-dram.c index 8e74b238..1ee849c1 100644 --- a/src/drivers/chips/sun55iw3/sys-dram.c +++ b/src/drivers/chips/sun55iw3/sys-dram.c @@ -26,7 +26,7 @@ int set_ddr_voltage(unsigned int vol_val) { return 0; } -uint64_t sunxi_get_dram_size() { +uint32_t sunxi_get_dram_size() { return dram_size; } diff --git a/src/drivers/chips/sun60iw2/sys-dram.c b/src/drivers/chips/sun60iw2/sys-dram.c index f4009ad0..0ceb6c56 100644 --- a/src/drivers/chips/sun60iw2/sys-dram.c +++ b/src/drivers/chips/sun60iw2/sys-dram.c @@ -20,6 +20,8 @@ extern sunxi_i2c_t i2c_pmu; +static uint32_t dram_size; + void sunxi_smc_en_with_glitch_workaround(void) { return; } @@ -30,6 +32,11 @@ int set_ddr_voltage_ext(char *name, int set_vol, int on) { return 0; } +uint32_t sunxi_get_dram_size() { + return dram_size; +} + uint32_t sunxi_dram_init(void *para) { - return 0; + dram_size = init_DRAM(0, para); + return dram_size; }