drivers/memory/tegra/mc.c
Source file repositories/reference/linux-study-clean/drivers/memory/tegra/mc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/memory/tegra/mc.c- Extension
.c- Size
- 25414 bytes
- Lines
- 1058
- Domain
- Driver Families
- Bucket
- drivers/memory
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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.hlinux/delay.hlinux/dma-mapping.hlinux/export.hlinux/interrupt.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/pm.hlinux/slab.hlinux/sort.hlinux/tegra-icc.hsoc/tegra/fuse.hmc.h
Detected Declarations
function tegra_mc_devm_action_put_devicefunction devm_tegra_memory_controller_getfunction tegra_mc_probe_devicefunction tegra_mc_get_carveout_infofunction tegra_mc_block_dma_commonfunction tegra_mc_dma_idling_commonfunction tegra_mc_unblock_dma_commonfunction tegra_mc_reset_status_commonfunction tegra_mc_hotreset_assertfunction tegra_mc_hotreset_deassertfunction tegra_mc_hotreset_statusfunction tegra_mc_reset_setupfunction tegra_mc_write_emem_configurationfunction tegra_mc_get_emem_device_countfunction definedfunction load_one_timingfunction load_timingsfunction for_each_child_of_node_scopedfunction tegra_mc_setup_timingsfunction for_each_child_of_node_scopedfunction tegra30_mc_probefunction mc_global_intstatus_to_channelfunction mc_channel_to_global_intstatusfunction tegra30_mc_handle_irqfunction for_each_set_bitfunction list_for_each_entryfunction tegra_mc_icc_getfunction tegra_mc_icc_setfunction Controllerfunction tegra_mc_num_channel_enabledfunction tegra_mc_setup_intmaskfunction tegra_mc_probefunction tegra_mc_sync_statefunction tegra_mc_resumefunction tegra_mc_initexport devm_tegra_memory_controller_getexport tegra_mc_probe_deviceexport tegra_mc_get_carveout_infoexport tegra_mc_write_emem_configurationexport tegra_mc_get_emem_device_count
Annotated Snippet
if (err) {
dev_err(mc->dev, "failed to block %s DMA: %d\n",
rst->name, err);
return err;
}
}
if (rst_ops->dma_idling) {
/* wait for completion of the outstanding DMA requests */
while (!rst_ops->dma_idling(mc, rst)) {
if (!retries--) {
dev_err(mc->dev, "failed to flush %s DMA\n",
rst->name);
return -EBUSY;
}
usleep_range(10, 100);
}
}
if (rst_ops->hotreset_assert) {
/* clear clients DMA requests sitting before arbitration */
err = rst_ops->hotreset_assert(mc, rst);
if (err) {
dev_err(mc->dev, "failed to hot reset %s: %d\n",
rst->name, err);
return err;
}
}
return 0;
}
static int tegra_mc_hotreset_deassert(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct tegra_mc *mc = reset_to_mc(rcdev);
const struct tegra_mc_reset_ops *rst_ops;
const struct tegra_mc_reset *rst;
int err;
rst = tegra_mc_reset_find(mc, id);
if (!rst)
return -ENODEV;
rst_ops = mc->soc->reset_ops;
if (!rst_ops)
return -ENODEV;
if (rst_ops->hotreset_deassert) {
/* take out client from hot reset */
err = rst_ops->hotreset_deassert(mc, rst);
if (err) {
dev_err(mc->dev, "failed to deassert hot reset %s: %d\n",
rst->name, err);
return err;
}
}
if (rst_ops->unblock_dma) {
/* allow new DMA requests to proceed to arbitration */
err = rst_ops->unblock_dma(mc, rst);
if (err) {
dev_err(mc->dev, "failed to unblock %s DMA : %d\n",
rst->name, err);
return err;
}
}
return 0;
}
static int tegra_mc_hotreset_status(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct tegra_mc *mc = reset_to_mc(rcdev);
const struct tegra_mc_reset_ops *rst_ops;
const struct tegra_mc_reset *rst;
rst = tegra_mc_reset_find(mc, id);
if (!rst)
return -ENODEV;
rst_ops = mc->soc->reset_ops;
if (!rst_ops)
return -ENODEV;
return rst_ops->reset_status(mc, rst);
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/export.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `function tegra_mc_devm_action_put_device`, `function devm_tegra_memory_controller_get`, `function tegra_mc_probe_device`, `function tegra_mc_get_carveout_info`, `function tegra_mc_block_dma_common`, `function tegra_mc_dma_idling_common`, `function tegra_mc_unblock_dma_common`, `function tegra_mc_reset_status_common`, `function tegra_mc_hotreset_assert`, `function tegra_mc_hotreset_deassert`.
- Atlas domain: Driver Families / drivers/memory.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.