Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1611064rwb; Wed, 5 Oct 2022 02:05:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IfwvKOorHfVbkDIRiXhdx0nLitsmgfKSE8D8o1pThdEKek16ARVO1M4+cUnH5p97WPMKS X-Received: by 2002:a62:190e:0:b0:561:a818:41bb with SMTP id 14-20020a62190e000000b00561a81841bbmr10599503pfz.50.1664960711292; Wed, 05 Oct 2022 02:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664960711; cv=none; d=google.com; s=arc-20160816; b=klJS8Fq//O/gMLDykCrxOxBf/6GZlU9SLVe0MEmdaTvB+RdUkCw7sdwD6Jzfr4x7SP O5absOaS3iEphAZiZEC+gyEHxbvYgkntyXOa6xkzBIT3poTN2Duxir4LUA57hB4aWifk refv9PtoYY6yWELJ4B0dl2dulN+tWT7fhEO7MuREJD0hHRfwqzI56RNqwOWmQJAxIcSm tLeV9PB5SpEDglWXwkTu/5IVA/JuXx4cZVY+hQb+dbnTyB2xxDCqrO7RE8gw7iCH72+z 1vi9pMBNmppFH7Xd7u/+nU5XLxxfT670JsfYa70Fwm6ESvL1iYZJW11DatHcIafpAtFx g2Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=nHR0fgIqhCBR11D6YKPfMXCOkggiFUHu53+6yotzsTg=; b=syWf9bf0yZlzLyftoFGIf8CMoWWmP7fwyod6GkhGG1kbQSXwk4xSf+uGL08h1hIpzX AgXi0N/YMVQK3ca/Nu/LCZOA0EP2SYELaKGxUYpEBwX0voq29JuL1xdw4upmwk1QwxgJ E+AcI4ILRUax+HtExuBC3hgkffF3yqYnZPd5b7BZAzGa8iHP7gwg8O4vuGFK091tSjFO NjXQAQRip7n+xSPogeS7PECtP25ptZb1rzlTHHvDoB4gHwNIoJ63mXE2oqnIUGc2sTd7 D8qC0M+okCzLFMcwgluBfhE7If9FiHjL2CyxF8MVmzRYRUstUSTL+7XK1o7GB2e/mDhc h4XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=pQ6HYkXt; 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=NONE dis=NONE) header.from=xff.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a63b944000000b0042b85da3a53si17303762pgo.473.2022.10.05.02.04.59; Wed, 05 Oct 2022 02:05:11 -0700 (PDT) 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=@xff.cz header.s=mail header.b=pQ6HYkXt; 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=NONE dis=NONE) header.from=xff.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229739AbiJEI7E (ORCPT + 99 others); Wed, 5 Oct 2022 04:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbiJEI7A (ORCPT ); Wed, 5 Oct 2022 04:59:00 -0400 Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E551963FF2; Wed, 5 Oct 2022 01:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1664960338; bh=lEwY/zjdybhUANOaEO/4dQ3U3RYpKuYPtegSEH6M8KM=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=pQ6HYkXtdvvb8qsKJ4r6ENWZLKMAfB4GcE4XFdPwNkiCWvjpZj9g6ghJr+eeedXQ9 hJ5W6OgUVhM9SO3E8O/fNHAadFYWX1H3T54oN7BfNPB+GD0HGvFOiyajhAk0hj8Pd9 /P3zUtN80mmvpU/EANmT5Zvs4uMPKiHoN1OScb1w= Date: Wed, 5 Oct 2022 10:58:57 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Peter Geis Cc: linux-rockchip@lists.infradead.org, Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Michael Riesch , Nicolas Frattaroli , Sascha Hauer , Frank Wunderlich , Ezequiel Garcia , Yifeng Zhao , Johan Jonker , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/Rockchip SoC support" , open list Subject: Re: [PATCH] arm64: dts: rockchip: rk356x: Fix PCIe register map and ranges Message-ID: <20221005085857.psmoj7ktohsvvxic@core> Mail-Followup-To: =?utf-8?Q?Ond=C5=99ej?= Jirman , Peter Geis , linux-rockchip@lists.infradead.org, Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Michael Riesch , Nicolas Frattaroli , Sascha Hauer , Frank Wunderlich , Ezequiel Garcia , Yifeng Zhao , Johan Jonker , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/Rockchip SoC support" , open list X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED References: <20221004144304.536023-1-megi@xff.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org Hello Peter, On Tue, Oct 04, 2022 at 03:52:39PM -0400, Peter Geis wrote: > On Tue, Oct 4, 2022 at 10:43 AM Ondrej Jirman wrote: > > Good Afternoon, > > > > > > I have two Realtek PCIe wifi cards connected over the 4 port > > PCIe bridge to Quartz64-A. The cards fail to work, when nvme > > SSD is connected at the same time to the bridge. Without nvme > > connected, cards work fine. The issue seems to be related > > to mixed use of devices which make use of I/O ranges and memory > > ranges. > > > > This mapping is designed to be more straightforward, inspired by > > dt-bindings docs for sample pcie3x2 node: > > > > reg = <0x3 0xc0800000 0x0 0x390000>, > > <0x0 0xfe280000 0x0 0x10000>, > > <0x3 0x80000000 0x0 0x100000>; > > ranges = <0x81000000 0x0 0x80800000 0x3 0x80800000 0x0 0x100000>, > > <0x83000000 0x0 0x80900000 0x3 0x80900000 0x0 0x3f700000>; > > > > I noticed that this is crafted so that there doesn't need to be > > any translation other than dropping the high dword bits, and I > > modified the ranges for pcie2x1 to follow the same principle. > > > > This change to the regs/ranges makes the issue go away and both > > nvme and wifi cards work when connected at the same time to the > > bridge. > > > > Signed-off-by: Ondrej Jirman > > --- > > arch/arm64/boot/dts/rockchip/rk356x.dtsi | 7 ++++--- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi > > index 319981c3e9f7..e88e8c4fe25b 100644 > > --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi > > +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi > > @@ -855,7 +855,8 @@ pcie2x1: pcie@fe260000 { > > compatible = "rockchip,rk3568-pcie"; > > reg = <0x3 0xc0000000 0x0 0x00400000>, > > <0x0 0xfe260000 0x0 0x00010000>, > > - <0x3 0x3f000000 0x0 0x01000000>; > > + <0x3 0x00000000 0x0 0x01000000>; > > + > > reg-names = "dbi", "apb", "config"; > > interrupts = , > > , > > @@ -884,8 +885,8 @@ pcie2x1: pcie@fe260000 { > > phys = <&combphy2 PHY_TYPE_PCIE>; > > phy-names = "pcie-phy"; > > power-domains = <&power RK3568_PD_PIPE>; > > - ranges = <0x01000000 0x0 0x3ef00000 0x3 0x3ef00000 0x0 0x00100000 > > - 0x02000000 0x0 0x00000000 0x3 0x00000000 0x0 0x3ef00000>; > > + ranges = <0x01000000 0x0 0x01000000 0x3 0x01000000 0x0 0x00100000 > > + 0x02000000 0x0 0x02000000 0x3 0x02000000 0x0 0x3e000000>; > > Have you verified these ranges do not regress the NVMe drive when it > is connected directly to the controller? The reason we went with the > configuration space we did was because the original space from > downstream caused errors on NVMe drives when reading large amounts > (>1GB) of data at a time. I did. Anyway... looking at the ranges more carefully, I came up with a scheme that uses whole of 0x300000000 range for MEM and the smaller 32M range at 0xf4000000 for I/O and config, and tested it again to work for both: - nvme without a switch (directly connected) - nvme+wifi cards with a switch See v2 for more details. That ranges setup is closer to what BSP does. Kind regards, o. > Very Respectfully, > Peter Geis > > > resets = <&cru SRST_PCIE20_POWERUP>; > > reset-names = "pipe"; > > #address-cells = <3>; > > -- > > 2.37.3 > >