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 A311642668B 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=1785413675; cv=none; b=jfHCjx+LzrUwhj08SfGpVhMI3EWr5l/mpAXbOY2KPzd7284YGdwcrrRp+5WEEtVDtOAu9wV+9iAH0YiBwGRtmpQe2ttqtow1iA+lPSfc3zT072LE4f8430LVJ1ZxZmBFs9m9xLPTiOjNlqtzwQMGakWKDNFWq2RlijpPk4BWrJ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785413675; c=relaxed/simple; bh=c747fqvNDgqVLoyxnKPVeIUVwA83B4m/ITNcnGHudIc=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=uxD5dHlTjoxzQmt17q5zbc0GSlHN/vhX5nah94MP/ui17c++moOEsNqlbAqvEtg6jIlorMe9UwJFbd3E/xFkVXWdQEemotviwgikHmX5IR0LYGDWGWbNhVtZ/unuW2Mkk0gXI+Mf2HWnYe83XTIJYxTbzqZspzwqPtm4ckesNVQ= 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=RSFDhpPp; 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="RSFDhpPp" Received: by mail-wr2-f1.google.com with SMTP id ffacd0b85a97d-46e747fbf36so797653f8f.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=lists.linux.dev; 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=RSFDhpPpHe4OAEgOolT/Q6zSAN5wH/xr4CmCPZSSrwz77SG1ma98aQP2/uWxh1fdbI lYc/uo9EFBCUW6/nrNWgUswhudIFpNuHuEk9XslmdGi37LnpYl5ZD0hnoZJGoUOm6RuJ prvTpG66u5gX9PZc2YCJ3/fQavAuVXDKTZXgcaFedjfhunmzW7pm+F4uK3mEf+Ypoamk qSnvZQYIZ0PgQXuHW2qoKSvDtnfCOKvAv5vh9TGytpqMW7vZnMbwldzEIyVn+1xjToso jzb3rfNZT7fpAKnNJvPpghbwU+bcxYDp0Wywpx6r36SxJPSq4z+nxDjlz9yimJ7do3jM s3jw== 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=qubNC4ExB3N81Wwsp9xigXIff0gyxbNg7SBjAN8um3561RRndGNBQ0vJH87FioIHqy j1jl16EiviEDEl20OH8CPqKLqNONjh5hHts0GediH+RfpIgxlNPukJLYb20l7WE6D8G4 6yzLop4f7LNepUesWKXiLSU1r+920HGxZa1umffFAdJBZc/0MXL2bM05Bvvok+Rhlsfb f96SbSooCzJQaeEdikUX0bbk4BG9zLO/ILTGOmoTUyrZZMg1e9kD1vhXaER6bHJUtYtR 3IeeyA+HOZA8pHi/ZMDURC+Vog/1g9vUUf0TfqUwL2A0gWPmpXjiDsmrIurwEApK2B8h b/0A== X-Forwarded-Encrypted: i=1; AHgh+Ro4rZ2vwgDsymPQvSLN3zO3u+vyOMpnaBKl8cXsHw1DNVC4oND+swQrsm8gIoHVgkjzdbY=@lists.linux.dev X-Gm-Message-State: AOJu0YyENNZKXO1BFDXiaKYiT+y9DPQwjqVnKiretDNuqvMjtZECT7jE cixWe7BeIA85xd4aIMljTqx4eqnTUH6xa8t8dths7yoEHD/zKxS+RQBWLmhOew0BUA== X-Gm-Gg: AR+sD10iAMEY1ZVHTBskNQV/rkNXkOQ5kC6UjXJKoY9rcsLAwOOcETReUmKuGkbvC6T LPPv+J329lWRjdFZdwrC2vbQIrHtfNPXtU5Ba8NLMH7wwmpwumdGIk0ErTAAwguvju1Km24Uobd iizwlFPbGP9OxwbTJ61cYRc/S9/YYOfYyE6g+SUprEObHzVg5XUDwj2IISES/apklQrPEJKYu5J qzi9QSLC3ImtMRjfuZvpLTzOPTYsWdBhDq36H/LUBGL/HvF1qYIDo9dIc5VbNziJDRw4JaPh8bG t3f0yL840RTMzZcSCtPDCS+Xl1mpbg7XyG+0KQ2GSotlrVnwvNRgw229501yPUW1SJ5u2hn9HVE y73ygWPA6YDMVq3fl/5Bs6YQZwIzMeqfgbhNelI5IHN8jhmk9hvS2DmwSdtHO6lkKsTkQ4JbOTS g5TI1FPi0LvnDikdKuJH+XJQnuXkheiLZkvfKvkldwYuN0E7gIMfld33+lFQhAgRXBYw== 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: imx@lists.linux.dev 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