From patchwork Wed Nov 20 03:45:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Z.Q. Hou" X-Patchwork-Id: 1197794 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="r5WmqLa9"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47HpW74Vdrz9sPV for ; Wed, 20 Nov 2019 14:45:39 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727264AbfKTDpe (ORCPT ); Tue, 19 Nov 2019 22:45:34 -0500 Received: from mail-eopbgr00058.outbound.protection.outlook.com ([40.107.0.58]:36436 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727357AbfKTDpe (ORCPT ); Tue, 19 Nov 2019 22:45:34 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=em45W8fTrhEAZoSaqFobJi8iHUPREnxB4AzfERV5dQlehfctv7zPDn5vPO9+OvM9JU2Fpl07rYM2efnyCMqWHodCIvUWSDpem9TiKUpFqeI9XzR+ucs9fFanGr+FwNhP4MJ9IsbGo3M3MsRStSd+wzONfgF7QcBuinUtv6RsNWz+mxiGSDFzHzUYu6Xso++CPsbiY3MnLnGr7KeJJ0acvqNJnH+8K2zOyTiOozT9/q+rcI5ypOniA5sJBkDX5LUKT+dW8YiZoJ99Qr8L4YKHTx3jl/eXosApy3GYIUP1eg0svNYHcYmq8rF+Bsa9W78lIwWJPVQRLPQuWO/Q7CSzrA== 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-SenderADCheck; bh=9tcCzCpg7MhUp68daqYKGFgRIlEc8U/und6a3AG+9pI=; b=W0AV0rwjDOCLEzrcMpCGtlVjqAkiEfCcBE84b455U+UtNkh2ft7Z9uD4hXuFpzZ+8VamVwKkNz/SN/XMRtB/8lM79TQgFM0bWZ15PKVfAXpJp1vzhSXBX/teLibrkcdTbeDbXDJ3glzzJDI0x47fGugzOzMtmTELf+U4rH7MV8NKPYYDYd5sDj++VdvIRKbGlyPXfrSgDGUjiyUxV36veVVl1fdya4beMhAUbpp6GH8BgnvOUH6eLoTwxd6HBfDfYNFlhSKMYKNuqeRsbh65QreSDn31lE5+ohkXu6ixtS56ztojHLJItfcWZGCNYB/u1niCQTHTd4eyWKAFrzNEyg== 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=9tcCzCpg7MhUp68daqYKGFgRIlEc8U/und6a3AG+9pI=; b=r5WmqLa9gwtBa6bjl594p9Ys5yUvHOTAmgCcFVxhZHJweYGjhdDGORXX3c+/RzLqc6xfrY3gBMe1Whav/0KqWMGak8lmAsHT/YblyQvGS5RKdkGQvesUKmI4NSASS2j21vPU4Dco7m6FflGJwy2sIOlUsvDmRhszV681anHpsf0= Received: from DB8PR04MB6747.eurprd04.prod.outlook.com (20.179.250.159) by DB8PR04MB5657.eurprd04.prod.outlook.com (20.179.9.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Wed, 20 Nov 2019 03:45:30 +0000 Received: from DB8PR04MB6747.eurprd04.prod.outlook.com ([fe80::898f:3cd6:c225:7219]) by DB8PR04MB6747.eurprd04.prod.outlook.com ([fe80::898f:3cd6:c225:7219%7]) with mapi id 15.20.2451.029; Wed, 20 Nov 2019 03:45:30 +0000 From: "Z.q. Hou" To: "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "bhelgaas@google.com" , "robh+dt@kernel.org" , "arnd@arndb.de" , "mark.rutland@arm.com" , "l.subrahmanya@mobiveil.co.in" , "shawnguo@kernel.org" , "m.karthikeyan@mobiveil.co.in" , Leo Li , "lorenzo.pieralisi@arm.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "andrew.murray@arm.com" CC: Mingkai Hu , "M.h. Lian" , Xiaowei Bao , "Z.q. Hou" Subject: [PATCHv9 02/12] PCI: mobiveil: Move the host initialization into a routine Thread-Topic: [PATCHv9 02/12] PCI: mobiveil: Move the host initialization into a routine Thread-Index: AQHVn1T0j1qfl+edyE6Gq9MkhB5hBA== Date: Wed, 20 Nov 2019 03:45:30 +0000 Message-ID: <20191120034451.30102-3-Zhiqiang.Hou@nxp.com> References: <20191120034451.30102-1-Zhiqiang.Hou@nxp.com> In-Reply-To: <20191120034451.30102-1-Zhiqiang.Hou@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR02CA0199.apcprd02.prod.outlook.com (2603:1096:201:20::11) To DB8PR04MB6747.eurprd04.prod.outlook.com (2603:10a6:10:10b::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=zhiqiang.hou@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [119.31.174.73] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 5cc634a7-b256-41c6-68e9-08d76d6c16c5 x-ms-traffictypediagnostic: DB8PR04MB5657:|DB8PR04MB5657: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3513; x-forefront-prvs: 02272225C5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(346002)(396003)(39860400002)(136003)(376002)(199004)(189003)(2201001)(54906003)(86362001)(36756003)(256004)(7736002)(305945005)(6116002)(66066001)(3846002)(110136005)(316002)(71190400001)(7416002)(1076003)(71200400001)(52116002)(2501003)(4326008)(5660300002)(66476007)(476003)(64756008)(66556008)(11346002)(446003)(76176011)(2616005)(66946007)(6512007)(66446008)(8676002)(386003)(6506007)(2906002)(99286004)(102836004)(6486002)(81166006)(81156014)(8936002)(50226002)(186003)(26005)(478600001)(14454004)(486006)(6436002)(25786009)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB8PR04MB5657; H:DB8PR04MB6747.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4A0KbhAdvAKEL5XsoFjbnRBgYoCp4t2w645CJ+XMTu3KOebhsw+I8bvEs9lStcqf/mK3/cBf/jWn+97VJO2gLin+oU44HJtIhxN9EBHLhL9tpZVvulPnKY2jUk0NIvVp7x/jZ74dMkTYnY59Xc8BsuIN5v3qrtFa1XXkNQh83oVLET1z+TnyajFP9Zu5oTlD/Zem3UCfZF9hBZ93ToRIg7SHViJUlv2ZMkRpajNPDsiNi4XyJ7v8eQh22ETmVwrICVE9QnReOGiuNCvsaVq/3zZRb3pTkCsdr+T/0WVto6tWHQekS7bXU0MhoABSrQvBoCwAlyftRE87oNPFpftn/rCrgk34CyW2NoSXLFviWTlZtG5VSogN54jUyyI8ymVNm/PBO+W2JGup41eAwXZfRVwCzNhROA9Xkthrx9iZdx2FUHcvdldFDKCKgP24q89a MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cc634a7-b256-41c6-68e9-08d76d6c16c5 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2019 03:45:30.4714 (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: RAyEzTHD8749SWCUdP+YVR3y6WO3MNLnN5Cg2jUfyb2lM8qTPaQxdHHFehAgYqYq1XQYaxyFvrm1FEV1+TIifA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB5657 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Hou Zhiqiang Move the host initialization related operations into a new routine to make it can be reused by other incoming platform's PCIe host driver, in which the Mobiveil GPEX is integrated. Signed-off-by: Hou Zhiqiang --- V9: - New patch splited from the #1 of V8 patches to make it easy to review. drivers/pci/controller/pcie-mobiveil.c | 38 +++++++++++++++----------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c index 5fd26e376af2..97f682ca7c7a 100644 --- a/drivers/pci/controller/pcie-mobiveil.c +++ b/drivers/pci/controller/pcie-mobiveil.c @@ -873,27 +873,15 @@ static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie) return 0; } -static int mobiveil_pcie_probe(struct platform_device *pdev) +int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) { - struct mobiveil_pcie *pcie; + struct root_port *rp = &pcie->rp; + struct pci_host_bridge *bridge = rp->bridge; + struct device *dev = &pcie->pdev->dev; struct pci_bus *bus; struct pci_bus *child; - struct pci_host_bridge *bridge; - struct device *dev = &pdev->dev; - struct root_port *rp; int ret; - /* allocate the PCIe port */ - bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie)); - if (!bridge) - return -ENOMEM; - - pcie = pci_host_bridge_priv(bridge); - rp = &pcie->rp; - rp->bridge = bridge; - - pcie->pdev = pdev; - ret = mobiveil_pcie_parse_dt(pcie); if (ret) { dev_err(dev, "Parsing DT failed, ret: %x\n", ret); @@ -956,6 +944,24 @@ static int mobiveil_pcie_probe(struct platform_device *pdev) return 0; } +static int mobiveil_pcie_probe(struct platform_device *pdev) +{ + struct mobiveil_pcie *pcie; + struct pci_host_bridge *bridge; + struct device *dev = &pdev->dev; + + bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie)); + if (!bridge) + return -ENOMEM; + + pcie = pci_host_bridge_priv(bridge); + pcie->rp.bridge = bridge; + + pcie->pdev = pdev; + + return mobiveil_pcie_host_probe(pcie); +} + static const struct of_device_id mobiveil_pcie_of_match[] = { {.compatible = "mbvl,gpex40-pcie",}, {},