blob: 55ecead2ddf9a32fad67e27d7199c986eec1f043 [file] [log] [blame]
Simon Glassb8aa4632022-04-24 23:31:14 -06001// SPDX-License-Identifier: GPL-2.0+
2/*
Simon Glass4de979f2023-07-12 09:04:32 -06003 * Bootdev for MMC
Simon Glassb8aa4632022-04-24 23:31:14 -06004 *
5 * Copyright 2021 Google LLC
6 * Written by Simon Glass <sjg@chromium.org>
7 */
8
9#include <common.h>
10#include <bootdev.h>
11#include <dm.h>
12#include <mmc.h>
13
Simon Glassb8aa4632022-04-24 23:31:14 -060014static int mmc_bootdev_bind(struct udevice *dev)
15{
16 struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev);
17
Simon Glasseacc2612023-01-17 10:48:08 -070018 ucp->prio = BOOTDEVP_2_INTERNAL_FAST;
Simon Glassb8aa4632022-04-24 23:31:14 -060019
20 return 0;
21}
22
23struct bootdev_ops mmc_bootdev_ops = {
Simon Glassb8aa4632022-04-24 23:31:14 -060024};
25
26static const struct udevice_id mmc_bootdev_ids[] = {
27 { .compatible = "u-boot,bootdev-mmc" },
28 { }
29};
30
31U_BOOT_DRIVER(mmc_bootdev) = {
32 .name = "mmc_bootdev",
33 .id = UCLASS_BOOTDEV,
34 .ops = &mmc_bootdev_ops,
35 .bind = mmc_bootdev_bind,
36 .of_match = mmc_bootdev_ids,
37};
Simon Glass843160f2023-01-17 10:47:38 -070038
39BOOTDEV_HUNTER(mmc_bootdev_hunter) = {
Simon Glasseacc2612023-01-17 10:48:08 -070040 .prio = BOOTDEVP_2_INTERNAL_FAST,
Simon Glass843160f2023-01-17 10:47:38 -070041 .uclass = UCLASS_MMC,
42 .drv = DM_DRIVER_REF(mmc_bootdev),
43};