linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Andrew Lunn <andrew@lunn.ch>, Jason Cooper <jason@lakedaemon.net>,
	Gregory Clement <gregory.clement@bootlin.com>,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: mvebu: how to determine the address of the internal register window
Date: Tue, 11 Dec 2018 10:37:06 +0100	[thread overview]
Message-ID: <20181211103657.79713087@windsurf> (raw)
In-Reply-To: <f54e8ca9-0ca5-ce03-aaf8-e837f68b3024@kleine-koenig.org>

Hello Uwe,

On Mon, 10 Dec 2018 18:09:38 +0100, Uwe Kleine-König wrote:

> using barebox on an mvebu machine the internal register window is moved
> from 0xd0000000 to 0xf1000000. Compared to U-Boot the PCI Express BAR0
> Internal Registers (on Armada 370: 0x40010 and 0x80010, on Armada XP a
> few more) are not fixed which makes accessing pci devices fail. Instead
> of letting barebox fix this up I'd like to make Linux ensure the
> register is configured correctly.
> 
> I think the right place for that is mvebu_pcie_setup_wins which needs to do
> 
> 	mvebu_writel(port, intregoffset, PCIE_BAR_LO_OFF(0));
> 
> I wonder however how I should determine the actual value to write here.
> I didn't find a function that exports the offset of the internal
> register window. Do you have a hint for me?

The base address of the internal registers is available in the Device
Tree:

        soc {
                ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000

See the 0xf1000000 here? That's the base address of the internal registers.

See also Documentation/devicetree/bindings/bus/mvebu-mbus.txt for more
details about this binding.

Alternatively, since the internal register window is always 1 MB large,
from the pci-mvebu driver, you can take the base address of any PCI
controller, do & ~0xFFFFF, and you get the base address of the internal
register window.

Does this helps?

Best regards

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2018-12-11  9:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 17:09 mvebu: how to determine the address of the internal register window Uwe Kleine-König
2018-12-11  9:37 ` Thomas Petazzoni [this message]

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=20181211103657.79713087@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=gregory.clement@bootlin.com \
    --cc=jason@lakedaemon.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).