blob: 541821743193537c497dcc90c59f33b06c1d95f2 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Thomas Choue51b65e2015-11-07 14:20:31 +08002/*
3 * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
Thomas Choue51b65e2015-11-07 14:20:31 +08004 */
5
6#include <common.h>
7#include <dm.h>
Miquel Raynalaa168ac2018-09-29 12:58:24 +02008#include <dm/device-internal.h>
Thomas Choue51b65e2015-11-07 14:20:31 +08009#include <errno.h>
10#include <mtd.h>
11
Miquel Raynalaa168ac2018-09-29 12:58:24 +020012/**
13 * mtd_probe - Probe the device @dev if not already done
14 *
15 * @dev: U-Boot device to probe
16 *
17 * @return 0 on success, an error otherwise.
18 */
19int mtd_probe(struct udevice *dev)
20{
21 if (device_active(dev))
22 return 0;
23
24 return device_probe(dev);
25}
26
Thomas Choue51b65e2015-11-07 14:20:31 +080027/*
28 * Implement a MTD uclass which should include most flash drivers.
29 * The uclass private is pointed to mtd_info.
30 */
31
32UCLASS_DRIVER(mtd) = {
33 .id = UCLASS_MTD,
34 .name = "mtd",
35 .per_device_auto_alloc_size = sizeof(struct mtd_info),
36};