The ICID check the USB controllers as "snps,dwc3" to add
their "iommus" property to the device tree passed to the OS/Linux.
The upstream Layerscape device trees imported since v6.19 (dts/upstream)
described these controllers as "fsl,<soc>-dwc3", "fsl,ls1028a-dwc3"
instead, since the Linux commit
7b204755ebc2 ("arm64: dts: layerscape: add dma-coherent for usb node"),
so on LX2160A boards, it fails:
WARNING could not find node snps,dwc3: FDT_ERR_NOTFOUND.
WARNING could not find node snps,dwc3: FDT_ERR_NOTFOUND.
The tables cannot simply switch to the new name: older device trees
still use "snps,dwc3" and carry no "iommus" property of their own.
So, let's keep "snps,dwc3" and, when it finds nothing,
then retry with "fsl,ls1028a-dwc3", which every newer
Layerscape USB node lists.
The stream IDs themselves are programmed by set_icids(), which does
not use the compatible, so the hardware setup is unchanged.
Signed-off-by: Vincent Jardin <[email protected]>
---
arch/arm/cpu/armv8/fsl-layerscape/icid.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/icid.c
b/arch/arm/cpu/armv8/fsl-layerscape/icid.c
index aa0af077d2f..9b6d5225799 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/icid.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/icid.c
@@ -5,6 +5,7 @@
#include <config.h>
#include <linux/libfdt.h>
+#include <linux/string.h>
#include <fdt_support.h>
#include <asm/io.h>
@@ -71,6 +72,19 @@ int fdt_set_iommu_prop(void *blob, int off, int smmu_ph, u32
*ids, int num_ids)
return 0;
}
+static int fdt_icid_node_offset(void *blob, struct icid_id_table *entry)
+{
+ int off;
+
+ off = fdt_node_offset_by_compat_reg(blob, entry->compat,
+ entry->compat_addr);
+ if (off < 0 && !strcmp(entry->compat, "snps,dwc3"))
+ off = fdt_node_offset_by_compat_reg(blob, "fsl,ls1028a-dwc3",
+ entry->compat_addr);
+
+ return off;
+}
+
static int fdt_fixup_icid_tbl(void *blob, int smmu_ph,
struct icid_id_table *tbl, int size)
{
@@ -80,9 +94,7 @@ static int fdt_fixup_icid_tbl(void *blob, int smmu_ph,
if (!tbl[i].compat)
continue;
- off = fdt_node_offset_by_compat_reg(blob,
- tbl[i].compat,
- tbl[i].compat_addr);
+ off = fdt_icid_node_offset(blob, &tbl[i]);
if (off > 0) {
err = fdt_set_iommu_prop(blob, off, smmu_ph,
&tbl[i].id, 1);
---
base-commit: a06e89ab05eaa2b8344d521319399333cd760ae5
branch: for-upstream/layerscape-icid-dwc3-v1
--
2.43.0