#define SYSCTL_SRC (1 << 25)
#define SYSCTL_SRD (1 << 26)
+struct omap_hsmmc_plat {
+ struct mmc_config cfg;
+};
+
struct omap_hsmmc_data {
struct hsmmc *base_addr;
+#ifndef CONFIG_DM_MMC
struct mmc_config cfg;
+#endif
#ifdef OMAP_HSMMC_USE_GPIO
#ifdef CONFIG_DM_MMC
struct gpio_desc cd_gpio; /* Change Detect GPIO */
#else
return (struct omap_hsmmc_data *)mmc->priv;
#endif
+}
+static inline struct mmc_config *omap_hsmmc_get_cfg(struct mmc *mmc)
+{
+#ifdef CONFIG_DM_MMC
+ struct omap_hsmmc_plat *plat = dev_get_platdata(mmc->dev);
+ return &plat->cfg;
+#else
+ return &((struct omap_hsmmc_data *)mmc->priv)->cfg;
+#endif
}
#if defined(OMAP_HSMMC_USE_GPIO) && !defined(CONFIG_DM_MMC)
static unsigned char mmc_board_init(struct mmc *mmc)
{
#if defined(CONFIG_OMAP34XX)
+ struct mmc_config *cfg = omap_hsmmc_get_cfg(mmc);
t2_t *t2_base = (t2_t *)T2_BASE;
struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
u32 pbias_lite;
&t2_base->devconf1);
/* Change from default of 52MHz to 26MHz if necessary */
- if (!(mmc->cfg->host_caps & MMC_MODE_HS_52MHz))
+ if (!(cfg->host_caps & MMC_MODE_HS_52MHz))
writel(readl(&t2_base->ctl_prog_io1) & ~CTLPROGIO1SPEEDCTRL,
&t2_base->ctl_prog_io1);
static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
{
struct omap_hsmmc_data *priv = dev_get_priv(dev);
+ struct omap_hsmmc_plat *plat = dev_get_platdata(dev);
+ struct mmc_config *cfg = &plat->cfg;
const void *fdt = gd->fdt_blob;
int node = dev_of_offset(dev);
- struct mmc_config *cfg;
int val;
priv->base_addr = map_physmem(dev_get_addr(dev), sizeof(struct hsmmc *),
MAP_NOCACHE);
- cfg = &priv->cfg;
cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
val = fdtdec_get_int(fdt, node, "bus-width", -1);
static int omap_hsmmc_probe(struct udevice *dev)
{
+ struct omap_hsmmc_plat *plat = dev_get_platdata(dev);
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
struct omap_hsmmc_data *priv = dev_get_priv(dev);
- struct mmc_config *cfg;
+ struct mmc_config *cfg = &plat->cfg;
struct mmc *mmc;
- cfg = &priv->cfg;
cfg->name = "OMAP SD/MMC";
cfg->ops = &omap_hsmmc_ops;
.ofdata_to_platdata = omap_hsmmc_ofdata_to_platdata,
.probe = omap_hsmmc_probe,
.priv_auto_alloc_size = sizeof(struct omap_hsmmc_data),
+ .platdata_auto_alloc_size = sizeof(struct omap_hsmmc_plat),
};
#endif