From patchwork Thu Jun 14 19:15:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 929648 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=o2.pl Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VWmopdWY"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 416Czd65YWz9s19 for ; Fri, 15 Jun 2018 05:17:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DGzmyUT2B69CQw6ZQNSNxFJJdT4ZsDJDVlYd/xs9a/k=; b=VWmopdWY3lbPDm PuDJoLkNwBbvkWx0TwetZZFPsI6gTrHVCEOxVsa0cyd3UUIm6xCl9X3+zaKku8JFXGF1tbhUvXXSV piN7gNYscp/SItaoUwilYlSYZSABIRHcq8T5GSNAI0heckTQ5prNhhxmTbyUT1oLuuWxg91hyDEsn 04uje/ocwfgNam1ae4GXeYKZ93AwWwmRi95sKCUQlL/CtSeC8DOFJTxfPWzqwOj19rL1VxRHLpI2x xE5r55dDuGdMx5nSP6CiSYQPXcZXYAIw+TtOgW0FBO/C0k/Ws6G58FtKp04ikFAxnSKyz5sL1fySq NdsdXTHN7WOdN+GtqcDQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTXjX-0003Mt-B9; Thu, 14 Jun 2018 19:16:35 +0000 Received: from mx-out.tlen.pl ([193.222.135.140]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTXjQ-0003BL-KY for openwrt-devel@lists.openwrt.org; Thu, 14 Jun 2018 19:16:34 +0000 Received: (wp-smtpd smtp.tlen.pl 2989 invoked from network); 14 Jun 2018 21:16:12 +0200 Received: from 131.ip-164-132-48.eu (HELO localhost.localdomain) (tomek_n@o2.pl@[164.132.48.131]) (envelope-sender ) by smtp.tlen.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 14 Jun 2018 21:16:12 +0200 From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Date: Thu, 14 Jun 2018 21:15:59 +0200 Message-Id: <20180614191559.26423-1-tomek_n@o2.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180609141342.23948-2-tomek_n@o2.pl> References: <20180609141342.23948-2-tomek_n@o2.pl> MIME-Version: 1.0 X-WP-MailID: 4c8972e557c5cd9b8ec7dc0440f8b78d X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 000000A [QXOE] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180614_121628_853254_A3C27BAC X-CRM114-Status: GOOD ( 17.42 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [193.222.135.140 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tomek_n[at]o2.pl) -0.0 SPF_PASS SPF: sender matches SPF record Subject: [OpenWrt-Devel] [PATCH v2 2/3] mvebu: reduce speed to gen1 for espressobin pcie X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Blumenstingl , Tomasz Maciej Nowak Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Since the beginning there's been an issue with initializing the Atheros based MiniPCIe wireless cards. Here's an example of kerenel log: OF: PCI: host bridge /soc/pcie@d0070000 ranges: OF: PCI: MEM 0xe8000000..0xe8ffffff -> 0xe8000000 OF: PCI: IO 0xe9000000..0xe900ffff -> 0xe9000000 advk-pcie d0070000.pcie: link up advk-pcie d0070000.pcie: PCI host bridge to bus 0000:00 pci_bus 0000:00: root bus resource [bus 00-ff] pci_bus 0000:00: root bus resource [mem0xe8000000-0xe8ffffff] pci_bus 0000:00: root bus resource [io 0x0000-0xffff](bus address[0xe9000000-0xe900ffff]) pci 0000:00:00.0: BAR 0: assigned [mem0xe8000000-0xe801ffff 64bit] pci 0000:00:00.0: BAR 6: assigned [mem0xe8020000-0xe802ffff pref] [...] advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x3c advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x44 advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 ath9k 0000:00:00.0: enabling device (0000 -> 0002) advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x3c advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0xc advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x40 ath9k 0000:00:00.0: request_irq failed advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 ath9k: probe of 0000:00:00.0 failed with error -22 The same happens for ath5k cards, while ath10k card didn't appear at all (not detected): OF: PCI: host bridge /soc/pcie@d0070000 ranges: OF: PCI: MEM 0xe8000000..0xe8ffffff -> 0xe8000000 OF: PCI: IO 0xe9000000..0xe900ffff -> 0xe9000000 advk-pcie d0070000.pcie: link never came up advk-pcie d0070000.pcie: PCI host bridge to bus 0000:00 pci_bus 0000:00: root bus resource [bus 00-ff] pci_bus 0000:00: root bus resource [mem0xe8000000-0xe8ffffff] pci_bus 0000:00: root bus resource [io 0x0000-0xffff](bus address[0xe9000000-0xe900ffff]) advk-pcie d0070000.pcie: config read/write timed out Following the issue on esppressobin.net forum [1] the workaround seems to be limiting the speed of PCIe bridge to 1st generation. This fixed the initialisation of all tested Atheros wireless cards. The change shouldn't affect the performance for wireless cards, it could reduce the performance of storage controller cards but since OpenWrt focuses on wireless connectivity, fixing compatibility with wireless cards should be a priority. For the record, the iwlwifi and mt76 cards were not affected by this issue. 1. http://espressobin.net/forums/topic/which-pcie-wlan-cards-are-supported Signed-off-by: Tomasz Maciej Nowak --- Changes in v2: - Following sugestion from Martin Blumenstingl the patch has been changed to allow changing max link speed in dts file instead of setting static register in the driver - change of title to reflect done changes - expand commit message with more informations Please also cherry-pick this to OpenWrt 18.06. --- ...ark-allow-to-specify-link-capability.patch | 43 +++++++++++ ...-3720-espressobin-set-max-link-to-ge.patch | 73 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 target/linux/mvebu/patches-4.14/527-PCI-aardvark-allow-to-specify-link-capability.patch create mode 100644 target/linux/mvebu/patches-4.14/528-arm64-dts-armada-3720-espressobin-set-max-link-to-ge.patch diff --git a/target/linux/mvebu/patches-4.14/527-PCI-aardvark-allow-to-specify-link-capability.patch b/target/linux/mvebu/patches-4.14/527-PCI-aardvark-allow-to-specify-link-capability.patch new file mode 100644 index 0000000000..fb57f4112a --- /dev/null +++ b/target/linux/mvebu/patches-4.14/527-PCI-aardvark-allow-to-specify-link-capability.patch @@ -0,0 +1,43 @@ +From f70b629e488cc3f2a325ac35476f4f7ae502c5d0 Mon Sep 17 00:00:00 2001 +From: Tomasz Maciej Nowak +Date: Thu, 14 Jun 2018 14:24:40 +0200 +Subject: [PATCH 1/2] PCI: aardvark: allow to specify link capability + +Use DT of_pci_get_max_link_speed() facility to allow specifying link +capability. If none or unspecified value is given it falls back to gen2, +which is default for Armada 3700 SoC. + +Signed-off-by: Tomasz Maciej Nowak +--- + drivers/pci/host/pci-aardvark.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/pci/host/pci-aardvark.c ++++ b/drivers/pci/host/pci-aardvark.c +@@ -272,6 +272,8 @@ static void advk_pcie_set_ob_win(struct + + static void advk_pcie_setup_hw(struct advk_pcie *pcie) + { ++ struct device *dev = &pcie->pdev->dev; ++ struct device_node *node = dev->of_node; + u32 reg; + int i; + +@@ -311,10 +313,15 @@ static void advk_pcie_setup_hw(struct ad + PCIE_CORE_CTRL2_TD_ENABLE; + advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG); + +- /* Set GEN2 */ ++ /* Set GEN */ + reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); + reg &= ~PCIE_GEN_SEL_MSK; +- reg |= SPEED_GEN_2; ++ if (of_pci_get_max_link_speed(node) == 1) ++ reg |= SPEED_GEN_1; ++ else if (of_pci_get_max_link_speed(node) == 3) ++ reg |= SPEED_GEN_3; ++ else ++ reg |= SPEED_GEN_2; + advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); + + /* Set lane X1 */ diff --git a/target/linux/mvebu/patches-4.14/528-arm64-dts-armada-3720-espressobin-set-max-link-to-ge.patch b/target/linux/mvebu/patches-4.14/528-arm64-dts-armada-3720-espressobin-set-max-link-to-ge.patch new file mode 100644 index 0000000000..5ff9b47268 --- /dev/null +++ b/target/linux/mvebu/patches-4.14/528-arm64-dts-armada-3720-espressobin-set-max-link-to-ge.patch @@ -0,0 +1,73 @@ +From 33f8fdcedb01680427328d710594facef7a0092c Mon Sep 17 00:00:00 2001 +From: Tomasz Maciej Nowak +Date: Thu, 14 Jun 2018 14:40:26 +0200 +Subject: [PATCH 2/2] arm64: dts: armada-3720-espressobin: set max link to gen1 + +Since the beginning there's been an issue with initializing the Atheros +based MiniPCIe wireless cards. Here's an example of kerenel log: + + OF: PCI: host bridge /soc/pcie@d0070000 ranges: + OF: PCI: MEM 0xe8000000..0xe8ffffff -> 0xe8000000 + OF: PCI: IO 0xe9000000..0xe900ffff -> 0xe9000000 + advk-pcie d0070000.pcie: link up + advk-pcie d0070000.pcie: PCI host bridge to bus 0000:00 + pci_bus 0000:00: root bus resource [bus 00-ff] + pci_bus 0000:00: root bus resource [mem0xe8000000-0xe8ffffff] + pci_bus 0000:00: root bus resource [io 0x0000-0xffff](bus address [0xe9000000-0xe900ffff]) + pci 0000:00:00.0: BAR 0: assigned [mem0xe8000000-0xe801ffff 64bit] + pci 0000:00:00.0: BAR 6: assigned [mem0xe8020000-0xe802ffff pref] + [...] + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x3c + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x44 + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 + ath9k 0000:00:00.0: enabling device (0000 -> 0002) + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x3c + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0xc + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x40 + ath9k 0000:00:00.0: request_irq failed + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 + ath9k: probe of 0000:00:00.0 failed with error -22 + +The same happens for ath5k cards, while ath10k card didn't appear at +all (not detected): + + OF: PCI: host bridge /soc/pcie@d0070000 ranges: + OF: PCI: MEM 0xe8000000..0xe8ffffff -> 0xe8000000 + OF: PCI: IO 0xe9000000..0xe900ffff -> 0xe9000000 + advk-pcie d0070000.pcie: link never came up + advk-pcie d0070000.pcie: PCI host bridge to bus 0000:00 + pci_bus 0000:00: root bus resource [bus 00-ff] + pci_bus 0000:00: root bus resource [mem0xe8000000-0xe8ffffff] + pci_bus 0000:00: root bus resource [io 0x0000-0xffff](bus address [0xe9000000-0xe900ffff]) + advk-pcie d0070000.pcie: config read/write timed out + +Following the issue on esppressobin.net forum [1] the workaround seems +to be limiting the speed of PCIe bridge to 1st generation. This fixed +the initialisation of all tested Atheros wireless cards. +The patch in the forum thread swaped registers which would limit speed +for all Armada 3700 based boards. The approach in this patch, in +conjunction with "PCI: aardvark: allow to specify link capability" patch +is less invasive, it only touches the affected board. + +For the record, the iwlwifi and mt76 cards were not affected by this +issue. + +1. http://espressobin.net/forums/topic/which-pcie-wlan-cards-are-supported + +Signed-off-by: Tomasz Maciej Nowak +--- + arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +@@ -79,6 +79,8 @@ + /* J9 */ + &pcie0 { + status = "okay"; ++ ++ max-link-speed = <1>; + }; + + /* J6 */