From patchwork Tue Jun 25 23:05:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 18124 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2E7C625E4B for ; Tue, 25 Jun 2013 23:05:59 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id d10sf18622342vea.0 for ; Tue, 25 Jun 2013 16:05:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=amiKoGAq2rB7T7vroHAWGxxa1rUyOyJ7TDfK5I7fVLk=; b=MzOy0L+1hP95uaBSKgnDY/4U2SPhVTMnPpiC9W6zjUbJmVW4Y9XSHlrTlhyD+BphkE uRlCA6uhk/Hp6elNzTFzvatppXLYpaYrnBDxdy/z0WETqFktEEwDEgGrukz6frHshD4n 9t4oKQc6fCzhpqWpow+1roAPlJ55Jsa4DwnbcQh02bCn0bYQGvlznrP5Hnoa4dAAtaLp uVpli240oVd9LqtAT+U16lWxRlC9hF1cQdB9wMi5sunocpPNXlszM2xB0Bpt4oOvahf2 YRR+CZyV+uQVm7bvgBbK7ZZBYn3nd9HHxW0AOoCfw7UuO79t0+NBVd73FArPxNHkX4Vy ioug== X-Received: by 10.236.129.178 with SMTP id h38mr672710yhi.12.1372201558447; Tue, 25 Jun 2013 16:05:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.72.233 with SMTP id g9ls221171qev.84.gmail; Tue, 25 Jun 2013 16:05:58 -0700 (PDT) X-Received: by 10.220.86.202 with SMTP id t10mr663723vcl.74.1372201558244; Tue, 25 Jun 2013 16:05:58 -0700 (PDT) Received: from mail-vb0-x232.google.com (mail-vb0-x232.google.com [2607:f8b0:400c:c02::232]) by mx.google.com with ESMTPS id zw14si6919910veb.64.2013.06.25.16.05.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Jun 2013 16:05:58 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::232; Received: by mail-vb0-f50.google.com with SMTP id w16so10208605vbb.9 for ; Tue, 25 Jun 2013 16:05:58 -0700 (PDT) X-Received: by 10.58.45.70 with SMTP id k6mr780276vem.9.1372201557916; Tue, 25 Jun 2013 16:05:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp87458veb; Tue, 25 Jun 2013 16:05:57 -0700 (PDT) X-Received: by 10.112.198.164 with SMTP id jd4mr863080lbc.74.1372201556837; Tue, 25 Jun 2013 16:05:56 -0700 (PDT) Received: from mail-lb0-x231.google.com (mail-lb0-x231.google.com [2a00:1450:4010:c04::231]) by mx.google.com with ESMTPS id p10si9566082lah.16.2013.06.25.16.05.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Jun 2013 16:05:56 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4010:c04::231 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=2a00:1450:4010:c04::231; Received: by mail-lb0-f177.google.com with SMTP id 10so1168927lbf.36 for ; Tue, 25 Jun 2013 16:05:56 -0700 (PDT) X-Received: by 10.112.189.101 with SMTP id gh5mr843036lbc.73.1372201556183; Tue, 25 Jun 2013 16:05:56 -0700 (PDT) Received: from localhost.localdomain (c83-249-208-144.bredband.comhem.se. [83.249.208.144]) by mx.google.com with ESMTPSA id et10sm9533669lbc.6.2013.06.25.16.05.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Jun 2013 16:05:55 -0700 (PDT) From: Linus Walleij To: arm@kernel.org Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij Subject: [PATCH 2/3] ARM: integrator: let pciv3 use mem/premem from device tree Date: Wed, 26 Jun 2013 01:05:51 +0200 Message-Id: <1372201551-25984-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-Gm-Message-State: ALoCoQkRyfuPeYebUaqDfEm/psPpEVzo63ENaLGUI00TKsBUd+hbLv0ryPC+Ue5hIMfT/uemnj1K X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Instead of relying on the hard-coded mem/premem bases for the PCI side, read in these from the device tree in the DT probe path. Hard-code the old values on the non-DT probe path. Introduce some static locals to hold these addresses instead of the earlier static #defines. Reported-by: Arnd Bergmann Signed-off-by: Linus Walleij --- arch/arm/mach-integrator/pci_v3.c | 46 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index a0e069d..bef1005 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c @@ -52,7 +52,8 @@ * the V3 only has two windows (therefore we need to map stuff on the fly), * we maintain the same addresses, even if they're not mapped. */ -#define PHYS_PCI_MEM_BASE 0x40000000 /* 512M */ +#define PHYS_PCI_MEM_BASE 0x40000000 /* 256M */ +#define PHYS_PCI_PRE_BASE 0x50000000 /* 256M */ #define PHYS_PCI_IO_BASE 0x60000000 /* 16M */ #define PHYS_PCI_CONFIG_BASE 0x61000000 /* 16M */ #define PHYS_PCI_V3_BASE 0x62000000 /* 64K */ @@ -285,10 +286,16 @@ /* Filled in by probe */ static void __iomem *pci_v3_base; +/* CPU side memory ranges */ static struct resource conf_mem; /* FIXME: remap this instead of static map */ static struct resource io_mem; static struct resource non_mem; static struct resource pre_mem; +/* PCI side memory ranges */ +static u64 non_mem_pci; +static u64 non_mem_pci_sz; +static u64 pre_mem_pci; +static u64 pre_mem_pci_sz; // V3 access routines #define v3_writeb(o,v) __raw_writeb(v, pci_v3_base + (unsigned int)(o)) @@ -354,19 +361,6 @@ static struct resource pre_mem; */ static DEFINE_RAW_SPINLOCK(v3_lock); -#define PCI_BUS_NONMEM_START 0x00000000 -#define PCI_BUS_NONMEM_SIZE SZ_256M - -#define PCI_BUS_PREMEM_START PCI_BUS_NONMEM_START + PCI_BUS_NONMEM_SIZE -#define PCI_BUS_PREMEM_SIZE SZ_256M - -#if PCI_BUS_NONMEM_START & 0x000fffff -#error PCI_BUS_NONMEM_START must be megabyte aligned -#endif -#if PCI_BUS_PREMEM_START & 0x000fffff -#error PCI_BUS_PREMEM_START must be megabyte aligned -#endif - #undef V3_LB_BASE_PREFETCH #define V3_LB_BASE_PREFETCH 0 @@ -453,7 +447,7 @@ static void v3_close_config_window(void) v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(pre_mem.start) | V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_PREFETCH | V3_LB_BASE_ENABLE); - v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(PCI_BUS_PREMEM_START) | + v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(pre_mem_pci) | V3_LB_MAP_TYPE_MEM_MULTIPLE); /* @@ -694,7 +688,7 @@ static void __init pci_v3_preinit(void) */ v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(non_mem.start) | V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_ENABLE); - v3_writew(V3_LB_MAP0, v3_addr_to_lb_map(PCI_BUS_NONMEM_START) | + v3_writew(V3_LB_MAP0, v3_addr_to_lb_map(non_mem_pci) | V3_LB_MAP_TYPE_MEM); /* @@ -704,7 +698,7 @@ static void __init pci_v3_preinit(void) v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(pre_mem.start) | V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_PREFETCH | V3_LB_BASE_ENABLE); - v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(PCI_BUS_PREMEM_START) | + v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(pre_mem_pci) | V3_LB_MAP_TYPE_MEM_MULTIPLE); /* @@ -905,11 +899,15 @@ static int __init pci_v3_dtprobe(struct platform_device *pdev, } if ((range.flags & IORESOURCE_MEM) && !(range.flags & IORESOURCE_PREFETCH)) { + non_mem_pci = range.pci_addr; + non_mem_pci_sz = range.size; of_pci_range_to_resource(&range, np, &non_mem); non_mem.name = "PCIv3 non-prefetched mem"; } if ((range.flags & IORESOURCE_MEM) && (range.flags & IORESOURCE_PREFETCH)) { + pre_mem_pci = range.pci_addr; + pre_mem_pci_sz = range.size; of_pci_range_to_resource(&range, np, &pre_mem); pre_mem.name = "PCIv3 prefetched mem"; } @@ -976,16 +974,18 @@ static int __init pci_v3_probe(struct platform_device *pdev) io_mem.end = PHYS_PCI_IO_BASE + SZ_16M - 1; io_mem.flags = IORESOURCE_MEM; + non_mem_pci = 0x00000000; + non_mem_pci_sz = SZ_256M; non_mem.name = "PCIv3 non-prefetched mem"; - non_mem.start = PHYS_PCI_MEM_BASE + PCI_BUS_NONMEM_START; - non_mem.end = PHYS_PCI_MEM_BASE + PCI_BUS_NONMEM_START + - PCI_BUS_NONMEM_SIZE - 1; + non_mem.start = PHYS_PCI_MEM_BASE; + non_mem.end = PHYS_PCI_MEM_BASE + SZ_256M - 1; non_mem.flags = IORESOURCE_MEM; + pre_mem_pci = 0x10000000; + pre_mem_pci_sz = SZ_256M; pre_mem.name = "PCIv3 prefetched mem"; - pre_mem.start = PHYS_PCI_MEM_BASE + PCI_BUS_PREMEM_START; - pre_mem.end = PHYS_PCI_MEM_BASE + PCI_BUS_PREMEM_START + - PCI_BUS_PREMEM_SIZE - 1; + pre_mem.start = PHYS_PCI_PRE_BASE + SZ_256M; + pre_mem.end = PHYS_PCI_PRE_BASE + SZ_256M - 1; pre_mem.flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; pci_v3.map_irq = pci_v3_map_irq;