From mboxrd@z Thu Jan 1 00:00:00 1970 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 DF9FBC3DA4A for ; Thu, 22 Aug 2024 07:27:16 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EZJLE47NxLo6eiTCM83oiOz2FzGL7nsxAHhhkcrrTiE=; b=rafQOTb1nFlHvo3FU9Ew8Te9XZ zZuRztYUPyfPFEv18lwise07yFhgY+bxS4cSq6RN2Ma9DG0vigubHVwrythCW6s47yijq6mdQaCIN GmTth7yswsPz+uuvDB3Tx/n2GJijrD9gSRFH4LI43fl3qLZq1c4ryHqbIvc87F7KrwQJYooNsfoNt MuWA7T4/uwi2MYm2fAUt04nbIznnBoNz97Ib6+NFnuid5dTnmXXVSP829ZmV/SqMQQIb3vl8GXhD9 tTT9mbbfE5DZIB1HOorriaxBPy/pXcDpsN4kjT0NtRJTuC1xjkGjTICvZa8TrwQi78FLUSLrL6hBo 4qGATiLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh2Do-0000000Brle-2M2l; Thu, 22 Aug 2024 07:27:04 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh27P-0000000BpiG-2fRn for linux-arm-kernel@lists.infradead.org; Thu, 22 Aug 2024 07:20:29 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5befe420fc2so819165a12.3 for ; Thu, 22 Aug 2024 00:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724311225; x=1724916025; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EZJLE47NxLo6eiTCM83oiOz2FzGL7nsxAHhhkcrrTiE=; b=Mv7T1NA9t0ckbnWGP2KWRYlNmtsRH4p13A7IIASpTr5DAineAFSxM+y20N04iNZFfk a9F2Zi8/fvvAt4gV94GfIOvFTKAMen71CekdAHifMe1+7KW5kxEw3+7VY1/9qsAEnC2k DqO6Vf2l2jK3ZVn+DXPXZIKhlZ5jgf0fcgF+knZzopXAB04c2B41pzLq6NmOC8l8KAo7 sjHapWtJNKxmW5nvDB7kqaGj4fZWtc/0dmcRBgLLsvUftvl1O/egXrCgbI0KQdITsJWF a0mOGtQ+D5bYGMQk8vatPNpEGQ4rXWdCv0ik+TwmGpQPmOMhXsKrpxzDYg6y4+7mNGbz cDag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724311225; x=1724916025; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EZJLE47NxLo6eiTCM83oiOz2FzGL7nsxAHhhkcrrTiE=; b=Sin+33GsodgmTjEO0F6uJ9coNB/dQOEMuP7xZNesmH39PKI47jleEdvOm2HLpI16WF +8PxdJxpuefwP6bWQy2g4YdHTtExK6jPundNhPh3W1dNIUmfOMd2rS2RSiG8em2nd27J 674FdvELAZMhPFdhqAujhTUGs97uuHUgnYFgYQwrmBc3JeSirpq2qp7vgldrjUDbSQVf kDxYJOUX1czCId2U2XoCu/ykOSQX8tyyd2sAathkZivGpB0jXlshbOiwDLCd95sRIN9g CRZZWL53CqkuRxa6zZ6NpSB8k9FQ2l3ee+W8WGGogqH/wUI9MwxKFQufg9l6Td625Qym S2Nw== X-Forwarded-Encrypted: i=1; AJvYcCXf13dVISF63MomNQ7yvkStmmWPOsRHgDWH5KnWrBiVJkx64Ml2SGQpsEwFqSH3HgU/9LyuSMShDLnLukBJDN/F@lists.infradead.org X-Gm-Message-State: AOJu0YyhnChGoBQJrF3vJ+KfyISTqDBJUkCxYkK3ZoA0o53yY5Dz3YWX jeErcDlm5UwKeg3uBdQktnYYAOM/YifSyY3u44DkAg9FLzy9XfrUnC8Wa8py X-Google-Smtp-Source: AGHT+IGxy+zKNyZnjMAmFsnzCP6StW+jFRGcpYePiTJJdxdrkAiZFUr29/nyIwkAIZWWVtSNyOXfvg== X-Received: by 2002:a05:6402:3713:b0:5a0:c6bc:9f5a with SMTP id 4fb4d7f45d1cf-5bf1f284c4bmr2262367a12.38.1724311225164; Thu, 22 Aug 2024 00:20:25 -0700 (PDT) Received: from eichest-laptop ([2a02:168:af72:0:daa9:644d:3c2:44bb]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c044ddc0e6sm530789a12.19.2024.08.22.00.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 00:20:24 -0700 (PDT) Date: Thu, 22 Aug 2024 09:20:23 +0200 From: Stefan Eichenberger To: Frank Li Cc: 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, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 0/3] PCI: imx6: reset link after suspend/resume Message-ID: References: <20240819090428.17349-1-eichest@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_002027_699040_DB00CBA9 X-CRM114-Status: GOOD ( 44.05 ) 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 Wed, Aug 21, 2024 at 12:51:12PM -0400, Frank Li wrote: > On Wed, Aug 21, 2024 at 05:41:00PM +0200, Stefan Eichenberger wrote: > > Hi Frank, > > > > On Tue, Aug 20, 2024 at 08:52:41AM +0200, Stefan Eichenberger wrote: > > > On Mon, Aug 19, 2024 at 10:30:38AM -0400, Frank Li wrote: > > > > On Mon, Aug 19, 2024 at 11:03:16AM +0200, Stefan Eichenberger wrote: > > > > > 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 > > > > > > > > Thanks you for your patch, but it may have conflict with > > > > https://lore.kernel.org/linux-pci/Zr4XG6r+HnbIlu8S@lizhi-Precision-Tower-5810/T/#t > > > > > > > > > > Thanks a lot for the hint. I will have a look at the series and see if I > > > can adapt my changes including your suggestions. > > > > I did some more tests with your series applied. Everything works as > > expected on an i.MX8M Plus. However, the i.MX6Quad PCIe link still does > > not work after a resume. I could trace the issues back to the following > > functions, besides that we could use the same suspend/resume function as > > for the other i.MX SoCs. > > Upstream 6q pci don't support suspend/resume. > > [IMX6Q] = { > .variant = IMX6Q, > .flags = IMX_PCIE_FLAG_IMX_PHY | > IMX_PCIE_FLAG_IMX_SPEED_CHANGE, > > If you add some code, can you post your patch(mark as RFC) then let me to > check. Sure, I will wait until your series is merged and then try to come up with an RFC for suspend/resume on i.MX6Quad. Maybe we could use the same mechanism as for the downstream kernel where they just toggle the IMX6Q_GPR1_PCIE_TEST_PD bit? https://github.com/nxp-imx/linux-imx/commit/4e92355e1f79d225ea842511fcfd42b343b32995