Simon Glass | f8b4a29 | 2022-04-24 23:31:14 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
Simon Glass | 4157158 | 2023-07-12 09:04:32 -0600 | [diff] [blame] | 3 | * Bootdev for MMC |
Simon Glass | f8b4a29 | 2022-04-24 23:31:14 -0600 | [diff] [blame] | 4 | * |
| 5 | * Copyright 2021 Google LLC |
| 6 | * Written by Simon Glass <sjg@chromium.org> |
| 7 | */ |
| 8 | |
Simon Glass | f8b4a29 | 2022-04-24 23:31:14 -0600 | [diff] [blame] | 9 | #include <bootdev.h> |
| 10 | #include <dm.h> |
| 11 | #include <mmc.h> |
| 12 | |
Simon Glass | f8b4a29 | 2022-04-24 23:31:14 -0600 | [diff] [blame] | 13 | static int mmc_bootdev_bind(struct udevice *dev) |
| 14 | { |
| 15 | struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev); |
| 16 | |
Simon Glass | 7e1f6a4 | 2023-01-17 10:48:08 -0700 | [diff] [blame] | 17 | ucp->prio = BOOTDEVP_2_INTERNAL_FAST; |
Simon Glass | f8b4a29 | 2022-04-24 23:31:14 -0600 | [diff] [blame] | 18 | |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | struct bootdev_ops mmc_bootdev_ops = { |
Simon Glass | f8b4a29 | 2022-04-24 23:31:14 -0600 | [diff] [blame] | 23 | }; |
| 24 | |
| 25 | static const struct udevice_id mmc_bootdev_ids[] = { |
| 26 | { .compatible = "u-boot,bootdev-mmc" }, |
| 27 | { } |
| 28 | }; |
| 29 | |
| 30 | U_BOOT_DRIVER(mmc_bootdev) = { |
| 31 | .name = "mmc_bootdev", |
| 32 | .id = UCLASS_BOOTDEV, |
| 33 | .ops = &mmc_bootdev_ops, |
| 34 | .bind = mmc_bootdev_bind, |
| 35 | .of_match = mmc_bootdev_ids, |
| 36 | }; |
Simon Glass | df71f26 | 2023-01-17 10:47:38 -0700 | [diff] [blame] | 37 | |
| 38 | BOOTDEV_HUNTER(mmc_bootdev_hunter) = { |
Simon Glass | 7e1f6a4 | 2023-01-17 10:48:08 -0700 | [diff] [blame] | 39 | .prio = BOOTDEVP_2_INTERNAL_FAST, |
Simon Glass | df71f26 | 2023-01-17 10:47:38 -0700 | [diff] [blame] | 40 | .uclass = UCLASS_MMC, |
| 41 | .drv = DM_DRIVER_REF(mmc_bootdev), |
| 42 | }; |