ohci-pci.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2019
  4. * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  5. *
  6. */
  7. #include <common.h>
  8. #include <dm.h>
  9. #include <errno.h>
  10. #include <pci.h>
  11. #include <usb.h>
  12. #include <asm/io.h>
  13. #include "ohci.h"
  14. static int ohci_pci_probe(struct udevice *dev)
  15. {
  16. struct ohci_regs *regs;
  17. regs = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
  18. return ohci_register(dev, regs);
  19. }
  20. static int ohci_pci_remove(struct udevice *dev)
  21. {
  22. return ohci_deregister(dev);
  23. }
  24. static const struct udevice_id ohci_pci_ids[] = {
  25. { .compatible = "ohci-pci" },
  26. { }
  27. };
  28. U_BOOT_DRIVER(ohci_pci) = {
  29. .name = "ohci_pci",
  30. .id = UCLASS_USB,
  31. .probe = ohci_pci_probe,
  32. .remove = ohci_pci_remove,
  33. .of_match = ohci_pci_ids,
  34. .ops = &ohci_usb_ops,
  35. .platdata_auto_alloc_size = sizeof(struct usb_platdata),
  36. .priv_auto_alloc_size = sizeof(ohci_t),
  37. .flags = DM_FLAG_ALLOC_PRIV_DMA,
  38. };
  39. static struct pci_device_id ohci_pci_supported[] = {
  40. { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_OHCI, ~0) },
  41. {},
  42. };
  43. U_BOOT_PCI_DEVICE(ohci_pci, ohci_pci_supported);