[PATCH master 2/2] ARM: Layerscape: icid: fixup ICID also for new fsl,ls1028a-dwc3 compat

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Feb 25 07:28:30 PST 2026


Newer kernel device trees no longer have the snps,dwc3 compatible we
match against, but instead have fsl,ls1028a-dwc3.

Adapt the code to match against both as we don't know beforehand what
flavor the kernel device tree will have.

Fixes: ea73c9d2c24e ("Revert "ARM64: dts: Layerscape: workaround v6.19-rc1 DT sync DWC3 breakage"")
Fixes: a3bf6c16f77d ("dts: update to v6.19-rc1")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/mach-layerscape/icid.c | 47 +++++++++++++++++++++------------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-layerscape/icid.c b/arch/arm/mach-layerscape/icid.c
index ebe3896075b7..2cdeaa3a8bca 100644
--- a/arch/arm/mach-layerscape/icid.c
+++ b/arch/arm/mach-layerscape/icid.c
@@ -63,6 +63,7 @@
 
 struct icid_id_table {
 	const char *compat;
+	const char *alt_compat;
 	u32 id;
 	u32 reg;
 	phys_addr_t compat_addr;
@@ -93,6 +94,27 @@ static phandle of_get_iommu_handle(struct device_node *root)
 	return of_node_create_phandle(iommu);
 }
 
+static bool of_fixup_icid_node(struct device_node *root, phandle iommu_handle,
+			       const struct icid_id_table *icid,
+			       const char *compat)
+{
+	struct device_node *np;
+
+	for_each_compatible_node_from(np, root, NULL, compat) {
+		struct resource res;
+
+		if (of_address_to_resource(np, 0, &res))
+			continue;
+
+		if (res.start == icid->compat_addr) {
+			of_set_iommu_prop(np, iommu_handle, icid->id);
+			return true;
+		}
+	}
+
+	return false;
+}
+
 static int of_fixup_icid(struct device_node *root, phandle iommu_handle,
 			 const struct icid_id_table *icid_table, int num_icid)
 {
@@ -100,22 +122,13 @@ static int of_fixup_icid(struct device_node *root, phandle iommu_handle,
 
 	for (i = 0; i < num_icid; i++) {
 		const struct icid_id_table *icid = &icid_table[i];
-		struct device_node *np;
 
 		if (!icid->compat)
 			continue;
 
-		for_each_compatible_node_from(np, root, NULL, icid->compat) {
-			struct resource res;
-
-			if (of_address_to_resource(np, 0, &res))
-				continue;
-
-			if (res.start == icid->compat_addr) {
-				of_set_iommu_prop(np, iommu_handle, icid->id);
-				break;
-			}
-		}
+		if (!of_fixup_icid_node(root, iommu_handle, icid, icid->compat)
+		    && icid->alt_compat)
+			of_fixup_icid_node(root, iommu_handle, icid, icid->alt_compat);
 	}
 
 	return 0;
@@ -168,19 +181,19 @@ static const struct icid_id_table icid_tbl_ls1046a[] = {
 		.compat_addr = LSCH2_ESDHC_ADDR,
 		.reg_addr = offsetof(struct ccsr_scfg, sdhc_icid) + LSCH2_SCFG_ADDR,
 	}, {
-		.compat = "snps,dwc3",
+		.compat = "fsl,ls1028a-dwc3", .alt_compat = "snps,dwc3",
 		.id = FSL_USB1_STREAM_ID,
 		.reg = (((FSL_USB1_STREAM_ID) << 24) | (1 << 23)),
 		.compat_addr = LSCH2_XHCI_USB1_ADDR,
 		.reg_addr = offsetof(struct ccsr_scfg, usb1_icid) + LSCH2_SCFG_ADDR,
 	}, {
-		.compat = "snps,dwc3",
+		.compat = "fsl,ls1028a-dwc3", .alt_compat = "snps,dwc3",
 		.id = FSL_USB2_STREAM_ID,
 		.reg = (((FSL_USB2_STREAM_ID) << 24) | (1 << 23)),
 		.compat_addr = LSCH2_XHCI_USB2_ADDR,
 		.reg_addr = offsetof(struct ccsr_scfg, usb2_icid) + LSCH2_SCFG_ADDR,
 	}, {
-		.compat = "snps,dwc3",
+		.compat = "fsl,ls1028a-dwc3", .alt_compat = "snps,dwc3",
 		.id = FSL_USB3_STREAM_ID,
 		.reg = (((FSL_USB3_STREAM_ID) << 24) | (1 << 23)),
 		.compat_addr = LSCH2_XHCI_USB3_ADDR,
@@ -584,13 +597,13 @@ void ls1046a_setup_icids(void)
 
 static const struct icid_id_table icid_tbl_ls1028a[] = {
 	{
-		.compat = "snps,dwc3",
+		.compat = "fsl,ls1028a-dwc3", .alt_compat = "snps,dwc3",
 		.id = 1,
 		.reg = 1,
 		.compat_addr = LSCH3_XHCI_USB1_ADDR,
 		.reg_addr = offsetof(struct lsch3_ccsr_gur, usb1_amqr) + LSCH3_GUTS_ADDR,
 	}, {
-		.compat = "snps,dwc3",
+		.compat = "fsl,ls1028a-dwc3", .alt_compat = "snps,dwc3",
 		.id = 2,
 		.reg = 2,
 		.compat_addr = LSCH3_XHCI_USB2_ADDR,
-- 
2.47.3




More information about the barebox mailing list