SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Macros | Functions | Variables
sys-dram.c File Reference
#include <io.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <log.h>
#include <sys-clk.h>
#include <sys-dram.h>
#include <common.h>
Include dependency graph for sys-dram.c:

Macros

#define DIV_ROUND_UP(a, b)   (((a) + (b) -1) / (b))
 
#define CONFIG_SYS_SDRAM_BASE   SDRAM_BASE
 
#define SUNXI_SID_BASE   0x3006200
 

Functions

static int ns_to_t (dram_para_t *para, int nanoseconds)
 
static void dram_enable_all_master (void)
 
static void dram_disable_all_master (void)
 
static void eye_delay_compensation (dram_para_t *para)
 
static void mctl_set_timing_params (dram_para_t *para)
 
static int ccu_set_pll_ddr_clk (int index, dram_para_t *para)
 
static void mctl_sys_init (dram_para_t *para)
 
static void mctl_com_init (dram_para_t *para)
 
static void mctl_phy_ac_remapping (dram_para_t *para)
 
static uint32_t mctl_channel_init (uint32_t ch_index, dram_para_t *para)
 
static uint32_t calculate_rank_size (uint32_t regval)
 
static uint32_t dramc_get_dram_size (void)
 
static int dqs_gate_detect (dram_para_t *para)
 
static int dramc_simple_wr_test (uint32_t mem_mb, int len)
 
static void mctl_vrefzq_init (dram_para_t *para)
 
static int mctl_core_init (dram_para_t *para)
 
static int auto_scan_dram_size (dram_para_t *para)
 
static int auto_scan_dram_rank_width (dram_para_t *para)
 
static int auto_scan_dram_config (dram_para_t *para)
 
static int init_DRAM (int type, dram_para_t *para)
 
uint32_t sunxi_dram_init (void *para)
 Initialize the DRAM.
 

Variables

static const uint8_t ac_remapping_tables [][22]
 

Macro Definition Documentation

◆ CONFIG_SYS_SDRAM_BASE

#define CONFIG_SYS_SDRAM_BASE   SDRAM_BASE

◆ DIV_ROUND_UP

#define DIV_ROUND_UP (   a,
 
)    (((a) + (b) -1) / (b))

◆ SUNXI_SID_BASE

#define SUNXI_SID_BASE   0x3006200

Function Documentation

◆ auto_scan_dram_config()

static int auto_scan_dram_config ( dram_para_t para)
static

◆ auto_scan_dram_rank_width()

static int auto_scan_dram_rank_width ( dram_para_t para)
static

◆ auto_scan_dram_size()

static int auto_scan_dram_size ( dram_para_t para)
static

◆ calculate_rank_size()

static uint32_t calculate_rank_size ( uint32_t  regval)
static

◆ ccu_set_pll_ddr_clk()

static int ccu_set_pll_ddr_clk ( int  index,
dram_para_t para 
)
static

◆ dqs_gate_detect()

static int dqs_gate_detect ( dram_para_t para)
static

◆ dram_disable_all_master()

static void dram_disable_all_master ( void  )
static

◆ dram_enable_all_master()

static void dram_enable_all_master ( void  )
static

◆ dramc_get_dram_size()

static uint32_t dramc_get_dram_size ( void  )
static

◆ dramc_simple_wr_test()

static int dramc_simple_wr_test ( uint32_t  mem_mb,
int  len 
)
static

◆ eye_delay_compensation()

static void eye_delay_compensation ( dram_para_t para)
static

◆ init_DRAM()

static int init_DRAM ( int  type,
dram_para_t para 
)
static

◆ mctl_channel_init()

static uint32_t mctl_channel_init ( uint32_t  ch_index,
dram_para_t para 
)
static

◆ mctl_com_init()

static void mctl_com_init ( dram_para_t para)
static

◆ mctl_core_init()

static int mctl_core_init ( dram_para_t para)
static

◆ mctl_phy_ac_remapping()

static void mctl_phy_ac_remapping ( dram_para_t para)
static

◆ mctl_set_timing_params()

static void mctl_set_timing_params ( dram_para_t para)
static

◆ mctl_sys_init()

static void mctl_sys_init ( dram_para_t para)
static

◆ mctl_vrefzq_init()

static void mctl_vrefzq_init ( dram_para_t para)
static

◆ ns_to_t()

static int ns_to_t ( dram_para_t para,
int  nanoseconds 
)
static

◆ sunxi_dram_init()

uint32_t sunxi_dram_init ( void *  para)

Initialize the DRAM.

This function initializes the DRAM with the specified parameters. The initialization process may involve configuration of memory controllers and other hardware settings. The user must provide a pointer to a structure containing the necessary initialization parameters.

Parameters
paraA pointer to a structure containing the parameters needed for the initialization process.
Returns
A status code indicating the result of the initialization. Typically returns zero on success and a non-zero value on failure.

Initialize the DRAM.

This function initializes the DRAM using the provided parameters encapsulated in the dram_para_t structure. It calls the init_DRAM function to perform the actual initialization and returns the result.

Parameters
paraA pointer to the dram_para_t structure that contains DRAM initialization parameters. The function casts this void pointer to a dram_para_t pointer.
Returns
uint32_t Returns the result of the init_DRAM function call, which represents the size of the initialized DRAM in MB. A return value of 0 indicates failure.

Variable Documentation

◆ ac_remapping_tables

const uint8_t ac_remapping_tables[][22]
static
Initial value:
= {
[0] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
[1] = {0x5, 0x13, 0x4, 0xF, 0xC, 0x3, 0xD, 0xE, 0x1, 0xA, 0x16, 0x14, 0x11, 0x10, 0x6, 0x8, 0x7, 0x9, 0x15, 0x2, 0xB, 0x12},
[2] = {0x13, 0x4, 0x12, 0x2, 0x6, 0x3, 0x5, 0x7, 0xC, 0x8, 0xD, 0xA, 0x9, 0x0, 0x0, 0x0, 0x16, 0x1, 0xB, 0x11, 0x15, 0x14},
}