Enablement of PCIe controller for lx2160a rev2
Subsystems (2)
v3 cover Enablement of PCIe controller for lx2160a rev2
lx2160a rev1 PCIe controller uses pcie_layerscape_gen4 driver and lx2160a rev2 PCIe controller uses pcie_layerscape driver.
This patch set enables support for lx2160a rev2 and uses pcie_layerscape or pcie_layerscape_gen4 driver based on SoC.
Also organize the device tree fixup in common, layerscape and layerscape_gen4 specific code.
Changes in v3:
1-Updated patch subject and description based on Priyanka Jain review comments
2-fix compilation errors with lx2160aqds_tfa_SECURE_BOOT_defconfig and lx2160ardb_tfa_SECURE_BOOT_defconfig
3-Enabled CONFIG_OF_BOARD_FIXUP for lx2160aqds_tfa_SECURE_BOOT_defconfig and lx2160ardb_tfa_SECURE_BOOT_defconfig
Changes in v2:
Updated patch subject and description based on Priyanka Jain review comments
Wasim Khan (9):
drivers/pci : enable pcie_layerscape code for lx2160a rev2
pci: layerscape: Add stream_id_cur field to ls_pcie structure
pci: layerscape: Suffix API names with _ls
pci: layerscape_gen4: Suffix API names with _ls_gen4
armv8: lx2160a: Add FSL_PEX_STREAM_ID_END for LX2160A
pci: layerscape: Common device tree fixup for NXP SoCs
pci: layerscape: Move streamId allocation to common device tree fixup
pci: layerscape: device tree fixup based on SoC and Version
configs: lx2160a: enable CONFIG_OF_BOARD_FIXUP for SECURE_BOOT
defconfig
.../asm/arch-fsl-layerscape/stream_id_lsch3.h | 8 +- configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 2 + configs/lx2160aqds_tfa_defconfig | 1 + configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 2 + configs/lx2160ardb_tfa_defconfig | 1 + drivers/pci/Makefile | 5 +- drivers/pci/pcie_layerscape.c | 3 +- drivers/pci/pcie_layerscape.h | 3 +- drivers/pci/pcie_layerscape_fixup.c | 44 +++---- drivers/pci/pcie_layerscape_fixup_common.c | 129 +++++++++++++++++++++ drivers/pci/pcie_layerscape_fixup_common.h | 28 +++++ drivers/pci/pcie_layerscape_gen4_fixup.c | 43 +++---- 12 files changed, 211 insertions(+), 58 deletions(-) create mode 100644 drivers/pci/pcie_layerscape_fixup_common.c create mode 100644 drivers/pci/pcie_layerscape_fixup_common.h
Signature · 1 line
2.7.4
PATCH v3 1/9 drivers/pci : enable pcie_layerscape code for lx2160a rev2
lx2160a rev1 uses pcie_layerscape_gen4 driver and lx2160a rev2 uses pcie_layerscape driver.
Enable pcie_layerscape code for CONFIG_PCIE_LAYERSCAPE_GEN4. Based on SoC and revision pcie controller probe will be invoked.
---
Changes in v3:
Updated patch subject and description based on Priyanka Jain review comments
Changes in v2:
Updated patch subject and description based on Priyanka Jain review comments
drivers/pci/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/Makefile +1 -1
@@ -35,7 +35,7 @@ obj-$(CONFIG_PCIE_FSL) += pcie_fsl.o pcie_fsl_fixup.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape_fixup.o obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie_layerscape_gen4.o \ - pcie_layerscape_gen4_fixup.o + pcie_layerscape_gen4_fixup.o pcie_layerscape.o obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o obj-$(CONFIG_PCI_KEYSTONE) += pcie_dw_ti.o
Signature · 1 line
2.7.4
PATCH v3 2/9 pci: layerscape: Add stream_id_cur field to ls_pcie structure
In reply to Wasim KhanAdd stream_id_cur field to ls_pcie structure and initialize it with 0 for all pcie controllers. This field will be used for streamId calculation.
---
Changes in v3:None
Changes in v2:
Updated copyright
drivers/pci/pcie_layerscape.c | 3 ++- drivers/pci/pcie_layerscape.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/pci/pcie_layerscape.c +2 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright 2017 NXP +* Copyright 2017-2019 NXP * Copyright 2014-2015 Freescale Semiconductor, Inc. * Layerscape PCIe driver */
@@ -339,6 +339,7 @@ static void ls_pcie_setup_ctrl(struct ls_pcie *pcie)dbi_writel (pcie,0 ,PCIE_DBI_RO_WR_EN );ls_pcie_disable_bars (pcie); + pcie->stream_id_cur =0 ; }static void ls_pcie_ep_setup_atu (struct ls_pcie *pcie)
drivers/pci/pcie_layerscape.h +2 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* -* Copyright 2017 NXP +* Copyright 2017-2019 NXP * Copyright 2014-2015 Freescale Semiconductor, Inc. * Layerscape PCIe driver */
@@ -144,6 +144,7 @@ struct ls_pcie {bool big_endian;bool enabled;int next_lut_index; +int stream_id_cur;int mode; };
Signature · 1 line
2.7.4
PATCH v3 3/9 pci: layerscape: Suffix API names with _ls
In reply to Wasim KhanSuffix layerscape fixup API names with _ls.
This is required to organize device tree fixup in common, layerscape and layerscape_gen4 specific code.
---
Changes in v3:None
Changes in v2:
Updated patch subject and description based on Priyanka Jain review comments
Updated NXP copyright
drivers/pci/pcie_layerscape_fixup.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/pci/pcie_layerscape_fixup.c +11 -11
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright 2017 NXP +* Copyright 2017-2019 NXP * Copyright 2014-2015 Freescale Semiconductor, Inc. * Layerscape PCIe driver */
@@ -69,8 +69,8 @@ static void ls_pcie_lut_set_mapping(struct ls_pcie *pcie, int index, u32 devid,* msi-map = <[devid] [phandle-to-msi-ctrl] [stream-id] [count] * [devid] [phandle-to-msi-ctrl] [stream-id] [count]>; */ -static void fdt_pcie_set_msi_map_entry (void *blob,struct ls_pcie *pcie, -u32 devid,u32 streamid) +static void fdt_pcie_set_msi_map_entry_ls (void *blob,struct ls_pcie *pcie, +u32 devid,u32 streamid) {u32 *prop;u32 phandle;
@@ -122,8 +122,8 @@ static void fdt_pcie_set_msi_map_entry(void *blob, struct ls_pcie *pcie,* iommu-map = <[devid] [phandle-to-iommu-ctrl] [stream-id] [count] * [devid] [phandle-to-iommu-ctrl] [stream-id] [count]>; */ -static void fdt_pcie_set_iommu_map_entry (void *blob,struct ls_pcie *pcie, -u32 devid,u32 streamid) +static void fdt_pcie_set_iommu_map_entry_ls (void *blob,struct ls_pcie *pcie, +u32 devid,u32 streamid) {u32 *prop;u32 iommu_map[4 ];
@@ -175,7 +175,7 @@ static void fdt_pcie_set_iommu_map_entry(void *blob, struct ls_pcie *pcie, } } -static void fdt_fixup_pcie (void *blob) +static void fdt_fixup_pcie_ls (void *blob) {struct udevice *dev, *bus;struct ls_pcie *pcie;
@@ -209,11 +209,11 @@ static void fdt_fixup_pcie(void *blob)ls_pcie_lut_set_mapping (pcie, index, bdf >>8 , streamid);/* update msi-map in device tree */ -fdt_pcie_set_msi_map_entry (blob, pcie, bdf >>8 , - streamid); +fdt_pcie_set_msi_map_entry_ls (blob, pcie, bdf >>8 , + streamid);/* update iommu-map in device tree */ -fdt_pcie_set_iommu_map_entry (blob, pcie, bdf >>8 , - streamid); +fdt_pcie_set_iommu_map_entry_ls (blob, pcie, bdf >>8 , + streamid); } }#endif
@@ -279,7 +279,7 @@ void ft_pci_setup(void *blob, bd_t *bd)ft_pcie_ls_setup (blob, pcie);#if defined(CONFIG_FSL_LSCH3 ) || defined(CONFIG_FSL_LSCH2 ) -fdt_fixup_pcie (blob); +fdt_fixup_pcie_ls (blob);#endif }
Signature · 1 line
2.7.4
PATCH v3 4/9 pci: layerscape_gen4: Suffix API names with _ls_gen4
In reply to Wasim KhanUpdate API names for layerscape gen4 fixup.
Suffix layerscape_gen4 fixup API names with _ls_gen4. This is required to organize device tree fixup in common, layerscape and layerscape_gen4 specific code.
---
Changes in v3:None
Changes in v2:
Updated patch subject and description based on Priyanka Jain review comments
--- drivers/pci/pcie_layerscape_gen4_fixup.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/pci/pcie_layerscape_gen4_fixup.c +12 -8
@@ -64,8 +64,9 @@ static void ls_pcie_g4_lut_set_mapping(struct ls_pcie_g4 *pcie, int index,* msi-map = <[devid] [phandle-to-msi-ctrl] [stream-id] [count] * [devid] [phandle-to-msi-ctrl] [stream-id] [count]>; */ -static void fdt_pcie_set_msi_map_entry (void *blob,struct ls_pcie_g4 *pcie, -u32 devid,u32 streamid) +static void fdt_pcie_set_msi_map_entry_ls_gen4 (void *blob, +struct ls_pcie_g4 *pcie, +u32 devid,u32 streamid) {u32 *prop;u32 phandle;
@@ -106,8 +107,9 @@ static void fdt_pcie_set_msi_map_entry(void *blob, struct ls_pcie_g4 *pcie,* iommu-map = <[devid] [phandle-to-iommu-ctrl] [stream-id] [count] * [devid] [phandle-to-iommu-ctrl] [stream-id] [count]>; */ -static void fdt_pcie_set_iommu_map_entry (void *blob,struct ls_pcie_g4 *pcie, -u32 devid,u32 streamid) +static void fdt_pcie_set_iommu_map_entry_ls_gen4 (void *blob, +struct ls_pcie_g4 *pcie, +u32 devid,u32 streamid) {u32 *prop;u32 iommu_map[4 ];
@@ -145,7 +147,7 @@ static void fdt_pcie_set_iommu_map_entry(void *blob, struct ls_pcie_g4 *pcie,fdt_appendprop (blob, nodeoff,"iommu-map" , iommu_map,16 ); } -static void fdt_fixup_pcie (void *blob) +static void fdt_fixup_pcie_ls_gen4 (void *blob) {struct udevice *dev, *bus;struct ls_pcie_g4 *pcie;
@@ -176,9 +178,11 @@ static void fdt_fixup_pcie(void *blob)/* map PCI b.d.f to streamID in LUT */ ls_pcie_g4_lut_set_mapping (pcie, index, bdf >>8 , streamid);/* update msi-map in device tree */ -fdt_pcie_set_msi_map_entry (blob, pcie, bdf >>8 , streamid); +fdt_pcie_set_msi_map_entry_ls_gen4 (blob, pcie, bdf >>8 , + streamid);/* update iommu-map in device tree */ - fdt_pcie_set_iommu_map_entry(blob, pcie, bdf >> 8, streamid); +fdt_pcie_set_iommu_map_entry_ls_gen4 (blob, pcie, bdf >>8 , + streamid); } }#endif
@@ -238,7 +242,7 @@ void ft_pci_setup(void *blob, bd_t *bd)ft_pcie_layerscape_gen4_setup (blob, pcie);#if defined(CONFIG_FSL_LSCH3 ) || defined(CONFIG_FSL_LSCH2 ) -fdt_fixup_pcie (blob); +fdt_fixup_pcie_ls_gen4 (blob);#endif }
Signature · 1 line
2.7.4
PATCH v3 5/9 armv8: lx2160a: Add FSL_PEX_STREAM_ID_END for LX2160A
In reply to Wasim KhanAdd FSL_PEX_STREAM_ID_END and remove FSL_PEX_STREAM_ID_NUM for lx2160a.
---
Changes in v3:None
Changes in v2:
Revomed user of FSL_PEX_STREAM_ID_NUM macro
arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h | 8 +++----- drivers/pci/pcie_layerscape_gen4_fixup.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h +3 -5
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* -* Copyright 2015-2018 NXP +* Copyright 2015-2019 NXP * Copyright 2014 Freescale Semiconductor, Inc. * */
@@ -83,14 +83,12 @@/* PCI - programmed in PEXn_LUT */ #define FSL_PEX_STREAM_ID_START 7 -#ifdef CONFIG_ARCH_LX2160A -#define FSL_PEX_STREAM_ID_NUM (0x100) -#endif -#if defined(CONFIG_ARCH_LS2080A ) || defined(CONFIG_ARCH_LS1028A )#define FSL_PEX_STREAM_ID_END 22#elif defined(CONFIG_ARCH_LS1088A )#define FSL_PEX_STREAM_ID_END 18 +#elif defined(CONFIG_ARCH_LX2160A ) +#define FSL_PEX_STREAM_ID_END (0x100)#endif
drivers/pci/pcie_layerscape_gen4_fixup.c +1 -1
@@ -37,7 +37,7 @@ static int ls_pcie_g4_next_streamid(struct ls_pcie_g4 *pcie) {int stream_id = pcie->stream_id_cur; -if (stream_id >FSL_PEX_STREAM_ID_NUM ) +if (stream_id >FSL_PEX_STREAM_ID_END )return -EINVAL ; pcie->stream_id_cur++;
Signature · 1 line
2.7.4
PATCH v3 6/9 pci: layerscape: Common device tree fixup for NXP SoCs
In reply to Wasim KhanAdd Common device tree fixup for NXP SoCs. Based on SoC and revision call pcie_layerscape or pcie_layerscape_gen4 fixup.
---
Changes in v3:
fix compilation errors with lx2160aqds_tfa_SECURE_BOOT_defconfig and lx2160ardb_tfa_SECURE_BOOT_defconfig
Changes in v2
Ported changes to latest codebase
configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 + configs/lx2160aqds_tfa_defconfig | 1 + configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 + configs/lx2160ardb_tfa_defconfig | 1 + drivers/pci/Makefile | 5 +++-- drivers/pci/pcie_layerscape_fixup.c | 5 +++-- drivers/pci/pcie_layerscape_fixup_common.c | 29 ++++++++++++++++++++++++++++ drivers/pci/pcie_layerscape_fixup_common.h | 26 +++++++++++++++++++++++++ drivers/pci/pcie_layerscape_gen4_fixup.c | 5 +++-- 9 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 drivers/pci/pcie_layerscape_fixup_common.c create mode 100644 drivers/pci/pcie_layerscape_fixup_common.h
configs/lx2160aqds_tfa_SECURE_BOOT_defconfig +1 -0
@@ -54,6 +54,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_LAYERSCAPE_GEN4=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_DM_RTC=y CONFIG_RTC_PCF2127=y CONFIG_DM_SCSI=y
configs/lx2160aqds_tfa_defconfig +1 -0
@@ -55,6 +55,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_LAYERSCAPE_GEN4=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_DM_RTC=y CONFIG_RTC_PCF2127=y CONFIG_DM_SCSI=y
configs/lx2160ardb_tfa_SECURE_BOOT_defconfig +1 -0
@@ -50,6 +50,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_LAYERSCAPE_GEN4=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_DM_RTC=y CONFIG_RTC_PCF2127=y CONFIG_DM_SCSI=y
configs/lx2160ardb_tfa_defconfig +1 -0
@@ -54,6 +54,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_LAYERSCAPE_GEN4=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_DM_RTC=y CONFIG_RTC_PCF2127=y CONFIG_DM_SCSI=y
drivers/pci/Makefile +3 -2
@@ -33,9 +33,10 @@ obj-$(CONFIG_PCI_AARDVARK) += pci-aardvark.o obj-$(CONFIG_PCIE_DW_MVEBU) += pcie_dw_mvebu.o obj-$(CONFIG_PCIE_FSL) += pcie_fsl.o pcie_fsl_fixup.o obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape.o -obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape_fixup.o +obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape_fixup.o pcie_layerscape_fixup_common.o obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie_layerscape_gen4.o \ - pcie_layerscape_gen4_fixup.o pcie_layerscape.o + pcie_layerscape_gen4_fixup.o \ + pcie_layerscape_fixup_common.o obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o obj-$(CONFIG_PCI_KEYSTONE) += pcie_dw_ti.o
drivers/pci/pcie_layerscape_fixup.c +3 -2
@@ -17,6 +17,7 @@#include <asm/arch/clock.h> #endif #include "pcie_layerscape.h" +#include "pcie_layerscape_fixup_common.h" #if defined(CONFIG_FSL_LSCH3 ) || defined(CONFIG_FSL_LSCH2 )/*
@@ -271,7 +272,7 @@ static void ft_pcie_ls_setup(void *blob, struct ls_pcie *pcie) }/* Fixup Kernel DT for PCIe */ -void ft_pci_setup (void *blob,bd_t *bd) +void ft_pci_setup_ls (void *blob,bd_t *bd) {struct ls_pcie *pcie;
@@ -284,7 +285,7 @@ void ft_pci_setup(void *blob, bd_t *bd) }#else /* !CONFIG_OF_BOARD_SETUP */ -void ft_pci_setup (void *blob,bd_t *bd) +void ft_pci_setup_ls (void *blob,bd_t *bd) { }#endif
drivers/pci/pcie_layerscape_fixup_common.c new file +29 -0
@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2019 NXP +* +* PCIe DT fixup for NXP Layerscape SoCs +* Author: Wasim Khan <[email protected]> +* +*/ + +#include <common.h> +#include <asm/arch/clock.h> +#include <asm/arch/soc.h> +#include "pcie_layerscape_fixup_common.h" + +void ft_pci_setup (void *blob,bd_t *bd) +{ +#if defined(CONFIG_FSL_LAYERSCAPE ) +uint svr; + + svr =SVR_SOC_VER (get_svr ()); + +if (svr ==SVR_LX2160A &&IS_SVR_REV (get_svr (),1 ,0 )) +ft_pci_setup_ls_gen4 (blob, bd); +else +ft_pci_setup_ls (blob, bd); +#else /* CONFIG_FSL_LAYERSCAPE */ +ft_pci_setup_ls (blob, bd); +#endif /* CONFIG_FSL_LAYERSCAPE */ +}
drivers/pci/pcie_layerscape_fixup_common.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2019 NXP +* +* PCIe DT fixup for NXP Layerscape SoCs +* Author: Wasim Khan <[email protected]> +* +*/ +#ifndef _PCIE_LAYERSCAPE_FIXUP_COMMON_H_ +#define _PCIE_LAYERSCAPE_FIXUP_COMMON_H_ + +#include <common.h> + +void ft_pci_setup_ls (void *blob,bd_t *bd); + +#if defined(CONFIG_FSL_LAYERSCAPE ) +#ifdef CONFIG_PCIE_LAYERSCAPE_GEN4 +void ft_pci_setup_ls_gen4 (void *blob,bd_t *bd); +#else +static void ft_pci_setup_ls_gen4 (void *blob,bd_t *bd) +{ +} +#endif +#endif /* CONFIG_FSL_LAYERSCAPE */ + +#endif //_PCIE_LAYERSCAPE_FIXUP_COMMON_H_
drivers/pci/pcie_layerscape_gen4_fixup.c +3 -2
@@ -19,6 +19,7 @@#include <asm/arch/clock.h> #endif #include "pcie_layerscape_gen4.h" +#include "pcie_layerscape_fixup_common.h" #if defined(CONFIG_FSL_LSCH3 ) || defined(CONFIG_FSL_LSCH2 )/*
@@ -234,7 +235,7 @@ static void ft_pcie_layerscape_gen4_setup(void *blob, struct ls_pcie_g4 *pcie) }/* Fixup Kernel DT for PCIe */ -void ft_pci_setup (void *blob,bd_t *bd) +void ft_pci_setup_ls_gen4 (void *blob,bd_t *bd) {struct ls_pcie_g4 *pcie;
@@ -247,7 +248,7 @@ void ft_pci_setup(void *blob, bd_t *bd) }#else /* !CONFIG_OF_BOARD_SETUP */ -void ft_pci_setup (void *blob,bd_t *bd) +void ft_pci_setup_ls_gen4 (void *blob,bd_t *bd) { }#endif
Signature · 1 line
2.7.4
PATCH v3 6/9 pci: layerscape: Common device tree fixup for NXP SoCs
Quoted 28 lines
-----Original Message-----
From: Wasim Khan <[email protected]>
Sent: Friday, November 15, 2019 2:54 PM
To: Priyanka Jain <[email protected]>; Z.q. Hou <[email protected]>
Cc: u-boot at lists.denx.de; Wasim Khan <[email protected]>
Subject: [PATCH v3 6/9] pci: layerscape: Common device tree fixup for NXP SoCsAdd Common device tree fixup for NXP SoCs. Based on SoC and revision call
pcie_layerscapeorpcie_layerscape_gen4fixup.Signed-off-by Wasim Khan <[email protected]>---
Changes in v3:
fix compilation errors withlx2160aqds_tfa_SECURE_BOOT_defconfigandlx2160ardb_tfa_SECURE_BOOT_defconfigChanges in v2
Ported changes to latest codebaseconfigs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 + configs/lx2160aqds_tfa_defconfig | 1 + configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 + configs/lx2160ardb_tfa_defconfig | 1 + drivers/pci/Makefile | 5 +++-- drivers/pci/pcie_layerscape_fixup.c | 5 +++-- drivers/pci/pcie_layerscape_fixup_common.c | 29
Quoted 5 lines
++++++++++++++++++++++++++++
drivers/pci/pcie_layerscape_fixup_common.h| 26
+++++++++++++++++++++++++drivers/pci/pcie_layerscape_gen4_fixup.c| 5 +++--9 files changed, 68 insertions(+), 6 deletions(-) create mode 100644
<snip>
This introduce below compilation warnings for some platforms like ls2080ardb_defconfig
"In file included from drivers/pci/pcie_layerscape_fixup.c:20:drivers/pci/pcie_layerscape_fixup_common.h:20:13: warning: ft_pci_setup_ls_gen4 defined but not used [-Wunused-function]
static void ft_pci_setup_ls_gen4(void *blob, bd_t *bd)"
Please ensure to run buildman to check compilation across other platforms. Priyanka
PATCH v3 7/9 pci: layerscape: Move streamId allocation to common device tree fixup
In reply to Wasim KhanMove streamId allocation to layerscape common device tree fixup. Calculate streamId based on SoC variant.
---
Changes in v3:None
Changes in v2:None
drivers/pci/pcie_layerscape_fixup.c | 16 ++++------------ drivers/pci/pcie_layerscape_fixup_common.c | 24 ++++++++++++++++++++++++ drivers/pci/pcie_layerscape_fixup_common.h | 1 + drivers/pci/pcie_layerscape_gen4_fixup.c | 18 ++++-------------- 4 files changed, 33 insertions(+), 26 deletions(-)
drivers/pci/pcie_layerscape_fixup.c +4 -12
@@ -31,17 +31,6 @@ static int ls_pcie_next_lut_index(struct ls_pcie *pcie)return -ENOSPC ;/* LUT is full */ } -/* returns the next available streamid for pcie, -errno if failed */ -static int ls_pcie_next_streamid (void ) -{ -static int next_stream_id =FSL_PEX_STREAM_ID_START ; - -if (next_stream_id >FSL_PEX_STREAM_ID_END ) -return -EINVAL ; - -return next_stream_id++; -} -static void lut_writel (struct ls_pcie *pcie,unsigned int value,unsigned int offset) {
@@ -192,10 +181,13 @@ static void fdt_fixup_pcie_ls(void *blob) bus = bus->parent; pcie =dev_get_priv (bus); - streamid =ls_pcie_next_streamid (); + streamid =pcie_next_streamid (pcie->stream_id_cur, pcie->idx); +if (streamid <0 ) {debug ("ERROR: no stream ids free\n" );continue ; + }else { + pcie->stream_id_cur++; } index =ls_pcie_next_lut_index (pcie);
drivers/pci/pcie_layerscape_fixup_common.c +24 -0
@@ -27,3 +27,27 @@ void ft_pci_setup(void *blob, bd_t *bd)ft_pci_setup_ls (blob, bd);#endif /* CONFIG_FSL_LAYERSCAPE */ } + +#if defined(CONFIG_FSL_LAYERSCAPE ) +#ifdef CONFIG_ARCH_LX2160A +/* returns the next available streamid for pcie, -errno if failed */ +int pcie_next_streamid (int currentid,int idx) +{ +if (currentid >FSL_PEX_STREAM_ID_END ) +return -EINVAL ; + +return currentid | ((idx +1 ) <<11 ); +} +#else +/* returns the next available streamid for pcie, -errno if failed */ +int pcie_next_streamid (int currentid,int idx) +{ +static int next_stream_id =FSL_PEX_STREAM_ID_START ; + +if (next_stream_id >FSL_PEX_STREAM_ID_END ) +return -EINVAL ; + +return next_stream_id++; +} +#endif +#endif /* CONFIG_FSL_LAYERSCAPE */
drivers/pci/pcie_layerscape_fixup_common.h +1 -0
@@ -22,5 +22,6 @@ static void ft_pci_setup_ls_gen4(void *blob, bd_t *bd) }#endif #endif /* CONFIG_FSL_LAYERSCAPE */ +int pcie_next_streamid (int currentid,int id);#endif //_PCIE_LAYERSCAPE_FIXUP_COMMON_H_
drivers/pci/pcie_layerscape_gen4_fixup.c +4 -14
@@ -33,19 +33,6 @@ static int ls_pcie_g4_next_lut_index(struct ls_pcie_g4 *pcie)return -ENOSPC ;/* LUT is full */ } -/* returns the next available streamid for pcie, -errno if failed */ -static int ls_pcie_g4_next_streamid (struct ls_pcie_g4 *pcie) -{ -int stream_id = pcie->stream_id_cur; - -if (stream_id >FSL_PEX_STREAM_ID_END ) -return -EINVAL ; - - pcie->stream_id_cur++; - -return stream_id | ((pcie->idx +1 ) <<11 ); -} -/* * Program a single LUT entry */
@@ -162,10 +149,13 @@ static void fdt_fixup_pcie_ls_gen4(void *blob) bus = bus->parent; pcie =dev_get_priv (bus); - streamid =ls_pcie_g4_next_streamid (pcie); + streamid =pcie_next_streamid (pcie->stream_id_cur, pcie->idx); +if (streamid <0 ) {debug ("ERROR: no stream ids free\n" );continue ; + }else { + pcie->stream_id_cur++; } index =ls_pcie_g4_next_lut_index (pcie);
Signature · 1 line
2.7.4
PATCH v3 8/9 pci: layerscape: device tree fixup based on SoC and Version
In reply to Wasim Khanlx2160a rev1 requires layerscape_gen4 device tree fixup and lx2160a rev2 requires layerscape device tree fixup. Add device tree fixup for lx2160a based on SoC and Version.
---
Changes in v3:
Updated patch subject and description based on Priyanka Jain review comments
Changes in v2:
Updated patch description based on Priyanka Jain
review comments
drivers/pci/pcie_layerscape_fixup.c | 1 + drivers/pci/pcie_layerscape_fixup_common.c | 76 ++++++++++++++++++++++++++++++ drivers/pci/pcie_layerscape_fixup_common.h | 1 + 3 files changed, 78 insertions(+)
drivers/pci/pcie_layerscape_fixup.c +1 -0
@@ -208,6 +208,7 @@ static void fdt_fixup_pcie_ls(void *blob)fdt_pcie_set_iommu_map_entry_ls (blob, pcie, bdf >>8 , streamid); } +pcie_board_fix_fdt (blob); }#endif
drivers/pci/pcie_layerscape_fixup_common.c +76 -0
82 lines not on this page · raw message
drivers/pci/pcie_layerscape_fixup_common.h +1 -0
@@ -23,5 +23,6 @@ static void ft_pci_setup_ls_gen4(void *blob, bd_t *bd)#endif #endif /* CONFIG_FSL_LAYERSCAPE */ int pcie_next_streamid (int currentid,int id); +int pcie_board_fix_fdt (void *fdt);#endif //_PCIE_LAYERSCAPE_FIXUP_COMMON_H_
Signature · 1 line
2.7.4
PATCH v3 9/9 configs: lx2160a: enable CONFIG_OF_BOARD_FIXUP for SECURE_BOOT defconfig
In reply to Wasim Khanlx2160a rev1 and rev2 SoC has different pcie controller. The pcie controller device tree node fields "compatible" and registers names needs to be updated accordingly.
Enable CONFIG_OF_BOARD_FIXUP to apply board_fix_fdt which updates the "compatible" and registers names.
---
Changes in v3:
Enabled CONFIG_OF_BOARD_FIXUP for lx2160aqds_tfa_SECURE_BOOT_defconfig and lx2160ardb_tfa_SECURE_BOOT_defconfig
configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 + configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/lx2160aqds_tfa_SECURE_BOOT_defconfig +1 -0
@@ -25,6 +25,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_CACHE=y CONFIG_MP=y CONFIG_OF_CONTROL=y +CONFIG_OF_BOARD_FIXUP=y CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-qds" CONFIG_NET_RANDOM_ETHADDR=y CONFIG_DM=y
configs/lx2160ardb_tfa_SECURE_BOOT_defconfig +1 -0
@@ -26,6 +26,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_CACHE=y CONFIG_MP=y CONFIG_OF_CONTROL=y +CONFIG_OF_BOARD_FIXUP=y CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb" CONFIG_NET_RANDOM_ETHADDR=y CONFIG_DM=y
Signature · 1 line
2.7.4