From patchwork Wed Sep 10 17:12:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 37215 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F016C20293 for ; Wed, 10 Sep 2014 17:13:00 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id hy4sf10838961vcb.8 for ; Wed, 10 Sep 2014 10:13:00 -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 :in-reply-to:references: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=C9xe1yj1+Ffh0cznL5SROBpZyq2MawUA7KJUAFB6lmQ=; b=MiOe5FNj1qPskXdYt9GDUVcVAX5j/0yEV45TY1S9IxFKKaunpFdf+6weXzQuPm+DYb /S01Qc28T7kGa+gISLNxM3HIEhJ0leBysS1Y1T571224CzEOFLtxGchO2ho9oWqd9Aor AvuOTByQYu3TrRPhhqIvbplMww18L1Ke7T/lqB2c9lISGezGT7hip/ulPxyCuHbHyriI eg3GF8Uki9dVBJaB6ArSwbA/XEYH/iHRLjYEXjYCTgmDbwbrILrExnDKHRqQsGn7yRNa ClJzpVJAg6FedEAt/BZqx5lRTQS9N1yoVUbvdKHTVCj73iTNa+810ITnPPj/ExXDTvTc 9YXA== X-Gm-Message-State: ALoCoQnTL9/PU2KYGiRZWOFygDPGG+AQTEVcL1auboqG9z4964d61K2yJBiLNfXqySV4Hzll6m0D X-Received: by 10.236.84.137 with SMTP id s9mr1259688yhe.56.1410369180743; Wed, 10 Sep 2014 10:13:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.203 with SMTP id t69ls2735874qgd.30.gmail; Wed, 10 Sep 2014 10:13:00 -0700 (PDT) X-Received: by 10.220.168.210 with SMTP id v18mr6500843vcy.3.1410369180662; Wed, 10 Sep 2014 10:13:00 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id r7si1671133vcy.73.2014.09.10.10.13.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Sep 2014 10:13:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id la4so2804413vcb.7 for ; Wed, 10 Sep 2014 10:13:00 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr37519307vcn.16.1410369180537; Wed, 10 Sep 2014 10:13: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 uj3csp468815vcb; Wed, 10 Sep 2014 10:13:00 -0700 (PDT) X-Received: by 10.68.109.5 with SMTP id ho5mr13179241pbb.13.1410369179653; Wed, 10 Sep 2014 10:12:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kk10si19926166pbd.5.2014.09.10.10.12.59 for ; Wed, 10 Sep 2014 10:12:59 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S1752827AbaIJRM4 (ORCPT + 27 others); Wed, 10 Sep 2014 13:12:56 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:49822 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751511AbaIJRMw (ORCPT ); Wed, 10 Sep 2014 13:12:52 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s8AHCFRG025171; Wed, 10 Sep 2014 12:12:15 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8AHCFmv004358; Wed, 10 Sep 2014 12:12:15 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 10 Sep 2014 12:12:15 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8AHCD48001437; Wed, 10 Sep 2014 12:12:14 -0500 From: Murali Karicheri To: , , , , , , , , , , CC: Murali Karicheri Subject: [PATCH v3 2/2] PCI: keystone: read pci device id dynamically to support multiple ports Date: Wed, 10 Sep 2014 13:12:39 -0400 Message-ID: <1410369159-11564-2-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1410369159-11564-1-git-send-email-m-karicheri2@ti.com> References: <1410369159-11564-1-git-send-email-m-karicheri2@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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.176 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). To support multiple port handling in Keystone PCI driver, read the PCI device ID dynamically by iomap/read/unmap during probe and save it in driver's private data and update it in host init code. The PCI device ID field in the RC's config space is not filled by default by the hardware and has to be updated by the PCI driver by reading the same from the SoC register indicated by reg index #2 in DT bindings. While at it remove the note for bootargs as this is no longer needed. Signed-off-by: Murali Karicheri --- v3 - removed handling of pcie-port and removed the documentation. Also updated commit log to reflect the real change. v2 - updated based on comment against v1. Removed handling of RC mode .../devicetree/bindings/pci/pci-keystone.txt | 3 --- drivers/pci/host/pci-keystone.c | 9 +++++---- drivers/pci/host/pci-keystone.h | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/pci-keystone.txt b/Documentation/devicetree/bindings/pci/pci-keystone.txt index bedacf0..54eae29 100644 --- a/Documentation/devicetree/bindings/pci/pci-keystone.txt +++ b/Documentation/devicetree/bindings/pci/pci-keystone.txt @@ -61,6 +61,3 @@ 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 f1119eb..a74f26e 100644 --- a/drivers/pci/host/pci-keystone.c +++ b/drivers/pci/host/pci-keystone.c @@ -253,8 +253,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); @@ -263,8 +263,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); @@ -373,7 +372,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;