From patchwork Wed Aug 6 17:03:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 34985 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E1E2820523 for ; Wed, 6 Aug 2014 17:04:14 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rp18sf11129425iec.4 for ; Wed, 06 Aug 2014 10:04:14 -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=7ff1kqtfi8K3bOvNEkbM7zAe4V4Cs+PMfx1Ry0GbF9o=; b=dHgyb6jLZp8XUe9h6voSsJ5/iTsWdXxxaI+TL5A2T2ruzdLQnhvK6N6qfI/oxIKaHG 1NjflD+QTdAMseL1DD9VqdYD2HBpkmUBnDNzLi2vSKT7CH2XY0ChK7QuOKFDji/brVnH a2UcW9OLBgNjnBkGh8GoxWUqLsN6iR3NywXtK24KbhmjkoPYXWim09jUvC235LoqEpqS VqMruOyQbL9+y3Hont25JMRNkBBuR//fvOFJ/24H3bEIAQrFgGIwp5KEwuaZhnmV5EnB u6NkC4naQXZGLu+/nAu12wXNkU2Zd8TGn1zuWmwQicPtXxWo3s3Z5a2fFhB7njdO2c6/ +heQ== X-Gm-Message-State: ALoCoQkUT7TSYSZ8jjcgIyYSICbnhB/6bI7OG1+k1HTyGY3bqryuMn+kVvcWk4wWRSApNaW+QgSi X-Received: by 10.182.43.196 with SMTP id y4mr5806538obl.35.1407344654083; Wed, 06 Aug 2014 10:04:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.77 with SMTP id r71ls279060qga.71.gmail; Wed, 06 Aug 2014 10:04:14 -0700 (PDT) X-Received: by 10.221.21.201 with SMTP id qt9mr11853987vcb.39.1407344653970; Wed, 06 Aug 2014 10:04:13 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id kd5si731140veb.67.2014.08.06.10.04.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Aug 2014 10:04:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so4383436vcb.32 for ; Wed, 06 Aug 2014 10:04:13 -0700 (PDT) X-Received: by 10.52.83.227 with SMTP id t3mr10324482vdy.20.1407344653880; Wed, 06 Aug 2014 10:04:13 -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.37.5 with SMTP id tc5csp40503vcb; Wed, 6 Aug 2014 10:04:13 -0700 (PDT) X-Received: by 10.68.69.7 with SMTP id a7mr12405795pbu.49.1407344652926; Wed, 06 Aug 2014 10:04:12 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si1352329pad.96.2014.08.06.10.04.12 for ; Wed, 06 Aug 2014 10:04:12 -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 S1757768AbaHFREH (ORCPT + 26 others); Wed, 6 Aug 2014 13:04:07 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:50542 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757738AbaHFREF (ORCPT ); Wed, 6 Aug 2014 13:04:05 -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 s76H3bjn028876; Wed, 6 Aug 2014 12:03:37 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s76H3bXi020395; Wed, 6 Aug 2014 12:03:37 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Wed, 6 Aug 2014 12:03:37 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s76H3a9S025478; Wed, 6 Aug 2014 12:03:37 -0500 From: Murali Karicheri To: , , , CC: , Murali Karicheri Subject: [PATCH v1] PCI: keystone: add a pci quirk to limit mrrs Date: Wed, 6 Aug 2014 13:03:52 -0400 Message-ID: <1407344632-13865-1-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.7.9.5 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.173 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: , Keystone PCI controller has a limitation that memory read request size must not exceed 256 bytes. This is a hardware limitation and add a quirk to force this limit on all downstream devices by updating mrrs. Signed-off-by: Murali Karicheri --- v1 - updated based on comments pr_info to dev_info This applies on top of the Keystone PCI controller patch series at http://thread.gmane.org/gmane.linux.kernel.pci/33523 drivers/pci/host/pci-keystone.c | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c index c1cfaef..50d6995 100644 --- a/drivers/pci/host/pci-keystone.c +++ b/drivers/pci/host/pci-keystone.c @@ -42,8 +42,48 @@ /* DEV_STAT_CTRL */ #define PCIE_CAP_BASE 0x70 +/* PCIE controller device IDs */ +#define PCIE_RC_K2HK 0xb008 +#define PCIE_RC_K2E 0xb009 +#define PCIE_RC_K2L 0xb00a + #define to_keystone_pcie(x) container_of(x, struct keystone_pcie, pp) +static void quirk_limit_mrrs(struct pci_dev *dev) +{ + struct pci_bus *bus = dev->bus; + struct pci_dev *bridge = bus->self; + + if (pci_is_root_bus(bus)) + return; + + /* look for the host bridge */ + while (!pci_is_root_bus(bus)) { + bridge = bus->self; + bus = bus->parent; + } + + if (bridge) { + u16 id; + + /* + * Keystone PCI controller has a h/w limitation of + * 256 bytes maximum read request size. It can't handle + * anything higher than this. So force this limit on + * all downstream devices + */ + pci_read_config_word(bridge, PCI_DEVICE_ID, &id); + if ((id == PCIE_RC_K2HK) || (id == PCIE_RC_K2E) || + (id == PCIE_RC_K2L)) { + if (pcie_get_readrq(dev) > 256) { + dev_info(&dev->dev, "limiting mrrs to 256\n"); + pcie_set_readrq(dev, 256); + } + } + } +} +DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_limit_mrrs); + static int ks_pcie_establish_link(struct keystone_pcie *ks_pcie) { struct pcie_port *pp = &ks_pcie->pp;