From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr2-f1.google.com (mail-wr2-f1.google.com [74.125.225.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2FC542587A for ; Thu, 30 Jul 2026 12:14:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785413673; cv=none; b=Tw/W+lNEMuQnE8gq25AbXSGDnF+vA9DdNKXvjkRGWr3D/ArU+nJyw1rHrCxVtjrVPyuq1UUjFDRCxWi2qGkV2K0VhpLnJdo7GER1NNXneyeTDPwJo6hQXxLZUt/oyIn+nVrEmKv9wPuZxWYiYZFzY+qAyuNlmz8Ke1IgegDrz3c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785413673; c=relaxed/simple; bh=c747fqvNDgqVLoyxnKPVeIUVwA83B4m/ITNcnGHudIc=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=bOCnsH9eMbHvsEjzoi8Cuy2GDkWd84jd0nVbVUGvJ5o7FyrbxiY5Xn7rJqXUbeKQ3KyXZmone1jk/R6PWlmC1GyFiSA+Ss/XUoJLwT7cnpIn2LTG1/aST3f96nsGECQwrQ6ODMnTuvaIJex8/LanXHJSEpV5sARPdcwl0XU1pKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=9elements.com; spf=pass smtp.mailfrom=9elements.com; dkim=pass (2048-bit key) header.d=9elements.com header.i=@9elements.com header.b=NskyoACr; arc=none smtp.client-ip=74.125.225.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=9elements.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=9elements.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=9elements.com header.i=@9elements.com header.b="NskyoACr" Received: by mail-wr2-f1.google.com with SMTP id ffacd0b85a97d-46e747fbf36so797654f8f.0 for ; Thu, 30 Jul 2026 05:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1785413670; x=1786018470; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=7eM/+djUdUKJLWwx0zayHVa8z9iYSo8gtg4+aGAkdTc=; b=NskyoACr+wxUdZSBWcWCek0Quq44Rjl6ppkyp1lIOr1Gdq7nDR/+HJqmjA31kUFJYY AHqqerojWES4AyaowhVSJRM1Hn4XFIR7sT0thWat6Xxg7QNpQZNtrr7X//n+atTlGG9d FO5d8XdJSbGjKORdENp1kttoGYYrvB1mJkKsxYLsM54h8MKlVmzjrAb7OruV8XfPJliC nvFFD0gC5Seu2mqrp5zZCQadgWYBi5AOMWtRsT2l9mh0ZrWysN6zxvtLNAyzZ7axZFHI 5pewBUG+v4N6src4D5UUGAPGrG5opacknLtwXvDaoLr0ydJrb/crG0J78Zf5vL5KQY6v VfCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785413670; x=1786018470; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=7eM/+djUdUKJLWwx0zayHVa8z9iYSo8gtg4+aGAkdTc=; b=RnwGOK1iF2USYKAWB94F+2xgXrLKxFXAYermYuFJOV/++9UfJyKVhg7IY70RG9exZW x6NfX8jwfODddcXS0eTgT4NTz1hpSEEHcc+WgJlCsxRvhzIN9tmtvxqsd8KDqU8Trh79 k3dwLmW+EvubJBZ9WhiB5Dm93VF7q9/dkB6eayDT2//J3TQ8XY1nqXqaUhR7PkiYiWZS mvm+6YcGA2TOFaaENvt8dm0swhlvevEP3a2chFyhUbFXEgZLS9uok/m0/dET7ha6t2R2 JZp0tA5DsgGQ8z9t9yq9x0vwksgU+yhPrYPkLoVHRDBD6U/bUzsCmVRBgSy2uBG7+lZn 4u3Q== X-Forwarded-Encrypted: i=1; AHgh+RqPLbgOrxHNGmzidgHbM2bLooPvxkQ4mx7aDU+3gmuTrPLHgjeDfLaG0Ei94ZYhf0lJzljeJfD4jvIaIJQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6R9Js8ual1YxG28Dv0edoks+iNu/CLuuHMAqKusJuewoH9LMb n7rzK7EssHPe4LvRsZb7JNLjo5QZbL+zqAOuN460Yklbk+elaoD8vtIsP1jld6J6pg== X-Gm-Gg: AR+sD13c2quiy10jFyLDjplOX8ufuvEScttfye6LcBs6QyZ1I/Z4m+X4AtIoQiTUmIs 9eXAH4A2aMIQZhANe/YcHaixL+ZzYOYJbnjBQKYFTAYEgMD9lsngOtx29/H6TAgA+Xf6vTcAuEA PV6qx8igkF1Uu9CAfx60GqZPsO7qUNOweDzcobAUTRKwWw0o/Rtm+vmBiLDmvgxlWa8Z1AZ+SnP lGm0Wl1y2xfWbEh/upo+rf0mYp1xZojOAZ2zl2/miNEbFhMvQMVGzO/16QO/cd699bFFcZsIAtw JbBJXH4ZdpGxSWqykZDVO+jVLl7+BuWLiIAgmcN23INFavdBEyJYgQ65gjxPiudtoCiTwwxIqds EWjIUzqwyJIt6WeTmV9ix/yWMjMXe/bYzN455jCZsn4abN7bgbvaCX+XK+CKzjsQhI4Af3AMI5B KqTT1tLj+TcBh8Cb/zdi6E9/hQSQBKK9L86S3xqo47k2yGcaw7CV8YA99KIfc2mxPATQ== X-Received: by 2002:a5d:59c3:0:b0:47f:9283:1fb3 with SMTP id ffacd0b85a97d-47fc806e48amr3531249f8f.0.1785413669775; Thu, 30 Jul 2026 05:14:29 -0700 (PDT) Received: from localhost ([188.111.3.154]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fc892cc54sm5743980f8f.21.2026.07.30.05.14.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jul 2026 05:14:29 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 30 Jul 2026 14:14:27 +0200 Message-Id: Cc: "Lucas Stach" , "Lorenzo Pieralisi" , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , "Rob Herring" , "Bjorn Helgaas" , "Sascha Hauer" , "Pengutronix Kernel Team" , "Fabio Estevam" , , , , Subject: Re: [PATCH] PCI: imx6: enable ASPM L1 only iff CLKREQ# is supported From: "Michal Gorlas" To: "Manivannan Sadhasivam" , "Richard Zhu" , "Frank Li" , "Michal Gorlas" X-Mailer: aerc 0.21.0 References: <20260719-l1-conditional-imx-v1-1-a55a57915c68@9elements.com> In-Reply-To: On Wed Jul 29, 2026 at 7:01 PM CEST, Manivannan Sadhasivam wrote: > On Sun, Jul 19, 2026 at 02:47:54AM +0200, Michal Gorlas wrote: >> Since commit f3ac2ff14834 ("PCI/ASPM: Enable all ClockPM and ASPM >> states for devicetree platforms"), ASPM states are force enabled >> on all devicetree platforms. This causes PCI devices on some iMX SoCs >> (for e.g. iMX 8M Plus Kontron SMARC eval carrier) to enter L1 even >> though CLKREQ# is not supported (and consequently supports-clkreq is >> not set in pcie controller node of their DT), which causes the device to >> never wake up from L1. >>=20 >> Hence, disable L1 capability in the LINKCAP register if supports-clkreq >> is not set in the DT explicitly. >>=20 >> Note, the logic here is very similar to 613f3255a35a, only difference >> is that leaving L0s enabled does not cause issues (at least >> I never encountered them myself when testing on the device) as its >> not dependent on CLKREQ# being physically there. >> Since there is already a way of specifying its presence in the DT, >> the driver should be aware and disable L1. >>=20 >> Fixes: f3ac2ff14834 ("PCI/ASPM: Enable all ClockPM and ASPM states for d= evicetree platforms") >> Signed-off-by: Michal Gorlas >> --- >> drivers/pci/controller/dwc/pci-imx6.c | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >>=20 >> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/control= ler/dwc/pci-imx6.c >> index 98e1db751132..7471501fbf04 100644 >> --- a/drivers/pci/controller/dwc/pci-imx6.c >> +++ b/drivers/pci/controller/dwc/pci-imx6.c >> @@ -1318,6 +1318,22 @@ static void imx_pcie_assert_perst(struct imx_pcie= *imx_pcie, bool assert) >> } >> } >> =20 >> +static void imx_pcie_disable_l1(struct dw_pcie *pci) >> +{ >> + u32 val; >> + u8 offset; >> + >> + offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); >> + >> + dw_pcie_dbi_ro_wr_en(pci); >> + >> + val =3D dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); >> + val &=3D ~PCI_EXP_LNKCAP_ASPM_L1; >> + dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, val); >> + >> + dw_pcie_dbi_ro_wr_dis(pci); >> +} >> + >> static int imx_pcie_host_init(struct dw_pcie_rp *pp) >> { >> struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); >> @@ -1442,6 +1458,9 @@ static int imx_pcie_host_init(struct dw_pcie_rp *p= p) >> =20 >> imx_setup_phy_mpll(imx_pcie); >> =20 >> + if (!imx_pcie->supports_clkreq) >> + imx_pcie_disable_l1(pci); > > Sashiko raised a valid issue here: > https://patchwork.kernel.org/project/linux-pci/patch/20260719-l1-conditio= nal-imx-v1-1-a55a57915c68@9elements.com/#27076171 > > IMX_PCIE_FLAG_BROKEN_SUSPEND is only set for i.MX6Q, but none of its DTs = have > 'supports-clkreq' property. So this patch will impact them also and since= they > do not reinitialize the hardware fully in resume(), ASPM settings will re= set to > hardware default. Right, for i.MX6Q, imx_pcie_disable_l1() could be called unconditionally in imx_pcie_resume_noirq() after the imx_check_flag(imx_pcie, IMX_PCIE_FLAG= _BROKEN_SUSPEND) block, something like: @@ -1767,6 +1767,7 @@ static int imx_pcie_resume_noirq(struct device *dev) return ret; imx_pcie_deassert_core_reset(imx_pcie); imx_pcie_assert_perst(imx_pcie, false); + imx_pcie_disable_l1(imx_pcie->pci); /* * Using PCIE_TEST_PD seems to disable MSI and powers down = the Though I do not have imx6q hw to test this, so it would be nice if NXP folks could give it a test. Best, Michal