Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2627549rwr; Fri, 28 Apr 2023 13:11:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4fuATRfH7BTB7YFxnUM0uleoKHqFRoTry3UlV9zgbH41T8RAy/9NiIz/f9rauD+BD615z8 X-Received: by 2002:a05:6a20:8e11:b0:f0:5d4:c4a with SMTP id y17-20020a056a208e1100b000f005d40c4amr8644573pzj.8.1682712718355; Fri, 28 Apr 2023 13:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682712718; cv=none; d=google.com; s=arc-20160816; b=QstOywSEsBc4HcP5BJTujptBdQ8HxVkjlSNQqQhzPc/YTwG4I87V0gFlpG8ZD3Gfl3 I8a8mHYQrKyk31Nt8929aA80wzzFdb31RxyaDlsbBNLlTHHjrq4yBBrcggXE5K5xyqVM yOgO57a3EL25Ge/a/fhok0ozaBTWoxZoswvohsKINR/lH0Sla6S7h5An216cKzMLzQuB guYZLY27P+H2UgW6JCFbE3XBpYFJaKV5R3hxEXHSmoV673iTCHlnIOljXJ0DF1FbnBEV 1aByp0oFVpyzGFiHQnuNmxyCbOPowrSb+brX+IKQJnqDl3jxXo5ncwlTbOUrfoZQO/8O Y8ZQ== 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 :message-id:subject:cc:to:from:date:dkim-signature; bh=ot16bbSWratITeieuZ2M5pTku5YX9XBembicO/4iWAk=; b=aDM/Wsf8YbvUwwkEbPCr9fyDQIz0MpSOR9bFIoaJl7zUOXkCzSRDkmVdt24RIORWx4 05C8z6EHidoyhj/VtnY4u2r2F6qQ3fN+ZM/71AMgEvySiR9hOBmef0WAR5ltRukGykqj 8KDc/QF6jYfZxkQPAps1nT8UiVx2v1uuc3U4zOBLHgh3x5XJBrZi7Q0r2XrAZGYtDAde NZHGJncAbdkYT76FwFxIvlyx7EtFXvU/0oWIWirerYPkmW3PrInuB+tZ6FE3mxMF7tA8 C/4PWiX5BeHAoy1F+gOzWSlCSEcsXstJBeEEwGrArc5imRVA2yyyYiH8fjzgHoY4cGHd fpRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gmwmeh3n; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v71-20020a63894a000000b0051a24ba4d74si21459519pgd.837.2023.04.28.13.11.46; Fri, 28 Apr 2023 13:11:58 -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=@kernel.org header.s=k20201202 header.b=gmwmeh3n; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229779AbjD1UJZ (ORCPT + 99 others); Fri, 28 Apr 2023 16:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjD1UJY (ORCPT ); Fri, 28 Apr 2023 16:09:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20F9626A1; Fri, 28 Apr 2023 13:09:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AFCA76446A; Fri, 28 Apr 2023 20:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBE2DC433D2; Fri, 28 Apr 2023 20:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682712559; bh=audxmFyFfzKOzyoEf7CTSzuG77aOVueJU+fs+OT6QdM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=gmwmeh3nYlaOJciNrWIxTRgwUw5/hXOkHvvVy1aYvbFtfN5+EpxW2zz6bXYD2JtY5 r/iFRuaIJFNiHddfPEXA0VigK56abay3652iAhmUYyWDFYQM1abYps8AqZ0G8u9HkQ JBTf+moZ3ny3l2ZNWzXp0Vff6iDJ+7KMiNOiSiumbHO1Z0tRwax1Icf1eTRVAM0OxE 5ApUk8Vcc0TY4MrfIeXzxMOFIKdyto5geze7Aiktfv0DL/bkSlUeTwv3McX1Ep41Io XCVbfWDK3dKw1OdOSRlJXogNkh7YfZTLkBVNqPD7Z3uE0vgrxVLxiNHEEwBZlzT6cw C7ckCPuGonLMg== Date: Fri, 28 Apr 2023 15:09:16 -0500 From: Bjorn Helgaas To: Frank Wunderlich Cc: linux-mediatek@lists.infradead.org, Rob Herring , Ryder Lee , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , linux-pci@vger.kernel.org, Lorenzo Pieralisi , linux-kernel@vger.kernel.org, Jianjun Wang , Matthias Brugger , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] PCI: mediatek-gen3: handle PERST after reset Message-ID: <20230428200916.GA361406@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230402131347.99268-1-linux@fw-web.de> X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Sun, Apr 02, 2023 at 03:13:47PM +0200, Frank Wunderlich wrote: > From: Frank Wunderlich > > De-assert PERST in separate step after reset signals to fully comply > the PCIe CEM clause 2.2. I guess this refers to PCIe CEM r5.0, sec 2.2. > This fixes some NVME detection issues on mt7986. > > Fixes: d3bf75b579b9 ("PCI: mediatek-gen3: Add MediaTek Gen3 driver for MT8192") > Signed-off-by: Frank Wunderlich > --- > Patch is taken from user Ruslan aka RRKh61 (permitted me to send it > with me as author). > > https://forum.banana-pi.org/t/bpi-r3-nvme-connection-issue/14563/17 > --- > drivers/pci/controller/pcie-mediatek-gen3.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c > index b8612ce5f4d0..176b1a04565d 100644 > --- a/drivers/pci/controller/pcie-mediatek-gen3.c > +++ b/drivers/pci/controller/pcie-mediatek-gen3.c > @@ -350,7 +350,13 @@ static int mtk_pcie_startup_port(struct mtk_gen3_pcie *pcie) > msleep(100); > > /* De-assert reset signals */ > - val &= ~(PCIE_MAC_RSTB | PCIE_PHY_RSTB | PCIE_BRG_RSTB | PCIE_PE_RSTB); > + val &= ~(PCIE_MAC_RSTB | PCIE_PHY_RSTB | PCIE_BRG_RSTB); > + writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG); > + > + msleep(100); There should be a #define for the 100ms value since it is required by the generic PCIe CEM spec, not by anything specific to mediatek. If one already exists, we should use it. If not, we should add one. pcie-tegra194.c and pcie-mediatek.c (at least) also have similar delays and should also use the same #define. There are several other drivers that contain "msleep(100)", but I didn't look to see their purpose. > + /* De-assert PERST# signals */ > + val &= ~(PCIE_PE_RSTB); > writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG); > > /* Check if the link is up or not */ > -- > 2.34.1 > >