From patchwork Sun Apr 2 13:13:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 13197395 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 B8D55C7619A for ; Sun, 2 Apr 2023 13:14:51 +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: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:In-Reply-To:References: List-Owner; bh=5N9bJfOeoCeN97NulIofLV0aLsh+E0vj7Ddt0mP0P44=; b=PC+wgMYvssnMtz qauhysafVU3M7tEtHIlC9Rc1nUOJ4/8kySuHCD7cYJxTRmZjUtmV3jSmZ6bg4PAdo4Zj6rs467YlK 4etXxVhdXQAZsiU26uCeUSfDWsK0ystcDgsHkYH/fCtiMRwfBzRca8POjBUNTG3kEfaMVp86ubTDW /QaKe5Qg7kk9QnL2v7EbAHBbphVqPYxQSMcm6leCawVX6ac2IwI6PzOf/6iPfxtW1IbrqfBYJGADI ZbNxRGTrqw4W3M2kgkJNtetOw8Mve2fGC6pITEbU/frVEd5nDj/NFBibG1DqVWPcg7XSf2NddtXZW PFv/3yqJLb24WgCWx42g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pixWz-00CVHb-1d; Sun, 02 Apr 2023 13:14:01 +0000 Received: from mxout2.routing.net ([2a03:2900:1:a::b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pixWw-00CVGw-19; Sun, 02 Apr 2023 13:13:59 +0000 Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout2.routing.net (Postfix) with ESMTP id CEE775FBFE; Sun, 2 Apr 2023 13:13:55 +0000 (UTC) Received: from frank-G5.. (fttx-pool-217.61.149.201.bambit.de [217.61.149.201]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id E3A711007F0; Sun, 2 Apr 2023 13:13:54 +0000 (UTC) From: Frank Wunderlich To: linux-mediatek@lists.infradead.org Cc: Frank Wunderlich , Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Matthias Brugger , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] PCI: mediatek-gen3: handle PERST after reset Date: Sun, 2 Apr 2023 15:13:47 +0200 Message-Id: <20230402131347.99268-1-linux@fw-web.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Mail-ID: 0729ddf9-6bfe-4c25-9067-7616871ef223 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230402_061358_542320_8F34D318 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Frank Wunderlich De-assert PERST in separate step after reset signals to fully comply the PCIe CEM clause 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); + + /* 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 */