From patchwork Wed Dec 17 10:34:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel FERNANDEZ X-Patchwork-Id: 5506611 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 4A0EABEEA8 for ; Wed, 17 Dec 2014 10:38:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 67A3D209E3 for ; Wed, 17 Dec 2014 10:38: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 D50A9209E1 for ; Wed, 17 Dec 2014 10:38:48 +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 1Y1ByS-0007rp-PG; Wed, 17 Dec 2014 10:36:56 +0000 Received: from mx07-00178001.pphosted.com ([62.209.51.94]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y1Bxa-0007KD-GG for linux-arm-kernel@lists.infradead.org; Wed, 17 Dec 2014 10:36:05 +0000 Received: from pps.filterd (m0046670.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id sBHAMB4P018409; Wed, 17 Dec 2014 11:35:09 +0100 Received: from beta.dmz-us.st.com (beta.dmz-us.st.com [167.4.1.35]) by mx07-00178001.pphosted.com with ESMTP id 1r9ga8q4eh-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 17 Dec 2014 11:35:09 +0100 Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id B5B8D26; Wed, 17 Dec 2014 10:35:06 +0000 (GMT) Received: from mail7.sgp.st.com (unknown [164.129.223.81]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 6087C2F; Wed, 17 Dec 2014 10:35:01 +0000 (GMT) Received: from lmenx315.lme.st.com ([10.48.254.122]) by mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id BZR93116 (AUTH frq07381); Wed, 17 Dec 2014 11:34:48 +0100 From: Gabriel FERNANDEZ To: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Srinivas Kandagatla , Maxime Coquelin , Patrice Chotard , Russell King , Bjorn Helgaas , Mohit Kumar , Jingoo Han , Grant Likely , Gabriel Fernandez , Fabrice Gasnier , Arnd Bergmann , Viresh Kumar , Thierry Reding , Minghuan Lian , Magnus Damm , Will Deacon , Tanmay Inamdar , Murali Karicheri , Kishon Vijay Abraham I , Pratyush Anand , Sachin Kamat , Andrew Lunn , Liviu Dudau , Srikanth Thokala Subject: [PATCH 5/5] PCI: st: disable IO support Date: Wed, 17 Dec 2014 11:34:46 +0100 Message-Id: <1418812486-12394-6-git-send-email-gabriel.fernandez@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418812486-12394-1-git-send-email-gabriel.fernandez@linaro.org> References: <1418812486-12394-1-git-send-email-gabriel.fernandez@linaro.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2014-12-17_03:2014-12-17, 2014-12-17, 1970-01-01 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141217_023603_180197_754E8AB7 X-CRM114-Status: GOOD ( 11.70 ) X-Spam-Score: -0.7 (/) Cc: devicetree@vger.kernel.org, kernel@stlinux.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Lee Jones , 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 sti SoCs PCIe IPs are built around DesignWare IP Core. But in these SoCs, PCIe IP doesn't support IO. By default, when no IO space is provided, a default one is assigned. Add an empty IO resource to the bus, and disable IO by default. Signed-off-by: Fabrice Gasnier --- drivers/pci/host/pci-st.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/pci/host/pci-st.c b/drivers/pci/host/pci-st.c index bd3d32d..c0d3895 100644 --- a/drivers/pci/host/pci-st.c +++ b/drivers/pci/host/pci-st.c @@ -357,9 +357,15 @@ static void st_pcie_board_reset(struct pcie_port *pp) static void st_pcie_hw_setup(struct pcie_port *pp) { struct st_pcie *pcie = to_st_pcie(pp); + u32 val; dw_pcie_setup_rc(pp); + /* Disable IO support */ + val = readl_relaxed(pp->dbi_base + PCI_COMMAND); + val &= ~PCI_COMMAND_IO; + writel_relaxed(val, pp->dbi_base + PCI_COMMAND); + /* Set up the config window to the top of the PCI address space */ writel_relaxed(pcie->config_window_start, pp->dbi_base + CFG_BASE_ADDRESS); @@ -445,11 +451,28 @@ static void st_pcie_host_init(struct pcie_port *pp) st_msi_init_one(pp); } +static void st_pcie_setup_bus(struct pcie_port *pp, struct pci_sys_data *sys) +{ + struct resource *res; + + /* This PCIe controller does not support IO, set an empty one. */ + res = devm_kzalloc(pp->dev, sizeof(*res), GFP_KERNEL); + if (!res) + return; + + res->start = 0; + res->end = 0; + res->name = "PCIe empty IO space"; + res->flags = IORESOURCE_IO; + pci_add_resource(&sys->resources, res); +} + static struct pcie_host_ops st_pcie_host_ops = { .rd_other_conf = st_pcie_rd_other_conf, .wr_other_conf = st_pcie_wr_other_conf, .link_up = st_pcie_link_up, .host_init = st_pcie_host_init, + .setup_bus = st_pcie_setup_bus, }; static int st_pcie_init(struct pcie_port *pp)