diff mbox series

[RESEND] u-boot: fixup the iommu-map property of fsl-mc node

Message ID 1537867699-22737-1-git-send-email-nipun.gupta@nxp.com
State Accepted
Commit a78df40cbabe2cb96e0d2fc18a64759302f9e809
Headers show
Series [RESEND] u-boot: fixup the iommu-map property of fsl-mc node | expand

Commit Message

Nipun Gupta Sept. 25, 2018, 9:28 a.m. UTC
The iommu-map property in the fsl-mc node is updated by
valid stream-ids by u-boot. This patch is to fixup this
property for LS208x and LS1088.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
This patch fixes iommu-map property added for fsl-mc in kernel patch
series: https://patchwork.kernel.org/patch/10594185/
Kernel patch series is accepted and would be available in kernel 4.20.

This patch is backward compatible and have only a debug log if the property
is not found in kernel.

 .../asm/arch-fsl-layerscape/stream_id_lsch3.h      |  3 ++
 board/freescale/ls1088a/ls1088a.c                  |  2 ++
 board/freescale/ls2080a/ls2080a.c                  |  2 ++
 board/freescale/ls2080aqds/ls2080aqds.c            |  2 ++
 board/freescale/ls2080ardb/ls2080ardb.c            |  2 ++
 drivers/net/fsl-mc/mc.c                            | 34 ++++++++++++++++++++++
 include/fsl-mc/fsl_mc.h                            |  1 +
 7 files changed, 46 insertions(+)

Comments

York Sun Sept. 26, 2018, 5:54 p.m. UTC | #1
On 09/25/2018 02:23 AM, Nipun Gupta wrote:
> The iommu-map property in the fsl-mc node is updated by
> valid stream-ids by u-boot. This patch is to fixup this
> property for LS208x and LS1088.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
> This patch fixes iommu-map property added for fsl-mc in kernel patch
> series: https://patchwork.kernel.org/patch/10594185/
> Kernel patch series is accepted and would be available in kernel 4.20.
> 
> This patch is backward compatible and have only a debug log if the property
> is not found in kernel.

Why did you send it again? This one
http://patchwork.ozlabs.org/patch/959615/ is already under review.
Please check patchwork before you do this next time.

York
Nipun Gupta Sept. 27, 2018, 4:07 a.m. UTC | #2
> -----Original Message-----
> From: York Sun
> Sent: Wednesday, September 26, 2018 11:24 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>; u-boot@lists.denx.de
> Cc: albert.u.boot@aribaud.net; Prabhakar Kushwaha
> <prabhakar.kushwaha@nxp.com>; Ashish Kumar <ashish.kumar@nxp.com>;
> Priyanka Jain <priyanka.jain@nxp.com>; joe.hershberger@ni.com; Alison
> Wang <alison.wang@nxp.com>; Shaohui.Xie@nxp.com
> Subject: Re: [PATCH RESEND] u-boot: fixup the iommu-map property of fsl-
> mc node
> 
> On 09/25/2018 02:23 AM, Nipun Gupta wrote:
> > The iommu-map property in the fsl-mc node is updated by
> > valid stream-ids by u-boot. This patch is to fixup this
> > property for LS208x and LS1088.
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> > This patch fixes iommu-map property added for fsl-mc in kernel patch
> > series: https://patchwork.kernel.org/patch/10594185/
> > Kernel patch series is accepted and would be available in kernel 4.20.
> >
> > This patch is backward compatible and have only a debug log if the property
> > is not found in kernel.
> 
> Why did you send it again? This one
> http://patchwork.ozlabs.org/patch/959615/ is already under review.
> Please check patchwork before you do this next time.

I'll take of this next time :)

Thanks,
Nipun

> 
> York
diff mbox series

Patch

diff --git a/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h b/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h
index afea9b8..8d002da 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h
@@ -35,6 +35,9 @@ 
  *  -DPAA2
  *     -u-boot will allocate a range of stream IDs to be used by the Management
  *      Complex for containers and will set these values in the MC DPC image.
+ *     -u-boot will fixup the iommu-map property in the fsl-mc node in the
+ *      device tree (see Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
+ *      for more info on the msi-map definition)
  *     -the MC is responsible for allocating and setting up 'isolation context
  *      IDs (ICIDs) based on the allocated stream IDs for all DPAA2 devices.
  *
diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
index a0dab6f..517a8ce 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -575,6 +575,8 @@  int ft_board_setup(void *blob, bd_t *bd)
 
 	fdt_fixup_memory_banks(blob, base, size, CONFIG_NR_DRAM_BANKS);
 
+	fdt_fsl_mc_fixup_iommu_map_entry(blob);
+
 	fsl_fdt_fixup_flash(blob);
 
 #ifdef CONFIG_FSL_MC_ENET
diff --git a/board/freescale/ls2080a/ls2080a.c b/board/freescale/ls2080a/ls2080a.c
index 75014fd..698ae1f 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -127,6 +127,8 @@  int ft_board_setup(void *blob, bd_t *bd)
 
 	fdt_fixup_memory_banks(blob, base, size, 2);
 
+	fdt_fsl_mc_fixup_iommu_map_entry(blob);
+
 #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
 	fdt_fixup_board_enet(blob);
 #endif
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index c811e99..d336ef8 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -332,6 +332,8 @@  int ft_board_setup(void *blob, bd_t *bd)
 
 	fdt_fixup_memory_banks(blob, base, size, 2);
 
+	fdt_fsl_mc_fixup_iommu_map_entry(blob);
+
 	fsl_fdt_fixup_dr_usb(blob, bd);
 
 #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index 46b18cf..cf91bc3 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -394,6 +394,8 @@  int ft_board_setup(void *blob, bd_t *bd)
 
 	fdt_fixup_memory_banks(blob, base, size, 2);
 
+	fdt_fsl_mc_fixup_iommu_map_entry(blob);
+
 	fsl_fdt_fixup_dr_usb(blob, bd);
 
 	fsl_fdt_fixup_flash(blob);
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 940025a..cb2fbe9 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -278,6 +278,40 @@  static int mc_fixup_dpl_mac_addr(void *blob, int dpmac_id,
 				 MC_FIXUP_DPL);
 }
 
+void fdt_fsl_mc_fixup_iommu_map_entry(void *blob)
+{
+	u32 *prop;
+	u32 iommu_map[4];
+	int offset;
+	int lenp;
+
+	/* find fsl-mc node */
+	offset = fdt_path_offset(blob, "/soc/fsl-mc");
+	if (offset < 0)
+		offset = fdt_path_offset(blob, "/fsl-mc");
+	if (offset < 0) {
+		printf("%s: fsl-mc: ERR: fsl-mc node not found in DT, err %d\n",
+		       __func__, offset);
+		return;
+	}
+
+	prop = fdt_getprop_w(blob, offset, "iommu-map", &lenp);
+	if (!prop) {
+		debug("%s: fsl-mc: ERR: missing iommu-map in fsl-mc bus node\n",
+		      __func__);
+		return;
+	}
+
+	iommu_map[0] = cpu_to_fdt32(FSL_DPAA2_STREAM_ID_START);
+	iommu_map[1] = *++prop;
+	iommu_map[2] = cpu_to_fdt32(FSL_DPAA2_STREAM_ID_START);
+	iommu_map[3] = cpu_to_fdt32(FSL_DPAA2_STREAM_ID_END -
+		FSL_DPAA2_STREAM_ID_START + 1);
+
+	fdt_setprop_inplace(blob, offset, "iommu-map",
+			    iommu_map, sizeof(iommu_map));
+}
+
 static int mc_fixup_dpc_mac_addr(void *blob, int dpmac_id,
 				 struct eth_device *eth_dev)
 {
diff --git a/include/fsl-mc/fsl_mc.h b/include/fsl-mc/fsl_mc.h
index 7f4859b..aef40d3 100644
--- a/include/fsl-mc/fsl_mc.h
+++ b/include/fsl-mc/fsl_mc.h
@@ -51,6 +51,7 @@  struct mc_ccsr_registers {
 	u32 reg_error[];
 };
 
+void fdt_fsl_mc_fixup_iommu_map_entry(void *blob);
 int get_mc_boot_status(void);
 int get_dpl_apply_status(void);
 #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET