From patchwork Mon Aug 19 09:03:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 13768097 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 A5400C3DA4A for ; Mon, 19 Aug 2024 09:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=CYk/Np4BRVvjkNNwkVfXEx5Cn133dtofexIhTAAA2fo=; b=cZ/jaxW02KJHZdXAG/FBFGCYrA viU4u17kiQqR+bGwq5mGIorSTCe06U47SBkMaWSgjpLfeByZHXndaFKoUiZflmUgeIjNL22IEaQAc gJwPoA5rSjawsXZQpWsbQr+7LreWmcYl7D84/UmBCiKDN8lW0iIAIxI5fLZ2JYztGF3R6P50o+kvh iPLD8WCPgnwNeh12g2zBEkkXdv1I3b6BhDulSL8t47xLdtyzvCitJa2UwV6G+dbV8la11S0imaor4 M2lQAR9KNNecyDCIq26n7wX3Uuk3cx/MzxR5bdtkLSrfUWm4BxkIAZn2x1ayeglBQME4PdHmhmYAZ MJqJUfzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfyKB-00000000s49-0lGp; Mon, 19 Aug 2024 09:05:15 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfyJU-00000000rp5-06VB for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 09:04:33 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4280b3a7efaso31762105e9.0 for ; Mon, 19 Aug 2024 02:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724058270; x=1724663070; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CYk/Np4BRVvjkNNwkVfXEx5Cn133dtofexIhTAAA2fo=; b=cA2WcwRj3U8Rnxy1ltHHvIJeEId2hZAPJim/lWmbabG6biRiXC6z1848xJ/EdNslLX U1FEtY8n2QPRQhAwsL9aLFVQE8LTGcEd9Ugd7kBWR9slf/TKqpiOHn9VGgYNm2YNCSEo 6QNiOKZsDbYWLuTTNbyGQ4BRbzHHtnEorBLU/Qo/ft3DSwQ6M32GWE+90xwQo2Aoml/A TmyxZUJc/nmWGLl9AWco3cyddYqm/CCKI4D8NglxcDbP8mvEmP5ftXNwQyyNZSQI4NcW I4e6nSeoDmMX4En3cUOX64GO39WR9WjpxRMrSUIL6PMfQsoOl814RPfQVfpZ5Fjrj/kP uHcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724058270; x=1724663070; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CYk/Np4BRVvjkNNwkVfXEx5Cn133dtofexIhTAAA2fo=; b=jtdcl9IVstj5Hu1LzEN2cK30RmFGMT2FxRTdf+CUTP3nS8RZ58ESa8SLze17d+1iDs shn8wgTHKfx4Llrd5r3t1tl3SCOGF1I77yhqyX9ZXKOPDtMWkG9MKgqNHThu4g4rEAOj rUeOPWOV8y8/83e2KDhuBU2GbNUq22RIwgSxpau9euTjBodM//7coq9DZ+8qkmdtzrHg QZw9IS4MkpfOyJzAm3nzBlxvQAMITna4fWuZqLyZxVeDJMkalA8AZ/YCmGYdQM3nKfJu m3gPhZSpD3V6dr3nHu5vHriDlW6245Tg5lbHiZv1LXCQthR4n61IsTXuojaMu+FEy4OB YS3Q== X-Forwarded-Encrypted: i=1; AJvYcCV6JI2Wpn1EX2NnBSKDA8riZQGkbzhZbPnwZGOAN3s5kExO0FAn6p4DohpjhsHAtHkYzWuh6v+9zFNGceRolq1wLy51/T17VGvvKKJlTP9TJe01K2Q= X-Gm-Message-State: AOJu0Yz1jZDPTbW8ghLb8q8vVQEpWdOstorM3Mdyum1vXe5uMgfqnjp5 fGk51tkPVHdhHAUEN5X/eMiRk0sGr4+gJZZ2p6TYxML0l+tx1P/O X-Google-Smtp-Source: AGHT+IEbU1HgO/yej+WfZeaZhOMIw5v7VLZzInmznYjHixqxo9k1PPUaTG3RO3a5m4gtSHIAvWU/XQ== X-Received: by 2002:a5d:5e0f:0:b0:367:4d9d:56a5 with SMTP id ffacd0b85a97d-371983d5ea0mr4843461f8f.44.1724058269951; Mon, 19 Aug 2024 02:04:29 -0700 (PDT) Received: from eichest-laptop.toradex.int ([2a02:168:af72:0:a64c:8731:e4fb:38f1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded19627sm154672095e9.5.2024.08.19.02.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 02:04:29 -0700 (PDT) From: Stefan Eichenberger To: hongxing.zhu@nxp.com, l.stach@pengutronix.de, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, francesco.dolcini@toradex.com Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v1 0/3] PCI: imx6: reset link after suspend/resume Date: Mon, 19 Aug 2024 11:03:16 +0200 Message-ID: <20240819090428.17349-1-eichest@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240819_020432_082356_EA0A5F73 X-CRM114-Status: GOOD ( 17.53 ) 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 On the i.MX6Quad (not QuadPlus), the PCIe link does not work after a suspend/resume cycle. Worse, the PCIe memory mapped I/O isn't accessible at all, so the system freezes when a PCIe driver tries to access its I/O space. The only way to get resume working again is to reset the PCIe link, similar to what is done on devices that support suspend/resume. Through trial and error, we found that something about the PCIe reference clock does not work as expected after a resume. We could not figure out if it is disabled (even though the registers still say it is enabled), or if it is somehow unstable or has some hiccups. With the workaround introduced in this patch series, we were able to fully resume a Compex WLE900VX (ath10k) miniPCIe Wifi module and an Intel AX200 M.2 Wifi module. If there is a better way or other ideas on how to fix this problem, please let us know. We are aware that resetting the link should not be necessary, but we could not find a better solution. More interestingly, even the SoCs that support suspend/resume according to the i.MX erratas seem to reset the link on resume in imx6_pcie_host_init, so we hope this might be a valid workaround. Stefan Eichenberger (3): PCI: imx6: Add a function to deassert the reset gpio PCI: imx6: move the wait for clock stabilization to enable ref clk PCI: imx6: reset link on resume drivers/pci/controller/dwc/pci-imx6.c | 69 +++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 10 deletions(-)