drivers/mmc/host/sdhci-pxav3.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/sdhci-pxav3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/sdhci-pxav3.c- Extension
.c- Size
- 15911 bytes
- Lines
- 606
- 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/err.hlinux/init.hlinux/platform_device.hlinux/clk.hlinux/io.hlinux/mmc/card.hlinux/mmc/host.hlinux/platform_data/pxa_sdhci.hlinux/slab.hlinux/delay.hlinux/module.hlinux/of.hlinux/of_device.hlinux/pinctrl/consumer.hlinux/pm.hlinux/pm_runtime.hlinux/mbus.hlinux/units.hsdhci.hsdhci-pltfm.h
Detected Declarations
struct sdhci_pxafunction Registerfunction armada_38x_quirksfunction pxav3_resetfunction pxav3_gen_init_74_clocksfunction pxav3_set_uhs_signalingfunction pxav3_set_powerfunction pxav3_set_clockfunction sdhci_pxav3_probefunction sdhci_pxav3_removefunction sdhci_pxav3_suspendfunction sdhci_pxav3_resumefunction sdhci_pxav3_runtime_suspendfunction sdhci_pxav3_runtime_resume
Annotated Snippet
struct sdhci_pxa {
struct clk *clk_core;
struct clk *clk_io;
u8 power_mode;
void __iomem *sdio3_conf_reg;
struct pinctrl *pinctrl;
struct pinctrl_state *pins_default;
struct pinctrl_state *pins_uhs;
};
/*
* These registers are relative to the second register region, for the
* MBus bridge.
*/
#define SDHCI_WINDOW_CTRL(i) (0x80 + ((i) << 3))
#define SDHCI_WINDOW_BASE(i) (0x84 + ((i) << 3))
#define SDHCI_MAX_WIN_NUM 8
/*
* Fields below belong to SDIO3 Configuration Register (third register
* region for the Armada 38x flavor)
*/
#define SDIO3_CONF_CLK_INV BIT(0)
#define SDIO3_CONF_SD_FB_CLK BIT(2)
static int mv_conf_mbus_windows(struct platform_device *pdev,
const struct mbus_dram_target_info *dram)
{
int i;
void __iomem *regs;
struct resource *res;
if (!dram) {
dev_err(&pdev->dev, "no mbus dram info\n");
return -EINVAL;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!res) {
dev_err(&pdev->dev, "cannot get mbus registers\n");
return -EINVAL;
}
regs = ioremap(res->start, resource_size(res));
if (!regs) {
dev_err(&pdev->dev, "cannot map mbus registers\n");
return -ENOMEM;
}
for (i = 0; i < SDHCI_MAX_WIN_NUM; i++) {
writel(0, regs + SDHCI_WINDOW_CTRL(i));
writel(0, regs + SDHCI_WINDOW_BASE(i));
}
for (i = 0; i < dram->num_cs; i++) {
const struct mbus_dram_window *cs = dram->cs + i;
/* Write size, attributes and target id to control register */
writel(((cs->size - 1) & 0xffff0000) |
(cs->mbus_attr << 8) |
(dram->mbus_dram_target_id << 4) | 1,
regs + SDHCI_WINDOW_CTRL(i));
/* Write base address to base register */
writel(cs->base, regs + SDHCI_WINDOW_BASE(i));
}
iounmap(regs);
return 0;
}
static int armada_38x_quirks(struct platform_device *pdev,
struct sdhci_host *host)
{
struct device_node *np = pdev->dev.of_node;
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
struct resource *res;
host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
sdhci_read_caps(host);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"conf-sdio3");
if (res) {
pxa->sdio3_conf_reg = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pxa->sdio3_conf_reg))
return PTR_ERR(pxa->sdio3_conf_reg);
Annotation
- Immediate include surface: `linux/err.h`, `linux/init.h`, `linux/platform_device.h`, `linux/clk.h`, `linux/io.h`, `linux/mmc/card.h`, `linux/mmc/host.h`, `linux/platform_data/pxa_sdhci.h`.
- Detected declarations: `struct sdhci_pxa`, `function Register`, `function armada_38x_quirks`, `function pxav3_reset`, `function pxav3_gen_init_74_clocks`, `function pxav3_set_uhs_signaling`, `function pxav3_set_power`, `function pxav3_set_clock`, `function sdhci_pxav3_probe`, `function sdhci_pxav3_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.