layerscape: add patches-5.4
[openwrt/staging/wigyori.git] / target / linux / layerscape / patches-5.4 / 701-net-0058-sdk_fman-probe-OH-ports-on-PPC.patch
diff --git a/target/linux/layerscape/patches-5.4/701-net-0058-sdk_fman-probe-OH-ports-on-PPC.patch b/target/linux/layerscape/patches-5.4/701-net-0058-sdk_fman-probe-OH-ports-on-PPC.patch
new file mode 100644 (file)
index 0000000..31d86dd
--- /dev/null
@@ -0,0 +1,38 @@
+From 11a68a2d48fee4524163c5ce36477bafb6515a98 Mon Sep 17 00:00:00 2001
+From: Camelia Groza <camelia.groza@nxp.com>
+Date: Mon, 26 Mar 2018 10:48:19 +0300
+Subject: [PATCH] sdk_fman: probe OH ports on PPC
+
+Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
+---
+ .../ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm_port.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm_port.c
++++ b/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm_port.c
+@@ -303,7 +303,13 @@ static t_LnxWrpFmPortDev *ReadFmPortDevT
+       tmp_prop = be32_to_cpu(*uint32_prop);
+       if (WARN_ON(lenp != sizeof(uint32_t)))
+               return NULL;
+-      if (of_device_is_compatible(port_node, "fsl,fman-port-oh")) {
++      if (of_device_is_compatible(port_node, "fsl,fman-port-oh") ||
++          of_device_is_compatible(port_node, "fsl,fman-v2-port-oh") ||
++          of_device_is_compatible(port_node, "fsl,fman-v3-port-oh")) {
++#ifndef CONFIG_FMAN_ARM
++              /* On PPC, OH ports start from cell-index 0x2 */
++              tmp_prop -= 0x2;
++#endif
+               if (unlikely(tmp_prop >= FM_MAX_NUM_OF_OH_PORTS)) {
+                       REPORT_ERROR(MAJOR, E_INVALID_VALUE,
+                                    ("of_get_property(%s, cell-index) failed",
+@@ -1433,6 +1439,10 @@ static const struct of_device_id fm_port
+       {
+        .compatible = "fsl,fman-port-oh"},
+       {
++       .compatible = "fsl,fman-v2-port-oh"},
++      {
++       .compatible = "fsl,fman-v3-port-oh"},
++      {
+        .compatible = "fsl,fman-port-1g-rx"},
+       {
+        .compatible = "fsl,fman-port-10g-rx"},