From patchwork Fri Sep 5 17:39:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 36890 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8FB5B202E4 for ; Fri, 5 Sep 2014 17:40:01 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id vb8sf61043593obc.8 for ; Fri, 05 Sep 2014 10:40:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=E4t7pSezukuEEdQMwPKiVq3hdVj6h6U4hBrvB0dsxZ4=; b=dCjAwv9q5UI4RHKsANOoi8VEvnNzkEzXqmxYkM7yjuTAh9qNQRG8YS+kQ6VY5aozFD pT+yBseS1MzNURZ+qykTe7PX63jzgJ2DuJm+xlnAKfScXScyeU7uJRdFP2aIA7cQ4j2+ p/aF/1/yKspET+fpRBjDMAEwoeNCczDhCJtnBOrywQugNpQySq70J7Blynm/PcmAFLaP 3cSXWUxpXcPHdUoUC5IoO8H/JNSa2jJ7OTrkfWxJXwv7NjFGN1QKae7XLc1f2hcWvL3K uTkcQTp9VkyLYNS4Yix5bCdhvVbnifmPcX/+Ef90EAuALN73+QUw5MvkuN3S9eG63vzT tqMA== X-Gm-Message-State: ALoCoQkrV36AJ194wVkLiSd/2wHBjoeUp89lKei1XTxlikpRFLdSJGDswEV9Q14pz4P7Eto6H0bK X-Received: by 10.50.138.167 with SMTP id qr7mr2720295igb.6.1409938801117; Fri, 05 Sep 2014 10:40:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.225 with SMTP id w88ls412307qge.38.gmail; Fri, 05 Sep 2014 10:40:00 -0700 (PDT) X-Received: by 10.220.202.9 with SMTP id fc9mr2416976vcb.40.1409938800933; Fri, 05 Sep 2014 10:40:00 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id fa5si1204929vcb.80.2014.09.05.10.40.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 10:40:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id le20so1323894vcb.26 for ; Fri, 05 Sep 2014 10:40:00 -0700 (PDT) X-Received: by 10.220.169.72 with SMTP id x8mr2379947vcy.45.1409938800783; Fri, 05 Sep 2014 10:40:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp116818vcb; Fri, 5 Sep 2014 10:40:00 -0700 (PDT) X-Received: by 10.66.141.39 with SMTP id rl7mr24221823pab.8.1409938799875; Fri, 05 Sep 2014 10:39:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id do5si5355911pbb.112.2014.09.05.10.39.59 for ; Fri, 05 Sep 2014 10:39:59 -0700 (PDT) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750832AbaIERj6 (ORCPT + 5 others); Fri, 5 Sep 2014 13:39:58 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:44063 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750797AbaIERj5 (ORCPT ); Fri, 5 Sep 2014 13:39:57 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s85HdMnV017166; Fri, 5 Sep 2014 12:39:22 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s85HdLug006251; Fri, 5 Sep 2014 12:39:21 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Fri, 5 Sep 2014 12:39:21 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s85HdKlP004658; Fri, 5 Sep 2014 12:39:20 -0500 From: Murali Karicheri To: , , , CC: Murali Karicheri , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Bjorn Helgaas , Santosh Shilimkar Subject: [PATCH] PCI: keystone: update to support multiple pci ports Date: Fri, 5 Sep 2014 13:39:42 -0400 Message-ID: <1409938782-31460-1-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m-karicheri2@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , K2E SoC has two PCI ports. The SATA controller is connected to second PCI port (port 1). This patch enhances the driver to support multiple ports. Update the DT Documentation for the new attribute, ti,pcie-port and remove the note for bootargs as this is no longer needed. Signed-off-by: Murali Karicheri CC: Rob Herring CC: Pawel Moll CC: Mark Rutland CC: Ian Campbell CC: Kumar Gala CC: Bjorn Helgaas CC: Santosh Shilimkar --- .../devicetree/bindings/pci/pci-keystone.txt | 8 ++++--- drivers/pci/host/pci-keystone.c | 23 ++++++++++++++------ drivers/pci/host/pci-keystone.h | 4 ++-- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/pci-keystone.txt b/Documentation/devicetree/bindings/pci/pci-keystone.txt index ceb3e24..e279143 100644 --- a/Documentation/devicetree/bindings/pci/pci-keystone.txt +++ b/Documentation/devicetree/bindings/pci/pci-keystone.txt @@ -58,11 +58,13 @@ Optional properties:- phy-names: name of the Generic Keystine SerDes phy for PCI - If boot loader already does PCI link establishment, then phys and phy-names shouldn't be present. + ti,pcie-port: PCI port number. This is used to configure the PCI port + number. For example K2E SoC supports 2 PCI ports and PCI bindings + for the second port adds ti,pcie-port = <1> to identify second port + and driver uses this to configure the PCI mode register for second + port. If not present, port number 0 is assumed. Designware DT Properties not applicable for Keystone PCI 1. pcie_bus clock-names not used. Instead, a phandle to phys is used. -Note for PCI driver usage -========================= -Driver requires pci=pcie_bus_perf in the bootargs for proper functioning. diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c index a132622..b4831e8 100644 --- a/drivers/pci/host/pci-keystone.c +++ b/drivers/pci/host/pci-keystone.c @@ -252,8 +252,8 @@ static int keystone_pcie_fault(unsigned long addr, unsigned int fsr, static void __init ks_pcie_host_init(struct pcie_port *pp) { - u32 vendor_device_id, val; struct keystone_pcie *ks_pcie = to_keystone_pcie(pp); + u32 val; ks_pcie_establish_link(ks_pcie); ks_dw_pcie_setup_rc_app_regs(ks_pcie); @@ -262,8 +262,7 @@ static void __init ks_pcie_host_init(struct pcie_port *pp) pp->dbi_base + PCI_IO_BASE); /* update the Vendor ID */ - vendor_device_id = readl(ks_pcie->va_reg_pciid); - writew((vendor_device_id >> 16), pp->dbi_base + PCI_DEVICE_ID); + writew(ks_pcie->device_id, pp->dbi_base + PCI_DEVICE_ID); /* update the DEV_STAT_CTRL to publish right mrrs */ val = readl(pp->dbi_base + PCIE_CAP_BASE + PCI_EXP_DEVCTL); @@ -344,12 +343,13 @@ static int __exit ks_pcie_remove(struct platform_device *pdev) static int __init ks_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; struct keystone_pcie *ks_pcie; + int ret = 0, port_id = 0; struct pcie_port *pp; struct resource *res; void __iomem *reg_p; struct phy *phy; - int ret = 0; u32 val; ks_pcie = devm_kzalloc(&pdev->dev, sizeof(*ks_pcie), @@ -360,17 +360,24 @@ static int __init ks_pcie_probe(struct platform_device *pdev) } pp = &ks_pcie->pp; + /* read the PCI port id */ + of_property_read_u32(np, "ti,pcie-port", &port_id); + /* index 2 is the devcfg register for RC mode settings */ res = platform_get_resource(pdev, IORESOURCE_MEM, 2); reg_p = devm_ioremap_resource(dev, res); if (IS_ERR(reg_p)) return PTR_ERR(reg_p); + /* enable RC mode in devcfg */ val = readl(reg_p); - val &= ~PCIE_MODE_MASK; - val |= PCIE_RC_MODE; + port_id <<= 1; + val &= ~(PCIE_MODE_MASK << port_id); + val |= (PCIE_RC_MODE << port_id); writel(val, reg_p); + devm_iounmap(dev, reg_p); + devm_release_mem_region(dev, res->start, resource_size(res)); /* initialize SerDes Phy if present */ phy = devm_phy_get(dev, "pcie-phy"); @@ -385,7 +392,9 @@ static int __init ks_pcie_probe(struct platform_device *pdev) reg_p = devm_ioremap_resource(dev, res); if (IS_ERR(reg_p)) return PTR_ERR(reg_p); - ks_pcie->va_reg_pciid = reg_p; + ks_pcie->device_id = readl(reg_p) >> 16; + devm_iounmap(dev, reg_p); + devm_release_mem_region(dev, res->start, resource_size(res)); pp->dev = dev; platform_set_drvdata(pdev, ks_pcie); diff --git a/drivers/pci/host/pci-keystone.h b/drivers/pci/host/pci-keystone.h index 729ea7d..80cfa8e 100644 --- a/drivers/pci/host/pci-keystone.h +++ b/drivers/pci/host/pci-keystone.h @@ -19,8 +19,8 @@ struct keystone_pcie { struct clk *clk; struct pcie_port pp; - void __iomem *va_reg_pciid; - + /* PCI Device ID */ + u32 device_id; int num_legacy_host_irqs; int legacy_host_irqs[MAX_LEGACY_HOST_IRQS]; struct device_node *legacy_intc_np;