public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] Tegra30: MMC: Add SD bus power-rail and SDMMC pad init routines
Date: Tue, 26 Feb 2013 16:26:11 -0700	[thread overview]
Message-ID: <512D4493.6060502@wwwdotorg.org> (raw)
In-Reply-To: <1361911596-16518-4-git-send-email-twarren@nvidia.com>

On 02/26/2013 01:46 PM, Tom Warren wrote:
> T30 requires specific SDMMC pad programming, and bus power-rail bringup.

> diff --git a/board/nvidia/cardhu/cardhu.c b/board/nvidia/cardhu/cardhu.c

> +/*
> + * Do I2C/PMU writes to bring up SD card bus power
> + *
> + */
> +void board_sdmmc_voltage_init(void)

We really shouldn't be adding to board files if we're remotely serious
about device tree; the whole point of DT is to remove code from the
board files, and describe the desired configuration as data in DT instead.

This function should be replaced by regulator nodes/properties in the
device tree, and the MMC (core?) driver calling into the board-specific
regulator driver to request the desired voltages.

But so long as we file a bug to replace this code with an explicit
regulator driver in the future, I guess it's fine for now.

> +{
> +	uchar reg, data_buffer[1];
> +	int i;
> +
> +	i2c_set_bus_num(0);	/* PMU is on bus 0 */
> +
> +	data_buffer[0] = 0x65;
> +	reg = 0x32;

We should at least comment what those register numbers and values mean.

BTW, I just noticed that commit f01b631 "Tegra30: Add/enable Cardhu
build (T30 reference board)" adds a file called
board/nvidia/cardhu/cardhu.c.mmc. That's a mistake, right?

> diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c

Hmm. This seems like SoC code, not board code...

> +void pad_init_mmc(struct tegra_mmc *reg)
> +{
> +#if defined(CONFIG_TEGRA30)

> +	/* Set the pad drive strength for SDMMC1 or 3 only */
> +	if (offset != TEGRA_SDMMC1_BASE && offset != TEGRA_SDMMC3_BASE) {
> +		debug("%s: settings are only valid for SDMMC1/SDMMC3!\n",
> +			__func__);
> +		return;
> +	}

Perhaps pass in the MMC instance ID instead of the base address. That'd
avoid having to know the base addresses in this code.

In fact, just putting this code into the pinmux driver (which owns these
registers) seems like a better idea; there's no need to only do this
when the SD controller is enabled, is there?

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

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-26 20:46 [U-Boot] [PATCH 0/5] Tegra30: MMC: Add DT-based MMC driver for Tegra30/Cardhu Tom Warren
2013-02-26 20:46 ` [U-Boot] [PATCH 1/5] Tegra30: fdt: Add SDMMC (sdhci) nodes for T30 boards (Cardhu for now) Tom Warren
2013-02-26 23:10   ` Stephen Warren
2013-02-27 16:20     ` Tom Warren
2013-02-27 18:02       ` Stephen Warren
2013-02-26 20:46 ` [U-Boot] [PATCH 2/5] Tegra: MMC: Added/update SDMMC registers/base addresses for T20/T30 Tom Warren
2013-02-26 23:15   ` Stephen Warren
2013-02-26 20:46 ` [U-Boot] [PATCH 3/5] Tegra30: MMC: Add SD bus power-rail and SDMMC pad init routines Tom Warren
2013-02-26 23:26   ` Stephen Warren [this message]
2013-02-27 16:59     ` Tom Warren
2013-02-27 18:08       ` Stephen Warren
2013-03-04 23:11         ` Tom Warren
2013-03-05  0:28           ` Stephen Warren
2013-03-05 15:28             ` Tom Warren
2013-03-05 17:03               ` Stephen Warren
2013-03-05 17:21                 ` Tom Warren
2013-03-05 17:48                   ` Stephen Warren
2013-02-26 20:46 ` [U-Boot] [PATCH 4/5] mmc: Tegra: Add SD bus power/voltage function and MMC pad init call Tom Warren
2013-02-26 20:46 ` [U-Boot] [PATCH 5/5] Tegra30: MMC: Enable DT MMC driver support for Tegra30 Cardhu boards Tom Warren
2013-02-26 23:02 ` [U-Boot] [PATCH 0/5] Tegra30: MMC: Add DT-based MMC driver for Tegra30/Cardhu Stephen 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=512D4493.6060502@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox