From patchwork Sat Apr 13 00:41:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1923299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=s4r5SxP6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pci+bounces-6208-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VGZPQ6vD7z1yZT for ; Sat, 13 Apr 2024 10:41:30 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B7B491C210CA for ; Sat, 13 Apr 2024 00:41:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 135CE1847; Sat, 13 Apr 2024 00:41:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s4r5SxP6" X-Original-To: linux-pci@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E464517FE for ; Sat, 13 Apr 2024 00:41:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712968885; cv=none; b=gjtvgqH2IiH8ZYgZrfy4Z+0diWLL9mso3QHSHosuHpnn4FZDQpv65fcZZ9Uvopf23PjD0UrS/leS3eyT8OkNF3aByXhkqQ3g9W1DzwaNv4FSUdIx0jyfdPQ1y63rpFuHg869Lx9H3row1xkRQnKKvWfhVW8FlrKbEceHn6JWRSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712968885; c=relaxed/simple; bh=XpYhNOv4ZHsSL532m9ktfz4Uqkztrb/PULdnHkhHXSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tTD/uLLWmybnKJ1BxiFEQlSwCV9XdadGAIJzi33LBsNvxVVAlwHXBdVstoc5OrO+0U8PNQLPciTDM1q468S/f1AFOroJzR6UmxkL18KSK1IGNaBlFY8PhxvNlVkmBKSa2od+ruAn0fLtwIpHzljJqV+hPUSong3kVuZIByW1a6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s4r5SxP6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63620C2BD10; Sat, 13 Apr 2024 00:41:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712968884; bh=XpYhNOv4ZHsSL532m9ktfz4Uqkztrb/PULdnHkhHXSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s4r5SxP62X6JE4fUhs5yNnHIfrZy75SUM1MNtonnbzhKUAW3oYbKH2AhoxBYRZNgY arclyENZfljBegg9gEnS/N1RxmWef0toYsmRtXT9jAvcQPTO82PKczPVIr98nlu+8n U8WRtt9vwTuOIjE2rC7RSxDS00BTC2emIPONu6x/8BgfM90mSZoeYKuaaY9Bc5pz7Z 7h7Mi9c3hW3fphmz/dFH1ddSdccM5xkJip5aRXmS8f0ySI6AfofS5/U6HJDbd6rp9k ojue8bHQkJgrK7xVu65ZfATou3Lx11bWloe17vAz06HqOEAdfCZLNLE/s1O/hEpWxu ojxrb2i/5ro5w== From: Damien Le Moal To: Shawn Lin , Bjorn Helgaas , Heiko Stuebner , linux-pci@vger.kernel.org Cc: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 1/2] PCI: rockchip-host: Fix rockchip_pcie_host_init_port() PERST# handling Date: Sat, 13 Apr 2024 09:41:19 +0900 Message-ID: <20240413004120.1099089-2-dlemoal@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240413004120.1099089-1-dlemoal@kernel.org> References: <20240413004120.1099089-1-dlemoal@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The PCIe specifications (PCIe CEM r5.1, sec 2.9.2) mandate that the PERST# signal must remain asserted for at least 100 usec (Tperst-clk) after the PCIe reference clock becomes stable (if a reference clock is supplied), and for at least 100 msec after the power is stable (Tpvperl, defined by the macro PCIE_T_PVPERL_MS). Modify rockchip_pcie_host_init_port() to satisfy these constraints by adding a sleep period before deasserting PERST# using the ep_gpio GPIO. Since Tperst-clk is the shorter wait time, add an msleep() call for the longer PCIE_T_PVPERL_MS milliseconds to handle both timing requirements. Signed-off-by: Damien Le Moal Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/pcie-rockchip-host.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c index 300b9dc85ecc..fc868251e570 100644 --- a/drivers/pci/controller/pcie-rockchip-host.c +++ b/drivers/pci/controller/pcie-rockchip-host.c @@ -322,6 +322,7 @@ static int rockchip_pcie_host_init_port(struct rockchip_pcie *rockchip) rockchip_pcie_write(rockchip, PCIE_CLIENT_LINK_TRAIN_ENABLE, PCIE_CLIENT_CONFIG); + msleep(PCIE_T_PVPERL_MS); gpiod_set_value_cansleep(rockchip->ep_gpio, 1); /* 500ms timeout value should be enough for Gen1/2 training */