mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-04 05:50:17 +00:00 
			
		
		
		
	Add basic support for MMC, providing a uclass which can set up an MMC device. This allows MMC drivers to move to using driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
		
			
				
	
	
		
			35 lines
		
	
	
		
			628 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			628 B
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * Copyright (C) 2015 Google, Inc
 | 
						|
 * Written by Simon Glass <sjg@chromium.org>
 | 
						|
 *
 | 
						|
 * SPDX-License-Identifier:	GPL-2.0+
 | 
						|
 */
 | 
						|
 | 
						|
#include <common.h>
 | 
						|
#include <mmc.h>
 | 
						|
#include <dm.h>
 | 
						|
#include <dm/lists.h>
 | 
						|
#include <dm/root.h>
 | 
						|
 | 
						|
struct mmc *mmc_get_mmc_dev(struct udevice *dev)
 | 
						|
{
 | 
						|
	struct mmc_uclass_priv *upriv;
 | 
						|
 | 
						|
	if (!device_active(dev))
 | 
						|
		return NULL;
 | 
						|
	upriv = dev_get_uclass_priv(dev);
 | 
						|
	return upriv->mmc;
 | 
						|
}
 | 
						|
 | 
						|
U_BOOT_DRIVER(mmc) = {
 | 
						|
	.name	= "mmc",
 | 
						|
	.id	= UCLASS_MMC,
 | 
						|
};
 | 
						|
 | 
						|
UCLASS_DRIVER(mmc) = {
 | 
						|
	.id		= UCLASS_MMC,
 | 
						|
	.name		= "mmc",
 | 
						|
	.flags		= DM_UC_FLAG_SEQ_ALIAS,
 | 
						|
	.per_device_auto_alloc_size = sizeof(struct mmc_uclass_priv),
 | 
						|
};
 |