All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] Tegra: MMC: Add DT support to MMC driver for all T20 boards
Date: Tue, 05 Feb 2013 16:51:52 -0700	[thread overview]
Message-ID: <51119B18.5090807@wwwdotorg.org> (raw)
In-Reply-To: <CA+m5__KOLCOKs=5A50FyfPw5Cg4wXrHHeQDx0OMtGCaLzSOCFA@mail.gmail.com>

On 02/05/2013 02:02 PM, Tom Warren wrote:
> Stephen,
> 
> On Tue, Feb 5, 2013 at 1:03 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 02/04/2013 04:48 PM, Tom Warren wrote:
>>> tegra_mmc_init() now uses DT info for bus width, WP/CD GPIOs, etc.
>>> Tested on Seaboard, fully functional.
>>
>>> diff --git a/board/compal/paz00/paz00.c b/board/compal/paz00/paz00.c
...
>>> @@ -55,18 +55,18 @@ static void pin_mux_mmc(void)
>>>  /* this is a weak define that we are overriding */
>>>  int board_mmc_init(bd_t *bd)
...
>>> +     debug("%s: init eMMC\n", __func__);
>>> +     /* init dev 0, eMMC chip */
>>> +     tegra_mmc_init(0);
...
>>> +     debug("%s: init SD slot\n", __func__);
>>> +     /* init dev 3, SD slot */
>>> +     tegra_mmc_init(3);
>>
>> That doesn't look right. The board code still has knowledge of which
>> SDHCI controllers are in use by the board. Instead, the board should
>> just call tegra_mmc_init() with no parameters at all, and the MMC driver
>> should scan the device tree for all present-and-enabled SDHCI nodes, and
>> instantiate a U-Boot SDHCI device. Without this, the device tree isn't
>> in control of the whole process, so there's little point doing the
>> conversion; a new board couldn't be supported /just/ by creating a new
>> device tree file.
...
>>>  static void tegra_get_setup(struct mmc_host *host, int dev_index)
...
>>> +     int count, node = 0;
>>> +     int node_list[MAX_HOSTS];
>>> +
>>> +     count = fdtdec_find_aliases_for_id(gd->fdt_blob, "sdmmc",
>>> +             COMPAT_NVIDIA_TEGRA20_SDMMC, node_list, MAX_HOSTS);
>>> +     debug("%s: count of nodes is %d\n", __func__, count);
>>> +
>>> +     if (count < dev_index) {
>>> +             printf("%s: device index %d exceeds node count (%d)!\n",
>>> +                     __func__, dev_index, count);
>>> +             return;
>>> +     }
>>
>> This requires that an alias exist in order for the SDHCI node to be
>> found/processed. This isn't correct; the SDHCI nodes must be enumerated
>> themselves, and then the aliases (if any are present) provide a naming
>> hint for them, but even without aliases, the SDHCI nodes must be processed.
>
> Again, I used Allen's SLINK driver for as a template here. In fact, it
> looks like our I2C and SPI/SLINK drivers do this, as well as the
> Exynos SPI and S3C24x0 I2C driver all do this.  Can you point out a
> U-Boot driver that does it the right way (preferably with more than 1
> node, like MMC)? I can take a look at that code to use as an example
> of what you're proposing above.

Tegra's I2C driver has just a single i2c_init_board() function, which
calls fdtdec_find_aliases_for_id() to find all the DT nodes for a given
compatible value (and associated aliases if there are any, I believe),
then calls process_nodes() to loop over them all, and
initialize/register them.

  reply	other threads:[~2013-02-05 23:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 23:48 [U-Boot] [PATCH 0/2] Tegra: MMC: Add DT support for MMC to T20 boards Tom Warren
2013-02-04 23:48 ` [U-Boot] [PATCH 1/2] Tegra: fdt: Add/enhance sdhci (mmc) nodes for all T20 DT files Tom Warren
2013-02-05 19:54   ` Stephen Warren
2013-02-05 20:29     ` Tom Warren
2013-02-05 20:49       ` Stephen Warren
2013-02-06  4:56         ` Simon Glass
2013-02-11 19:48           ` Scott Wood
2013-02-04 23:48 ` [U-Boot] [PATCH 2/2] Tegra: MMC: Add DT support to MMC driver for all T20 boards Tom Warren
2013-02-05  9:28   ` [U-Boot] [PATCH 2/2] Tegra: MMC: Add DT support to MMC driver forall " Marc Dietrich
2013-02-05 15:31     ` Tom Warren
2013-02-05 20:06       ` [U-Boot] [PATCH 2/2] Tegra: MMC: Add DT support to MMC driverforall " Marc Dietrich
2013-02-05 20:41         ` Tom Warren
2013-02-05 20:51           ` Stephen Warren
2013-02-05 20:54           ` [U-Boot] [PATCH 2/2] Tegra: MMC: Add DT support to MMCdriverforall " Marc Dietrich
2013-02-05 21:26             ` Tom Warren
2013-02-05 20:03   ` [U-Boot] [PATCH 2/2] Tegra: MMC: Add DT support to MMC driver for all " Stephen Warren
2013-02-05 21:02     ` Tom Warren
2013-02-05 23:51       ` Stephen Warren [this message]
2013-02-12 18:07       ` Simon Glass
2013-02-12 19:05         ` Tom Warren
2013-02-12 19:08           ` Simon Glass
2013-02-12 20:13         ` Stephen Warren
2013-02-12 22:34           ` Simon Glass
2013-02-12 18:05     ` Simon Glass
2013-02-05  0:02 ` [U-Boot] [PATCH 0/2] Tegra: MMC: Add DT support for MMC to " Tom Warren
2013-02-05 10:21 ` Thierry Reding
2013-02-05 15:31   ` Tom Warren

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=51119B18.5090807@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.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 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.