From patchwork Thu Feb 29 19:45:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 208500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp639009dyb; Thu, 29 Feb 2024 11:47:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX5haHdSyxZGKZoJ2KItKiY4z8ctRvZJ9iDxlG9Rf/F8U3rJFoHVyT31IsZ7B6Tsti6vJBdJykO1s30m10e4h0Ia+RX0Q== X-Google-Smtp-Source: AGHT+IG/blYzn4m0YfBV//Wl8LD1rD5OfcAD9LeAZB3zd6FFeNldRe0OQ7Le0y454HoKLF4LPE9O X-Received: by 2002:a17:906:b78e:b0:a43:fe92:f9b7 with SMTP id dt14-20020a170906b78e00b00a43fe92f9b7mr1848300ejb.3.1709236023719; Thu, 29 Feb 2024 11:47:03 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qx6-20020a170906fcc600b00a43db2e1acbsi818964ejb.351.2024.02.29.11.47.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 11:47:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87377-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="ifinzG2/"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-87377-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87377-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4D4851F23AFC for ; Thu, 29 Feb 2024 19:46:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04CEA13F44D; Thu, 29 Feb 2024 19:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="ifinzG2/" Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2076.outbound.protection.outlook.com [40.107.249.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFAC9134411; Thu, 29 Feb 2024 19:46:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709235980; cv=fail; b=koh2uPd468zj5DmVSRuRDgOhMVw0rjhTXHyHprCho+tpKqGVTZ6qAXuM1zdO0T1jEUWhBq/aoFLubktyN6wuUPZ2kwEEsxJiIFw6SKE9AfRGUqoIYZdP0KkuR94/iXpXRk7Ovxpn0noLtrJzfR3ar6KP/1EIXH4WovBeXVGn8os= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709235980; c=relaxed/simple; bh=xcIPY6M2Sdn5SiPQKSOJ+bp+N8Wbftor6QM7jEuLcOU=; h=From:To:Subject:Date:Message-Id:Content-Type:MIME-Version; b=XevDAwn32ylt6OB2zTfdWST6SOsr9KQGlFerBr+BybhfDptKB5WNYKVlpoIJA5JZe8l7hue+5gLvVP7zau4ChK5Fha7Jj4Fa6L2gWpMrA1SysCoZxYHwNf07D1i707xV5IM37dKCUvoZccK8Jhgy2ikBBMDFTK/TA5g7fB7QIvU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=ifinzG2/; arc=fail smtp.client-ip=40.107.249.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G5JKIo9shbzjK6jnyUiOE0WmiDgn9JF9ii3IsGgxNBTwTxAO/fexldn5cYz/OO2uLrHOHZ+9v6yYbPqNGdAZREAZP3qfGSqENeTer8YLZopn3NKwgnuUsYutJE0LQ9Py4NfkoGPLorKDNtiQtv4vSTnl5cssG08lPlJ76jTysSZxehOCYG0gUT6hP3Zh+MARsYpS7Wqzjd7XdKG8+LYticm2kXWEhj6h7OSKPkMP79JbFwRCiW245T3PzBJ3pqyesd8vxMZx2+bRJu/5X/lTzk+17SSCOgMaKSQtHZeF2Mq06JKmmDt3ARh1uymWgzdFNxdVkUB56Ef+/rfeLj0+SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=94Wsnbn3IwR5EvAEYoBxd7PI9/IApQorut/MNb1tbYk=; b=L+9u3ju0stqZFVzrXocyrrlwn8PGhVgimoLFzfL0l/+rF21Zx+y9JNNLt0PaKFbXQXHn7TTN+ATR3O0Ay28WEVWQCqXanjdr3P7yBfmDuwliL0w5oYijQ5RMSkUzAz4EkkUULcEWXrLL9d5fhv/ZGyf1oBVBYua0Y0dTQT9sWBJvX7mRf3XTVAvrhLlpaDtH3jp95gfFKXA+Y6Nu1k97hRd8Wk9qzN5+HoYmdCZ+yByhQK9mgX/O0kAWfQCC+sSZfhnD+aeUSP5y7+EeXh5NG8AEftkd73HrLncpf7zCWEPo/38amFaRLFXbTxzGQ6tcom3CxxCe24f97ly2xwMFWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=94Wsnbn3IwR5EvAEYoBxd7PI9/IApQorut/MNb1tbYk=; b=ifinzG2/m32pO75G4PPh0ybV4EzaKc7NjXQ8TK531Qqf5T0Hpp+0K9/ef3VbeT7erA2WSUnv6gfaU/nMkn6TefLV2UgSlzxTS8zdv7pdMF4z/icABTVogCw2EaNB1wAyZzi2lZmMchEQspHopa4dhOYEP/3NQy5LPBrXKGGc8bY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AM8PR04MB7985.eurprd04.prod.outlook.com (2603:10a6:20b:234::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.32; Thu, 29 Feb 2024 19:46:14 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Thu, 29 Feb 2024 19:46:14 +0000 From: Frank Li To: Minghuan Lian , Mingkai Hu , Roy Zang , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linuxppc-dev@lists.ozlabs.org (open list:PCI DRIVER FOR FREESCALE LAYERSCAPE), linux-pci@vger.kernel.org (open list:PCI DRIVER FOR FREESCALE LAYERSCAPE), linux-arm-kernel@lists.infradead.org (moderated list:PCI DRIVER FOR FREESCALE LAYERSCAPE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/1] PCI: layerscape(ep): Implement common 'dbi' reg-names for dbi_base Date: Thu, 29 Feb 2024 14:45:58 -0500 Message-Id: <20240229194559.709182-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: BY5PR03CA0025.namprd03.prod.outlook.com (2603:10b6:a03:1e0::35) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM8PR04MB7985:EE_ X-MS-Office365-Filtering-Correlation-Id: 218ce07a-419d-47ca-b9f3-08dc395f1673 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zR2fueHXiEdTV8ylaQ+fOYbm8ydSQ3UgLYONCzoz4MbvgAMaF3e3u5fXMFMdxn9jG2WnaBgDts/kI2J/btdq5enj7RMQCrTJATSqtpGQG5NzwSQUEPlXNX6yHMXPDh5cDc6A9F17eshDpsn9lfYy6feoOF1lnswcj1L365x4wNDAxWXldVvoDKh2xDx8zPS+8EOeWrdPlCpD9qtI2nkwGqq2bxlyfWme3a9+LZqBOhBUrp4gb5Tb1/kfZBLre023gVYnSeDCtAKepA4z+ITHIoujWA5AJK+Dock0LVqARtNWsWtglNsWzdPjuII8Xg8kdVcLlA4wBB2b3s6bbtYegt9HXlysCbTaXSTe3EXSAko4KrKTXvvAZ5rO1CuVVpuNGyA4p1SqbdR6JCQBebiM9ikecqU5IGp5W/XpbKQZ2Tya5Q5WB5pbyx5iP/DZ487aXEc/qZXtM2F4ua2RJ6IIn4EFpTfQfMBSHotCSgGhVzXQ9YyU8lmzADpQvqPk30yhEdkjZpTrQdoMrFUjz3kDpWIMQbDrqvOv6CbTsXeMXoUQ/FESz2VLH8ePnH0hyzlQTPLfxneNkZLCD1dR6b97w6s7NblVXknGf2mmYN68ZtE+XXzjgDiDimSeD6z7vZHUdkN2xPgksBINEhn7Qc87EMBD/sSfKkyF2NbJh7aQyeDnyrnFVD/xl5b9/A3EYYD2jEKtBdlUg2RYcwOIQgPJtUfedDsp+MfHMyFFT1+AlsU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: whxdZmaV9b23zNuavIpkYjOVNKZa4tpW1jaqnsj88pgxjYtP2VfEElSFn8HoafuBMlnXx7lazb/yxCQT1NhGXlliyH0UuqxGEnlBPi+ivNokWNTpbdzuZ+pbg+wqxg7yTgxIASyrrVi24wrbGiwBVgqC0kPOer9FhmOX/Kp0U6P/ttITCElOFeRnrO/zX1W67CPCTwXp9MW7JdvGMHlk62WW1C2nFbcD/+z5FeA8qTZPNxLHe6k+QfQhJ6Zd8ZVcGYUJkyb4Hd8REbY4m/vH/NFNrS7NzNxlg/x3vU0Sw+Dx05H46LqwMXTEogSAJcKZ0+Zy2l/LLxT7sWKPHYWfnNn0CeJpJf1muEca44N+0+Ly3UKQYJ6txkwF+k4aQnytLF+vkd7BFPAlmssiXwHlyf2+nREnmfKWiljmd1Hyd22w6uuGnuosv9aMmm7gFrXwQrDXwy+PFJ+wOFwyl7u0v0btiBEmcFZFC5R2PujGdO3RoSGEy/951CYOs4YR74JW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rA X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 218ce07a-419d-47ca-b9f3-08dc395f1673 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 19:46:14.2570 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a/6NUmowVVpfrLT7Dx+uU7Bt/4hYCyu4nzlJ3zLxPPapma4HPKMmBZ3A9X8Mh5wIWATVYVLBdUanXgkE6ADUeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7985 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792263872876080428 X-GMAIL-MSGID: 1792263872876080428 Apply 'dbi' as the primary name for dbi_base register space in line with Designware common binding. Attempt resource acquisition using 'dbi' first via platform_get_resource_byname(). If encountering older device tree files, gracefully fallback to 'regs', issuing a warning message. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-layerscape-ep.c | 7 ++++++- drivers/pci/controller/dwc/pci-layerscape.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c index 1f6ee1460ec2a..92d4750611d07 100644 --- a/drivers/pci/controller/dwc/pci-layerscape-ep.c +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c @@ -259,7 +259,12 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev) pcie->pci = pci; pcie->ls_epc = ls_epc; - dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); + dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi"); + if (!dbi_base) { + dev_warn(dev, "Please update your dtb, reg-names 'regs' should be 'dbi'"); + dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); + } + pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_base); if (IS_ERR(pci->dbi_base)) return PTR_ERR(pci->dbi_base); diff --git a/drivers/pci/controller/dwc/pci-layerscape.c b/drivers/pci/controller/dwc/pci-layerscape.c index ee6f525681337..1985086f6a1f3 100644 --- a/drivers/pci/controller/dwc/pci-layerscape.c +++ b/drivers/pci/controller/dwc/pci-layerscape.c @@ -345,7 +345,12 @@ static int ls_pcie_probe(struct platform_device *pdev) pcie->pci = pci; pci->pp.ops = pcie->drvdata->ops; - dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); + dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi"); + if (!dbi_base) { + dev_err(dev, "Please update your dtb, reg-names 'regs' should be 'dbi'"); + dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); + } + pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_base); if (IS_ERR(pci->dbi_base)) return PTR_ERR(pci->dbi_base);