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 A34E3CCF9F8 for ; Mon, 3 Nov 2025 09:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject: From:MIME-Version:Date:Message-ID:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ThWZ1DAvgSDkOWHmTaOe639cIqTl3UVh0gKY8jYIJcc=; b=u8Z+99WxUmBqKrsnyE4VXIS7/h a52hvyOwop6iQNIEDvCQf6CNHa3t4OdqLbNxrw0LNW12ZoxINvmiTuuIKs/aSPTQvU3oeXOfEkmg7 qO3kjYOKxUAhZ9Kdxw0sV8t0jcQ933UiQLYqQ0pmRbCNf3R/quUOOaLjsWj522ihMvLelBmdo8l3Z DGukcGxBcy5EzB2YbJ4bjAeheen8/6rYR5g6vKo8/dZpqI7Mhshwb1fJZ+GevL67jtF5H30kh+Gbf RPbXZd7KHY/ided++JQV1rkBo4gPmsAw2RjFUdPIbAQUK6tpIZAhfYxrYByPCuPGaG+0TRxBqyU3k z+/Kehiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vFrBV-00000009XVo-3les; Mon, 03 Nov 2025 09:49:09 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vFrBT-00000009XUx-0J2O for linux-amlogic@lists.infradead.org; Mon, 03 Nov 2025 09:49:08 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-47721743fd0so22024295e9.2 for ; Mon, 03 Nov 2025 01:49:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762163345; x=1762768145; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=cyfgOfO5wbQrka4RaJRIQ58bY784PFhznl4lHer181M=; b=VHRVf+lhthMaNb7IlvSh8+I2p0YMcaYWkIoaWz1mrsMPsBCpiLhGLxMYz7nfVoDU+b okb8o8FyB+/rdPNHDZkd9neIE82+oGvjB3QVAevjP79dTL6BgveEZ8UQqFamGd3P5j7V 8HfDGJEqc0adxxFbpKYQ/a9YLe0N5KFGtKqUxiOt80hEwsP2T7UX5bBjOWszC6RCHwqa kqoKdya8sJLojAXnvgxAl8MVG0AWTj1+AN8UeMUfFuWzY53KbmRZ8hd0iAyJKYqUETpm 0scbRWOy+jdHwvW3rtdVj3k32Qs8/ALtYR0IPwR4caAlVibvvSv4zzCVo8SHCPkzt68H 3pYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762163345; x=1762768145; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=cyfgOfO5wbQrka4RaJRIQ58bY784PFhznl4lHer181M=; b=NPhTK8VUY43pAAR0qf199OHJvo9vvFatFpO4l82KZsqjx0zG9dfTE5bX1k/Tyj2Ca7 yGg+HUGsZiw5C8jMsFWSGl/HjqBlPOgjcU4pEWgi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/Yu2LHLMUnh/Mg== X-Received: by 2002:a05:600c:b8d:b0:471:803:6a26 with SMTP id 5b1f17b1804b1-477308c8bc7mr112449905e9.37.1762163344829; Mon, 03 Nov 2025 01:49:04 -0800 (PST) Received: from [192.168.27.65] (home.rastines.starnux.net. [82.64.67.166]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4773c4ac18bsm144251275e9.5.2025.11.03.01.49.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Nov 2025 01:49:03 -0800 (PST) Message-ID: <807e9f74-79ed-44bc-8a80-3d99787edc65@linaro.org> Date: Mon, 3 Nov 2025 10:49:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Neil Armstrong Subject: Re: [PATCH RESEND 3/3] PCI: meson: Fix parsing the DBI register region To: Manivannan Sadhasivam , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Hanjie Lin , Yue Wang , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Andrew Murray , Jingoo Han , Krishna Chaitanya Chundru Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, stable@vger.kernel.org, Linnaea Lavia References: <20251101-pci-meson-fix-v1-0-c50dcc56ed6a@oss.qualcomm.com> <20251101-pci-meson-fix-v1-3-c50dcc56ed6a@oss.qualcomm.com> Content-Language: en-US, fr Autocrypt: addr=neil.armstrong@linaro.org; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7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AKCRAWmrexpM/4rrXiB/sGbkQ6itMrAIfn M7IbRuiSZS1unlySUVYu3SD6YBYnNi3G5EpbwfBNuT3H8//rVvtOFK4OD8cRYkxXRQmTvqa3 3eDIHu/zr1HMKErm+2SD6PO9umRef8V82o2oaCLvf4WeIssFjwB0b6a12opuRP7yo3E3gTCS KmbUuLv1CtxKQF+fUV1cVaTPMyT25Od+RC1K+iOR0F54oUJvJeq7fUzbn/KdlhA8XPGzwGRy 4zcsPWvwnXgfe5tk680fEKZVwOZKIEuJC3v+/yZpQzDvGYJvbyix0lHnrCzq43WefRHI5XTT QbM0WUIBIcGmq38+OgUsMYu4NzLu7uZFAcmp6h8g Organization: Linaro In-Reply-To: <20251101-pci-meson-fix-v1-3-c50dcc56ed6a@oss.qualcomm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251103_014907_179124_21484C89 X-CRM114-Status: GOOD ( 21.73 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Neil Armstrong Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org On 11/1/25 05:29, Manivannan Sadhasivam wrote: > First of all, the driver was parsing the 'dbi' register region as 'elbi'. > This was due to DT mistakenly passing 'dbi' as 'elbi'. Since the DT is > now fixed to supply 'dbi' region, this driver can rely on the DWC core > driver to parse and map it. > > However, to support the old DTs, if the 'elbi' region is found in DT, parse > and map the region as both 'dw_pcie::elbi_base' as 'dw_pcie::dbi_base'. > This will allow the driver to work with both broken and fixed DTs. > > Also, skip parsing the 'elbi' region in DWC core if 'pci->elbi_base' was > already populated. > > Cc: # 6.2 > Reported-by: Linnaea Lavia > Closes: https://lore.kernel.org/linux-pci/DM4PR05MB102707B8CDF84D776C39F22F2C7F0A@DM4PR05MB10270.namprd05.prod.outlook.com/ > Fixes: 9c0ef6d34fdb ("PCI: amlogic: Add the Amlogic Meson PCIe controller driver") > Fixes: c96992a24bec ("PCI: dwc: Add support for ELBI resource mapping") > Signed-off-by: Manivannan Sadhasivam > --- > drivers/pci/controller/dwc/pci-meson.c | 18 +++++++++++++++--- > drivers/pci/controller/dwc/pcie-designware.c | 12 +++++++----- > 2 files changed, 22 insertions(+), 8 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c > index 787469d1b396d4c7b3e28edfe276b7b997fb8aee..54b6a4196f1767a3c14c6c901bfee3505588134c 100644 > --- a/drivers/pci/controller/dwc/pci-meson.c > +++ b/drivers/pci/controller/dwc/pci-meson.c > @@ -108,10 +108,22 @@ static int meson_pcie_get_mems(struct platform_device *pdev, > struct meson_pcie *mp) > { > struct dw_pcie *pci = &mp->pci; > + struct resource *res; > > - pci->dbi_base = devm_platform_ioremap_resource_byname(pdev, "elbi"); > - if (IS_ERR(pci->dbi_base)) > - return PTR_ERR(pci->dbi_base); > + /* > + * For the broken DTs that supply 'dbi' as 'elbi', parse the 'elbi' > + * region and assign it to both 'pci->elbi_base' and 'pci->dbi_space' so > + * that the DWC core can skip parsing both regions. > + */ > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi"); > + if (res) { > + pci->elbi_base = devm_pci_remap_cfg_resource(pci->dev, res); > + if (IS_ERR(pci->elbi_base)) > + return PTR_ERR(pci->elbi_base); > + > + pci->dbi_base = pci->elbi_base; > + pci->dbi_phys_addr = res->start; > + } > > mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg"); > if (IS_ERR(mp->cfg_base)) > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index c644216995f69cbf065e61a0392bf1e5e32cf56e..06eca858eb1b3c7a8a833df6616febcdbe854850 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -168,11 +168,13 @@ int dw_pcie_get_resources(struct dw_pcie *pci) > } > > /* ELBI is an optional resource */ > - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi"); > - if (res) { > - pci->elbi_base = devm_ioremap_resource(pci->dev, res); > - if (IS_ERR(pci->elbi_base)) > - return PTR_ERR(pci->elbi_base); > + if (!pci->elbi_base) { > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi"); > + if (res) { > + pci->elbi_base = devm_ioremap_resource(pci->dev, res); > + if (IS_ERR(pci->elbi_base)) > + return PTR_ERR(pci->elbi_base); > + } > } > > /* LLDD is supposed to manually switch the clocks and resets state */ > Reviewed-by: Neil Armstrong _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic