Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755048AbaGWB1e (ORCPT ); Tue, 22 Jul 2014 21:27:34 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:16553 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751692AbaGWB1b (ORCPT ); Tue, 22 Jul 2014 21:27:31 -0400 X-AuditID: cbfee68f-b7fef6d000003970-15-53cf0f81c281 From: Jingoo Han To: "'Murali Karicheri'" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: "'Santosh Shilimkar'" , "'Russell King'" , "'Grant Likely'" , "'Rob Herring'" , "'Bjorn Helgaas'" , "'Richard Zhu'" , "'Kishon Vijay Abraham I'" , "'Marek Vasut'" , "'Arnd Bergmann'" , "'Pawel Moll'" , "'Mark Rutland'" , "'Ian Campbell'" , "'Kumar Gala'" , "'Randy Dunlap'" , "'Jingoo Han'" References: <1405961925-27248-1-git-send-email-m-karicheri2@ti.com> <1405961925-27248-4-git-send-email-m-karicheri2@ti.com> In-reply-to: <1405961925-27248-4-git-send-email-m-karicheri2@ti.com> Subject: Re: [PATCH v7 3/5] PCI: designware: enhance dw_pcie_host_init() to support v3.65 DW hardware Date: Wed, 23 Jul 2014 10:27:28 +0900 Message-id: <003201cfa615$44615ff0$cd241fd0$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac+lBVI6UuGp3R+5Rm6OXxFBZmHNyABD8G0Q Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHKsWRmVeSWpSXmKPExsVy+t8zfd1G/vPBBn+e8Vv8nXSM3WJJU4bF y0OaFv1vFrJaHPizg9Hi3KuVjBaXF15itbjwtIfNYtPja6wWl3fNYbM4O+84m8Xty7wWfb0H 2CzetDUyWiy9fpHJYsL0tSwWj2cJW7y9M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xYFOpx8rlX9g8Nq/Q8ti0qpPN4861PUDeknqPvi2rGD2O39jO 5PF5k1wAf1QDo01GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4Cu W2YO0M9KCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMI6xozDy+azFazQrei6 vo6lgXGrShcjB4eEgInE3AOSXYycQKaYxIV769m6GLk4hASmM0q8OnmNGcL5zSjRcLiLFaSK TUBN4suXw+wgCRGBXkaJjxN2gLUwC9xlkdg8/yQ7SJWQQK1E46u1TCA2p4CLxLm2JmYQW1gg XeJ01ztGEJtFQFXi+6HjYDavgK3EwYNz2CBsQYkfk++xgNjMAloS63ceZ4Kw5SU2r3nLDHG2 usSjv7ogYREBI4mXG+8xQ5SISOx78Y5xAqPQLCSTZiGZNAvJpFlIWhYwsqxiFE0tSC4oTkrP NdIrTswtLs1L10vOz93ECE57z6R3MK5qsDjEKMDBqMTDW1BzLliINbGsuDL3EKMEB7OSCG90 K1CINyWxsiq1KD++qDQntfgQoynQoxOZpUST84EpOa8k3tDYxMzI0sjMwsjE3FxJnPdgq3Wg kEB6YklqdmpqQWoRTB8TB6dUA6OJTBBj3RztOOscr+J/DV2exl1X1X+IWrA1PZnroBizaC1v 4xqex5zLiotOfwm09ZK32OUmvqH63gxWFbWFEVctIk4lT9DR5v3+bP6eW3Mf3VnvOUdZNeI/ uynvpLuWGQZxQmqSU+O0eE+Ju+/a46S/fT5DkO7WJ5lLp4hx9jJPNHpy7N1sayWW4oxEQy3m ouJEADLoRdSRAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, July 22, 2014 1:59 AM, Murali Karicheri wrote: > > keystone PCI controller is based on v3.65 designware hardware. This > version differs from newer versions of the hardware in few functional > areas discussed below that makes it necessary to change dw_pcie_host_init() > to support v3.65 based PCI controller. > > 1. No support for ATU port. So any ATU specific resource handling code > is to be bypassed for v3.65 h/w. > 2. MSI controller uses Application space to implement MSI and 32 MSI > interrupts are multiplexed over 8 IRQs to the host. Hence the code > to process MSI IRQ needs to be different. This patch allows platform > driver to provide its own irq_domain_ops ptr to irq_domain_add_linear() > through an API callback from the designware core driver. > 3. MSI interrupt generation requires EP to write to the RC's application > register. So enhance the driver to allow setup of inbound access to > MSI irq register as a post scan bus API callback. > > Signed-off-by: Murali Karicheri > Reviewed-by: Pratyush Anand > Acked-by: Mohit KUMAR > > CC: Santosh Shilimkar > CC: Russell King > CC: Grant Likely > CC: Rob Herring > CC: Jingoo Han Acked-by: Jingoo Han Best regards, Jingoo Han > CC: Bjorn Helgaas > CC: Richard Zhu > CC: Kishon Vijay Abraham I > CC: Marek Vasut > CC: Arnd Bergmann > CC: Pawel Moll > CC: Mark Rutland > CC: Ian Campbell > CC: Kumar Gala > CC: Randy Dunlap > CC: Grant Likely > --- > drivers/pci/host/pcie-designware.c | 54 +++++++++++++++++++++++------------- > drivers/pci/host/pcie-designware.h | 2 ++ > 2 files changed, 36 insertions(+), 20 deletions(-) > > diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c > index 905941c..35bb4af 100644 > --- a/drivers/pci/host/pcie-designware.c > +++ b/drivers/pci/host/pcie-designware.c > @@ -420,8 +420,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp) > struct device_node *np = pp->dev->of_node; > struct of_pci_range range; > struct of_pci_range_parser parser; > + int i, ret; > u32 val; > - int i; > > if (of_pci_range_parser_init(&parser, np)) { > dev_err(pp->dev, "missing ranges property\n"); > @@ -467,21 +467,26 @@ int __init dw_pcie_host_init(struct pcie_port *pp) > } > } > > - pp->cfg0_base = pp->cfg.start; > - pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; > pp->mem_base = pp->mem.start; > > - pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, > - pp->config.cfg0_size); > if (!pp->va_cfg0_base) { > - dev_err(pp->dev, "error with ioremap in function\n"); > - return -ENOMEM; > + pp->cfg0_base = pp->cfg.start; > + pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, > + pp->config.cfg0_size); > + if (!pp->va_cfg0_base) { > + dev_err(pp->dev, "error with ioremap in function\n"); > + return -ENOMEM; > + } > } > - pp->va_cfg1_base = devm_ioremap(pp->dev, pp->cfg1_base, > - pp->config.cfg1_size); > + > if (!pp->va_cfg1_base) { > - dev_err(pp->dev, "error with ioremap\n"); > - return -ENOMEM; > + pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; > + pp->va_cfg1_base = devm_ioremap(pp->dev, pp->cfg1_base, > + pp->config.cfg1_size); > + if (!pp->va_cfg1_base) { > + dev_err(pp->dev, "error with ioremap\n"); > + return -ENOMEM; > + } > } > > if (of_property_read_u32(np, "num-lanes", &pp->lanes)) { > @@ -490,16 +495,22 @@ 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_host_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 { > + ret = pp->ops->msi_host_init(pp, &dw_pcie_msi_chip); > + if (ret < 0) > + return ret; > + } > } > > if (pp->ops->host_init) > @@ -759,6 +770,9 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys) > BUG(); > } > > + if (bus && pp->ops->scan_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..080c649 100644 > --- a/drivers/pci/host/pcie-designware.h > +++ b/drivers/pci/host/pcie-designware.h > @@ -70,6 +70,8 @@ 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); > + void (*scan_bus)(struct pcie_port *pp); > + int (*msi_host_init)(struct pcie_port *pp, struct msi_chip *chip); > }; > > int dw_pcie_cfg_read(void __iomem *addr, int where, int size, u32 *val); > -- > 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/