1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright 2021 Google LLC
6 * Written by Simon Glass <sjg@chromium.org>
14 static int mmc_get_bootflow(struct udevice *dev, struct bootflow_iter *iter,
15 struct bootflow *bflow)
17 struct udevice *mmc_dev = dev_get_parent(dev);
21 ret = mmc_get_blk(mmc_dev, &blk);
23 * If there is no media, indicate that no more partitions should be
26 if (ret == -EOPNOTSUPP)
29 return log_msg_ret("blk", ret);
31 ret = bootdev_find_in_blk(dev, blk, iter, bflow);
33 return log_msg_ret("find", ret);
38 static int mmc_bootdev_bind(struct udevice *dev)
40 struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev);
42 ucp->prio = BOOTDEVP_0_INTERNAL_FAST;
47 struct bootdev_ops mmc_bootdev_ops = {
48 .get_bootflow = mmc_get_bootflow,
51 static const struct udevice_id mmc_bootdev_ids[] = {
52 { .compatible = "u-boot,bootdev-mmc" },
56 U_BOOT_DRIVER(mmc_bootdev) = {
57 .name = "mmc_bootdev",
59 .ops = &mmc_bootdev_ops,
60 .bind = mmc_bootdev_bind,
61 .of_match = mmc_bootdev_ids,