From patchwork Wed Jan 30 15:46:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 2068571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 72BACDF264 for ; Wed, 30 Jan 2013 15:49:32 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U0Zrq-0006HM-5z; Wed, 30 Jan 2013 15:46:30 +0000 Received: from [2002:4e20:1eda::1] (helo=caramon.arm.linux.org.uk) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U0Zrl-0006GY-KJ for linux-arm-kernel@lists.infradead.org; Wed, 30 Jan 2013 15:46:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=BDX29xhIggJpi9A49ofxfR76ipIp2Qmeb4cdYAhNEtM=; b=B8YU4kCSR7HCj0ZVg2w+/5YuF4+a3W5AWaF6/urzSyO38PD/lwQa+Q7JdV+B2O2aLPUSHNdr/ztKmkVpeyOr8fJTXMVL45g8zKhzuJ1kRAm6ciQrDN2Wu1LRAazM6qiA0j6ErBlUNEmxjpFQ4RZ4zTt66th9dhj469WcQ+5qXZ8=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:38694) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1U0ZrQ-0001XC-HA; Wed, 30 Jan 2013 15:46:04 +0000 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1U0ZrP-0007f2-3y; Wed, 30 Jan 2013 15:46:03 +0000 Date: Wed, 30 Jan 2013 15:46:02 +0000 From: Russell King - ARM Linux To: Thomas Petazzoni Subject: Re: [PATCH v2 19/27] pci: PCIe driver for Marvell Armada 370/XP systems Message-ID: <20130130154602.GL23505@n2100.arm.linux.org.uk> References: <1359399397-29729-1-git-send-email-thomas.petazzoni@free-electrons.com> <1359399397-29729-20-git-send-email-thomas.petazzoni@free-electrons.com> <20130130113245.GH23505@n2100.arm.linux.org.uk> <20130130120344.GA29490@avionic-0098.mockup.avionic-design.de> <20130130150856.GJ23505@n2100.arm.linux.org.uk> <20130130151934.GK23505@n2100.arm.linux.org.uk> <20130130163659.75360dba@skate> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130130163659.75360dba@skate> User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130130_104626_135129_65E14FF4 X-CRM114-Status: GOOD ( 20.39 ) X-Spam-Score: 1.8 (+) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (1.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS Cc: Lior Amsalem , Andrew Lunn , Jason Cooper , Arnd Bergmann , Stephen Warren , linux-pci@vger.kernel.org, Thierry Reding , Eran Ben-Avi , Nadav Haklai , Maen Suleiman , Shadi Ammouri , Gregory Clement , Tawfik Bayouk , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Jason Gunthorpe X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Wed, Jan 30, 2013 at 04:36:59PM +0100, Thomas Petazzoni wrote: > Dear Russell King - ARM Linux, > > On Wed, 30 Jan 2013 15:19:34 +0000, Russell King - ARM Linux wrote: > > diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h > > index db9fedb..bba0cf3 100644 > > --- a/arch/arm/include/asm/mach/pci.h > > +++ b/arch/arm/include/asm/mach/pci.h > > @@ -29,6 +29,7 @@ struct hw_pci { > > void (*postinit)(void); > > u8 (*swizzle)(struct pci_dev *dev, u8 *pin); > > int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); > > + resource_size_t (*window_align)(struct pci_bus *, unsigned long); > > }; > > Didn't you say just yesterday that you would prefer a numerical value > rather than a hook that could do random things? :-) Hrh, right. :) And it also helps if I modify the right struct too! Try this instead. Overwrite sys->win_align_mem / sys->win_align_io in the setup function as required. arch/arm/include/asm/mach/pci.h | 2 ++ arch/arm/kernel/bios32.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h index db9fedb..a2301ae 100644 --- a/arch/arm/include/asm/mach/pci.h +++ b/arch/arm/include/asm/mach/pci.h @@ -42,6 +42,8 @@ struct pci_sys_data { int busnr; /* primary bus number */ u64 mem_offset; /* bus->cpu memory mapping offset */ unsigned long io_offset; /* bus->cpu IO mapping offset */ + resource_size_t win_align_mem; + resource_size_t win_align_io; struct pci_bus *bus; /* PCI bus */ struct list_head resources; /* root bus resources (apertures) */ struct resource io_res; diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 379cf32..ba81630 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -463,6 +463,8 @@ static void __init pcibios_init_hw(struct hw_pci *hw, struct list_head *head) sys->swizzle = hw->swizzle; sys->map_irq = hw->map_irq; INIT_LIST_HEAD(&sys->resources); + sys->win_align_mem = 1; + sys->win_align_io = 1; ret = hw->setup(nr, sys); @@ -581,6 +583,21 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, return start; } +resource_size_t pcibios_window_alignment(struct pci_bus *bus, + unsigned long type) +{ + struct pci_sys_data *sys = bus->sysdata; + + /* Ignore downstream buses */ + if (!bus->parent) { + if (type & IORESOURCE_MEM) + return sys->win_align_mem; + if (type & IORESOURCE_IO) + return sys->win_align_io; + } + return 1; +} + /** * pcibios_enable_device - Enable I/O and memory. * @dev: PCI device to be enabled