mmc_bootdev.c 833 B

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