[U-Boot] [PATCH 2/2] Tegra: MMC: Add DT support to MMC driverforall T20 boards

Marc Dietrich
2013-02-05T20:06:02Z

On Tuesday 05 February 2013 08:31:03 Tom Warren wrote:
> Marc,
>
> On Tue, Feb 5, 2013 at 2:28 AM, Marc Dietrich <marvin24@gmx.de> wrote:
> >>
> >> [...]
> >>
> >> diff --git a/board/compal/paz00/paz00.c b/board/compal/paz00/paz00.c
> >> index 1447f47..5cee91a 100644
> >> --- 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("board_mmc_init called\n");
> >> + debug("%s called\n", __func__);
> >>
> >> /* Enable muxes, etc. for SDMMC controllers */
> >> pin_mux_mmc();
> >>
> >> - debug("board_mmc_init: init eMMC\n");
> >> - /* init dev 0, eMMC chip, with 8-bit bus */
> >> - tegra_mmc_init(0, 8, -1, -1);
> >> + debug("%s: init eMMC\n", __func__);
> >> + /* init dev 0, eMMC chip */
> >> + tegra_mmc_init(0);
> >
> > This looks wrong because the sd is on sdmmc0
> >
> >> - debug("board_mmc_init: init SD slot\n");
> >> - /* init dev 3, SD slot, with 4-bit bus */
> >> - tegra_mmc_init(3, 4, GPIO_PV1, GPIO_PV5);
> >> + debug("%s: init SD slot\n", __func__);
> >> + /* init dev 3, SD slot */
> >> + tegra_mmc_init(3);
> >
> > and the emmc on sdmmc3. The DTS is correct.
> >
> > Not your fault as it seems to be wrong in the original code already.
> > I guess it didn't made large difference but may in the future. I wonder
> > how to test this though.
> >
> > Marc
>
> OK, so just the comments are wrong in paz00.c - I can fix that if I
> have to do a V2 patchset, or when I apply the patches to u-boot-tegra.

ah no, this is weird!

index 3 maps to sdmmc1
index 2 maps to sdmmc2
index 1 maps to sdmmc3
index 0 maps to sdmmc4

so all is fine, nearly ...

> As to testing, just stop at the command prompt and select each device
> (mmc dev 0, etc.) and run mmcinfo. You should be able to tell from the
> data displayed whether you are on an SD-card or eMMC chip. You can
> also eject the SD-card and you should get a warning about card
> presence due to the CD GPIO.

the sd card is not detected because:

TEGRA20
Board: Compal Paz00
DRAM: 512 MiB
MMC: tegra_get_setup: dev_index = 0
tegra_get_setup: count of nodes is 2
tegra_get_setup: found controller at c8000600, width = 8, periph_id = 15
tegra_mmc_init: index 0, bus width 8 pwr_gpio -1 cd_gpio -1
tegra_mmc_init: bus width = 8
tegra_get_setup: dev_index = 3
tegra_get_setup: count of nodes is 2
tegra_get_setup: device index 3 exceeds node count (2)!

If I understand correctly, you are counting the aliases only, not the
controllers..., so index 3 (the sdcard) is not initialized at all. Arrr,
debugging stole all of my time, but I guess this needs fixing.

Marc