1 /* 2 * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw> 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <common.h> 8 #include <dm.h> 9 #include <dm/device-internal.h> 10 #include <errno.h> 11 #include <mtd.h> 12 13 /** 14 * mtd_probe - Probe the device @dev if not already done 15 * 16 * @dev: U-Boot device to probe 17 * 18 * @return 0 on success, an error otherwise. 19 */ mtd_probe(struct udevice * dev)20int mtd_probe(struct udevice *dev) 21 { 22 if (device_active(dev)) 23 return 0; 24 25 return device_probe(dev); 26 } 27 28 /* 29 * Implement a MTD uclass which should include most flash drivers. 30 * The uclass private is pointed to mtd_info. 31 */ 32 33 UCLASS_DRIVER(mtd) = { 34 .id = UCLASS_MTD, 35 .name = "mtd", 36 .per_device_auto_alloc_size = sizeof(struct mtd_info), 37 }; 38