From patchwork Wed Jan 8 05:01:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minghuan Lian X-Patchwork-Id: 3451551 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6FC559F1C4 for ; Wed, 8 Jan 2014 05:01:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A602D2010E for ; Wed, 8 Jan 2014 05:01:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97132200D5 for ; Wed, 8 Jan 2014 05:01:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750898AbaAHFBn (ORCPT ); Wed, 8 Jan 2014 00:01:43 -0500 Received: from co9ehsobe004.messaging.microsoft.com ([207.46.163.27]:11672 "EHLO co9outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796AbaAHFBn (ORCPT ); Wed, 8 Jan 2014 00:01:43 -0500 Received: from mail215-co9-R.bigfish.com (10.236.132.239) by CO9EHSOBE031.bigfish.com (10.236.130.94) with Microsoft SMTP Server id 14.1.225.22; Wed, 8 Jan 2014 05:01:42 +0000 Received: from mail215-co9 (localhost [127.0.0.1]) by mail215-co9-R.bigfish.com (Postfix) with ESMTP id 50D5E320288; Wed, 8 Jan 2014 05:01:42 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: -1 X-BigFish: VS-1(zz154dIzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h2189h1d1ah1d2ah1fc6hzz1de098h17326ah8275bh8275dh1de097h186068hz2dh2a8h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1e23h1fe8h1ff5h2218h2216h226dh22d0h2327h2336h1155h) Received: from mail215-co9 (localhost.localdomain [127.0.0.1]) by mail215-co9 (MessageSwitch) id 1389157300295647_8599; Wed, 8 Jan 2014 05:01:40 +0000 (UTC) Received: from CO9EHSMHS032.bigfish.com (unknown [10.236.132.231]) by mail215-co9.bigfish.com (Postfix) with ESMTP id 388A646004B; Wed, 8 Jan 2014 05:01:40 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO9EHSMHS032.bigfish.com (10.236.130.42) with Microsoft SMTP Server (TLS) id 14.16.227.3; Wed, 8 Jan 2014 05:01:40 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.3.158.2; Wed, 8 Jan 2014 05:01:39 +0000 Received: from lmh.ap.freescale.net (lmh.ap.freescale.net [10.193.20.65]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s0851V2D018463; Tue, 7 Jan 2014 22:01:36 -0700 From: Minghuan Lian To: CC: Zang Roy-R61911 , Scott Wood , Kumar Gala , Bjorn Helgaas , , Minghuan Lian Subject: [PATCH 02/12][v4] pci: fsl: add structure fsl_pci Date: Wed, 8 Jan 2014 13:01:53 +0800 Message-ID: <1389157323-3088-2-git-send-email-Minghuan.Lian@freescale.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1389157323-3088-1-git-send-email-Minghuan.Lian@freescale.com> References: <1389157323-3088-1-git-send-email-Minghuan.Lian@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-FOPE-CONNECTOR: Id%0$Dn%FREESCALE.MAIL.ONMICROSOFT.COM$RO%1$TLS%0$FQDN%$TlsDn% Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, UNRESOLVED_TEMPLATE 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 PowerPC uses structure pci_controller to describe PCI controller, but ARM uses structure pci_sys_data. In order to support PowerPC and ARM simultaneously, the patch adds a structure fsl_pci that contains most of the members of the pci_controller and pci_sys_data. Meanwhile, it defines a interface fsl_arch_sys_to_pci() which should be implemented in architecture-specific PCI controller driver to convert pci_controller or pci_sys_data to fsl_pci. Signed-off-by: Minghuan Lian --- change log: v4: Added indirect type macro v1-v3: Derived from http://patchwork.ozlabs.org/patch/278965/ Based on upstream master. Based on the discussion of RFC version here http://patchwork.ozlabs.org/patch/274487/ include/linux/fsl/pci-common.h | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/include/linux/fsl/pci-common.h b/include/linux/fsl/pci-common.h index 5e4f683..7ea20a1 100644 --- a/include/linux/fsl/pci-common.h +++ b/include/linux/fsl/pci-common.h @@ -102,5 +102,53 @@ struct ccsr_pci { }; +/* + * Structure of a PCI controller (host bridge) + */ +struct fsl_pci { + struct list_head node; + bool is_pcie; + struct device_node *dn; + struct device *dev; + + int first_busno; + int last_busno; + int self_busno; + struct resource busn; + + struct pci_ops *ops; + struct ccsr_pci __iomem *regs; + +#define INDIRECT_TYPE_SET_CFG_TYPE 0x00000001 +#define INDIRECT_TYPE_EXT_REG 0x00000002 +#define INDIRECT_TYPE_SURPRESS_PRIMARY_BUS 0x00000004 +#define INDIRECT_TYPE_NO_PCIE_LINK 0x00000008 +#define INDIRECT_TYPE_BIG_ENDIAN 0x00000010 +#define INDIRECT_TYPE_BROKEN_MRM 0x00000020 +#define INDIRECT_TYPE_FSL_CFG_REG_LINK 0x00000040 + u32 indirect_type; + + struct resource io_resource; + resource_size_t io_base_phys; + resource_size_t pci_io_size; + + struct resource mem_resources[3]; + resource_size_t mem_offset[3]; + + int global_number; /* PCI domain number */ + + resource_size_t dma_window_base_cur; + resource_size_t dma_window_size; + + void *sys; +}; + +/* + * Convert architecture specific pci controller structure to fsl_pci + * PowerPC uses structure pci_controller and ARM uses structure pci_sys_data + * to describe pci controller. + */ +extern struct fsl_pci *fsl_arch_sys_to_pci(void *sys); + #endif /* __PCI_COMMON_H */ #endif /* __KERNEL__ */