aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/701-net-0089-fsl-fman-backup-and-restore-ICID-registers.patch
diff options
context:
space:
mode:
authorYangbo Lu <yangbo.lu@nxp.com>2020-04-10 10:47:05 +0800
committerPetr Štetiar <ynezz@true.cz>2020-05-07 12:53:06 +0200
commitcddd4591404fb4c53dc0b3c0b15b942cdbed4356 (patch)
tree392c1179de46b0f804e3789edca19069b64e6b44 /target/linux/layerscape/patches-5.4/701-net-0089-fsl-fman-backup-and-restore-ICID-registers.patch
parentd1d2c0b5579ea4f69a42246c9318539d61ba1999 (diff)
downloadupstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.gz
upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.bz2
upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.zip
layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Diffstat (limited to 'target/linux/layerscape/patches-5.4/701-net-0089-fsl-fman-backup-and-restore-ICID-registers.patch')
-rw-r--r--target/linux/layerscape/patches-5.4/701-net-0089-fsl-fman-backup-and-restore-ICID-registers.patch116
1 files changed, 116 insertions, 0 deletions
diff --git a/target/linux/layerscape/patches-5.4/701-net-0089-fsl-fman-backup-and-restore-ICID-registers.patch b/target/linux/layerscape/patches-5.4/701-net-0089-fsl-fman-backup-and-restore-ICID-registers.patch
new file mode 100644
index 0000000000..3b5acba46e
--- /dev/null
+++ b/target/linux/layerscape/patches-5.4/701-net-0089-fsl-fman-backup-and-restore-ICID-registers.patch
@@ -0,0 +1,116 @@
+From ef2b0593c906a85ca59ed5957ae7a7361974349c Mon Sep 17 00:00:00 2001
+From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
+Date: Tue, 6 Feb 2018 16:21:17 +0200
+Subject: [PATCH] fsl/fman: backup and restore ICID registers
+
+During probing, FMAN is reset thus losing all its register
+settings. Backup port ICID registers before reset and restore
+them after, similarly to how it's done on powerpc / PAMU based
+platforms.
+This also has the side effect of disabling the old code path
+(liodn backup/restore handling) that obviously make no sense
+in the context of SMMU on ARMs.
+
+Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
+Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
+---
+ drivers/net/ethernet/freescale/fman/fman.c | 35 +++++++++++++++++++++++++++++-
+ drivers/net/ethernet/freescale/fman/fman.h | 4 ++++
+ 2 files changed, 38 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/freescale/fman/fman.c
++++ b/drivers/net/ethernet/freescale/fman/fman.c
+@@ -634,6 +634,7 @@ static void set_port_order_restoration(s
+ iowrite32be(tmp, &fpm_rg->fmfp_prc);
+ }
+
++#ifdef CONFIG_PPC
+ static void set_port_liodn(struct fman *fman, u8 port_id,
+ u32 liodn_base, u32 liodn_ofst)
+ {
+@@ -651,6 +652,27 @@ static void set_port_liodn(struct fman *
+ iowrite32be(tmp, &fman->dma_regs->fmdmplr[port_id / 2]);
+ iowrite32be(liodn_ofst, &fman->bmi_regs->fmbm_spliodn[port_id - 1]);
+ }
++#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
++static void save_restore_port_icids(struct fman *fman, bool save)
++{
++ int port_idxes[] = {
++ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc,
++ 0xd, 0xe, 0xf, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
++ 0x10, 0x11, 0x30, 0x31
++ };
++ int idx, i;
++
++ for (i = 0; i < ARRAY_SIZE(port_idxes); i++) {
++ idx = port_idxes[i];
++ if (save)
++ fman->sp_icids[idx] =
++ ioread32be(&fman->bmi_regs->fmbm_spliodn[idx]);
++ else
++ iowrite32be(fman->sp_icids[idx],
++ &fman->bmi_regs->fmbm_spliodn[idx]);
++ }
++}
++#endif
+
+ static void enable_rams_ecc(struct fman_fpm_regs __iomem *fpm_rg)
+ {
+@@ -1919,7 +1941,10 @@ _return:
+ static int fman_init(struct fman *fman)
+ {
+ struct fman_cfg *cfg = NULL;
+- int err = 0, i, count;
++ int err = 0, count;
++#ifdef CONFIG_PPC
++ int i;
++#endif
+
+ if (is_init_done(fman->cfg))
+ return -EINVAL;
+@@ -1939,6 +1964,7 @@ static int fman_init(struct fman *fman)
+ memset_io((void __iomem *)(fman->base_addr + CGP_OFFSET), 0,
+ fman->state->fm_port_num_of_cg);
+
++#ifdef CONFIG_PPC
+ /* Save LIODN info before FMan reset
+ * Skipping non-existent port 0 (i = 1)
+ */
+@@ -1958,6 +1984,9 @@ static int fman_init(struct fman *fman)
+ }
+ fman->liodn_base[i] = liodn_base;
+ }
++#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
++ save_restore_port_icids(fman, true);
++#endif
+
+ err = fman_reset(fman);
+ if (err)
+@@ -2186,8 +2215,12 @@ int fman_set_port_params(struct fman *fm
+ if (err)
+ goto return_err;
+
++#ifdef CONFIG_PPC
+ set_port_liodn(fman, port_id, fman->liodn_base[port_id],
+ fman->liodn_offset[port_id]);
++#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
++ save_restore_port_icids(fman, false);
++#endif
+
+ if (fman->state->rev_info.major < 6)
+ set_port_order_restoration(fman->fpm_regs, port_id);
+--- a/drivers/net/ethernet/freescale/fman/fman.h
++++ b/drivers/net/ethernet/freescale/fman/fman.h
+@@ -347,8 +347,12 @@ struct fman {
+ unsigned long fifo_offset;
+ size_t fifo_size;
+
++#ifdef CONFIG_PPC
+ u32 liodn_base[64];
+ u32 liodn_offset[64];
++#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
++ u32 sp_icids[64];
++#endif
+
+ struct fman_dts_params dts_params;
+ };