drivers/mmc/host/sdhci-s3c.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/sdhci-s3c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/sdhci-s3c.c- Extension
.c- Size
- 20515 bytes
- Lines
- 777
- 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/spinlock.hlinux/delay.hlinux/dma-mapping.hlinux/platform_device.hlinux/platform_data/mmc-sdhci-s3c.hlinux/slab.hlinux/clk.hlinux/io.hlinux/module.hlinux/of.hlinux/pm.hlinux/pm_runtime.hlinux/mmc/host.hsdhci.h
Detected Declarations
struct sdhci_s3cstruct sdhci_s3c_drv_datafunction sdhci_s3c_get_max_clkfunction sdhci_s3c_consider_clockfunction sdhci_s3c_set_clockfunction sdhci_s3c_get_min_clockfunction sdhci_cmu_get_max_clockfunction sdhci_cmu_get_min_clockfunction sdhci_cmu_set_clockfunction sdhci_s3c_parse_dtfunction sdhci_s3c_parse_dtfunction sdhci_s3c_probefunction sdhci_s3c_removefunction sdhci_s3c_suspendfunction sdhci_s3c_resumefunction sdhci_s3c_runtime_suspendfunction sdhci_s3c_runtime_resume
Annotated Snippet
struct sdhci_s3c {
struct sdhci_host *host;
struct platform_device *pdev;
struct resource *ioarea;
struct s3c_sdhci_platdata *pdata;
int cur_clk;
int ext_cd_irq;
struct clk *clk_io;
struct clk *clk_bus[MAX_BUS_CLK];
unsigned long clk_rates[MAX_BUS_CLK];
bool no_divider;
};
/**
* struct sdhci_s3c_drv_data - S3C SDHCI platform specific driver data
* @sdhci_quirks: sdhci host specific quirks.
* @no_divider: no or non-standard internal clock divider.
* @ops: sdhci_ops to use for this variant
*
* Specifies platform specific configuration of sdhci controller.
* Note: A structure for driver specific platform data is used for future
* expansion of its usage.
*/
struct sdhci_s3c_drv_data {
unsigned int sdhci_quirks;
bool no_divider;
const struct sdhci_ops *ops;
};
static inline struct sdhci_s3c *to_s3c(struct sdhci_host *host)
{
return sdhci_priv(host);
}
/**
* sdhci_s3c_get_max_clk - callback to get maximum clock frequency.
* @host: The SDHCI host instance.
*
* Callback to return the maximum clock rate acheivable by the controller.
*/
static unsigned int sdhci_s3c_get_max_clk(struct sdhci_host *host)
{
struct sdhci_s3c *ourhost = to_s3c(host);
unsigned long rate, max = 0;
int src;
for (src = 0; src < MAX_BUS_CLK; src++) {
rate = ourhost->clk_rates[src];
if (rate > max)
max = rate;
}
return max;
}
/**
* sdhci_s3c_consider_clock - consider one the bus clocks for current setting
* @ourhost: Our SDHCI instance.
* @src: The source clock index.
* @wanted: The clock frequency wanted.
*/
static unsigned int sdhci_s3c_consider_clock(struct sdhci_s3c *ourhost,
unsigned int src,
unsigned int wanted)
{
unsigned long rate;
struct clk *clksrc = ourhost->clk_bus[src];
int shift;
if (IS_ERR(clksrc))
return UINT_MAX;
/*
* If controller uses a non-standard clock division, find the best clock
* speed possible with selected clock source and skip the division.
*/
if (ourhost->no_divider) {
rate = clk_round_rate(clksrc, wanted);
return wanted - rate;
}
rate = ourhost->clk_rates[src];
for (shift = 0; shift <= 8; ++shift) {
if ((rate >> shift) <= wanted)
break;
}
Annotation
- Immediate include surface: `linux/spinlock.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/platform_device.h`, `linux/platform_data/mmc-sdhci-s3c.h`, `linux/slab.h`, `linux/clk.h`, `linux/io.h`.
- Detected declarations: `struct sdhci_s3c`, `struct sdhci_s3c_drv_data`, `function sdhci_s3c_get_max_clk`, `function sdhci_s3c_consider_clock`, `function sdhci_s3c_set_clock`, `function sdhci_s3c_get_min_clock`, `function sdhci_cmu_get_max_clock`, `function sdhci_cmu_get_min_clock`, `function sdhci_cmu_set_clock`, `function sdhci_s3c_parse_dt`.
- 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.