public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Chris Ball <chris@printf.net>,
	linux-mmc@vger.kernel.org, Jason Cooper <jason@lakedaemon.net>,
	Andrew Lunn <andrew@lunn.ch>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	Lior Amsalem <alior@marvell.com>,
	Tawfik Bayouk <tawfik@marvell.com>,
	Marcin Wojtas <mw@semihalf.com>
Subject: Re: [PATCH] mmc: sdhci-pxav3: add support for the Armada 38x SDHCI controller
Date: Tue, 18 Feb 2014 19:02:47 +0100	[thread overview]
Message-ID: <2905238.0nD7CECiVl@wuerfel> (raw)
In-Reply-To: <1392736109-3981-1-git-send-email-thomas.petazzoni@free-electrons.com>

On Tuesday 18 February 2014 16:08:29 Thomas Petazzoni wrote:
> From: Marcin Wojtas <mw@semihalf.com>
> 
> The SDHCI unit used on the Armada 380 and 385 Marvell SoC is similar
> to the PXAv3 unit. The only difference is that on Armada 38x, the
> PXAv3 unit accesses memory through MBus windows which must be
> configured prior to using the device. Without this, DMA would not
> work.
> 
> In order to achieve this, the sdhci-pxav3 driver is extended with an
> additional compatible string "marvell,armada-380-sdhci". When this
> compatible string is used, the MBus windows are initialized in a way
> that is identical to what all other DMA-capable drivers for Marvell
> EBU platforms do.

It seems odd to do this in the sdhci driver, when the configuration
is done in registers that belong to mbus.

> +/*
> + * These registers are relative to the second register region, for the
> + * MBus bridge.
> + */
> +#define SDHCI_WINDOW_CTRL(i)   (0x80 + ((i) << 3))
> +#define SDHCI_WINDOW_BASE(i)   (0x84 + ((i) << 3))
> +#define SDHCI_MAX_WIN_NUM      8

These look similar to the outbound mbus windows that are used for MMIO,
but it's not really clear from the code what they really do.

> +       for (i = 0; i < SDHCI_MAX_WIN_NUM; i++) {
> +               writel(0, regs + SDHCI_WINDOW_CTRL(i));
> +               writel(0, regs + SDHCI_WINDOW_BASE(i));
> +       }
> +
> +       for (i = 0; i < dram->num_cs; i++) {
> +               const struct mbus_dram_window *cs = dram->cs + i;
> +
> +               /* Write size, attributes and target id to control register
> */ +               writel(((cs->size - 1) & 0xffff0000) |
> +                       (cs->mbus_attr << 8) |
> +                       (dram->mbus_dram_target_id << 4) | 1,
> +                       regs + SDHCI_WINDOW_CTRL(i));
> +               /* Write base address to base register */
> +               writel(cs->base, regs + SDHCI_WINDOW_BASE(i));
> +       }

Accessing the mbus_dram_window() is also something that seems to fit
better into the mbus driver.

I assume there are more the same register ranges for each bus master
behind mbus (PCI being special again). How about adding an exported
function to the mbus driver that sets up all the windows for one
bus master correctly, passing only the number of the bus master?

	Arnd

  reply	other threads:[~2014-02-18 18:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18 15:08 [PATCH] mmc: sdhci-pxav3: add support for the Armada 38x SDHCI controller Thomas Petazzoni
2014-02-18 18:02 ` Arnd Bergmann [this message]
2014-02-18 19:26   ` Thomas Petazzoni
2014-02-18 19:43     ` Arnd Bergmann
2014-02-18 19:57       ` Thomas Petazzoni
2014-02-25 18:40 ` Thomas Petazzoni
2014-03-20 20:13   ` Thomas Petazzoni
2014-03-29 15:14 ` Thomas Petazzoni
2014-03-29 16:19   ` Chris Ball
2014-03-29 16:48     ` 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=2905238.0nD7CECiVl@wuerfel \
    --to=arnd@arndb.de \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=chris@printf.net \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mw@semihalf.com \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=tawfik@marvell.com \
    --cc=thomas.petazzoni@free-electrons.com \
    /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