From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: NSA310 + DT
Date: Tue, 30 Jul 2013 20:36:10 +0200 [thread overview]
Message-ID: <20130730183610.GT24782@lunn.ch> (raw)
In-Reply-To: <20130730191943.49f8070c@skate>
On Tue, Jul 30, 2013 at 07:19:43PM +0200, Thomas Petazzoni wrote:
> Dear Finn Hoffmann,
>
> BTW, any reason why this discussion is not taking place on LAKML ?
Ah, sorry, did not look at the CC: list. Now one list...
Andrew
>
> On Tue, 30 Jul 2013 18:37:13 +0200, Finn Hoffmann wrote:
>
> > $ lspci -v
> > 00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 7846 (prog-if
> > 00 [Normal decode])
> > Flags: bus master, fast devsel, latency 0
> > Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
> > I/O behind bridge: 00010000-00010fff
> > Prefetchable memory behind bridge: e0000000-e00fffff
>
> Ok, so there should be one mem window from e0000000 to e0100000...
>
> > # cat /sys/kernel/debug/mvebu-mbus/devices
> > [00] 00000000e8010000 - 00000000e8020000 : pcie0.0 (remap 0000000000010000)
> > [01] disabled
> > [02] disabled
> > [03] disabled
> > [04] 00000000f4000000 - 00000000f4010000 : nand
> > [05] 00000000f5000000 - 00000000f5010000 : sram
> > [06] disabled
> > [07] disabled
>
> ... but there's none here.
>
> Seems like your device is using a prefetchable memory window, and our
> emulated PCI-to-PCI bridge isn't taking this into account.
>
> Can you test the below (completely untested) patch? Regardless of
> whether it works or not, I'm interested in seeing the "PCI MVEBU"
> debug messages that I've added, as well as the output
> of /sys/kernel/debug/mvebu-mbus/devices.
>
> Thanks a lot!
>
> Thomas
>
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index 13a633b..641dd3d 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -129,6 +129,8 @@ struct mvebu_pcie_port {
> struct mvebu_pcie *pcie;
> phys_addr_t memwin_base;
> size_t memwin_size;
> + phys_addr_t prefmemwin_base;
> + size_t prefmemwin_size;
> phys_addr_t iowin_base;
> size_t iowin_size;
> };
> @@ -348,6 +350,39 @@ static void mvebu_pcie_handle_membase_change(struct mvebu_pcie_port *port)
> MVEBU_MBUS_PCI_MEM);
> }
>
> +static void mvebu_pcie_handle_prefmembase_change(struct mvebu_pcie_port *port)
> +{
> + /* Are the new membase/memlimit values invalid? */
> + if (port->bridge.prefmemlimit < port->bridge.prefmembase) {
> +
> + /* If a window was configured, remove it */
> + if (port->prefmemwin_base) {
> + mvebu_mbus_del_window(port->prefmemwin_base,
> + port->prefmemwin_size);
> + port->prefmemwin_base = 0;
> + port->prefmemwin_size = 0;
> + }
> +
> + return;
> + }
> +
> + /*
> + * We read the PCI-to-PCI bridge emulated registers, and
> + * calculate the base address and size of the address decoding
> + * window to setup, according to the PCI-to-PCI bridge
> + * specifications.
> + */
> + port->prefmemwin_base = ((port->bridge.prefmembase & 0xFFF0) << 16);
> + port->prefmemwin_size =
> + (((port->bridge.prefmemlimit & 0xFFF0) << 16) | 0xFFFFF) -
> + port->prefmemwin_base;
> +
> + mvebu_mbus_add_window_remap_flags(port->name, port->prefmemwin_base,
> + port->prefmemwin_size,
> + MVEBU_MBUS_NO_REMAP,
> + MVEBU_MBUS_PCI_MEM);
> +}
> +
> /*
> * Initialize the configuration space of the PCI-to-PCI bridge
> * associated with the given PCIe interface.
> @@ -492,18 +527,28 @@ static int mvebu_sw_pci_bridge_write(struct mvebu_pcie_port *port,
> bridge->iobase = (value & 0xff) | PCI_IO_RANGE_TYPE_32;
> bridge->iolimit = ((value >> 8) & 0xff) | PCI_IO_RANGE_TYPE_32;
> bridge->secondary_status = value >> 16;
> + pr_info("MVEBU PCI %d.%d: new io, base 0x%x, limit 0x%x\n",
> + port->port, port->lane,
> + bridge->iobase, bridge->iolimit);
> mvebu_pcie_handle_iobase_change(port);
> break;
>
> case PCI_MEMORY_BASE:
> bridge->membase = value & 0xffff;
> bridge->memlimit = value >> 16;
> + pr_info("MVEBU PCI %d.%d: new mem, base 0x%x, limit 0x%x\n",
> + port->port, port->lane,
> + bridge->membase, bridge->memlimit);
> mvebu_pcie_handle_membase_change(port);
> break;
>
> case PCI_PREF_MEMORY_BASE:
> bridge->prefmembase = value & 0xffff;
> bridge->prefmemlimit = value >> 16;
> + pr_info("MVEBU PCI %d.%d: new pref mem, base 0x%x, limit 0x%x\n",
> + port->port, port->lane,
> + bridge->prefmembase, bridge->prefmemlimit);
> + mvebu_pcie_handle_prefmembase_change(port);
> break;
>
> case PCI_PREF_BASE_UPPER32:
>
>
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
next prev parent reply other threads:[~2013-07-30 18:36 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <51DC564A.8050002@harsszegi.com>
2013-07-09 19:36 ` NSA310 + DT Andrew Lunn
2013-07-09 20:21 ` Andrew Lunn
2013-07-10 0:53 ` tibor at harsszegi.com
2013-07-10 6:23 ` Andrew Lunn
2013-07-10 8:42 ` tibor at harsszegi.com
2013-07-10 13:41 ` Andrew Lunn
[not found] ` <51DD8E8B.2040505@harsszegi.com>
2013-07-10 16:44 ` Tibor Harsszegi
2013-07-10 16:53 ` Andrew Lunn
2013-07-10 16:57 ` Tibor Harsszegi
2013-07-10 17:13 ` Tibor Harsszegi
2013-07-10 17:15 ` Tibor Harsszegi
2013-07-10 17:23 ` Andrew Lunn
2013-07-10 17:29 ` Tibor Harsszegi
2013-07-10 1:01 ` tibor at harsszegi.com
2013-07-10 7:37 ` Andrew Lunn
2013-07-10 8:43 ` tibor at harsszegi.com
[not found] ` <51DEDB32.4080101@harsszegi.com>
2013-07-11 16:44 ` gpio_blink_set + Kirkwood Andrew Lunn
2013-07-11 18:32 ` Tibor Harsszegi
2013-07-11 18:37 ` Jason Cooper
2013-07-11 18:52 ` Tibor Harsszegi
2013-07-11 19:44 ` Jason Cooper
2013-07-29 17:05 ` NSA310 + DT Finn Hoffmann
2013-07-29 19:21 ` Jason Cooper
2013-07-29 20:43 ` Andrew Lunn
[not found] ` <51F78DA6.8010307@uni-bremen.de>
[not found] ` <20130730144752.GR24782@lunn.ch>
[not found] ` <20130730172407.3aab15c6@skate>
[not found] ` <51F7EBB9.7000504@uni-bremen.de>
[not found] ` <20130730191943.49f8070c@skate>
2013-07-30 18:36 ` Andrew Lunn [this message]
2013-07-30 19:31 ` Finn Hoffmann
2013-07-30 19:42 ` Andrew Lunn
2013-07-30 21:23 ` Thomas Petazzoni
2013-07-31 9:14 ` Thomas Petazzoni
2013-07-31 9:43 ` Finn Hoffmann
2013-07-31 9:51 ` Thomas Petazzoni
2013-07-31 11:41 ` Finn Hoffmann
2013-07-31 11:47 ` Thomas Petazzoni
2013-07-31 16:45 ` Andrew Lunn
2013-08-01 8:01 ` Finn Hoffmann
2013-08-01 16:04 ` Andrew Lunn
2013-08-01 20:43 ` Finn Hoffmann
2013-08-02 8:35 ` Finn Hoffmann
2013-08-02 8:46 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130730183610.GT24782@lunn.ch \
--to=andrew@lunn.ch \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.