p2sb_sandbox.c 727 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Sandbox P2SB for testing
  4. *
  5. * Copyright 2019 Google LLC
  6. */
  7. #define LOG_CATEGORY UCLASS_P2SB
  8. #include <common.h>
  9. #include <dm.h>
  10. #include <asm/io.h>
  11. #include <p2sb.h>
  12. struct sandbox_p2sb_priv {
  13. ulong base;
  14. };
  15. static int sandbox_p2sb_probe(struct udevice *dev)
  16. {
  17. struct p2sb_uc_priv *upriv = dev_get_uclass_priv(dev);
  18. upriv->mmio_base = dm_pci_read_bar32(dev, 0);
  19. return 0;
  20. }
  21. static const struct udevice_id sandbox_p2sb_ids[] = {
  22. { .compatible = "sandbox,p2sb" },
  23. { }
  24. };
  25. U_BOOT_DRIVER(p2sb_sandbox) = {
  26. .name = "p2sb_sandbox",
  27. .id = UCLASS_P2SB,
  28. .of_match = sandbox_p2sb_ids,
  29. .probe = sandbox_p2sb_probe,
  30. .priv_auto_alloc_size = sizeof(struct sandbox_p2sb_priv),
  31. };