From patchwork Mon Jul 14 06:03:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush ANAND X-Patchwork-Id: 4542701 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B7727C0514 for ; Mon, 14 Jul 2014 06:07:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E527C20158 for ; Mon, 14 Jul 2014 06:07:50 +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 5398520103 for ; Mon, 14 Jul 2014 06:07:49 +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 1X6ZO9-0007mk-0B; Mon, 14 Jul 2014 06:05:25 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X6ZO5-0006fS-9C for linux-arm-kernel@lists.infradead.org; Mon, 14 Jul 2014 06:05:22 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id s6E5sotY030496; Mon, 14 Jul 2014 08:04:06 +0200 Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx08-00178001.pphosted.com with ESMTP id 1n32ug15dc-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 14 Jul 2014 08:04:06 +0200 Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 43AEA24; Mon, 14 Jul 2014 06:03:52 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas4.st.com [10.80.176.69]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 0F3D6293; Mon, 14 Jul 2014 06:03:41 +0000 (GMT) Received: from localhost (10.199.210.48) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.298.1; Mon, 14 Jul 2014 14:03:39 +0800 Date: Mon, 14 Jul 2014 11:33:34 +0530 From: Pratyush Anand To: Murali Karicheri Subject: Re: [PATCH v4 0/6] Add Keystone PCIe controller driver Message-ID: <20140714060334.GB2930@pratyush-vbox> References: <1405110995-24676-1-git-send-email-m-karicheri2@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1405110995-24676-1-git-send-email-m-karicheri2@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52, 1.0.14, 0.0.0000 definitions=2014-07-13_03:2014-07-11, 2014-07-13, 1970-01-01 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140713_230521_646906_24D2F002 X-CRM114-Status: GOOD ( 17.43 ) X-Spam-Score: -0.7 (/) Cc: Richard Zhu , Marek Vasut , Randy Dunlap , Russell King , Pawel Moll , Arnd Bergmann , Ian Campbell , "linux-pci@vger.kernel.org" , Jingoo Han , "linux-kernel@vger.kernel.org" , Kishon Vijay Abraham I , Bjorn Helgaas , Rob Herring , Mohit KUMAR DCG , Grant Likely , Kumar Gala , Mark Rutland , "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=-1.9 required=5.0 tests=BAYES_00,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 Oh.. I see my reply from gmail is not readable at all. (I forgot to switch to plain text :( ) Please ignore last mail I am replying again here. On Sat, Jul 12, 2014 at 04:36:29AM +0800, Murali Karicheri wrote: [...] > Murali Karicheri (6): > PCI: designware: add rd[wr]_other_conf API > PCI: designware: refactor MSI code to work with v3.65 dw hardware For above two you can add my reviewed-by: > PCI: designware: refactor host init code to re-use on keystone PCI > PCI: designware: enhance dw core driver to support keystone PCI host In stead of using version number and then changing few functions from static to global , I would have used same philosophy of adding callbacks wherever needed. May be maintainers can give their view, instead of patch 3 and 4 I would have gone with something like this, where kc_pcie can be passed through pp->plat_data. ~Pratyush diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 905941c..b216192 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c @@ -490,16 +490,21 @@ int __init dw_pcie_host_init(struct pcie_port *pp) } if (IS_ENABLED(CONFIG_PCI_MSI)) { - pp->irq_domain = irq_domain_add_linear(pp->dev->of_node, - MAX_MSI_IRQS, &msi_domain_ops, - &dw_pcie_msi_chip); - if (!pp->irq_domain) { - dev_err(pp->dev, "irq domain init failed\n"); - return -ENXIO; - } + if (!pp->ops->msi_init) { + pp->irq_domain = irq_domain_add_linear(pp->dev->of_node, + MAX_MSI_IRQS, &msi_domain_ops, + &dw_pcie_msi_chip); + if (!pp->irq_domain) { + dev_err(pp->dev, "irq domain init failed\n"); + return -ENXIO; + } - for (i = 0; i < MAX_MSI_IRQS; i++) - irq_create_mapping(pp->irq_domain, i); + for (i = 0; i < MAX_MSI_IRQS; i++) + irq_create_mapping(pp->irq_domain, i); + } else { + pp->ops->msi_init(pp, &msi_domain_ops, + &dw_pcie_msi_chip); + } } if (pp->ops->host_init) @@ -759,6 +764,9 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys) BUG(); } + if (bus && pp->ops->scan_bus) + bus = pp->ops->scan_bus(pp); + return bus; } diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h index 387f69e..39ce496 100644 --- a/drivers/pci/host/pcie-designware.h +++ b/drivers/pci/host/pcie-designware.h @@ -52,6 +52,7 @@ struct pcie_port { struct irq_domain *irq_domain; unsigned long msi_data; DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS); + void *plat_data; }; struct pcie_host_ops { @@ -70,6 +71,9 @@ struct pcie_host_ops { void (*msi_set_irq)(struct pcie_port *pp, int irq); void (*msi_clear_irq)(struct pcie_port *pp, int irq); u32 (*get_msi_data)(struct pcie_port *pp); + struct pci_bus *(*scan_bus)(struct pcie_port *pp); + void (*msi_init) (struct pcie_port *pp, struct irq_domain_ops *ops, + struct msi_chip *chip); }; int dw_pcie_cfg_read(void __iomem *addr, int where, int size, u32 *val);