sandbox_adder.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Sandbox adder for p2sb testing
  4. *
  5. * Copyright 2019 Google LLC
  6. */
  7. #define LOG_CATEGORY UCLASS_MISC
  8. #include <common.h>
  9. #include <axi.h>
  10. #include <dm.h>
  11. #include <misc.h>
  12. #include <p2sb.h>
  13. #include <asm/io.h>
  14. struct sandbox_adder_priv {
  15. ulong base;
  16. };
  17. int sandbox_adder_read(struct udevice *dev, ulong address, void *data,
  18. enum axi_size_t size)
  19. {
  20. struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
  21. u32 *val = data;
  22. *val = pplat->pid << 24 | address;
  23. return 0;
  24. }
  25. int sandbox_adder_write(struct udevice *dev, ulong address, void *data,
  26. enum axi_size_t size)
  27. {
  28. return 0;
  29. }
  30. static int sandbox_adder_probe(struct udevice *dev)
  31. {
  32. return 0;
  33. }
  34. static struct axi_ops sandbox_adder_ops = {
  35. .read = sandbox_adder_read,
  36. .write = sandbox_adder_write,
  37. };
  38. static const struct udevice_id sandbox_adder_ids[] = {
  39. { .compatible = "sandbox,adder" },
  40. { }
  41. };
  42. U_BOOT_DRIVER(adder_sandbox) = {
  43. .name = "sandbox_adder",
  44. .id = UCLASS_AXI,
  45. .of_match = sandbox_adder_ids,
  46. .probe = sandbox_adder_probe,
  47. .ops = &sandbox_adder_ops,
  48. .priv_auto = sizeof(struct sandbox_adder_priv),
  49. };