[From nobody Thu Jun 25 05:55:01 2020
Received: from mail.codigosur.net ([109.69.10.39])
 by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux))
 id 1goKsu-0005yF-Tp
 for openwrt-devel@lists.openwrt.org; Tue, 29 Jan 2019 04:20:31 +0000
Received: from authenticated-user (mail.codigosur.net [109.69.10.39])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mail.codigosur.net (Postfix) with ESMTPSA id CE3068E0DFD;
 Tue, 29 Jan 2019 04:13:50 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=altermundi.net;
 s=mail; t=1548735233;
 bh=TuB4sRs+7R18qM+7IAqJFSfoPp8hasuY2pHIJesYEwk=;
 h=From:To:Cc:Subject:Date:From;
 b=DwWfFi/a+aBJPotgZVNmy+xOUZTx3qWKlBaFP/DCuwHWQbcL03b+pbJU+hA5v/lms
 IRR9Oc7kjO5TZKnrpzrBb994Oz2gjQixcn7Kl43PVwA1UbZCvdFMwruwnzwQ0gpDFu
 v2rQBlryahR8bBi0hn8P0lwrxdtqFj0vRn0msSgY86Vzkn0I+zyhhOIPuOO250+Qhl
 iYvBVjP+LUY/ejEaKbFQA6mgAgdzIVMLDx79LO9aRfQVfq3izN6k2sAjbDhjXehod6
 5a7nVyfroPaIQF3RIhHy6IL/KGF1PSfn9M1JXY39icxXWysxyeyKZHtAtyx0LNgq6g
 O0dqZc0Ao1iDQ==
From: Santiago Piccinini &lt;spiccinini@altermundi.net&gt;
To: openwrt-devel@lists.openwrt.org
Cc: Santiago Piccinini &lt;spiccinini@altermundi.net&gt;
Subject: [PATCH 0/2] ath79: fix qca955x dual pci support
Date: Tue, 29 Jan 2019 01:12:51 -0300
Message-Id: &lt;20190129041253.18725-1-spiccinini@altermundi.net&gt;
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20190128_202029_381792_728A0E3E 
X-CRM114-Status: UNSURE (   8.09  )
X-CRM114-Notice: Please train this message.
X-Spam-Score: -0.2 (/)
X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary:
 Content analysis details:   (-0.2 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/,
 no trust [109.69.10.39 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily
 valid
 -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from
 envelope-from domain
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from
 author's domain

Hi!
While adding support to LibreRouter v1 board, that has 2 mpci boards, I
found two bugs on the definition of the pci resources that only arise when
using both pci at the same time (none of the boards already supported in ath79
has 2 pci).

These changes fix qca955x dual pci support in a backwards compatible way.
Here are some dmesg of test runs applying these changes (over
0465e41e0532ae54c2018ddbfa01927a9b594769):

Before the first patch, enabling pcie0 and pcie1:
[    0.131911] PCI host bridge /ahb/apb/pcie-controller@180c0000 ranges:
[    0.138778]  MEM 0x0000000010000000..0x0000000013ffffff
[    0.144362]   IO 0x0000000000000000..0x0000000000000000
[    0.150229] PCI host bridge /ahb/apb/pcie-controller@18250000 ranges:
[    0.157120]  MEM 0x0000000012000000..0x0000000013ffffff
[    0.162676]   IO 0x0000000000000000..0x0000000000000000
[    0.168238] Skipping PCI bus scan due to resource conflict
[    0.189522] PCI host bridge to bus 0000:00

After the first patch, the MEM addresses are ok but IO has conflicts:
[    0.131910] PCI host bridge /ahb/apb/pcie-controller@180c0000 ranges:
[    0.138770]  MEM 0x0000000010000000..0x0000000011ffffff
[    0.144353]   IO 0x0000000000000000..0x0000000000000000
[    0.150224] PCI host bridge /ahb/apb/pcie-controller@18250000 ranges:
[    0.157119]  MEM 0x0000000012000000..0x0000000013ffffff
[    0.162676]   IO 0x0000000000000000..0x0000000000000000
[    0.168238] Skipping PCI bus scan due to resource conflict

After the second patch, all good:
[    0.131909] PCI host bridge /ahb/apb/pcie-controller@180c0000 ranges:
[    0.138770]  MEM 0x0000000010000000..0x0000000011ffffff
[    0.144354]   IO 0x0000000000000000..0x0000000000000000
[    0.150220] PCI host bridge /ahb/apb/pcie-controller@18250000 ranges:
[    0.157112]  MEM 0x0000000012000000..0x0000000013ffffff
[    0.162667]   IO 0x0000000000000001..0x0000000000000001
[    0.183692] PCI host bridge to bus 0000:00
[    0.188058] pci_bus 0000:00: root bus resource [mem 0x10000000-0x11ffffff]
[    0.195405] pci_bus 0000:00: root bus resource [io  0x0000]
[    0.201334] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.208556] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.217397] pci 0000:00:00.0: BAR 0: assigned [mem 0x10000000-0x1001ffff 64bit]
[    0.225218] pci 0000:00:00.0: BAR 6: assigned [mem 0x10020000-0x1002ffff pref]
[    0.233021] PCI host bridge to bus 0000:01
[    0.237403] pci_bus 0000:01: root bus resource [mem 0x12000000-0x13ffffff]
[    0.244710] pci_bus 0000:01: root bus resource [io  0x0001]
[    0.250640] pci_bus 0000:01: root bus resource [??? 0x00000000 flags 0x0]
[    0.257856] pci_bus 0000:01: No busn resource found for root bus, will use [bus 01-ff]
[    0.266688] pci 0000:01:00.0: BAR 0: assigned [mem 0x12000000-0x1201ffff 64bit]
[    0.274481] pci 0000:01:00.0: BAR 6: assigned [mem 0x12020000-0x1202ffff pref]

Test with pcie0 disabled and pcie1 enabled (emulating some devices with
only pcie1)
The pcie1 bus is still numbered 0 so this patches shold be backwards
compatible:
[    0.131920] PCI host bridge /ahb/apb/pcie-controller@18250000 ranges:
[    0.138787]  MEM 0x0000000012000000..0x0000000013ffffff
[    0.144371]   IO 0x0000000000000001..0x0000000000000001
[    0.165180] PCI host bridge to bus 0000:00
[    0.169544] pci_bus 0000:00: root bus resource [mem 0x12000000-0x13ffffff]
[    0.176891] pci_bus 0000:00: root bus resource [io  0x0001]
[    0.182818] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.190042] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.198881] pci 0000:00:00.0: BAR 0: assigned [mem 0x12000000-0x1201ffff 64bit]
[    0.206704] pci 0000:00:00.0: BAR 6: assigned [mem 0x12020000-0x1202ffff pref]

Best,
SAn
PS: this is my first contribution to openwrt!

Santiago Piccinini (2):
  ath79: fix qca955x pcie0 memory size
  ath79: fix qca955x dual pci resource allocation

 target/linux/ath79/dts/qca9557.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1


]