mmc: dw_mmc: Introduce dw_mci_alloc_host()

This helper is used for variant drivers to allocate struct dw_mci
and set struct dw_mci as private data of struct mmc_host.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Shawn Lin 2025-12-20 13:22:05 +08:00 committed by Ulf Hansson
parent 3449b31eb1
commit c72be4c306
2 changed files with 18 additions and 0 deletions

View File

@ -3258,6 +3258,23 @@ static void dw_mci_enable_cd(struct dw_mci *host)
}
}
struct dw_mci *dw_mci_alloc_host(struct device *dev)
{
struct mmc_host *mmc;
struct dw_mci *host;
mmc = devm_mmc_alloc_host(dev, sizeof(struct dw_mci));
if (!mmc)
return ERR_PTR(-ENOMEM);
host = mmc_priv(mmc);
host->mmc = mmc;
host->dev = dev;
return host;
}
EXPORT_SYMBOL(dw_mci_alloc_host);
int dw_mci_probe(struct dw_mci *host)
{
const struct dw_mci_drv_data *drv_data = host->drv_data;

View File

@ -544,6 +544,7 @@ static inline void mci_fifo_l_writeq(void __iomem *addr, u64 value)
#define __raw_readq(__reg) (*(volatile u64 __force *)(__reg))
#endif
extern struct dw_mci *dw_mci_alloc_host(struct device *device);
extern int dw_mci_probe(struct dw_mci *host);
extern void dw_mci_remove(struct dw_mci *host);
#ifdef CONFIG_PM