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 2D443CCFA03 for ; Thu, 6 Nov 2025 10:00:50 +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=KBSagdTUTkvYTdbzlyEF455WNUF7/8a6xNpjxe0Ampc=; b=N7KY8Jb9ya7+MPvTs2EZ29Ea+Z ongsUHVcteYcMqjI05U4tPvt0ymYLur3G4889DFFJtAIvmBhmPRyNCh/2w7KH5bEFYlMthDJ6pbrb aYCI7ZCqzl3khXFACeFgjlv5dQ+1Ox7OcTkCXlcydVbD2ntGonW5zKsuvcuX+qJ9Wh6KgGF6cR9tb //sAsdbwL7wLjmusrGP8Z57lLuZSxOPJwSK7j5mZQASkabHPpqC0e7eq6nDhNodxELg0I8ksKLCXm VEMU49a2H59C6DeY361aX7YrlKxsNRbRh3WQECvbEjkTJuMFnbRCEg+D9cT23drdOE5wUg8efx33P BkfxRx3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vGwnH-0000000FE54-11tM; Thu, 06 Nov 2025 10:00:39 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vGwnE-0000000FE3Y-1zz6 for linux-amlogic@lists.infradead.org; Thu, 06 Nov 2025 10:00:37 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-47114a40161so7454465e9.3 for ; Thu, 06 Nov 2025 02:00:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762423233; x=1763028033; 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=hotEei7lwkfLoPtTcXzDgl2xx83T+2l/lt8Evo2copA=; b=GvXjOg/O9H/AP6tyIN5h4pCY0io9FIA2uK09NsUcu1hbOye8PtCxChHo+4ld/YxrVV cB/wyK8JdL3vkxzOlVfPSe/tR8eDDq9+VszcnYS8AzGlNxBxxYgofeFV0WhzYelAgL4Y vsnMxSDIxWwoBRKL3AXgPax9xMLhjooJvIObaqBP9UJBm2yx6LupSr9eKGpj+nNOs6SN mg2wnO+DLDgyNjqEdCL24HR7EY7XAkWC29SbqMCXAiH8Zqlzz6PCJ8akVpNS81vrI+/W /TwYTKpQkvHtpZKYZXUZ+piuOx8BUFCx/buxVKdV1NNfa8p7ekDe7HNTDtIbnSr+eg2F hUKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762423233; x=1763028033; 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=hotEei7lwkfLoPtTcXzDgl2xx83T+2l/lt8Evo2copA=; b=jfv0UvXHSl9Ag5/SzMOQmqGOTx0jmSqr7WZWaM/GTQLmSZPjq/VM9VszXdTs7Y/cG3 Wrnc2LRdcQ7NU9exEZwnqsjwX5ro+bBS7cHNZt2CumZd7RDXv6J9Q/yB0jW5PrilULsW QmAyB0AK7PudceUb80qFH7kFuTGf7ztCI3eAgPb+ewCKF3ILWnfEt+nE0UbZbArf1G3s UNZUyuUQ9QOppPbaX9ZLxbVNBk+n7u1beMvStPCpXo+TnYoIBFsklzTUUrQEU3KkYVwk uZbG+iwWWNymAtHfoC1RqTRdaLqBSGVoNvE+QlQMyE7DEOWOecg9gW30x0Icwlvmtlx4 jzeA== X-Forwarded-Encrypted: i=1; AJvYcCWstqxV4aeYK5bamZFcJZkBlRMQhdRZJoJZSKxuf5N3Q7g/lDzLXCj1r70EA/VDwaRrNsVPLYQpeqmLfqpo@lists.infradead.org X-Gm-Message-State: AOJu0Yxkn/1DG/gxadMSRYdmIDgOD6H+SOzcasyjYHffduOFecFl7pm0 068Wob4kCXpEBbirD6Nm5IuFjCH1DcbWV8OOrJV3DT1KBOIyZihxtm6hfwliKPM6cms= X-Gm-Gg: ASbGncv07usxsKgYTsjTv3F3uzEZU1ndTmlaC74Odg0UDAboXKO+VukDQqCatrfLOlo DTYpEZNGydVC6Q1AEbKrfGxp8mZmw8qzbzE62KYuVkrfxg0UBnh/tlQm1DNqWHM0Bair89KR09y O7MNNawGkshwR1gWu39lDNuj4grwWPqiB5t4EtUq1X5BhTs5UEHd1xbqWnpx+z1eup/Jp1vhaRB LpPvMZHMabtxybgOxEvYl2If/iDHAlVdqcLulsbkv41ss8gBQk4hUAZpY2BwrJW/vrf68Kp/kVL 0Xf5YmRzyLsxe9EbcTzb7A7YXEpVogD2VHCQ2RGT2IA/70a+8HH1K/zIiKb1ay31oQTD9jOcvfw yHn0DBTY9TcD1AEkRIa4etH9CbZsZlIoSDbbqWDvw9B9NlLhWDDIA7yQ5isKRlHDr3BV5YsYC6m VODnRC49cJi4FKvQDz0Ai92cMW8G3zwaY6tA== X-Google-Smtp-Source: AGHT+IG+IVP2okOyZfO9efTEqK5kYK+g6r3W0Uym8vBYAKG016/w0MJyIa7e2e068PJnJ764TdjQ4Q== X-Received: by 2002:a05:600c:621a:b0:471:14f5:126f with SMTP id 5b1f17b1804b1-4775ce206f3mr49954515e9.33.1762423233373; Thu, 06 Nov 2025 02:00:33 -0800 (PST) Received: from [192.168.27.65] (home.rastines.starnux.net. [82.64.67.166]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-477625e88fasm45340025e9.15.2025.11.06.02.00.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Nov 2025 02:00:32 -0800 (PST) Message-ID: <1c31a5ef-39f6-460b-8046-3c7b2627e3ba@linaro.org> Date: Thu, 6 Nov 2025 11:00:29 +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/7cjCEbipGGFlfIML3sfqnIv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GbkQ6itMrAIfn 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-20251106_020036_563745_18A3F825 X-CRM114-Status: GOOD ( 22.58 ) 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 Hi, 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 */ > Tested with "old" and "new" DT worked fine with both: Tested-by: Neil Armstrong # on Bananapi-M2S Thanks, Neil _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic