From patchwork Fri Oct 6 07:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13411103 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 6241BE92FF4 for ; Fri, 6 Oct 2023 07:49:04 +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:Subject:Cc:To: From:Date: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=7QdCf18G2+DC98eXqsMCms43B0DR5CygBlkO4Feo85c=; b=h19hVaupoc5/IR hFvpys2zuFV5ET2mUDuG4ij8kJxXYKhIlEtllfSQYxdOn4t58jfo2fuWQmdYFa2gG/0bYsvZMwtcq MP3PRr7ejaBgA2dH7WVXXtTtkedYn4P9D6A9jg6nI9L8HRll5n4ti9XPU42sl5jL/a18r3n+2a/BB dVzy4joz8tXMyS0G49H+0GmfbItKbdz7H/53JQhYIO+Kpp/XoFW4emnwudpL5lTcIyE549AiAi6eY 1MJLc+d4A7Euz7RnYQY2Leb8i+BvZbt1i4eMCr8fyPYNj1JzFrVWUV93gGA+Xpbz6Rp2jqNxILV/n oiV9sv6QvdpylxBojPOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qofZb-005CtD-32; Fri, 06 Oct 2023 07:48:35 +0000 Received: from pidgin.makrotopia.org ([185.142.180.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qofZY-005Cru-2J; Fri, 06 Oct 2023 07:48:34 +0000 Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qofZT-0004lD-0L; Fri, 06 Oct 2023 07:48:27 +0000 Date: Fri, 6 Oct 2023 09:45:58 +0200 From: Daniel Golle To: linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno , Matthias Brugger , Bjorn Helgaas , Rob Herring , Krzysztof =?utf-8?q?Wilczy=C5=84ski?= , Lorenzo Pieralisi , Jianjun Wang , Ryder Lee Cc: Christian Marangi , Frank Wunderlich , John Crispin Subject: [PATCH] PCI: mediatek-gen3: fix PCIe #PERST being de-asserted too early Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231006_004832_754364_12E90BAF X-CRM114-Status: GOOD ( 10.38 ) 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 The driver for MediaTek gen3 PCIe hosts de-asserts all reset signals at the same time using a single register write operation. Delay the de-assertion of the #PERST signal by 100ms as required by PCIe CEM clause 2.2, some PCIe devices fail to come up otherwise. Signed-off-by: Daniel Golle --- 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 e0e27645fdf4..ba8cfce03aad 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 */