cache-uclass.c 791 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2019 Intel Corporation <www.intel.com>
  4. */
  5. #define LOG_CATEGORY UCLASS_CACHE
  6. #include <common.h>
  7. #include <cache.h>
  8. #include <dm.h>
  9. int cache_get_info(struct udevice *dev, struct cache_info *info)
  10. {
  11. struct cache_ops *ops = cache_get_ops(dev);
  12. if (!ops->get_info)
  13. return -ENOSYS;
  14. return ops->get_info(dev, info);
  15. }
  16. int cache_enable(struct udevice *dev)
  17. {
  18. struct cache_ops *ops = cache_get_ops(dev);
  19. if (!ops->enable)
  20. return -ENOSYS;
  21. return ops->enable(dev);
  22. }
  23. int cache_disable(struct udevice *dev)
  24. {
  25. struct cache_ops *ops = cache_get_ops(dev);
  26. if (!ops->disable)
  27. return -ENOSYS;
  28. return ops->disable(dev);
  29. }
  30. UCLASS_DRIVER(cache) = {
  31. .id = UCLASS_CACHE,
  32. .name = "cache",
  33. .post_bind = dm_scan_fdt_dev,
  34. };