drivers/memory/tegra/tegra124-emc.c
Source file repositories/reference/linux-study-clean/drivers/memory/tegra/tegra124-emc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/memory/tegra/tegra124-emc.c- Extension
.c- Size
- 37212 bytes
- Lines
- 1426
- Domain
- Driver Families
- Bucket
- drivers/memory
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk-provider.hlinux/clk.hlinux/clkdev.hlinux/clk/tegra.hlinux/debugfs.hlinux/delay.hlinux/interconnect-provider.hlinux/io.hlinux/module.hlinux/mutex.hlinux/of_address.hlinux/of_platform.hlinux/platform_device.hlinux/pm_opp.hlinux/sort.hlinux/string.hsoc/tegra/fuse.hsoc/tegra/mc.hmc.htegra-emc-common.h
Detected Declarations
struct emc_timingstruct tegra_emcenum emc_dram_typeenum emc_dll_changefunction emc_ccfifo_writelfunction emc_seq_update_timingfunction emc_seq_disable_auto_calfunction emc_seq_wait_clkchangefunction tegra124_emc_prepare_timing_changefunction tegra124_emc_complete_timing_changefunction emc_read_current_timingfunction emc_initfunction load_one_timing_from_dtfunction cmp_timingsfunction tegra124_emc_load_timings_from_dtfunction for_each_child_of_node_scopedfunction tegra124_emc_find_node_by_ram_codefunction for_each_child_of_nodefunction tegra124_emc_validate_ratefunction tegra124_emc_debug_available_rates_showfunction tegra124_emc_debug_min_rate_getfunction tegra124_emc_debug_min_rate_setfunction tegra124_emc_debug_max_rate_getfunction tegra124_emc_debug_max_rate_setfunction emc_debugfs_initfunction to_tegra_emc_providerfunction emc_of_icc_xlate_extendedfunction emc_icc_setfunction tegra124_emc_interconnect_initfunction tegra124_emc_opp_table_initfunction devm_tegra124_emc_unset_callbackfunction tegra124_emc_probe
Annotated Snippet
struct emc_timing {
unsigned long rate;
u32 emc_burst_data[ARRAY_SIZE(emc_burst_regs)];
u32 emc_auto_cal_config;
u32 emc_auto_cal_config2;
u32 emc_auto_cal_config3;
u32 emc_auto_cal_interval;
u32 emc_bgbias_ctl0;
u32 emc_cfg;
u32 emc_cfg_2;
u32 emc_ctt_term_ctrl;
u32 emc_mode_1;
u32 emc_mode_2;
u32 emc_mode_4;
u32 emc_mode_reset;
u32 emc_mrs_wait_cnt;
u32 emc_sel_dpd_ctrl;
u32 emc_xm2dqspadctrl2;
u32 emc_zcal_cnt_long;
u32 emc_zcal_interval;
};
struct tegra_emc {
struct device *dev;
struct tegra_mc *mc;
void __iomem *regs;
struct clk *clk;
enum emc_dram_type dram_type;
unsigned int dram_bus_width;
unsigned int dram_num;
struct emc_timing last_timing;
struct emc_timing *timings;
unsigned int num_timings;
struct {
struct dentry *root;
unsigned long min_rate;
unsigned long max_rate;
} debugfs;
struct icc_provider provider;
struct tegra_emc_rate_requests reqs;
};
/* Timing change sequence functions */
static void emc_ccfifo_writel(struct tegra_emc *emc, u32 value,
unsigned long offset)
{
writel(value, emc->regs + EMC_CCFIFO_DATA);
writel(offset, emc->regs + EMC_CCFIFO_ADDR);
}
static void emc_seq_update_timing(struct tegra_emc *emc)
{
unsigned int i;
u32 value;
writel(1, emc->regs + EMC_TIMING_CONTROL);
for (i = 0; i < EMC_STATUS_UPDATE_TIMEOUT; ++i) {
value = readl(emc->regs + EMC_STATUS);
if ((value & EMC_STATUS_TIMING_UPDATE_STALLED) == 0)
return;
udelay(1);
}
dev_err(emc->dev, "timing update timed out\n");
}
static void emc_seq_disable_auto_cal(struct tegra_emc *emc)
{
unsigned int i;
u32 value;
writel(0, emc->regs + EMC_AUTO_CAL_INTERVAL);
for (i = 0; i < EMC_STATUS_UPDATE_TIMEOUT; ++i) {
value = readl(emc->regs + EMC_AUTO_CAL_STATUS);
if ((value & EMC_AUTO_CAL_STATUS_ACTIVE) == 0)
return;
udelay(1);
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/clk.h`, `linux/clkdev.h`, `linux/clk/tegra.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/interconnect-provider.h`, `linux/io.h`.
- Detected declarations: `struct emc_timing`, `struct tegra_emc`, `enum emc_dram_type`, `enum emc_dll_change`, `function emc_ccfifo_writel`, `function emc_seq_update_timing`, `function emc_seq_disable_auto_cal`, `function emc_seq_wait_clkchange`, `function tegra124_emc_prepare_timing_change`, `function tegra124_emc_complete_timing_change`.
- Atlas domain: Driver Families / drivers/memory.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.