Message ID | 20230113164449.906002-8-robimarko@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp374014wrt; Fri, 13 Jan 2023 08:50:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1yU+ik3k6aepEGsC2A1WFsxIe2BUKnXuHu9+sRyzA4SE97kgeF6i5L6KkEwdEGG7jca47 X-Received: by 2002:a05:6a00:198c:b0:582:d44f:3948 with SMTP id d12-20020a056a00198c00b00582d44f3948mr36092967pfl.18.1673628629298; Fri, 13 Jan 2023 08:50:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673628629; cv=none; d=google.com; s=arc-20160816; b=I9oH0eNDPHrE6ImyV7geH9TL/zPUiEJ19OXFx1Rr5ZxWPcFU0nbU6BwUThlha1zX2S mhWdIEtwcnMDebQsxpDREhgo+KrH+T0Huf5jBp9FPxTZLvsZRsmDSYaA3qkJmgQAH7VW aKL0sFJBDoNZc/ZfgshQU9aGdypKpNq7fR/+F4d0XuWSQHnTN0nr+Mnqi6vWdsaXJFne XwS8Dmkxl1syRluh9tt42P29RrxOiDTAnBwJh9yWZZS1k52ezlADO5L3jEjtlMtKpOFf pA4Fe+JFseGgN3tf/OGmKDGptPtIbTuRn5pS5m+/gnA/dbtV6esRBHzhnpObjXbxzOVu 9N3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wGVN3rLMqJQGbw0wWLclIhoV7qmP5/8gcNfX7fkrepc=; b=a/0MesQ4MupPuX/R9utA1vOMlim5VthKeNDX/YWvRD+CqKYiQGhUxjPo3xCJ73C6sD QM43W5m+5WiMTiNi0i9t2dg78iDHo2dSvilG1xgeD9qHTd74W/CQh34C8SbZ8ksGUM3U /GH8etHMXnRaWP6+3jvngp2izenPeANPjWgmcAT1xSF5lzMppdrodAHHBgQikLByPpNb S1yxxSyapW+B+ffa1qKi+S2PTIsIkEFByOtThPdSNvH+vkFoOrbdQFQss37/wpmtlbBE CwNHcdZmZI0AS+6ci6XsJm+s0dJ3VxdedvCYG4VVulbdxXAAMqIjfOgEb7Ydmz/Gd0ct ATtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gJ8+B0Wi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a056a001a1100b005820fba237fsi22778703pfv.302.2023.01.13.08.50.15; Fri, 13 Jan 2023 08:50:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gJ8+B0Wi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229640AbjAMQsP (ORCPT <rfc822;callmefire3@gmail.com> + 99 others); Fri, 13 Jan 2023 11:48:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbjAMQrR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 13 Jan 2023 11:47:17 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6637F58D12; Fri, 13 Jan 2023 08:45:03 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id l22so23904329eja.12; Fri, 13 Jan 2023 08:45:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wGVN3rLMqJQGbw0wWLclIhoV7qmP5/8gcNfX7fkrepc=; b=gJ8+B0Wi77XymiL/mpPDCUfVYHG0jWaZZhwS+lctfzbnfDK4etJHm7PctM2Fqsi6AU wPF7w4kJlbBfNrrBSf/gj1ixHYlLKhAqVbqZ1RoOulmJ9sqSMsLV8ZDzfSuwlEoZWUpv N3++2HOnLeaBsIKH5/E59POv5Z8XoYanAt8U5UU32NHR6ZlHX3j4GORTfQ0Km2Ai886W F59dxMePI/m/GZHSPhuaMzAKGpSAqoo5Ra+WHrqjcI5/pZIDFiBK4BiglnZiZfZwLZdC 58a7HiMaj9fm1BvKCFR2/qlaSkb0up/+Pte4KAaq1QOYQyi7j38DwztZQtYCAQ/3ZwTc a7Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wGVN3rLMqJQGbw0wWLclIhoV7qmP5/8gcNfX7fkrepc=; b=spSXWbcKYrV2uPgDfMYFfkHF/iAhceejxTUstNMDQLxgdSJzF65mi5zhENMK4k1CQa zuvkLG1ItT9O7oAdjOUaD7ETlCLvX6nrp061o3oBBltDpJ2NTFu2xZzX7b9LlnlrFE4B VT3FF3B3c5s653p4IJPbN36EJNqKxrDjJFOxQcjttUjB4icG5VOpu4LJVsiw+qfmOlBx XLsafAHO1BtPrWaqXqbtF1C7/0tPaO5V4aoNZqTHa7mRjkGy1pXHT/KjWKc/MzohpRTD jT588jx1zgut83tK7LSDbFgMMG3kW1UhNTsn6AnME+b+Ue5EDtmtwXTXXcBT0hpzV23D LHRQ== X-Gm-Message-State: AFqh2kquO4vQEO70IPRWqPWkEmHh9xv47+qmJZmZQvI8QWCZwT9ZFAld UbVrkGi/IE88KTlv+so0CPI= X-Received: by 2002:a17:907:9814:b0:857:1e36:3b7b with SMTP id ji20-20020a170907981400b008571e363b7bmr16733593ejc.11.1673628301934; Fri, 13 Jan 2023 08:45:01 -0800 (PST) Received: from fedora.. (dh207-97-147.xnet.hr. [88.207.97.147]) by smtp.googlemail.com with ESMTPSA id sb25-20020a1709076d9900b007b2a58e31dasm8777831ejc.145.2023.01.13.08.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 08:45:01 -0800 (PST) From: Robert Marko <robimarko@gmail.com> To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, bhelgaas@google.com, lpieralisi@kernel.org, robh@kernel.org, kw@linux.com, krzysztof.kozlowski+dt@linaro.org, mani@kernel.org, svarbanov@mm-sol.com, shawn.guo@linaro.org, linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Robert Marko <robimarko@gmail.com> Subject: [PATCH v2 8/9] arm64: dts: qcom: ipq8074: fix Gen3 PCIe node Date: Fri, 13 Jan 2023 17:44:48 +0100 Message-Id: <20230113164449.906002-8-robimarko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113164449.906002-1-robimarko@gmail.com> References: <20230113164449.906002-1-robimarko@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754926813620049626?= X-GMAIL-MSGID: =?utf-8?q?1754926813620049626?= |
Series |
[v2,1/9] arm64: dts: qcom: ipq8074: fix Gen2 PCIe QMP PHY
|
|
Commit Message
Robert Marko
Jan. 13, 2023, 4:44 p.m. UTC
IPQ8074 comes in 2 silicon versions:
* v1 with 2x Gen2 PCIe ports and QMP PHY-s
* v2 with 1x Gen3 and 1x Gen2 PCIe ports and QMP PHY-s
v2 is the final and production version that is actually supported by the
kernel, however it looks like PCIe related nodes were added for the v1 SoC.
Finish the PCIe fixup by using the correct compatible, adding missing ATU
register space, declaring max-link-speed, use correct ranges, add missing
clocks and resets.
Fixes: 33057e1672fe ("ARM: dts: ipq8074: Add pcie nodes")
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 30 +++++++++++++++------------
1 file changed, 17 insertions(+), 13 deletions(-)
Comments
On Fri, Jan 13, 2023, at 17:44, Robert Marko wrote: > IPQ8074 comes in 2 silicon versions: > * v1 with 2x Gen2 PCIe ports and QMP PHY-s > * v2 with 1x Gen3 and 1x Gen2 PCIe ports and QMP PHY-s > > v2 is the final and production version that is actually supported by the > kernel, however it looks like PCIe related nodes were added for the v1 SoC. > > Finish the PCIe fixup by using the correct compatible, adding missing ATU > register space, declaring max-link-speed, use correct ranges, add missing > clocks and resets. > > Fixes: 33057e1672fe ("ARM: dts: ipq8074: Add pcie nodes") > Signed-off-by: Robert Marko <robimarko@gmail.com> I was reading through the pull request today and saw this patch along with the Gen2 one: > @@ -871,9 +873,9 @@ pcie0: pci@20000000 { > phy-names = "pciephy"; > > ranges = <0x81000000 0 0x20200000 0x20200000 > - 0 0x100000 /* downstream I/O */ > + 0 0x10000>, /* downstream I/O */ Fixing the length here seems fine, but the bus-side address still looks wrong: 0x20200000 is way outside of the usual port ranges from 0 to 0x10000 on the local bus. > - 0x82000000 0 0x20300000 0x20300000 > - 0 0xd00000>; /* non-prefetchable memory */ > + <0x82000000 0 0x20220000 0x20220000 > + 0 0xfde0000>; /* non-prefetchable memory */ I see the total size of the memory space is under 256MB. Are you sure that there is no 64-bit BAR in addition to this? I also see commit 7d1158c984d3 ("arm64: dts: qcom: sm8550: Add PCIe PHYs and controllers nodes") introduce the same broken I/O port range (oversized 1MB space wiht an identity map) for a new SoC. This should probably be fixed as well, along with reviewing the other ones. Has the I/O space mapping on any of these actually been tested, or just copied from one SoC to another? Very few devices actually use I/O space, so it wouldn't be surprising if it never worked in the first place. Arnd
On Mon, 30 Jan 2023 at 18:11, Arnd Bergmann <arnd@arndb.de> wrote: > > On Fri, Jan 13, 2023, at 17:44, Robert Marko wrote: > > IPQ8074 comes in 2 silicon versions: > > * v1 with 2x Gen2 PCIe ports and QMP PHY-s > > * v2 with 1x Gen3 and 1x Gen2 PCIe ports and QMP PHY-s > > > > v2 is the final and production version that is actually supported by the > > kernel, however it looks like PCIe related nodes were added for the v1 SoC. > > > > Finish the PCIe fixup by using the correct compatible, adding missing ATU > > register space, declaring max-link-speed, use correct ranges, add missing > > clocks and resets. > > > > Fixes: 33057e1672fe ("ARM: dts: ipq8074: Add pcie nodes") > > Signed-off-by: Robert Marko <robimarko@gmail.com> > > I was reading through the pull request today and saw this patch > along with the Gen2 one: > > > > @@ -871,9 +873,9 @@ pcie0: pci@20000000 { > > phy-names = "pciephy"; > > > > ranges = <0x81000000 0 0x20200000 0x20200000 > > - 0 0x100000 /* downstream I/O */ > > + 0 0x10000>, /* downstream I/O */ > > Fixing the length here seems fine, but the bus-side address > still looks wrong: 0x20200000 is way outside of the usual > port ranges from 0 to 0x10000 on the local bus. > > > - 0x82000000 0 0x20300000 0x20300000 > > - 0 0xd00000>; /* non-prefetchable memory */ > > + <0x82000000 0 0x20220000 0x20220000 > > + 0 0xfde0000>; /* non-prefetchable memory */ > > I see the total size of the memory space is under 256MB. Are you > sure that there is no 64-bit BAR in addition to this? > > I also see commit 7d1158c984d3 ("arm64: dts: qcom: sm8550: Add > PCIe PHYs and controllers nodes") introduce the same broken > I/O port range (oversized 1MB space wiht an identity map) for a > new SoC. This should probably be fixed as well, along with > reviewing the other ones. > > Has the I/O space mapping on any of these actually been tested, > or just copied from one SoC to another? Very few devices actually > use I/O space, so it wouldn't be surprising if it never worked > in the first place. Hi Arnd, As pointed out in the commit description, the ranges property was copied from the QCA-s downstream 5.4 kernel [1] as I dont have any documentation on the SoC. I have runtime tested this on Xiaomi AX3600 which has a QCA9889 card on the Gen3 PCIe port, and on Xiaomi AX9000 which has QCA9889 on Gen2 port and QCN9074 on the Gen3 port and they are working fine. [1] https://git.codelinaro.org/clo/qsdk/oss/kernel/linux-ipq-5.4/-/blob/NHSS.QSDK.12.3.r2/arch/arm64/boot/dts/qcom/ipq8074.dtsi#L834 Regards, Robert > > Arnd
On Thu, Feb 2, 2023, at 10:16, Robert Marko wrote: > On Mon, 30 Jan 2023 at 18:11, Arnd Bergmann <arnd@arndb.de> wrote: >> On Fri, Jan 13, 2023, at 17:44, Robert Marko wrote: > > As pointed out in the commit description, the ranges property was copied > from the QCA-s downstream 5.4 kernel [1] as I dont have any documentation > on the SoC. > > I have runtime tested this on Xiaomi AX3600 which has a QCA9889 card on the > Gen3 PCIe port, and on Xiaomi AX9000 which has QCA9889 on Gen2 port > and QCN9074 on the Gen3 port and they are working fine. Neither of those use I/O ports though, nor does any other sensible device that was made in the past decade. The compatible string tells me that this is a designware pcie block, so I think driver actually sets up the mapping based on the ranges property in DT in dw_pcie_iatu_detect() and dw_pcie_iatu_setup(), rather than the mapping being determined by hardware or firmware in advance. Not sure about the general policy we have for this case, maybe the pci controller or pci-dwc maintainers have an idea here. I would think it's better to either have no I/O ranges in DT or have sensible ones than ones that are clearly bogus, if the controller is able to set up the ranges. Arnd
On Thu, Feb 02, 2023 at 10:42:15AM +0100, Arnd Bergmann wrote: > On Thu, Feb 2, 2023, at 10:16, Robert Marko wrote: > > On Mon, 30 Jan 2023 at 18:11, Arnd Bergmann <arnd@arndb.de> wrote: > >> On Fri, Jan 13, 2023, at 17:44, Robert Marko wrote: > > > > As pointed out in the commit description, the ranges property was copied > > from the QCA-s downstream 5.4 kernel [1] as I dont have any documentation > > on the SoC. > > > > I have runtime tested this on Xiaomi AX3600 which has a QCA9889 card on the > > Gen3 PCIe port, and on Xiaomi AX9000 which has QCA9889 on Gen2 port > > and QCN9074 on the Gen3 port and they are working fine. > > Neither of those use I/O ports though, nor does any other sensible > device that was made in the past decade. > > The compatible string tells me that this is a designware pcie block, > so I think driver actually sets up the mapping based on the ranges > property in DT in dw_pcie_iatu_detect() and dw_pcie_iatu_setup(), > rather than the mapping being determined by hardware or firmware > in advance. > > Not sure about the general policy we have for this case, maybe the > pci controller or pci-dwc maintainers have an idea here. I would > think it's better to either have no I/O ranges in DT or have > sensible ones than ones that are clearly bogus, if the controller > is able to set up the ranges. > Just happen to see this thread and I agree that the I/O port range is indeeed bogus. This is due to the fact that no one tested I/O range with a compatible device. I'm not sure about the PCI policy though but we should fix the mapping across all SoCs. I will send out a series for that. Thanks for spotting, Arnd! - Mani > Arnd
On Tue, 28 Feb 2023 at 14:20, Manivannan Sadhasivam <mani@kernel.org> wrote: > > On Thu, Feb 02, 2023 at 10:42:15AM +0100, Arnd Bergmann wrote: > > On Thu, Feb 2, 2023, at 10:16, Robert Marko wrote: > > > On Mon, 30 Jan 2023 at 18:11, Arnd Bergmann <arnd@arndb.de> wrote: > > >> On Fri, Jan 13, 2023, at 17:44, Robert Marko wrote: > > > > > > As pointed out in the commit description, the ranges property was copied > > > from the QCA-s downstream 5.4 kernel [1] as I dont have any documentation > > > on the SoC. > > > > > > I have runtime tested this on Xiaomi AX3600 which has a QCA9889 card on the > > > Gen3 PCIe port, and on Xiaomi AX9000 which has QCA9889 on Gen2 port > > > and QCN9074 on the Gen3 port and they are working fine. > > > > Neither of those use I/O ports though, nor does any other sensible > > device that was made in the past decade. > > > > The compatible string tells me that this is a designware pcie block, > > so I think driver actually sets up the mapping based on the ranges > > property in DT in dw_pcie_iatu_detect() and dw_pcie_iatu_setup(), > > rather than the mapping being determined by hardware or firmware > > in advance. > > > > Not sure about the general policy we have for this case, maybe the > > pci controller or pci-dwc maintainers have an idea here. I would > > think it's better to either have no I/O ranges in DT or have > > sensible ones than ones that are clearly bogus, if the controller > > is able to set up the ranges. > > > > Just happen to see this thread and I agree that the I/O port range is indeeed > bogus. This is due to the fact that no one tested I/O range with a compatible > device. > > I'm not sure about the PCI policy though but we should fix the mapping across > all SoCs. I will send out a series for that. Thanks for sorting this out. Regards, Robert > > Thanks for spotting, Arnd! > > - Mani > > > Arnd > > -- > மணிவண்ணன் சதாசிவம்
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi index 5ef4383ab18b..74eecca4f9e3 100644 --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi @@ -854,16 +854,18 @@ IRQ_TYPE_LEVEL_HIGH>, /* int_c */ }; pcie0: pci@20000000 { - compatible = "qcom,pcie-ipq8074"; + compatible = "qcom,pcie-ipq8074-gen3"; reg = <0x20000000 0xf1d>, <0x20000f20 0xa8>, - <0x00080000 0x2000>, + <0x20001000 0x1000>, + <0x00080000 0x4000>, <0x20100000 0x1000>; - reg-names = "dbi", "elbi", "parf", "config"; + reg-names = "dbi", "elbi", "atu", "parf", "config"; device_type = "pci"; linux,pci-domain = <0>; bus-range = <0x00 0xff>; num-lanes = <1>; + max-link-speed = <3>; #address-cells = <3>; #size-cells = <2>; @@ -871,9 +873,9 @@ pcie0: pci@20000000 { phy-names = "pciephy"; ranges = <0x81000000 0 0x20200000 0x20200000 - 0 0x100000 /* downstream I/O */ - 0x82000000 0 0x20300000 0x20300000 - 0 0xd00000>; /* non-prefetchable memory */ + 0 0x10000>, /* downstream I/O */ + <0x82000000 0 0x20220000 0x20220000 + 0 0xfde0000>; /* non-prefetchable memory */ interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi"; @@ -891,28 +893,30 @@ IRQ_TYPE_LEVEL_HIGH>, /* int_c */ clocks = <&gcc GCC_SYS_NOC_PCIE0_AXI_CLK>, <&gcc GCC_PCIE0_AXI_M_CLK>, <&gcc GCC_PCIE0_AXI_S_CLK>, - <&gcc GCC_PCIE0_AHB_CLK>, - <&gcc GCC_PCIE0_AUX_CLK>; - + <&gcc GCC_PCIE0_AXI_S_BRIDGE_CLK>, + <&gcc GCC_PCIE0_RCHNG_CLK>; clock-names = "iface", "axi_m", "axi_s", - "ahb", - "aux"; + "axi_bridge", + "rchng"; + resets = <&gcc GCC_PCIE0_PIPE_ARES>, <&gcc GCC_PCIE0_SLEEP_ARES>, <&gcc GCC_PCIE0_CORE_STICKY_ARES>, <&gcc GCC_PCIE0_AXI_MASTER_ARES>, <&gcc GCC_PCIE0_AXI_SLAVE_ARES>, <&gcc GCC_PCIE0_AHB_ARES>, - <&gcc GCC_PCIE0_AXI_MASTER_STICKY_ARES>; + <&gcc GCC_PCIE0_AXI_MASTER_STICKY_ARES>, + <&gcc GCC_PCIE0_AXI_SLAVE_STICKY_ARES>; reset-names = "pipe", "sleep", "sticky", "axi_m", "axi_s", "ahb", - "axi_m_sticky"; + "axi_m_sticky", + "axi_s_sticky"; status = "disabled"; }; };