drivers/mmc/host/sdhci-of-ma35d1.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/sdhci-of-ma35d1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/sdhci-of-ma35d1.c- Extension
.c- Size
- 8635 bytes
- Lines
- 308
- 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/align.hlinux/array_size.hlinux/bits.hlinux/build_bug.hlinux/clk.hlinux/delay.hlinux/dev_printk.hlinux/device.hlinux/dma-mapping.hlinux/err.hlinux/math.hlinux/mfd/syscon.hlinux/minmax.hlinux/mmc/card.hlinux/mmc/host.hlinux/mod_devicetable.hlinux/module.hlinux/pinctrl/consumer.hlinux/platform_device.hlinux/regmap.hlinux/reset.hlinux/sizes.hlinux/types.hsdhci-pltfm.hsdhci.h
Detected Declarations
struct ma35_privstruct ma35_restore_datafunction ma35_adma_write_descfunction ma35_set_clockfunction ma35_start_signal_voltage_switchfunction ma35_voltage_switchfunction ma35_execute_tuningfunction ma35_probefunction ma35_disable_card_clkfunction ma35_remove
Annotated Snippet
struct ma35_priv {
struct reset_control *rst;
struct pinctrl *pinctrl;
struct pinctrl_state *pins_uhs;
struct pinctrl_state *pins_default;
};
struct ma35_restore_data {
u32 reg;
u32 width;
};
static const struct ma35_restore_data restore_data[] = {
{ SDHCI_CLOCK_CONTROL, sizeof(u32)},
{ SDHCI_BLOCK_SIZE, sizeof(u32)},
{ SDHCI_INT_ENABLE, sizeof(u32)},
{ SDHCI_SIGNAL_ENABLE, sizeof(u32)},
{ SDHCI_AUTO_CMD_STATUS, sizeof(u32)},
{ SDHCI_HOST_CONTROL, sizeof(u32)},
{ SDHCI_TIMEOUT_CONTROL, sizeof(u8) },
{ MA35_SDHCI_MSHCCTL, sizeof(u16)},
{ MA35_SDHCI_MBIUCTL, sizeof(u16)},
};
/*
* If DMA addr spans 128MB boundary, we split the DMA transfer into two
* so that each DMA transfer doesn't exceed the boundary.
*/
static void ma35_adma_write_desc(struct sdhci_host *host, void **desc, dma_addr_t addr, int len,
unsigned int cmd)
{
int tmplen, offset;
if (likely(!len || (ALIGN(addr, SZ_128M) == ALIGN(addr + len - 1, SZ_128M)))) {
sdhci_adma_write_desc(host, desc, addr, len, cmd);
return;
}
offset = addr & (SZ_128M - 1);
tmplen = SZ_128M - offset;
sdhci_adma_write_desc(host, desc, addr, tmplen, cmd);
addr += tmplen;
len -= tmplen;
sdhci_adma_write_desc(host, desc, addr, len, cmd);
}
static void ma35_set_clock(struct sdhci_host *host, unsigned int clock)
{
u32 ctl;
/*
* If the clock frequency exceeds MMC_HIGH_52_MAX_DTR,
* disable command conflict check.
*/
ctl = sdhci_readw(host, MA35_SDHCI_MSHCCTL);
if (clock > MMC_HIGH_52_MAX_DTR)
ctl &= ~MA35_SDHCI_CMD_CONFLICT_CHK;
else
ctl |= MA35_SDHCI_CMD_CONFLICT_CHK;
sdhci_writew(host, ctl, MA35_SDHCI_MSHCCTL);
sdhci_set_clock(host, clock);
}
static int ma35_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct sdhci_host *host = mmc_priv(mmc);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct ma35_priv *priv = sdhci_pltfm_priv(pltfm_host);
switch (ios->signal_voltage) {
case MMC_SIGNAL_VOLTAGE_180:
if (!IS_ERR(priv->pinctrl) && !IS_ERR(priv->pins_uhs))
pinctrl_select_state(priv->pinctrl, priv->pins_uhs);
break;
case MMC_SIGNAL_VOLTAGE_330:
if (!IS_ERR(priv->pinctrl) && !IS_ERR(priv->pins_default))
pinctrl_select_state(priv->pinctrl, priv->pins_default);
break;
default:
dev_err(mmc_dev(host->mmc), "Unsupported signal voltage!\n");
return -EINVAL;
}
return sdhci_start_signal_voltage_switch(mmc, ios);
}
static void ma35_voltage_switch(struct sdhci_host *host)
{
Annotation
- Immediate include surface: `linux/align.h`, `linux/array_size.h`, `linux/bits.h`, `linux/build_bug.h`, `linux/clk.h`, `linux/delay.h`, `linux/dev_printk.h`, `linux/device.h`.
- Detected declarations: `struct ma35_priv`, `struct ma35_restore_data`, `function ma35_adma_write_desc`, `function ma35_set_clock`, `function ma35_start_signal_voltage_switch`, `function ma35_voltage_switch`, `function ma35_execute_tuning`, `function ma35_probe`, `function ma35_disable_card_clk`, `function ma35_remove`.
- 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.