sunxi: enable IOMMU support for Allwinner A523/H616
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -81,9 +81,21 @@ CONFIG_HOTPLUG_CORE_SYNC=y
|
|||||||
CONFIG_HOTPLUG_CORE_SYNC_DEAD=y
|
CONFIG_HOTPLUG_CORE_SYNC_DEAD=y
|
||||||
# CONFIG_HOTPLUG_PCI_PCIE is not set
|
# CONFIG_HOTPLUG_PCI_PCIE is not set
|
||||||
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
|
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
|
||||||
|
# CONFIG_IOMMUFD is not set
|
||||||
|
CONFIG_IOMMU_API=y
|
||||||
|
# CONFIG_IOMMU_DEBUGFS is not set
|
||||||
# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set
|
# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set
|
||||||
# CONFIG_IOMMU_DEFAULT_DMA_STRICT is not set
|
# CONFIG_IOMMU_DEFAULT_DMA_STRICT is not set
|
||||||
CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y
|
CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y
|
||||||
|
CONFIG_IOMMU_DMA=y
|
||||||
|
CONFIG_IOMMU_IOVA=y
|
||||||
|
CONFIG_IOMMU_IO_PGTABLE=y
|
||||||
|
# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set
|
||||||
|
# CONFIG_IOMMU_IO_PGTABLE_DART is not set
|
||||||
|
CONFIG_IOMMU_IO_PGTABLE_LPAE=y
|
||||||
|
# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set
|
||||||
|
CONFIG_IOMMU_SUPPORT=y
|
||||||
|
CONFIG_IRQ_MSI_IOMMU=y
|
||||||
CONFIG_IRQ_MSI_LIB=y
|
CONFIG_IRQ_MSI_LIB=y
|
||||||
CONFIG_LEGACY_DIRECT_IO=y
|
CONFIG_LEGACY_DIRECT_IO=y
|
||||||
CONFIG_LRU_GEN_WALKS_MMU=y
|
CONFIG_LRU_GEN_WALKS_MMU=y
|
||||||
@@ -97,6 +109,7 @@ CONFIG_MUSB_PIO_ONLY=y
|
|||||||
CONFIG_NEED_SG_DMA_LENGTH=y
|
CONFIG_NEED_SG_DMA_LENGTH=y
|
||||||
CONFIG_NOP_USB_XCEIV=y
|
CONFIG_NOP_USB_XCEIV=y
|
||||||
CONFIG_NO_IOPORT_MAP=y
|
CONFIG_NO_IOPORT_MAP=y
|
||||||
|
CONFIG_OF_IOMMU=y
|
||||||
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
|
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
|
||||||
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
|
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
|
||||||
CONFIG_PARTITION_PERCPU=y
|
CONFIG_PARTITION_PERCPU=y
|
||||||
@@ -170,6 +183,10 @@ CONFIG_TOOLS_SUPPORT_RELR=y
|
|||||||
CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y
|
CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y
|
||||||
# CONFIG_UACCE is not set
|
# CONFIG_UACCE is not set
|
||||||
CONFIG_UNMAP_KERNEL_AT_EL0=y
|
CONFIG_UNMAP_KERNEL_AT_EL0=y
|
||||||
|
CONFIG_USB_DWC3=y
|
||||||
|
CONFIG_USB_DWC3_DUAL_ROLE=y
|
||||||
|
# CONFIG_USB_DWC3_HOST is not set
|
||||||
|
# CONFIG_USB_DWC3_GADGET is not set
|
||||||
CONFIG_USB_MUSB_DUAL_ROLE=y
|
CONFIG_USB_MUSB_DUAL_ROLE=y
|
||||||
CONFIG_USB_MUSB_HDRC=y
|
CONFIG_USB_MUSB_HDRC=y
|
||||||
CONFIG_USB_MUSB_SUNXI=y
|
CONFIG_USB_MUSB_SUNXI=y
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ Signed-off-by: Marvin Wewer <mwewer37@proton.me>
|
|||||||
+#endif
|
+#endif
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/drivers/iommu/sun55i-iommu.c
|
+++ b/drivers/iommu/sun55i-iommu.c
|
||||||
@@ -0,0 +1,1604 @@
|
@@ -0,0 +1,1606 @@
|
||||||
+/* SPDX-License-Identifier: GPL-2.0-or-later */
|
+/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
+/* Copyright(c) 2020 - 2023 Allwinner Technology Co.,Ltd. All rights reserved. */
|
+/* Copyright(c) 2020 - 2023 Allwinner Technology Co.,Ltd. All rights reserved. */
|
||||||
+/*******************************************************************************
|
+/*******************************************************************************
|
||||||
@@ -1358,8 +1358,7 @@ Signed-off-by: Marvin Wewer <mwewer37@proton.me>
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int sun55i_iommu_attach_dev(struct iommu_domain *domain,
|
+static int sun55i_iommu_attach_dev(struct iommu_domain *domain,
|
||||||
+ struct device *dev,
|
+ struct device *dev)
|
||||||
+ struct iommu_domain *old_domain)
|
|
||||||
+{
|
+{
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
@@ -1369,8 +1368,9 @@ Signed-off-by: Marvin Wewer <mwewer37@proton.me>
|
|||||||
+ struct sunxi_iommu_owner *owner = dev_iommu_priv_get(dev);
|
+ struct sunxi_iommu_owner *owner = dev_iommu_priv_get(dev);
|
||||||
+
|
+
|
||||||
+ WARN(!dev->dma_mask || *dev->dma_mask == 0, "NULL or 0 dma mask will fail iommu setup\n");
|
+ WARN(!dev->dma_mask || *dev->dma_mask == 0, "NULL or 0 dma mask will fail iommu setup\n");
|
||||||
|
+ iommu_setup_dma_ops(dev);
|
||||||
+
|
+
|
||||||
+ sun55i_enable_device_iommu(owner->data, owner->tlbid, owner->flag);
|
+ sun55i_enable_device_iommu(owner->data, owner->tlbid, owner->flag);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static struct iommu_device *sun55i_iommu_probe_device(struct device *dev)
|
+static struct iommu_device *sun55i_iommu_probe_device(struct device *dev)
|
||||||
@@ -1753,6 +1753,8 @@ Signed-off-by: Marvin Wewer <mwewer37@proton.me>
|
|||||||
+ sunxi_iommu_read(iommu, IOMMU_PMU_ML_REG6);
|
+ sunxi_iommu_read(iommu, IOMMU_PMU_ML_REG6);
|
||||||
+
|
+
|
||||||
+ spin_unlock(&iommu->iommu_lock);
|
+ spin_unlock(&iommu->iommu_lock);
|
||||||
|
+err:
|
||||||
|
+ return 0;
|
||||||
+
|
+
|
||||||
+ len = scnprintf(
|
+ len = scnprintf(
|
||||||
+ buf, PAGE_SIZE,
|
+ buf, PAGE_SIZE,
|
||||||
|
|||||||
+1
-3
@@ -4,7 +4,6 @@ Date: Sun, 11 Jan 2026 12:11:10 +0000
|
|||||||
Subject: arm64: dts: allwinner: a527-cubie-a5e: enable PCIe/USB-C combophy
|
Subject: arm64: dts: allwinner: a527-cubie-a5e: enable PCIe/USB-C combophy
|
||||||
|
|
||||||
Signed-off-by: Marvin Wewer <mwewer37@proton.me>
|
Signed-off-by: Marvin Wewer <mwewer37@proton.me>
|
||||||
---
|
|
||||||
---
|
---
|
||||||
arch/arm64/boot/dts/allwinner/sun55i-a527-cubie-a5e.dts | 58 ++++++++++
|
arch/arm64/boot/dts/allwinner/sun55i-a527-cubie-a5e.dts | 58 ++++++++++
|
||||||
1 file changed, 58 insertions(+)
|
1 file changed, 58 insertions(+)
|
||||||
@@ -51,7 +50,7 @@ Signed-off-by: Marvin Wewer <mwewer37@proton.me>
|
|||||||
};
|
};
|
||||||
|
|
||||||
&cpu0 {
|
&cpu0 {
|
||||||
@@ -430,3 +463,28 @@
|
@@ -430,3 +463,27 @@
|
||||||
usb1_vbus-supply = <®_usb_vbus>;
|
usb1_vbus-supply = <®_usb_vbus>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
@@ -79,4 +78,3 @@ Signed-off-by: Marvin Wewer <mwewer37@proton.me>
|
|||||||
+ wakeup-source;
|
+ wakeup-source;
|
||||||
+ status = "okay";
|
+ status = "okay";
|
||||||
+};
|
+};
|
||||||
+
|
|
||||||
|
|||||||
Reference in New Issue
Block a user