lantiq: reset pci core on startup
authorMathias Kresin <dev@kresin.me>
Sun, 23 Jun 2019 19:58:21 +0000 (21:58 +0200)
committerMathias Kresin <dev@kresin.me>
Mon, 12 Apr 2021 21:37:51 +0000 (23:37 +0200)
Reset the pci core on startup as it's done by the vendor SDK. It was
most likely omitted, as we haven't had a proper reset controller for
ages.

Signed-off-by: Mathias Kresin <dev@kresin.me>
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9.dtsi
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube.dtsi
target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi
target/linux/lantiq/patches-5.10/0201-MIPS-lantiq-pci-reset-core-on-startup.patch [new file with mode: 0644]
target/linux/lantiq/patches-5.4/0201-MIPS-lantiq-pci-reset-core-on-startup.patch [new file with mode: 0644]

index 0eec0c614d07c0feebb0a6a1d41dd7c0bad58dc1..455fcd21dd4d583da11631f4a00094608e768b42 100644 (file)
                        interrupt-map = <0x7000 0 0 1 &icu0 30 1>;
                        req-mask = <0x1>;
 
+                       resets = <&reset 13 13>;
+                       reset-names = "pci";
+
                        device_type = "pci";
                };
        };
index 34d828954254275b0da14663757659ab374f0f44..2947b25146f29ec26308e961e2a7bde3feabc853 100644 (file)
                        interrupt-map = <0x7000 0 0 1 &icu0 30 1>; /* slot 14, irq 30 */
                        req-mask = <0x1>; /* GNT1 */
 
+                       resets = <&reset 13 13>;
+                       reset-names = "pci";
+
                        device_type = "pci";
                };
        };
index 22d5509a33faa0665de6c8e3e46ce0655d65ff62..c037f3ac07acaaa18d115087cb417a19f1055c52 100644 (file)
                        interrupt-map = <0x7000 0 0 1 &icu0 30 1>; /* slot 14, irq 30 */
                        req-mask = <0x1>; /* GNT1 */
 
+                       resets = <&reset0 13 13>;
+                       reset-names = "pci";
+
                        device_type = "pci";
                };
        };
diff --git a/target/linux/lantiq/patches-5.10/0201-MIPS-lantiq-pci-reset-core-on-startup.patch b/target/linux/lantiq/patches-5.10/0201-MIPS-lantiq-pci-reset-core-on-startup.patch
new file mode 100644 (file)
index 0000000..4a09590
--- /dev/null
@@ -0,0 +1,43 @@
+From 44e33007412b9a8fc32faee897a57c8c1bb39391 Mon Sep 17 00:00:00 2001
+From: Mathias Kresin <dev@kresin.me>
+Date: Sun, 3 Feb 2019 11:10:50 +0100
+Subject: [PATCH 2/6] MIPS: lantiq: pci: reset core on startup
+
+Reset the pci core on startup as it's done by the vendor SDK. It was
+most likely omitted, as we haven't had a proper reset controller for
+ages.
+
+Signed-off-by: Mathias Kresin <dev@kresin.me>
+---
+ arch/mips/pci/pci-lantiq.c            | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
+index 9afca76a7b02..2e41f91c688c 100644
+--- a/arch/mips/pci/pci-lantiq.c
++++ b/arch/mips/pci/pci-lantiq.c
+@@ -16,6 +16,8 @@
+ #include <linux/of_gpio.h>
+ #include <linux/of_irq.h>
+ #include <linux/of_pci.h>
++#include <linux/reset.h>
++#include <linux/device.h>
+ #include <asm/addrspace.h>
+@@ -95,6 +97,12 @@ static int ltq_pci_startup(struct platform_device *pdev)
+       struct device_node *node = pdev->dev.of_node;
+       const __be32 *req_mask, *bus_clk;
+       u32 temp_buffer;
++      int ret;
++
++      /* reset pci core */
++      ret = device_reset(&pdev->dev);
++      if (ret)
++              return dev_err_probe(&pdev->dev, ret, "PCI reset failed!\n");
+       /* get our clocks */
+       clk_pci = clk_get(&pdev->dev, NULL);
+-- 
+2.25.1
+
diff --git a/target/linux/lantiq/patches-5.4/0201-MIPS-lantiq-pci-reset-core-on-startup.patch b/target/linux/lantiq/patches-5.4/0201-MIPS-lantiq-pci-reset-core-on-startup.patch
new file mode 100644 (file)
index 0000000..31330e2
--- /dev/null
@@ -0,0 +1,46 @@
+From 1058f2729707f680acbaae60f56f022de48da186 Mon Sep 17 00:00:00 2001
+From: Mathias Kresin <dev@kresin.me>
+Date: Sun, 3 Feb 2019 11:10:50 +0100
+Subject: [PATCH 2/6] MIPS: lantiq: pci: reset core on startup
+
+Reset the pci core on startup as it's done by the vendor SDK. It was
+most likely omitted, as we haven't had a proper reset controller for
+ages.
+
+Signed-off-by: Mathias Kresin <dev@kresin.me>
+---
+ arch/mips/pci/pci-lantiq.c            | 11 +++++++++++
+ 1 files changed, 11 insertions(+)
+
+diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
+index 9afca76a7b02..7c30399a60d7 100644
+--- a/arch/mips/pci/pci-lantiq.c
++++ b/arch/mips/pci/pci-lantiq.c
+@@ -16,6 +16,7 @@
+ #include <linux/of_gpio.h>
+ #include <linux/of_irq.h>
+ #include <linux/of_pci.h>
++#include <linux/reset.h>
+ #include <asm/addrspace.h>
+@@ -95,6 +96,16 @@ static int ltq_pci_startup(struct platform_device *pdev)
+       struct device_node *node = pdev->dev.of_node;
+       const __be32 *req_mask, *bus_clk;
+       u32 temp_buffer;
++      int ret;
++
++      /* reset pci core */
++      ret = device_reset(&pdev->dev);
++      if (ret) {
++              if (ret != -EPROBE_DEFER)
++                      dev_err(&pdev->dev, "PCI reset failed!\n");
++
++              return ret;
++      }
+       /* get our clocks */
+       clk_pci = clk_get(&pdev->dev, NULL);
+-- 
+2.25.1
+