[PATCH 1/1] [u-boot][master][PATCH v5] pico-imx7d: add baseboard SD card boot detect

Fabio Estevam festevam at gmail.com
Sat Oct 7 14:37:09 CEST 2023


On Fri, Oct 6, 2023 at 6:37 PM <egyszeregy at freemail.hu> wrote:
>
> From: Benjamin Szőke <egyszeregy at freemail.hu>
>
> Take over codes from Techenxion to support

Typo in Technexion.

> mmc autodetect boot for pico-imx7d.

Please explain better in the commit log that you are adding support
for the SD card in variants like the nymph baseboard.

>  int board_mmc_getcd(struct mmc *mmc)
>  {
> -       /* Assume uSDHC3 emmc is always present */
> -       return 1;
> +       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
> +       int ret = 0;
> +
> +       switch (cfg->esdhc_base) {
> +       case USDHC1_BASE_ADDR:
> +               ret = !gpio_get_value(USDHC1_CD_GPIO); /* Assume uSDHC1 sd is always present */

Remove the comment as this is no longer true. You are reading a GPIO
to decide that.

> +               break;
> +       case USDHC3_BASE_ADDR:
> +               ret = !gpio_get_value(USDHC3_CD_GPIO); /* Assume uSDHC3 emmc is always present */

Remove the comment as this is no longer true. You are reading a GPIO
to decide that.

>  int board_mmc_init(struct bd_info *bis)
>  {
> -       imx_iomux_v3_setup_multiple_pads(usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
> -       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
> -       return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
> +       int ret;
> +       u32 index = 0;

No need to initialize 'index' with 0.

I tested it here on an imx7d-pico-pi. Prior to your patch, I got:

U-Boot 2023.10-00559-g931b7c36604b (Oct 07 2023 - 09:17:25 -0300)

CPU:   Freescale i.MX7D rev1.2 1000 MHz (running at 792 MHz)
CPU:   Commercial temperature grade (0C to 95C) at 55C
Reset cause: POR
Model: TechNexion PICO-IMX7D Board and PI baseboard
Board: i.MX7D PICOSOM
DRAM:  512 MiB
Core:  75 devices, 16 uclasses, devicetree: separate
PMIC: PFUZE3000 DEV_ID=0x30 REV_ID=0x11
MMC:   FSL_SDHC: 3, FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... OK
In:    serial at 30a70000
Out:   serial
Err:   serial
Net:   eth0: ethernet at 30be0000
Hit any key to stop autoboot:  0

After your patch:

U-Boot 2023.10-00560-g9bf37c401a1d-dirty (Oct 07 2023 - 09:23:54 -0300)

CPU:   Freescale i.MX7D rev1.2 1000 MHz (running at 792 MHz)
CPU:   Commercial temperature grade (0C to 95C) at 54C
Reset cause: POR
Model: TechNexion PICO-IMX7D Board and PI baseboard
Board: i.MX7D PICOSOM
DRAM:  512 MiB
Core:  72 devices, 16 uclasses, devicetree: separate
PMIC: PFUZE3000 DEV_ID=0x30 REV_ID=0x11
MMC:   FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... OK
In:    serial at 30a70000
Out:   serial
Err:   serial
MMC Device 2 not found
no mmc device at slot 2
Net:   eth0: ethernet at 30be0000

The messages:

MMC Device 2 not found
no mmc device at slot 2

are a bit annoying as there is no SD card in the imx7d-pico-pi.

I would prefer if these messages were not shown.

Can you try to get rid of it on the  imx7d-pico-pi?

Tested-by: Fabio Estevam <festevam at gmail.com>


More information about the U-Boot mailing list