From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81562C4345F for ; Tue, 30 Apr 2024 08:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eu2FxefweyvtAhFpieD3k7JLVLrnab+8mEYB+9nJ/JA=; b=kECluCwFb1Rn0O lwpn4ftJsPlbRH7aqhcW9BG/5LexfnRHRUZBRVZfxM5cHACdxZfvGG5clpeZqzD9RFwrl4wos1xiG GbeGI8grHZXXS/6aH2xTP3DkLjzqQoiS+m84TyVQDGsnCTDIzqvQdVf5NKZFJCbwkcElFry9dykiy VFur5ksdrBij5pF3aF1zg18cZfZJt77FmPoGsjCbsYTs/uds++vCOxB28YxnVS5l6sKElkUMgWUN3 YkrzsV+cJE4Ijn7aXbTlDPEa47TEBMJgOQ3d7l0G4Q2jowupGt8oonIEVcn+RNuCoF4shGYBoww6k JNPnCqgrfY1FIy5fQJrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1j0U-00000005d74-46aY; Tue, 30 Apr 2024 08:38:35 +0000 Received: from gloria.sntech.de ([185.11.138.130]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1j0S-00000005d5n-3RtS; Tue, 30 Apr 2024 08:38:34 +0000 Received: from i53875b01.versanet.de ([83.135.91.1] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1j06-0007i9-Ie; Tue, 30 Apr 2024 10:38:10 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Lorenzo Pieralisi , Krzysztof =?utf-8?B?V2lsY3p5xYRza2k=?= , Rob Herring , Bjorn Helgaas , Simon Xue , Kever Yang , Niklas Cassel Cc: Damien Le Moal , Niklas Cassel , Jianfeng Liu , Manivannan Sadhasivam , stable@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH v3] PCI: dw-rockchip: Fix initial PERST# GPIO value Date: Tue, 30 Apr 2024 10:38:09 +0200 Message-ID: <2493811.Mh6RI2rZIc@diego> In-Reply-To: <20240417164227.398901-1-cassel@kernel.org> References: <20240417164227.398901-1-cassel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_013832_911491_D5C883D1 X-CRM114-Status: GOOD ( 17.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Am Mittwoch, 17. April 2024, 18:42:26 CEST schrieb Niklas Cassel: > PERST# is active low according to the PCIe specification. > > However, the existing pcie-dw-rockchip.c driver does: > gpiod_set_value(..., 0); msleep(100); gpiod_set_value(..., 1); > When asserting + deasserting PERST#. > > This is of course wrong, but because all the device trees for this > compatible string have also incorrectly marked this GPIO as ACTIVE_HIGH: > $ git grep -B 10 reset-gpios arch/arm64/boot/dts/rockchip/rk3568* > $ git grep -B 10 reset-gpios arch/arm64/boot/dts/rockchip/rk3588* > > The actual toggling of PERST# is correct. > (And we cannot change it anyway, since that would break device tree > compatibility.) > > However, this driver does request the GPIO to be initialized as > GPIOD_OUT_HIGH, which does cause a silly sequence where PERST# gets > toggled back and forth for no good reason. > > Fix this by requesting the GPIO to be initialized as GPIOD_OUT_LOW > (which for this driver means PERST# asserted). > > This will avoid an unnecessary signal change where PERST# gets deasserted > (by devm_gpiod_get_optional()) and then gets asserted > (by rockchip_pcie_start_link()) just a few instructions later. > > Before patch, debug prints on EP side, when booting RC: > [ 845.606810] pci: PERST# asserted by host! > [ 852.483985] pci: PERST# de-asserted by host! > [ 852.503041] pci: PERST# asserted by host! > [ 852.610318] pci: PERST# de-asserted by host! > > After patch, debug prints on EP side, when booting RC: > [ 125.107921] pci: PERST# asserted by host! > [ 132.111429] pci: PERST# de-asserted by host! > > This extra, very short, PERST# assertion + deassertion has been reported > to cause issues with certain WLAN controllers, e.g. RTL8822CE. > > Fixes: 0e898eb8df4e ("PCI: rockchip-dwc: Add Rockchip RK356X host controller driver") > Tested-by: Jianfeng Liu > Tested-by: Heiko Stuebner > Signed-off-by: Niklas Cassel > Reviewed-by: Manivannan Sadhasivam > Cc: stable@vger.kernel.org # 5.15+ Reviewed-by: Heiko Stuebner it also matches what the vendor kernel does. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel