
Lucas,
On Mon, Feb 11, 2013 at 10:59 AM, Tom Warren twarren.nvidia@gmail.com wrote:
Lucas,
On Mon, Feb 11, 2013 at 10:33 AM, Lucas Stach dev@lynxeye.de wrote:
Am Montag, den 11.02.2013, 10:17 -0700 schrieb Tom Warren:
tegra_mmc_init() now parses the DT info for bus width, WP/CD GPIOs, etc. Tested on Seaboard, fully functional.
Tamonten boards (medcom-wide, plutux, and tec) use a different/new dtsi file w/common settings.
Signed-off-by: Tom Warren twarren@nvidia.com
v2:
- all boards now call tegra_mmc_init once, w/no params
- count MMC controllers, not aliases
- AD boards (medcom/plutux/tec) use common tegra20-tamonten.dtsi
arch/arm/include/asm/arch-tegra/mmc.h | 2 +- arch/arm/include/asm/arch-tegra/tegra_mmc.h | 13 +- board/avionic-design/common/tamonten.c | 4 +- board/compal/paz00/paz00.c | 11 +- board/compulab/trimslice/trimslice.c | 9 +- board/nvidia/harmony/harmony.c | 11 +- board/nvidia/seaboard/seaboard.c | 11 +- board/nvidia/whistler/whistler.c | 7 +- board/toradex/colibri_t20_iris/colibri_t20_iris.c | 2 +- drivers/mmc/tegra_mmc.c | 259 +++++++++++++-------- include/configs/medcom-wide.h | 2 + include/configs/plutux.h | 2 + include/configs/tec.h | 2 + include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 15 files changed, 197 insertions(+), 140 deletions(-)
[...]
diff --git a/board/nvidia/harmony/harmony.c b/board/nvidia/harmony/harmony.c index 93430ed..fba06c2 100644 --- a/board/nvidia/harmony/harmony.c +++ b/board/nvidia/harmony/harmony.c @@ -58,18 +58,13 @@ static void pin_mux_mmc(void) /* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd) {
debug("board_mmc_init called\n");
debug("%s called\n", __func__); /* Enable muxes, etc. for SDMMC controllers */ pin_mux_mmc();
debug("board_mmc_init: init SD slot J26\n");
/* init dev 0, SD slot J26, with 8-bit bus */
tegra_mmc_init(0, 8, GPIO_PI6, GPIO_PH2);
debug("board_mmc_init: init SD slot J5\n");
/* init dev 2, SD slot J5, with 4-bit bus */
tegra_mmc_init(2, 4, GPIO_PT3, GPIO_PI5);
debug("%s: init MMC devs\n", __func__);
tegra_mmc_init();
tegra_mmc_init should not be called from every individual board file, but from the common nvidia tegra board file. Only the pinmux should stay in the individual board code, same thing as was done to all the other functions like NAND and USB.
True. I was originally just adapting the current config-file driven MMC to DT step-by-step, but you're right - it should be called just once for all boards in the common board file. I'll change it in V3.
I've looked into this some more, and it appears that I can't just add a call to tegra_mmc_init() from board_init() in boards/nvidia/common/board.c.
board_init() is where the other periphs do their pin_mux and xxx_init() calls (USB, SPI, etc.). board_init() is called early in board_init_r(), before mmc_initialize() is called. mmc_initialize() is needed before tegra_mmc_init() can use the mmc_device struct, etc. So tegra_mmc_init() needs to be called after mmc_initialize(), and right now that's in each board's board_mmc_init(). In board_mmc_init(), each board sets up any power rails needed for SD-card or eMMC access, sets up it's pin muxes for MMC, and then calls tegra_mmc_init() to parse the DT file and populate the mmc structs.
I could move the pin_mux_mmc() function calls from each board file into nvidia/common/board.c's board_init(), but it wouldn't really change much. So I'll leave it as it is for now, with pin_mux_mmc() and tegra_mmc_init() being called from each board's 'board' file (seaboard.c, colibri_t20_iris.c, etc).
Let me know if you see another way to move Tegra MMC init to a common board file that doesn't break the MMC driver flow.
Thanks,
Tom
Thanks,
Tom
return 0;
}
[...]
Regards, Lucas