coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
sdram.c File Reference
#include <device/mmio.h>
#include <console/console.h>
#include <delay.h>
#include <soc/addressmap.h>
#include <soc/clock.h>
#include <soc/emc.h>
#include <soc/mc.h>
#include <soc/pmc.h>
#include <soc/sdram.h>
#include <symbols.h>
Include dependency graph for sdram.c:

Go to the source code of this file.

Functions

static void sdram_patch (uintptr_t addr, uint32_t value)
 
static void writebits (uint32_t value, uint32_t *addr, uint32_t mask)
 
static void sdram_configure_pmc (const struct sdram_params *param, struct tegra_pmc_regs *regs)
 
static void sdram_start_clocks (const struct sdram_params *param)
 
static void sdram_deassert_clock_enable_signal (const struct sdram_params *param, struct tegra_pmc_regs *regs)
 
static void sdram_deassert_sel_dpd (const struct sdram_params *param, struct tegra_pmc_regs *regs)
 
static void sdram_set_swizzle (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_set_pad_controls (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_trigger_emc_timing_update (struct tegra_emc_regs *regs)
 
static void sdram_init_mc (const struct sdram_params *param, struct tegra_mc_regs *regs)
 
static void sdram_init_emc (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_set_emc_timing (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_patch_bootrom (const struct sdram_params *param, struct tegra_mc_regs *regs)
 
static void sdram_set_dpd3 (const struct sdram_params *param, struct tegra_pmc_regs *regs)
 
static void sdram_set_dli_trims (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_set_clock_enable_signal (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_init_zq_calibration (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_set_zq_calibration (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_set_refresh (const struct sdram_params *param, struct tegra_emc_regs *regs)
 
static void sdram_enable_arbiter (const struct sdram_params *param)
 
static void sdram_lock_carveouts (const struct sdram_params *param, struct tegra_mc_regs *regs)
 
void sdram_init (const struct sdram_params *param)
 
uint32_t sdram_get_ram_code (void)
 
int sdram_size_mb (void)
 
uintptr_t sdram_max_addressable_mb (void)
 

Function Documentation

◆ sdram_configure_pmc()

◆ sdram_deassert_clock_enable_signal()

static void sdram_deassert_clock_enable_signal ( const struct sdram_params param,
struct tegra_pmc_regs regs 
)
static

Definition at line 62 of file sdram.c.

References clrbits32, PMC_POR_DPD_CTRL_MEM0_HOLD_CKE_LOW_OVR_MASK, sdram_params::PmcPorDpdCtrlWait, and udelay().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_deassert_sel_dpd()

static void sdram_deassert_sel_dpd ( const struct sdram_params param,
struct tegra_pmc_regs regs 
)
static

Definition at line 70 of file sdram.c.

References clrbits32, PMC_POR_DPD_CTRL_MEM0_ADDR0_CLK_SEL_DPD_MASK, PMC_POR_DPD_CTRL_MEM0_ADDR1_CLK_SEL_DPD_MASK, and udelay().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_enable_arbiter()

static void sdram_enable_arbiter ( const struct sdram_params param)
static

Definition at line 531 of file sdram.c.

References sdram_params::AhbArbitrationXbarCtrlMemInitDone, and setbits32.

Referenced by sdram_init().

Here is the caller graph for this function:

◆ sdram_get_ram_code()

uint32_t sdram_get_ram_code ( void  )

Definition at line 601 of file sdram.c.

◆ sdram_init()

void sdram_init ( const struct sdram_params param)

Definition at line 552 of file sdram.c.

◆ sdram_init_emc()

static void sdram_init_emc ( const struct sdram_params param,
struct tegra_emc_regs regs 
)
static

Definition at line 217 of file sdram.c.

References sdram_params::EmcAdrCfg, sdram_params::EmcAutoCalConfig, sdram_params::EmcAutoCalConfig2, sdram_params::EmcAutoCalConfig3, sdram_params::EmcAutoCalInterval, sdram_params::EmcAutoCalWait, sdram_params::EmcClkenOverride, udelay(), and write32().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_init_mc()

static void sdram_init_mc ( const struct sdram_params param,
struct tegra_mc_regs regs 
)
static

Definition at line 136 of file sdram.c.

References MC_TIMING_CONTROL_TIMING_UPDATE, sdram_params::McClkenOverride, sdram_params::McDisExtraSnapLevels, sdram_params::McDisplaySnapRing, sdram_params::McEmemAdrCfg, sdram_params::McEmemAdrCfgBankMask0, sdram_params::McEmemAdrCfgBankMask1, sdram_params::McEmemAdrCfgBankMask2, sdram_params::McEmemAdrCfgBankSwizzle3, sdram_params::McEmemAdrCfgDev0, sdram_params::McEmemAdrCfgDev1, sdram_params::McEmemArbCfg, sdram_params::McEmemArbDaCovers, sdram_params::McEmemArbDaTurns, sdram_params::McEmemArbMisc0, sdram_params::McEmemArbMisc1, sdram_params::McEmemArbOutstandingReq, sdram_params::McEmemArbOverride, sdram_params::McEmemArbOverride1, sdram_params::McEmemArbRing1Throttle, sdram_params::McEmemArbRsv, sdram_params::McEmemArbTimingFaw, sdram_params::McEmemArbTimingR2R, sdram_params::McEmemArbTimingR2W, sdram_params::McEmemArbTimingRap2Pre, sdram_params::McEmemArbTimingRas, sdram_params::McEmemArbTimingRc, sdram_params::McEmemArbTimingRcd, sdram_params::McEmemArbTimingRp, sdram_params::McEmemArbTimingRrd, sdram_params::McEmemArbTimingW2R, sdram_params::McEmemArbTimingW2W, sdram_params::McEmemArbTimingWap2Pre, sdram_params::McEmemCfg, sdram_params::McMtsCarveoutAdrHi, sdram_params::McMtsCarveoutBom, sdram_params::McMtsCarveoutSizeMb, sdram_params::McSecCarveoutAdrHi, sdram_params::McSecCarveoutBom, sdram_params::McSecCarveoutSizeMb, sdram_params::McStatControl, sdram_params::McVideoProtectBom, sdram_params::McVideoProtectBomAdrHi, sdram_params::McVideoProtectGpuOverride0, sdram_params::McVideoProtectGpuOverride1, sdram_params::McVideoProtectSizeMb, sdram_params::McVideoProtectVprOverride, sdram_params::McVideoProtectVprOverride1, and write32().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_init_zq_calibration()

static void sdram_init_zq_calibration ( const struct sdram_params param,
struct tegra_emc_regs regs 
)
static

Definition at line 475 of file sdram.c.

References EMC_ZCAL_WARM_COLD_BOOT_ENABLES_COLDBOOT_MASK, sdram_params::EmcDevSelect, sdram_params::EmcZcalInitDev0, sdram_params::EmcZcalInitDev1, sdram_params::EmcZcalInitWait, sdram_params::EmcZcalWarmColdBootEnables, udelay(), and write32().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_lock_carveouts()

static void sdram_lock_carveouts ( const struct sdram_params param,
struct tegra_mc_regs regs 
)
static

Definition at line 539 of file sdram.c.

References MC_EMEM_CFG_ACCESS_CTRL_WRITE_ACCESS_DISABLED, sdram_params::McMtsCarveoutRegCtrl, sdram_params::McSecCarveoutProtectWriteAccess, sdram_params::McVideoProtectWriteAccess, and write32().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_max_addressable_mb()

uintptr_t sdram_max_addressable_mb ( void  )

Definition at line 630 of file sdram.c.

References _dram, MiB, MIN, and sdram_size_mb().

Referenced by cbmem_top_chipset(), fb_base_mb(), romstage(), and soc_read_resources().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_patch()

static void sdram_patch ( uintptr_t  addr,
uint32_t  value 
)
static

Definition at line 14 of file sdram.c.

References addr, value, and write32().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_patch_bootrom()

static void sdram_patch_bootrom ( const struct sdram_params param,
struct tegra_mc_regs regs 
)
static

Definition at line 372 of file sdram.c.

References addr, BOOT_ROM_PATCH_CONTROL_BASE_ADDRESS, BOOT_ROM_PATCH_CONTROL_ENABLE_MASK, BOOT_ROM_PATCH_CONTROL_OFFSET_MASK, BOOT_ROM_PATCH_CONTROL_OFFSET_SHIFT, sdram_params::BootRomPatchControl, sdram_params::BootRomPatchData, and write32().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_set_clock_enable_signal()

◆ sdram_set_dli_trims()

◆ sdram_set_dpd3()

static void sdram_set_dpd3 ( const struct sdram_params param,
struct tegra_pmc_regs regs 
)
static

Definition at line 385 of file sdram.c.

References sdram_params::PmcIoDpd3Req, sdram_params::PmcIoDpd3ReqWait, udelay(), and write32().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_set_emc_timing()

static void sdram_set_emc_timing ( const struct sdram_params param,
struct tegra_emc_regs regs 
)
static

Definition at line 234 of file sdram.c.

References EMC_CFG_EMC2PMACRO_CFG_BYPASS_ADDRPIPE_MASK, EMC_CFG_EMC2PMACRO_CFG_BYPASS_DATAPIPE1_MASK, EMC_CFG_EMC2PMACRO_CFG_BYPASS_DATAPIPE2_MASK, sdram_params::EmcAcpdControl, sdram_params::EmcAct2Pden, sdram_params::EmcAr2Pden, sdram_params::EmcBgbiasCtl0, sdram_params::EmcBurstRefreshNum, sdram_params::EmcCdbCntl1, sdram_params::EmcCdbCntl2, sdram_params::EmcCdbCntl3, sdram_params::EmcCfg, sdram_params::EmcCfg2, sdram_params::EmcCfgDigDll, sdram_params::EmcCfgDigDllPeriod, sdram_params::EmcCfgPipe, sdram_params::EmcCfgRsv, sdram_params::EmcCmdQ, sdram_params::EmcCtt, sdram_params::EmcCttDuration, sdram_params::EmcDbg, sdram_params::EmcDllXformAddr0, sdram_params::EmcDllXformAddr1, sdram_params::EmcDllXformAddr2, sdram_params::EmcDllXformAddr3, sdram_params::EmcDllXformAddr4, sdram_params::EmcDllXformAddr5, sdram_params::EmcDllXformDq0, sdram_params::EmcDllXformDq1, sdram_params::EmcDllXformDq2, sdram_params::EmcDllXformDq3, sdram_params::EmcDllXformDq4, sdram_params::EmcDllXformDq5, sdram_params::EmcDllXformDq6, sdram_params::EmcDllXformDq7, sdram_params::EmcDllXformDqs0, sdram_params::EmcDllXformDqs1, sdram_params::EmcDllXformDqs10, sdram_params::EmcDllXformDqs11, sdram_params::EmcDllXformDqs12, sdram_params::EmcDllXformDqs13, sdram_params::EmcDllXformDqs14, sdram_params::EmcDllXformDqs15, sdram_params::EmcDllXformDqs2, sdram_params::EmcDllXformDqs3, sdram_params::EmcDllXformDqs4, sdram_params::EmcDllXformDqs5, sdram_params::EmcDllXformDqs6, sdram_params::EmcDllXformDqs7, sdram_params::EmcDllXformDqs8, sdram_params::EmcDllXformDqs9, sdram_params::EmcDllXformQUse0, sdram_params::EmcDllXformQUse1, sdram_params::EmcDllXformQUse10, sdram_params::EmcDllXformQUse11, sdram_params::EmcDllXformQUse12, sdram_params::EmcDllXformQUse13, sdram_params::EmcDllXformQUse14, sdram_params::EmcDllXformQUse15, sdram_params::EmcDllXformQUse2, sdram_params::EmcDllXformQUse3, sdram_params::EmcDllXformQUse4, sdram_params::EmcDllXformQUse5, sdram_params::EmcDllXformQUse6, sdram_params::EmcDllXformQUse7, sdram_params::EmcDllXformQUse8, sdram_params::EmcDllXformQUse9, sdram_params::EmcDsrVttgenDrv, sdram_params::EmcEInput, sdram_params::EmcEInputDuration, sdram_params::EmcFbioCfg5, sdram_params::EmcFbioCfg6, sdram_params::EmcFbioSpare, sdram_params::EmcIbdly, sdram_params::EmcMc2EmcQ, sdram_params::EmcMrsWaitCnt, sdram_params::EmcMrsWaitCnt2, sdram_params::EmcOdtRead, sdram_params::EmcOdtWrite, sdram_params::EmcPChg2Pden, sdram_params::EmcPdEx2Rd, sdram_params::EmcPdEx2Wr, sdram_params::EmcPreRefreshReqCnt, sdram_params::EmcPutermAdj, sdram_params::EmcPutermExtra, sdram_params::EmcPutermWidth, sdram_params::EmcQpop, sdram_params::EmcQRst, sdram_params::EmcQSafe, sdram_params::EmcQUse, sdram_params::EmcQuseWidth, sdram_params::EmcR2p, sdram_params::EmcR2r, sdram_params::EmcR2w, sdram_params::EmcRas, sdram_params::EmcRc, sdram_params::EmcRdRcd, sdram_params::EmcRdv, sdram_params::EmcRdvMask, sdram_params::EmcRefresh, sdram_params::EmcRext, sdram_params::EmcRfc, sdram_params::EmcRfcSlr, sdram_params::EmcRp, sdram_params::EmcRrd, sdram_params::EmcRw2Pden, sdram_params::EmcTcke, sdram_params::EmcTckesr, sdram_params::EmcTClkStable, sdram_params::EmcTClkStop, sdram_params::EmcTfaw, sdram_params::EmcTpd, sdram_params::EmcTRefBw, sdram_params::EmcTrpab, sdram_params::EmcTxdsrvttgen, sdram_params::EmcTxsr, sdram_params::EmcTxsrDll, sdram_params::EmcW2p, sdram_params::EmcW2r, sdram_params::EmcW2w, sdram_params::EmcWdv, sdram_params::EmcWdvMask, sdram_params::EmcWext, sdram_params::EmcWrRcd, write32(), and writebits().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_set_pad_controls()

◆ sdram_set_refresh()

◆ sdram_set_swizzle()

◆ sdram_set_zq_calibration()

static void sdram_set_zq_calibration ( const struct sdram_params param,
struct tegra_emc_regs regs 
)
static

Definition at line 493 of file sdram.c.

References sdram_params::EmcZcalInterval, sdram_params::EmcZcalMrwCmd, sdram_params::EmcZcalWaitCnt, and write32().

Referenced by sdram_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdram_size_mb()

int sdram_size_mb ( void  )

Definition at line 610 of file sdram.c.

References BIOS_DEBUG, tegra_mc_regs::emem_cfg, MC_EMEM_CFG_SIZE_MB_MASK, MC_EMEM_CFG_SIZE_MB_SHIFT, printk, read32(), and TEGRA_MC_BASE.

Here is the call graph for this function:

◆ sdram_start_clocks()

◆ sdram_trigger_emc_timing_update()

static void sdram_trigger_emc_timing_update ( struct tegra_emc_regs regs)
static

Definition at line 131 of file sdram.c.

References EMC_TIMING_CONTROL_TIMING_UPDATE, and write32().

Referenced by sdram_init(), sdram_set_dli_trims(), and sdram_set_refresh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writebits()

static void writebits ( uint32_t  value,
uint32_t addr,
uint32_t  mask 
)
static

Definition at line 20 of file sdram.c.

References addr, clrsetbits32, mask, and value.

Referenced by sdram_configure_pmc(), sdram_set_clock_enable_signal(), sdram_set_emc_timing(), and sdram_set_refresh().

Here is the caller graph for this function: