drivers/mmc/host/sdhci-cadence.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/sdhci-cadence.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/sdhci-cadence.c- Extension
.c- Size
- 18381 bytes
- Lines
- 676
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/bits.hlinux/iopoll.hlinux/module.hlinux/mmc/host.hlinux/mmc/mmc.hlinux/of.hlinux/platform_device.hlinux/reset.hsdhci-pltfm.h
Detected Declarations
struct sdhci_cdns_phy_paramstruct sdhci_cdns_privstruct sdhci_cdns_phy_cfgstruct sdhci_cdns_drv_datafunction cdns_writelfunction sdhci_cdns_write_phy_regfunction sdhci_cdns_phy_param_countfunction sdhci_cdns_phy_param_parsefunction sdhci_cdns_phy_initfunction sdhci_cdns_get_timeout_clockfunction sdhci_cdns_set_emmc_modefunction sdhci_cdns_get_emmc_modefunction sdhci_cdns_set_tune_valfunction sdhci_cdns_tune_blkgapfunction sdhci_cdns_execute_tuningfunction sdhci_cdns_set_uhs_signalingfunction elba_priv_writelfunction elba_write_lfunction elba_write_wfunction elba_write_bfunction elba_drv_initfunction sdhci_cdns_hs400_enhanced_strobefunction sdhci_cdns_mmc_hw_resetfunction sdhci_cdns_probefunction sdhci_cdns_resume
Annotated Snippet
struct sdhci_cdns_phy_param {
u8 addr;
u8 data;
};
struct sdhci_cdns_priv {
void __iomem *hrs_addr;
void __iomem *ctl_addr; /* write control */
spinlock_t wrlock; /* write lock */
bool enhanced_strobe;
void (*priv_writel)(struct sdhci_cdns_priv *priv, u32 val, void __iomem *reg);
struct reset_control *rst_hw;
unsigned int nr_phy_params;
struct sdhci_cdns_phy_param phy_params[];
};
struct sdhci_cdns_phy_cfg {
const char *property;
u8 addr;
};
struct sdhci_cdns_drv_data {
int (*init)(struct platform_device *pdev);
const struct sdhci_pltfm_data pltfm_data;
};
static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = {
{ "cdns,phy-input-delay-sd-highspeed", SDHCI_CDNS_PHY_DLY_SD_HS, },
{ "cdns,phy-input-delay-legacy", SDHCI_CDNS_PHY_DLY_SD_DEFAULT, },
{ "cdns,phy-input-delay-sd-uhs-sdr12", SDHCI_CDNS_PHY_DLY_UHS_SDR12, },
{ "cdns,phy-input-delay-sd-uhs-sdr25", SDHCI_CDNS_PHY_DLY_UHS_SDR25, },
{ "cdns,phy-input-delay-sd-uhs-sdr50", SDHCI_CDNS_PHY_DLY_UHS_SDR50, },
{ "cdns,phy-input-delay-sd-uhs-ddr50", SDHCI_CDNS_PHY_DLY_UHS_DDR50, },
{ "cdns,phy-input-delay-mmc-highspeed", SDHCI_CDNS_PHY_DLY_EMMC_SDR, },
{ "cdns,phy-input-delay-mmc-ddr", SDHCI_CDNS_PHY_DLY_EMMC_DDR, },
{ "cdns,phy-dll-delay-sdclk", SDHCI_CDNS_PHY_DLY_SDCLK, },
{ "cdns,phy-dll-delay-sdclk-hsmmc", SDHCI_CDNS_PHY_DLY_HSMMC, },
{ "cdns,phy-dll-delay-strobe", SDHCI_CDNS_PHY_DLY_STROBE, },
};
static inline void cdns_writel(struct sdhci_cdns_priv *priv, u32 val,
void __iomem *reg)
{
writel(val, reg);
}
static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
u8 addr, u8 data)
{
void __iomem *reg = priv->hrs_addr + SDHCI_CDNS_HRS04;
u32 tmp;
int ret;
ret = readl_poll_timeout(reg, tmp, !(tmp & SDHCI_CDNS_HRS04_ACK),
0, 10);
if (ret)
return ret;
tmp = FIELD_PREP(SDHCI_CDNS_HRS04_WDATA, data) |
FIELD_PREP(SDHCI_CDNS_HRS04_ADDR, addr);
priv->priv_writel(priv, tmp, reg);
tmp |= SDHCI_CDNS_HRS04_WR;
priv->priv_writel(priv, tmp, reg);
ret = readl_poll_timeout(reg, tmp, tmp & SDHCI_CDNS_HRS04_ACK, 0, 10);
if (ret)
return ret;
tmp &= ~SDHCI_CDNS_HRS04_WR;
priv->priv_writel(priv, tmp, reg);
ret = readl_poll_timeout(reg, tmp, !(tmp & SDHCI_CDNS_HRS04_ACK),
0, 10);
return ret;
}
static unsigned int sdhci_cdns_phy_param_count(struct device_node *np)
{
unsigned int count = 0;
int i;
for (i = 0; i < ARRAY_SIZE(sdhci_cdns_phy_cfgs); i++)
if (of_property_present(np, sdhci_cdns_phy_cfgs[i].property))
count++;
return count;
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bits.h`, `linux/iopoll.h`, `linux/module.h`, `linux/mmc/host.h`, `linux/mmc/mmc.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct sdhci_cdns_phy_param`, `struct sdhci_cdns_priv`, `struct sdhci_cdns_phy_cfg`, `struct sdhci_cdns_drv_data`, `function cdns_writel`, `function sdhci_cdns_write_phy_reg`, `function sdhci_cdns_phy_param_count`, `function sdhci_cdns_phy_param_parse`, `function sdhci_cdns_phy_init`, `function sdhci_cdns_get_timeout_clock`.
- Atlas domain: Driver Families / drivers/mmc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.