mtd-uclass.c 700 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
  4. */
  5. #include <common.h>
  6. #include <dm.h>
  7. #include <dm/device-internal.h>
  8. #include <errno.h>
  9. #include <mtd.h>
  10. /**
  11. * mtd_probe - Probe the device @dev if not already done
  12. *
  13. * @dev: U-Boot device to probe
  14. *
  15. * @return 0 on success, an error otherwise.
  16. */
  17. int mtd_probe(struct udevice *dev)
  18. {
  19. if (device_active(dev))
  20. return 0;
  21. return device_probe(dev);
  22. }
  23. /*
  24. * Implement a MTD uclass which should include most flash drivers.
  25. * The uclass private is pointed to mtd_info.
  26. */
  27. UCLASS_DRIVER(mtd) = {
  28. .id = UCLASS_MTD,
  29. .name = "mtd",
  30. .per_device_auto_alloc_size = sizeof(struct mtd_info),
  31. };