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 8DC82C4345F for ; Wed, 17 Apr 2024 15:20:36 +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:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=Z/23XelVXvuQFuvuh6+pxFmk8UVXPFkS4T4OlNrdU0c=; b=pZ7cqsWqBSTLXn ZHY+6NOpdwNhJNxpg1/R3M3A23cxUGQeB+tREgqOsm8d4gyZrx/IsblsZRr1VPHlImdL7vHm9h1el M425Z6iggAgtw8VnSNc/Pr46NeXYL4RsFptFeOl7tXKViP9pRhRLx4n8qQ7IZzb4PM5+VzFdM9VGu OswPDCINguMhRQrbuEIX13FdW6JcVBd6kS74f3azH64+HVzzu6mzilZMqzV4bNo/ZsTr1JGLNDyOL QiGvgPv6+kWGQ5ZqhG6ia7p7+Oxn3i6wm1f1DiGXTFQmAs56MBT3PM2x33d89ez8x7j0j1Tr2/K1y Y1qxWSfXddXKqf7B5JSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx75D-0000000GYd7-3GiZ; Wed, 17 Apr 2024 15:20:23 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx75A-0000000GYb6-25Cl; Wed, 17 Apr 2024 15:20:22 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E7F8E61509; Wed, 17 Apr 2024 15:20:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C669C072AA; Wed, 17 Apr 2024 15:20:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713367219; bh=bjG0OvVci60DYDmOstQK1av/d1jsvMQvEpItMyw5WyA=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=oKNyUK2YWHX8izA/mUulk3F0nlFtMEadilpVR2vygtEwK0vfii3BK7XbujV5Lbozd XSVXsrp79Ixbx/KQ17UpMtNKQDneMeCzlrh7itYCXyXqfIFtN75zTX9Gg5Ncd+lDju BgaqIuEWgp7SPxmvmuyMun17Am84fsKkKDIQjxfZtcU+uCWxrMy3cM06DvHYwIptb7 cSw8QKj8TKldn0hNb9VetsJJ+96WCK4fum3C2ndFKKtJE63pJAgSF5dHhL8KqWRmCH wd9WGvW1957MkjPjp4dcbmIr6bE7m26xwIcsXzUXdgSYud0y60mvZiNjMZIrc9r9kd qOlxNve/9WPjw== Date: Wed, 17 Apr 2024 10:20:17 -0500 From: Bjorn Helgaas To: Niklas Cassel Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Heiko Stuebner , Simon Xue , Shawn Lin , Damien Le Moal , 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 v2] PCI: dw-rockchip: Fix GPIO initialization flag Message-ID: <20240417152017.GA202515@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240416121522.269972-1-cassel@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240417_082020_885636_04E70862 X-CRM114-Status: GOOD ( 24.34 ) 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 On Tue, Apr 16, 2024 at 02:15:22PM +0200, Niklas Cassel wrote: > PERST is active low according to the PCIe specification. Maybe update the subject to mention that this is about PERST# and avoiding an unnecessary toggle. Also maybe worth using "PERST#" here in the commit log to match the spec and connect with the explicit GPIO levels. > 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 > Signed-off-by: Niklas Cassel > Reviewed-by: Manivannan Sadhasivam > Cc: stable@vger.kernel.org # 5.15+ > --- > Changes since V1: > -Picked up tags. > -CC stable. > -Clarified commit message. > > drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c > index d6842141d384..a909e42b4273 100644 > --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c > +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c > @@ -240,7 +240,7 @@ static int rockchip_pcie_resource_get(struct platform_device *pdev, > return PTR_ERR(rockchip->apb_base); > > rockchip->rst_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", > - GPIOD_OUT_HIGH); > + GPIOD_OUT_LOW); > if (IS_ERR(rockchip->rst_gpio)) > return PTR_ERR(rockchip->rst_gpio); > > -- > 2.44.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel