mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 2/2] ARM: Layerscape: icid: fixup ICID also for new fsl,ls1028a-dwc3 compat
Date: Wed, 25 Feb 2026 16:28:30 +0100	[thread overview]
Message-ID: <20260225152832.446129-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260225152832.446129-1-a.fatoum@pengutronix.de>

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@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




  reply	other threads:[~2026-02-25 15:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 15:28 [PATCH master 1/2] ARM: Layerscape: LS1046: re-enable USB bus snooping Ahmad Fatoum
2026-02-25 15:28 ` Ahmad Fatoum [this message]
2026-02-26 12:01 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260225152832.446129-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox