From patchwork Wed Aug 23 06:08:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Z.Q. Hou" X-Patchwork-Id: 9916649 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A00B60327 for ; Wed, 23 Aug 2017 06:26:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ABD32895B for ; Wed, 23 Aug 2017 06:26:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DEB92895F; Wed, 23 Aug 2017 06:26:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3C642895B for ; Wed, 23 Aug 2017 06:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753278AbdHWG0w (ORCPT ); Wed, 23 Aug 2017 02:26:52 -0400 Received: from mail-by2nam03on0063.outbound.protection.outlook.com ([104.47.42.63]:61119 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753057AbdHWG0v (ORCPT ); Wed, 23 Aug 2017 02:26:51 -0400 Received: from BN6PR03CA0081.namprd03.prod.outlook.com (10.164.122.147) by MWHPR03MB3325.namprd03.prod.outlook.com (10.174.249.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18; Wed, 23 Aug 2017 06:26:48 +0000 Received: from BN1AFFO11FD034.protection.gbl (2a01:111:f400:7c10::149) by BN6PR03CA0081.outlook.office365.com (2603:10b6:405:6f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18 via Frontend Transport; Wed, 23 Aug 2017 06:26:48 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD034.mail.protection.outlook.com (10.58.52.158) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1341.15 via Frontend Transport; Wed, 23 Aug 2017 06:26:47 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v7N6QOgE007516; Tue, 22 Aug 2017 23:26:43 -0700 From: Zhiqiang Hou To: , , , CC: , , , , , , Hou Zhiqiang Subject: [PATCHv4 4/9] PCI: layerscape: refactor the host_init function Date: Wed, 23 Aug 2017 14:08:51 +0800 Message-ID: <20170823060856.9387-5-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170823060856.9387-1-Zhiqiang.Hou@nxp.com> References: <20170823060856.9387-1-Zhiqiang.Hou@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131479432077956941; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(626005)(2950100002)(48376002)(5003940100001)(106466001)(85426001)(105606002)(47776003)(305945005)(498600001)(53936002)(6666003)(86362001)(5660300001)(575784001)(4326008)(2201001)(8656003)(50466002)(7416002)(68736007)(81156014)(77096006)(189998001)(8936002)(36756003)(1076002)(97736004)(72206003)(76176999)(50986999)(81166006)(8676002)(50226002)(2906002)(54906002)(104016004)(39060400002)(356003)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB3325; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD034; 1:MI0otTQ2bbCyHvahwgB17xmxQa85hntr/QaZXQzobE6u5RqN+NfTYDSK4AzuXRj5ftULetdS3GUiY8RpFzWA3FP/crmz3OJjGNT5w0x3zdaobxfI84k1J19mtHGJgVvu MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43de854f-179c-4604-75ec-08d4e9efeebb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603180)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:MWHPR03MB3325; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB3325; 3:4/HADqb1vLMj6pkV+9A+ynKMfVzSH3JX8Buo1g5xMM4U3fZdMGPzc6kIUoR1KTxBYB2/O3khrg/mqxZWETlynNPClVEYDdgwtooVzfKVxXbU9VumxzLegndwG/hQ8l1srAM1xCxoPwfMyCmpJlTWuohLUPIYNX36DFnNx+eYeclwzRspLSwlJvTjfKv+8ajRqbImrhtmffWfEqhUsPi5/HKhCCpNy3KpC2DqIcMrz4S+sM/RbpjifJKRENam7Ct0F1dPTY2Sf8H05JFm+serPNMdot3xkkNU54ezYKhvS8WdSeejAiPJirA1miLzF3H/8pXuogsGsEqTWlcgkZj44vIbw0WgXi7Wozke6+/iNQU=; 25:TBNXywxncI4CjVprgoK8MZP8uTRFnnc8U3imMHraj39yJVPR/Wb2VoueoZXlJdcw8DagyTHHNYGcMNlbTK6hpBXnQLI5TYEvJdYViOwT9fLRPa6RSFBcSpOQ0oNt+5NB/TeXWLdb/M4p14hqWTpv2IQLP0nvmXUkFYAvN0R38uNSuzxowEDDQY+GjOJhiykwLUqIJzaAfUDseQdljh4pUm0M+xMXeypirmxVxsuC64L6LP9gIsu5HdqM6SQvSOV3RB8OQJdv/vqLiiNfqNl8U7C1Xq2qIgf3lFuQEBI03DkCq9Lms6bs/1CWheHganx8QVnHjEnHupcw5orwySI+FQ== X-MS-TrafficTypeDiagnostic: MWHPR03MB3325: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB3325; 31:/rbqViONwjYhsOW9o07Iad88DCAynCnPb2+Iev9Mc30SR4xAnTzFa6B8HofpOt4KWii8w0OI4N4U1uLMyLFmk+4nxX4xrkLLcItluGibvPrFKTRYUqG9mE1RMXNXFQRzB71axDTmUb6FI0DNq4X+q/ECvtN02FtuMBFWrSj0IeVauaq6IcBkkpfDsTbx+ClDGTlMsMWcFH1+LcL7XeEWnTt5RVOP2Hpm8JIcytQ1jR8=; 4:ejBjBClNC3CtcAtF85+L/A/VoCWS2/Ha3DA5Qrog+M9KCZbuhj5OBDjIpdtX/V6o5FW6HNSrD8PwQ/Ntg1Ly/8sQ5yZllGluyV3Sd9UMdzGqke/GHyYVc/wzKNuaJiSiF1U36l5awgfj50IacgAy7TIyUO717YrA2nFk3DrDVAhJ89oPlyDjMV5ufOahLsyo4VJl0zCTq+GRHpR0QKLG/0vsm7Pr6smENrjprE7NUU9ffWXz0pOT//AXvzhir0c6wiMxMRpTi2QqR+IRHx3F27YuVYeAzlsp1E9CwsW18iI= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(8121501046)(5005006)(13016025)(13018025)(3002001)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123565025)(20161123563025)(20161123556025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR03MB3325; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR03MB3325; X-Forefront-PRVS: 040866B734 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB3325; 23:Iuvj5BMpfkQpd01DEqhmONyu6uHPw7HGfDnuEF6FC?= =?us-ascii?Q?PzMxpUD/K1byS9AQ1o5Q+YE2M3ZfgcnLG8qAKZC0d6UOL3I+TrQbsr5oFPEo?= =?us-ascii?Q?FwmsUU17qPThhrny6o29UJqB3fE8Hu6x1+QwFzCS4lRILhBGsLFe4UtxLaPy?= =?us-ascii?Q?f5QusMNh1WNHcmc1967QGU+GowvgFWkKHMqc7n1Q3LzulvopojHh6rqyZxgm?= =?us-ascii?Q?m3AkaR4TTa2fmWbdfkuS3psVhNIJ0N+8o9cFhlqvQ8X7nVQhNJHai58cEh1i?= =?us-ascii?Q?GjRKjw/wCUCRt6DK1CiN+X0+zVAjgrLMWdTVd/S10JF1U6+gtyeJUeoiX5SG?= =?us-ascii?Q?x5sE66l3g7fBaauEUKx7Sxl8TMBYg/18733clhEa4OoM8oDR7dYvPiD9mb78?= =?us-ascii?Q?Pwuk7kGi2piGTPCGalZDFiNAUfS7+RPRQWnvLC0u89reRlBvkkJ9BXOs/0FZ?= =?us-ascii?Q?HRc/xylzQyxLGXoijO5J1OBKBMiq9+UI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MnzqVpFmIGnMOiy4f5ds4Qd+2kwELhwd1FVsj4QyYFEepiFYZG+9USG0jX/xvMQ4U+GpSzjdO0igyeVkq2akBJ7rUuFW1l5UktfL5nr/q7bzsjdOAKUCOTEOa59UvwM/Q9POBArR0ChRw+QQLbEh7xfV7TOY0WKLmkjp1SREAz4IhuK7a5ed0sDf+Y1AcrgFI7kpw==; 5:3vUy6m5afKTUA3avuv0VVb/l7/Ip/Bc7LUce3NJBtr24Qsm1kBZD0HTM9lqQ2FyV8v48QPH0xMgwnYvo0Vif75PWXJRbpYuaT0+ISZ+YHpBh1wWOtCuu57RLDJhcBmb9PhX0iDFdBiNNnIh/BABWDA==; 24:oX/Ny+qxhLlC/FhgQZevt8xFFtQl0+6iUeByVC9zz5IbM52baXyYZ00E21VsGA2sbYD9ZyIOCk+TOscrHFKwtTQJNKEOpqHQN+wvmA86Av8=; 7:hXARQIrhXbZVv2PBp1RO7PNV4chm0L+V8Wbqh7M6XKd/ZrKs1DB6/QdKBWdjREI8MzOD5rjcCQJ0YTn8gXBm2+fUz2hgJPHJeRdsEMkUxlapxcssK+RQeq9UCv5TjKaBRtaiZ8TdjNeGr9p5/N4aXMW8kV/FMQwU1ZGjwcvkCixOi++bGjD7226YpayE53lBgW9KNomkxE2iB7pV8nqgnwZuGICbBw2Lyh4HEpe5kFk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2017 06:26:47.6084 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB3325 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hou Zhiqiang Make the ls1021a's host_init reuse layerscape platform's common host_init function. Signed-off-by: Hou Zhiqiang --- V4: - no change drivers/pci/dwc/pci-layerscape.c | 65 ++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c index 3aa34214643c..57b86a0cd2c8 100644 --- a/drivers/pci/dwc/pci-layerscape.c +++ b/drivers/pci/dwc/pci-layerscape.c @@ -108,42 +108,6 @@ static int ls1021_pcie_link_up(struct dw_pcie *pci) return 1; } -static int ls1021_pcie_host_init(struct pcie_port *pp) -{ - struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct ls_pcie *pcie = to_ls_pcie(pci); - struct device *dev = pci->dev; - u32 index[2]; - int ret; - - pcie->scfg = syscon_regmap_lookup_by_phandle(dev->of_node, - "fsl,pcie-scfg"); - if (IS_ERR(pcie->scfg)) { - ret = PTR_ERR(pcie->scfg); - dev_err(dev, "No syscfg phandle specified\n"); - pcie->scfg = NULL; - return ret; - } - - if (of_property_read_u32_array(dev->of_node, - "fsl,pcie-scfg", index, 2)) { - pcie->scfg = NULL; - return -EINVAL; - } - pcie->index = index[1]; - - dw_pcie_setup_rc(pp); - - iowrite32(1, pci->dbi_base + PCIE_DBI_RO_WR_EN); - ls_pcie_fix_class(pcie); - ls_pcie_clear_multifunction(pcie); - iowrite32(0, pci->dbi_base + PCIE_DBI_RO_WR_EN); - - ls_pcie_drop_msg_tlp(pcie); - - return 0; -} - static int ls_pcie_link_up(struct dw_pcie *pci) { struct ls_pcie *pcie = to_ls_pcie(pci); @@ -176,6 +140,35 @@ static int ls_pcie_host_init(struct pcie_port *pp) return 0; } +static int ls1021_pcie_host_init(struct pcie_port *pp) +{ + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct ls_pcie *pcie = to_ls_pcie(pci); + struct device *dev = pci->dev; + u32 index[2]; + int ret; + + pcie->scfg = syscon_regmap_lookup_by_phandle(dev->of_node, + "fsl,pcie-scfg"); + if (IS_ERR(pcie->scfg)) { + ret = PTR_ERR(pcie->scfg); + dev_err(dev, "No syscfg phandle specified\n"); + pcie->scfg = NULL; + return ret; + } + + if (of_property_read_u32_array(dev->of_node, + "fsl,pcie-scfg", index, 2)) { + pcie->scfg = NULL; + return -EINVAL; + } + pcie->index = index[1]; + + ls_pcie_host_init(pp); + + return 0; +} + static int ls_pcie_msi_host_init(struct pcie_port *pp, struct msi_controller *chip) {