[U-Boot] [PATCH 2/3] wandboard: Add support for carrier board MicroSD card

Fabio Estevam festevam at gmail.com
Mon Apr 15 15:54:32 CEST 2013


On Mon, Apr 15, 2013 at 10:35 AM, Otavio Salvador
<otavio at ossystems.com.br> wrote:

>  int board_mmc_init(bd_t *bis)
>  {
> -       imx_iomux_v3_setup_multiple_pads(usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
> -
> -       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
> -       usdhc_cfg[0].max_bus_width = 4;
> -       gpio_direction_input(USDHC3_CD_GPIO);
> +       int i;
> +
> +       /*
> +        * According to the board_mmc_init() the following map is done:
> +        * (U-boot device node)    (Physical Port)
> +        * mmc0                    SOM MicroSD
> +        * mmc1                    Carrier board MicroSD
> +        */
> +       for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
> +               switch (i) {
> +               case 0:
> +                       imx_iomux_v3_setup_multiple_pads(
> +                               usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
> +                       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
> +                       usdhc_cfg[0].max_bus_width = 4;
> +                       gpio_direction_input(USDHC3_CD_GPIO);
> +                       break;
> +               case 1:
> +                       imx_iomux_v3_setup_multiple_pads(
> +                               usdhc1_pads, ARRAY_SIZE(usdhc1_pads));
> +                       usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
> +                       usdhc_cfg[1].max_bus_width = 4;
> +                       gpio_direction_input(USDHC1_CD_GPIO);
> +                       break;
> +               default:
> +                       printf("Warning: you configured more USDHC controllers"
> +                                  "(%d) than supported by the board\n", i + 1);
> +                       return 0;

This should be an error. What about return -EINVAL ?

> +               }
> +
> +               if (fsl_esdhc_initialize(bis, &usdhc_cfg[i]))
> +                       printf("Warning: failed to initialize mmc dev %d\n", i);
> +       }
>
> -       return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
> +       return 0;

With this change, you never return an error.


More information about the U-Boot mailing list