[PATCH v2 0/9] Apple PCIe/XHCI support

Mark Kettenis kettenis at openbsd.org
Sat Jan 21 20:27:51 CET 2023


This series adds support for the PCIe controller found on Apple M1 and
M2 machines and enables support for PCIe XHCI controllers.  This makes
the type-A USB ports on the M1 Mac mini work.  Since the use of Apples
DART IOMMU is mandatory (these PCIe DARTs don't support bypass mode),
this adds DMA mapping operations to the IOMMU uclass and implements
them for the Apple DART.  It modifies the XHCI driver code to go map
DMA buffers through the IOMMU if there is one.  Since the M1 Mac mini
now has two types of XHCI controllers with different number of ports
(2 for the DWC3 controllers, 8 for the Fresco Logic PCIe controller)
this uncovered an issue in with the way the hub descriptor is
implemented in the XHCI driver.


ChangeLog:

v2: - Add test for new operations and PCI IOMMU mapping


Mark Kettenis (9):
  iommu: Add DMA mapping operations
  test: Add test for IOMMU uclass map/unmap ops
  iommu: apple: Implement DMA mapping operations for Apple DART
  usb: xhci: Implement DMA mapping
  iommu: Implement mapping IOMMUs for PCI devices
  test: Add test for mapping IOMMUs for PCI devices
  pci: Add Apple PCIe controller driver
  arm: apple: Enable PCIe USB controller
  usb: xhci: Fix root hub descriptor

 MAINTAINERS                   |   1 +
 arch/arm/Kconfig              |   2 +
 arch/sandbox/dts/test.dts     |   2 +
 configs/apple_m1_defconfig    |   1 +
 drivers/iommu/apple_dart.c    | 311 +++++++++++++++++++++++++----
 drivers/iommu/iommu-uclass.c  |  93 +++++++++
 drivers/iommu/sandbox_iommu.c |  58 ++++++
 drivers/pci/Kconfig           |   9 +
 drivers/pci/Makefile          |   1 +
 drivers/pci/pcie_apple.c      | 354 ++++++++++++++++++++++++++++++++++
 drivers/usb/host/xhci-mem.c   |  84 +++++---
 drivers/usb/host/xhci-ring.c  |  76 +++++---
 drivers/usb/host/xhci.c       |  25 +--
 include/dm/device.h           |   3 +
 include/iommu.h               |  24 +++
 include/usb/xhci.h            |  28 ++-
 test/dm/iommu.c               |  74 ++++++-
 17 files changed, 1037 insertions(+), 109 deletions(-)
 create mode 100644 drivers/pci/pcie_apple.c

-- 
2.39.0



More information about the U-Boot mailing list