From patchwork Wed Apr 15 09:48:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minghuan Lian X-Patchwork-Id: 6219491 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F3D7E9F2EC for ; Wed, 15 Apr 2015 09:50:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EC172034F for ; Wed, 15 Apr 2015 09:50:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46494202E9 for ; Wed, 15 Apr 2015 09:50:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YiJup-0001QO-N9; Wed, 15 Apr 2015 09:47:27 +0000 Received: from mail-bn1bon0114.outbound.protection.outlook.com ([157.56.111.114] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YiJug-0001ML-BY for linux-arm-kernel@lists.infradead.org; Wed, 15 Apr 2015 09:47:20 +0000 Received: from BLUPR03MB566.namprd03.prod.outlook.com (10.141.77.155) by BLUPR03MB1490.namprd03.prod.outlook.com (0.163.81.20) with Microsoft SMTP Server (TLS) id 15.1.136.25; Wed, 15 Apr 2015 09:46:55 +0000 Received: from BY2PR03CA055.namprd03.prod.outlook.com (10.141.249.28) by BLUPR03MB566.namprd03.prod.outlook.com (10.141.77.155) with Microsoft SMTP Server (TLS) id 15.1.136.25; Wed, 15 Apr 2015 09:46:54 +0000 Received: from BN1AFFO11FD021.protection.gbl (2a01:111:f400:7c10::116) by BY2PR03CA055.outlook.office365.com (2a01:111:e400:2c5d::28) with Microsoft SMTP Server (TLS) id 15.1.136.25 via Frontend Transport; Wed, 15 Apr 2015 09:46:53 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD021.mail.protection.outlook.com (10.58.52.81) with Microsoft SMTP Server (TLS) id 15.1.142.12 via Frontend Transport; Wed, 15 Apr 2015 09:46:52 +0000 Received: from lmh.ap.freescale.net (lmh.ap.freescale.net [10.193.20.53]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t3F9kiPX007157; Wed, 15 Apr 2015 02:46:49 -0700 From: Minghuan Lian To: Subject: [PATCH v2 1/3] arm/pci: Add support architecture-independent PCIe driver Date: Wed, 15 Apr 2015 17:48:33 +0800 Message-ID: <1429091315-31891-2-git-send-email-Minghuan.Lian@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429091315-31891-1-git-send-email-Minghuan.Lian@freescale.com> References: <1429091315-31891-1-git-send-email-Minghuan.Lian@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(199003)(189002)(85426001)(47776003)(87936001)(50226001)(6806004)(86362001)(76176999)(50986999)(2950100001)(92566002)(62966003)(77096005)(77156002)(19580405001)(50466002)(48376002)(229853001)(110136001)(2351001)(105606002)(106466001)(104016003)(46102003)(19580395003)(36756003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR03MB566; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB566; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB1490; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:BLUPR03MB566; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB566; X-Forefront-PRVS: 0547116B72 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2015 09:46:52.5288 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB566 X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150415_024718_692981_3F1258E7 X-CRM114-Status: GOOD ( 10.80 ) X-Spam-Score: -0.0 (/) Cc: Arnd Bergmann , Minghuan Lian , Jingoo Han , Hu Mingkai-B21284 , Zang Roy-R61911 , Yoder Stuart-B08248 , Bjorn Helgaas , Scott Wood , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PCIe common driver of arm architecture uses private structure pci_sys_data and hw_pci to associate with specific PCIe controller ops which results in the PCIe controller driver not compatible with other architectures. This patch provides another approach to support architecture-independent PCIe driver which does not need to use pci_sys_data and hw_pci and call pci_common_init_dev(). Signed-off-by: Minghuan Lian --- change log: v1-v2: no change arch/arm/kernel/bios32.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index ab19b7c0..8820ed5 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -7,6 +7,7 @@ */ #include #include +#include #include #include #include @@ -17,12 +18,16 @@ #include static int debug_pci; +static int pci_commont_init_enable; #ifdef CONFIG_PCI_MSI struct msi_controller *pcibios_msi_controller(struct pci_dev *dev) { struct pci_sys_data *sysdata = dev->bus->sysdata; + if (!pci_commont_init_enable) + return NULL; + return sysdata->msi_ctrl; } #endif @@ -508,6 +513,8 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw) struct pci_sys_data *sys; LIST_HEAD(head); + pci_commont_init_enable = 1; + pci_add_flags(PCI_REASSIGN_ALL_RSRC); if (hw->preinit) hw->preinit(); @@ -597,7 +604,7 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, start = (start + align - 1) & ~(align - 1); - if (sys->align_resource) + if (pci_commont_init_enable && sys->align_resource) return sys->align_resource(dev, res, start, size, align); return start; @@ -651,3 +658,13 @@ void __init pci_map_io_early(unsigned long pfn) pci_io_desc.pfn = pfn; iotable_init(&pci_io_desc, 1); } + +/* + * Try to assign the IRQ number from DT when adding a new device + */ +int pcibios_add_device(struct pci_dev *dev) +{ + dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); + + return 0; +}