510b7458a57ad03c799e1bf5b924a7ce8d4100b3
[openwrt/openwrt.git] / target / linux / mvebu / patches-5.4 / 410-PCI-aardvark-Fix-initialization-with-old-Marvell-s-A.patch
1 From b0c6ae0f8948a2be6bf4e8b4bbab9ca1343289b6 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
3 Date: Wed, 2 Sep 2020 16:43:44 +0200
4 Subject: [PATCH] PCI: aardvark: Fix initialization with old Marvell's Arm
5 Trusted Firmware
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Old ATF automatically power on pcie phy and does not provide SMC call for
11 phy power on functionality which leads to aardvark initialization failure:
12
13 [ 0.330134] mvebu-a3700-comphy d0018300.phy: unsupported SMC call, try updating your firmware
14 [ 0.338846] phy phy-d0018300.phy.1: phy poweron failed --> -95
15 [ 0.344753] advk-pcie d0070000.pcie: Failed to initialize PHY (-95)
16 [ 0.351160] advk-pcie: probe of d0070000.pcie failed with error -95
17
18 This patch fixes above failure by ignoring 'not supported' error in
19 aardvark driver. In this case it is expected that phy is already power on.
20
21 Tested-by: Tomasz Maciej Nowak <tmn505@gmail.com>
22 Link: https://lore.kernel.org/r/20200902144344.16684-3-pali@kernel.org
23 Fixes: 366697018c9a ("PCI: aardvark: Add PHY support")
24 Signed-off-by: Pali Rohár <pali@kernel.org>
25 Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
26 Reviewed-by: Rob Herring <robh@kernel.org>
27 Cc: <stable@vger.kernel.org> # 5.8+: ea17a0f153af: phy: marvell: comphy: Convert internal SMCC firmware return codes to errno
28 ---
29 drivers/pci/controller/pci-aardvark.c | 4 +++-
30 1 file changed, 3 insertions(+), 1 deletion(-)
31
32 --- a/drivers/pci/controller/pci-aardvark.c
33 +++ b/drivers/pci/controller/pci-aardvark.c
34 @@ -1124,7 +1124,9 @@ static int advk_pcie_enable_phy(struct a
35 }
36
37 ret = phy_power_on(pcie->phy);
38 - if (ret) {
39 + if (ret == -EOPNOTSUPP) {
40 + dev_warn(&pcie->pdev->dev, "PHY unsupported by firmware\n");
41 + } else if (ret) {
42 phy_exit(pcie->phy);
43 return ret;
44 }