drivers/mmc/host/alcor.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/alcor.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/alcor.c- Extension
.c- Size
- 29578 bytes
- Lines
- 1180
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/pci.hlinux/module.hlinux/io.hlinux/pm.hlinux/irq.hlinux/interrupt.hlinux/platform_device.hlinux/string_choices.hlinux/mmc/host.hlinux/mmc/mmc.hlinux/alcor_pci.h
Detected Declarations
struct alcor_pll_confstruct alcor_sdmmc_hostenum alcor_cookiefunction alcor_rmw8function alcor_mask_sd_irqsfunction alcor_unmask_sd_irqsfunction alcor_resetfunction alcor_data_set_dmafunction alcor_trigger_data_transferfunction alcor_trf_block_piofunction alcor_prepare_sg_miterfunction alcor_prepare_datafunction alcor_send_cmdfunction alcor_request_completefunction alcor_finish_datafunction alcor_err_irqfunction alcor_cmd_irq_donefunction alcor_cmd_irq_threadfunction alcor_data_irq_donefunction alcor_data_irq_threadfunction alcor_cd_irqfunction alcor_irq_threadfunction alcor_irqfunction alcor_set_clockfunction alcor_set_timingfunction alcor_set_bus_widthfunction alcor_card_busyfunction alcor_get_cdfunction alcor_get_rofunction alcor_requestfunction alcor_pre_reqfunction for_each_sgfunction alcor_post_reqfunction alcor_set_power_modefunction alcor_set_iosfunction alcor_signal_voltage_switchfunction alcor_timeout_timerfunction alcor_hw_initfunction alcor_hw_uninitfunction alcor_init_mmcfunction alcor_pci_sdmmc_drv_probefunction alcor_pci_sdmmc_drv_removefunction alcor_pci_sdmmc_suspendfunction alcor_pci_sdmmc_resume
Annotated Snippet
struct alcor_pll_conf {
unsigned int clk_src_freq;
unsigned int clk_src_reg;
unsigned int min_div;
unsigned int max_div;
};
struct alcor_sdmmc_host {
struct device *dev;
struct alcor_pci_priv *alcor_pci;
struct mmc_request *mrq;
struct mmc_command *cmd;
struct mmc_data *data;
unsigned int dma_on:1;
struct mutex cmd_mutex;
struct delayed_work timeout_work;
struct sg_mapping_iter sg_miter; /* SG state for PIO */
struct scatterlist *sg;
unsigned int blocks; /* remaining PIO blocks */
int sg_count;
u32 irq_status_sd;
unsigned char cur_power_mode;
};
static const struct alcor_pll_conf alcor_pll_cfg[] = {
/* MHZ, CLK src, max div, min div */
{ 31250000, AU6601_CLK_31_25_MHZ, 1, 511},
{ 48000000, AU6601_CLK_48_MHZ, 1, 511},
{125000000, AU6601_CLK_125_MHZ, 1, 511},
{384000000, AU6601_CLK_384_MHZ, 1, 511},
};
static inline void alcor_rmw8(struct alcor_sdmmc_host *host, unsigned int addr,
u8 clear, u8 set)
{
struct alcor_pci_priv *priv = host->alcor_pci;
u32 var;
var = alcor_read8(priv, addr);
var &= ~clear;
var |= set;
alcor_write8(priv, var, addr);
}
/* As soon as irqs are masked, some status updates may be missed.
* Use this with care.
*/
static inline void alcor_mask_sd_irqs(struct alcor_sdmmc_host *host)
{
struct alcor_pci_priv *priv = host->alcor_pci;
alcor_write32(priv, 0, AU6601_REG_INT_ENABLE);
}
static inline void alcor_unmask_sd_irqs(struct alcor_sdmmc_host *host)
{
struct alcor_pci_priv *priv = host->alcor_pci;
alcor_write32(priv, AU6601_INT_CMD_MASK | AU6601_INT_DATA_MASK |
AU6601_INT_CARD_INSERT | AU6601_INT_CARD_REMOVE |
AU6601_INT_OVER_CURRENT_ERR,
AU6601_REG_INT_ENABLE);
}
static void alcor_reset(struct alcor_sdmmc_host *host, u8 val)
{
struct alcor_pci_priv *priv = host->alcor_pci;
int i;
alcor_write8(priv, val | AU6601_BUF_CTRL_RESET,
AU6601_REG_SW_RESET);
for (i = 0; i < 100; i++) {
if (!(alcor_read8(priv, AU6601_REG_SW_RESET) & val))
return;
udelay(50);
}
dev_err(host->dev, "%s: timeout\n", __func__);
}
/*
* Perform DMA I/O of a single page.
*/
static void alcor_data_set_dma(struct alcor_sdmmc_host *host)
{
struct alcor_pci_priv *priv = host->alcor_pci;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pci.h`, `linux/module.h`, `linux/io.h`, `linux/pm.h`, `linux/irq.h`, `linux/interrupt.h`, `linux/platform_device.h`.
- Detected declarations: `struct alcor_pll_conf`, `struct alcor_sdmmc_host`, `enum alcor_cookie`, `function alcor_rmw8`, `function alcor_mask_sd_irqs`, `function alcor_unmask_sd_irqs`, `function alcor_reset`, `function alcor_data_set_dma`, `function alcor_trigger_data_transfer`, `function alcor_trf_block_pio`.
- 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.
- 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.