dm: mmc: Check that drivers have operations

When binding a new MMC device, make sure that it has the required
operations. Since for now we still support *not* having the operations
(with CONFIG_DM_MMC_OPS not enabled) it makes sense to add this check.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2017-04-23 20:02:09 -06:00
parent e48eeb9ea3
commit 66656020ff

View File

@ -196,6 +196,10 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
struct udevice *bdev;
int ret, devnum = -1;
#ifdef CONFIG_DM_MMC_OPS
if (!mmc_get_ops(dev))
return -ENOSYS;
#endif
#ifndef CONFIG_SPL_BUILD
/* Use the fixed index with aliase node's index */
fdtdec_get_alias_seq(gd->fdt_blob, "mmc", dev_of_offset(dev), &devnum);