drivers/mmc/host/sdhci-xenon.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/sdhci-xenon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/sdhci-xenon.c- Extension
.c- Size
- 20038 bytes
- Lines
- 728
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/delay.hlinux/ktime.hlinux/module.hlinux/of.hlinux/pm.hlinux/pm_runtime.hlinux/mm.hlinux/dma-mapping.hsdhci-pltfm.hsdhci-xenon.h
Detected Declarations
function Copyrightfunction xenon_set_sdclk_off_idlefunction xenon_set_acgfunction xenon_enable_sdhcfunction xenon_disable_sdhcfunction xenon_enable_sdhc_parallel_tranfunction xenon_mask_cmd_conflict_errfunction xenon_retune_setupfunction xenon_reset_exitfunction xenon_resetfunction xenon_set_uhs_signalingfunction xenon_set_powerfunction xenon_voltage_switchfunction xenon_get_max_clockfunction xenon_set_iosfunction get_preset_valuefunction xenon_start_signal_voltage_switchfunction xenon_init_cardfunction xenon_execute_tuningfunction xenon_enable_sdio_irqfunction xenon_replace_mmc_host_opsfunction xenon_probe_paramsfunction xenon_sdhc_preparefunction xenon_sdhc_unpreparefunction xenon_probefunction xenon_removefunction xenon_suspendfunction xenon_runtime_suspendfunction xenon_runtime_resume
Annotated Snippet
if (timedout) {
dev_err(mmc_dev(host->mmc), "Internal clock never stabilised.\n");
return -ETIMEDOUT;
}
usleep_range(900, 1100);
}
return 0;
}
/* Set SDCLK-off-while-idle */
static void xenon_set_sdclk_off_idle(struct sdhci_host *host,
unsigned char sdhc_id, bool enable)
{
u32 reg;
u32 mask;
reg = sdhci_readl(host, XENON_SYS_OP_CTRL);
/* Get the bit shift basing on the SDHC index */
mask = (0x1 << (XENON_SDCLK_IDLEOFF_ENABLE_SHIFT + sdhc_id));
if (enable)
reg |= mask;
else
reg &= ~mask;
sdhci_writel(host, reg, XENON_SYS_OP_CTRL);
}
/* Enable/Disable the Auto Clock Gating function */
static void xenon_set_acg(struct sdhci_host *host, bool enable)
{
u32 reg;
reg = sdhci_readl(host, XENON_SYS_OP_CTRL);
if (enable)
reg &= ~XENON_AUTO_CLKGATE_DISABLE_MASK;
else
reg |= XENON_AUTO_CLKGATE_DISABLE_MASK;
sdhci_writel(host, reg, XENON_SYS_OP_CTRL);
}
/* Enable this SDHC */
static void xenon_enable_sdhc(struct sdhci_host *host,
unsigned char sdhc_id)
{
u32 reg;
reg = sdhci_readl(host, XENON_SYS_OP_CTRL);
reg |= (BIT(sdhc_id) << XENON_SLOT_ENABLE_SHIFT);
sdhci_writel(host, reg, XENON_SYS_OP_CTRL);
host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY;
/*
* Force to clear BUS_TEST to
* skip bus_test_pre and bus_test_post
*/
host->mmc->caps &= ~MMC_CAP_BUS_WIDTH_TEST;
}
/* Disable this SDHC */
static void xenon_disable_sdhc(struct sdhci_host *host,
unsigned char sdhc_id)
{
u32 reg;
reg = sdhci_readl(host, XENON_SYS_OP_CTRL);
reg &= ~(BIT(sdhc_id) << XENON_SLOT_ENABLE_SHIFT);
sdhci_writel(host, reg, XENON_SYS_OP_CTRL);
}
/* Enable Parallel Transfer Mode */
static void xenon_enable_sdhc_parallel_tran(struct sdhci_host *host,
unsigned char sdhc_id)
{
u32 reg;
reg = sdhci_readl(host, XENON_SYS_EXT_OP_CTRL);
reg |= BIT(sdhc_id);
sdhci_writel(host, reg, XENON_SYS_EXT_OP_CTRL);
}
/* Mask command conflict error */
static void xenon_mask_cmd_conflict_err(struct sdhci_host *host)
{
u32 reg;
reg = sdhci_readl(host, XENON_SYS_EXT_OP_CTRL);
reg |= XENON_MASK_CMD_CONFLICT_ERR;
sdhci_writel(host, reg, XENON_SYS_EXT_OP_CTRL);
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/delay.h`, `linux/ktime.h`, `linux/module.h`, `linux/of.h`, `linux/pm.h`, `linux/pm_runtime.h`, `linux/mm.h`.
- Detected declarations: `function Copyright`, `function xenon_set_sdclk_off_idle`, `function xenon_set_acg`, `function xenon_enable_sdhc`, `function xenon_disable_sdhc`, `function xenon_enable_sdhc_parallel_tran`, `function xenon_mask_cmd_conflict_err`, `function xenon_retune_setup`, `function xenon_reset_exit`, `function xenon_reset`.
- 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.