drivers/mmc/host/sdhci-tegra.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/sdhci-tegra.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/sdhci-tegra.c- Extension
.c- Size
- 57581 bytes
- Lines
- 1934
- Domain
- Driver Families
- Bucket
- drivers/mmc
- 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/bitfield.hlinux/clk.hlinux/delay.hlinux/dma-mapping.hlinux/err.hlinux/gpio/consumer.hlinux/init.hlinux/io.hlinux/iommu.hlinux/iopoll.hlinux/ktime.hlinux/mmc/card.hlinux/mmc/host.hlinux/mmc/mmc.hlinux/mmc/slot-gpio.hlinux/module.hlinux/of.hlinux/pinctrl/consumer.hlinux/platform_device.hlinux/pm_opp.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/reset.hsoc/tegra/common.hsdhci-cqhci.hsdhci-pltfm.hcqhci.h
Detected Declarations
struct sdhci_tegra_soc_datastruct sdhci_tegra_autocal_offsetsstruct sdhci_tegrafunction tegra_sdhci_readwfunction tegra_sdhci_writewfunction tegra_sdhci_writelfunction tegra_sdhci_configure_card_clkfunction tegra210_sdhci_writewfunction tegra_sdhci_get_rofunction tegra_sdhci_is_pad_and_regulator_validfunction tegra_sdhci_set_tapfunction tegra_sdhci_resetfunction tegra_sdhci_configure_cal_padfunction tegra_sdhci_set_pad_autocal_offsetfunction tegra_sdhci_set_padctrlfunction tegra_sdhci_pad_autocalibfunction tegra_sdhci_parse_pad_autocal_dtfunction tegra_sdhci_requestfunction tegra_sdhci_parse_tap_and_trimfunction tegra_sdhci_parse_dtfunction tegra_sdhci_set_clockfunction tegra_sdhci_hs400_enhanced_strobefunction tegra_sdhci_get_max_clockfunction tegra_sdhci_set_dqs_trimfunction tegra_sdhci_hs400_dll_calfunction tegra_sdhci_tap_correctionfunction tegra_sdhci_post_tuningfunction tegra_sdhci_execute_hw_tuningfunction tegra_sdhci_set_uhs_signalingfunction tegra_sdhci_execute_tuningfunction sdhci_tegra_start_signal_voltage_switchfunction tegra_sdhci_init_pinctrl_infofunction tegra_sdhci_voltage_switchfunction tegra_cqhci_writelfunction cqhci_readlfunction sdhci_tegra_update_dcmd_descfunction sdhci_tegra_cqe_enablefunction sdhci_tegra_dumpregsfunction sdhci_tegra_cqhci_irqfunction tegra_sdhci_set_timeoutfunction sdhci_tegra_cqe_pre_enablefunction sdhci_tegra_cqe_post_disablefunction tegra_sdhci_set_dma_maskfunction sdhci_tegra_add_hostfunction sdhci_tegra_program_stream_idfunction sdhci_tegra_probefunction sdhci_tegra_removefunction sdhci_tegra_runtime_suspend
Annotated Snippet
struct sdhci_tegra_soc_data {
const struct sdhci_pltfm_data *pdata;
u64 dma_mask;
u32 nvquirks;
u8 min_tap_delay;
u8 max_tap_delay;
};
/* Magic pull up and pull down pad calibration offsets */
struct sdhci_tegra_autocal_offsets {
u32 pull_up_3v3;
u32 pull_down_3v3;
u32 pull_up_3v3_timeout;
u32 pull_down_3v3_timeout;
u32 pull_up_1v8;
u32 pull_down_1v8;
u32 pull_up_1v8_timeout;
u32 pull_down_1v8_timeout;
u32 pull_up_sdr104;
u32 pull_down_sdr104;
u32 pull_up_hs400;
u32 pull_down_hs400;
};
struct sdhci_tegra {
const struct sdhci_tegra_soc_data *soc_data;
struct gpio_desc *power_gpio;
struct clk *tmclk;
bool ddr_signaling;
bool pad_calib_required;
bool pad_control_available;
struct reset_control *rst;
struct pinctrl *pinctrl_sdmmc;
struct pinctrl_state *pinctrl_state_3v3;
struct pinctrl_state *pinctrl_state_1v8;
struct pinctrl_state *pinctrl_state_3v3_drv;
struct pinctrl_state *pinctrl_state_1v8_drv;
struct sdhci_tegra_autocal_offsets autocal_offsets;
ktime_t last_calib;
u32 default_tap;
u32 default_trim;
u32 dqs_trim;
bool enable_hwcq;
unsigned long curr_clk_rate;
u8 tuned_tap_delay;
u32 stream_id;
};
static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
if (unlikely((soc_data->nvquirks & NVQUIRK_FORCE_SDHCI_SPEC_200) &&
(reg == SDHCI_HOST_VERSION))) {
/* Erratum: Version register is invalid in HW. */
return SDHCI_SPEC_200;
}
return readw(host->ioaddr + reg);
}
static void tegra_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
switch (reg) {
case SDHCI_TRANSFER_MODE:
/*
* Postpone this write, we must do it together with a
* command write that is down below.
*/
pltfm_host->xfer_mode_shadow = val;
return;
case SDHCI_COMMAND:
writel((val << 16) | pltfm_host->xfer_mode_shadow,
host->ioaddr + SDHCI_TRANSFER_MODE);
return;
}
writew(val, host->ioaddr + reg);
}
static void tegra_sdhci_writel(struct sdhci_host *host, u32 val, int reg)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/init.h`, `linux/io.h`.
- Detected declarations: `struct sdhci_tegra_soc_data`, `struct sdhci_tegra_autocal_offsets`, `struct sdhci_tegra`, `function tegra_sdhci_readw`, `function tegra_sdhci_writew`, `function tegra_sdhci_writel`, `function tegra_sdhci_configure_card_clk`, `function tegra210_sdhci_writew`, `function tegra_sdhci_get_ro`, `function tegra_sdhci_is_pad_and_regulator_valid`.
- Atlas domain: Driver Families / drivers/mmc.
- 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.