drivers/mmc/host/dw_mmc-starfive.c

Source file repositories/reference/linux-study-clean/drivers/mmc/host/dw_mmc-starfive.c

File Facts

System
Linux kernel
Corpus path
drivers/mmc/host/dw_mmc-starfive.c
Extension
.c
Size
3470 bytes
Lines
129
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (!ret && smpl_raise < 0) {
			smpl_raise = smpl_phase;
		} else if (ret && smpl_raise >= 0) {
			smpl_fall = smpl_phase - 1;
			break;
		}
	}

	if (smpl_phase >= grade)
		smpl_fall = grade - 1;

	if (smpl_raise < 0) {
		smpl_phase = 0;
		dev_err(host->dev, "No valid delay chain! use default\n");
		ret = -EINVAL;
		goto out;
	}

	smpl_phase = (smpl_raise + smpl_fall) / 2;
	dev_dbg(host->dev, "Found valid delay chain! use it [delay=%d]\n", smpl_phase);
	ret = 0;

out:
	dw_mci_starfive_set_sample_phase(host, smpl_phase);
	mci_writel(host, RINTSTS, ALL_INT_CLR);
	return ret;
}

static const struct dw_mci_drv_data starfive_data = {
	.common_caps		= MMC_CAP_CMD23,
	.set_ios		= dw_mci_starfive_set_ios,
	.execute_tuning		= dw_mci_starfive_execute_tuning,
};

static const struct of_device_id dw_mci_starfive_match[] = {
	{ .compatible = "starfive,jh7110-mmc",
		.data = &starfive_data },
	{},
};
MODULE_DEVICE_TABLE(of, dw_mci_starfive_match);

static int dw_mci_starfive_probe(struct platform_device *pdev)
{
	return dw_mci_pltfm_register(pdev, &starfive_data);
}

static struct platform_driver dw_mci_starfive_driver = {
	.probe = dw_mci_starfive_probe,
	.remove = dw_mci_pltfm_remove,
	.driver = {
		.name = "dwmmc_starfive",
		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
		.of_match_table = dw_mci_starfive_match,
	},
};
module_platform_driver(dw_mci_starfive_driver);

MODULE_DESCRIPTION("StarFive JH7110 Specific DW-MSHC Driver Extension");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:dwmmc_starfive");

Annotation

Implementation Notes