1 /* 2 * Copyright (C) 2015 Google, Inc 3 * Written by Simon Glass <sjg@chromium.org> 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #include <common.h> 9 #include <mmc.h> 10 #include <dm.h> 11 #include <dm/lists.h> 12 #include <dm/root.h> 13 14 struct mmc *mmc_get_mmc_dev(struct udevice *dev) 15 { 16 struct mmc_uclass_priv *upriv; 17 18 if (!device_active(dev)) 19 return NULL; 20 upriv = dev_get_uclass_priv(dev); 21 return upriv->mmc; 22 } 23 24 U_BOOT_DRIVER(mmc) = { 25 .name = "mmc", 26 .id = UCLASS_MMC, 27 }; 28 29 UCLASS_DRIVER(mmc) = { 30 .id = UCLASS_MMC, 31 .name = "mmc", 32 .flags = DM_UC_FLAG_SEQ_ALIAS, 33 .per_device_auto_alloc_size = sizeof(struct mmc_uclass_priv), 34 }; 35