From patchwork Thu Feb 13 03:03:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 3641971 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 01D91BF13A for ; Thu, 13 Feb 2014 03:03:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1521920165 for ; Thu, 13 Feb 2014 03:03:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3373720158 for ; Thu, 13 Feb 2014 03:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbaBMDCo (ORCPT ); Wed, 12 Feb 2014 22:02:44 -0500 Received: from mail-pd0-f169.google.com ([209.85.192.169]:61582 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619AbaBMDCl (ORCPT ); Wed, 12 Feb 2014 22:02:41 -0500 Received: by mail-pd0-f169.google.com with SMTP id v10so9920574pde.0 for ; Wed, 12 Feb 2014 19:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=0GOxN7PljaJboe6iTk6vHVEvSgY5gIILuuk+Y6L5s54=; b=E9QWBwHW5GyJPWORlGCGUdTR8Wb5kYH5ihSHNLp6aJm7Yet4BQWgv0f1F6D4hBVNKP cdlHhkdHILwdq4bLhdomJwHHG+xVruQZUdEaRtjvRIcTrI1/I1wfqIQb8plbSk4ToCFw NoeOiv3VXYav5Gn/CJj/nFiZ6MMdAB4gfUZk4NKbLzJ+uANFc1K+WtOyzN0+t76svbs5 r2Oc6nI7oBUo6Dnb3mtk88LK8FFnuMSXC2QarHzNHoe0/51BHLvlb7PjzDNxnr/kWh7Q IfqDBus4O3JXwRgfXu0Cz8o7BMs7yT8io3a5IpuK1xnQJSZm7URNWcdlbeuLXDh0TFmi HK6A== X-Received: by 10.69.1.2 with SMTP id bc2mr39480883pbd.102.1392260561028; Wed, 12 Feb 2014 19:02:41 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id pp5sm977546pbb.33.2014.02.12.19.02.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Feb 2014 19:02:39 -0800 (PST) From: Magnus Damm To: linux-pci@vger.kernel.org Cc: horms@verge.net.au, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, valentine.barshak@cogentembedded.com, ben.dooks@codethink.co.uk, geert@linux-m68k.org, bhelgaas@google.com, Magnus Damm Date: Thu, 13 Feb 2014 12:03:53 +0900 Message-Id: <20140213030353.10398.71544.sendpatchset@w520> In-Reply-To: <20140213030302.10398.37322.sendpatchset@w520> References: <20140213030302.10398.37322.sendpatchset@w520> Subject: [PATCH v2 05/08] PCI: rcar: Break out window size handling Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Magnus Damm Break out the hard coded window size code to allow dynamic setup. The window size is still left at 1GiB but with this patch changing window size is easy for testing. Signed-off-by: Magnus Damm --- Changes since V1: - Updated to fit on top of patches from Ben Dooks drivers/pci/host/pci-rcar-gen2.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0007/drivers/pci/host/pci-rcar-gen2.c +++ work/drivers/pci/host/pci-rcar-gen2.c 2014-02-13 10:16:48.000000000 +0900 @@ -18,6 +18,7 @@ #include #include #include +#include #include /* AHB-PCI Bridge PCI communication registers */ @@ -98,6 +99,7 @@ struct rcar_pci_priv { struct resource mem_res; struct resource *cfg_res; int irq; + unsigned long window_size; }; /* PCI configuration space operations */ @@ -241,10 +243,31 @@ static int __init rcar_pci_setup(int nr, iowrite32(val, reg + RCAR_USBCTR_REG); udelay(4); - /* De-assert reset and set PCIAHB window1 size to 1GB */ + /* De-assert reset and reset PCIAHB window1 size */ val &= ~(RCAR_USBCTR_PCIAHB_WIN1_MASK | RCAR_USBCTR_PCICLK_MASK | RCAR_USBCTR_USBH_RST | RCAR_USBCTR_PLL_RST); - iowrite32(val | RCAR_USBCTR_PCIAHB_WIN1_1G, reg + RCAR_USBCTR_REG); + + /* Setup PCIAHB window1 size */ + switch (priv->window_size) { + case SZ_2G: + val |= RCAR_USBCTR_PCIAHB_WIN1_2G; + break; + case SZ_1G: + val |= RCAR_USBCTR_PCIAHB_WIN1_1G; + break; + case SZ_512M: + val |= RCAR_USBCTR_PCIAHB_WIN1_512M; + break; + default: + pr_warn("unknown window size %ld - defaulting to 256M\n", + priv->window_size); + priv->window_size = SZ_256M; + /* fall-through */ + case SZ_256M: + val |= RCAR_USBCTR_PCIAHB_WIN1_256M; + break; + } + iowrite32(val, reg + RCAR_USBCTR_REG); /* Configure AHB master and slave modes */ iowrite32(RCAR_AHB_BUS_MODE, reg + RCAR_AHB_BUS_CTR_REG); @@ -255,7 +278,7 @@ static int __init rcar_pci_setup(int nr, RCAR_PCI_ARBITER_PCIBP_MODE; iowrite32(val, reg + RCAR_PCI_ARBITER_CTR_REG); - /* PCI-AHB mapping: 0x40000000-0x80000000 */ + /* PCI-AHB mapping: 0x40000000 base */ iowrite32(0x40000000 | RCAR_PCIAHB_PREFETCH16, reg + RCAR_PCIAHB_WIN1_CTR_REG); @@ -341,6 +364,8 @@ static int rcar_pci_probe(struct platfor return priv->irq; } + priv->window_size = SZ_1G; + hw_private[0] = priv; memset(&hw, 0, sizeof(hw)); hw.nr_controllers = ARRAY_SIZE(hw_private);