[U-Boot] [PATCH 1/9] wandboard: Return error if the SDHC port index is invalid

Fabio Estevam festevam at gmail.com
Wed May 22 02:53:16 CEST 2013


Hi Wolfgang,

On Tue, May 21, 2013 at 6:24 PM, Wolfgang Denk <wd at denx.de> wrote:

> Can we _please_ remove all this code?  A _runtime_ check for a _build_
> _time_ _detectable_ situation makes no sense to me.
>
> For such a misconfiguration, the build should fail.
>
> Handling this at runtime is the wrong approach.
>
>
> This comment applies for the whole series.

For the wandboard file, would the code bellow be better?

	for (index = 0; index < CONFIG_SYS_FSL_USDHC_NUM; ++index) {
		switch (index) {
		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;
		}

		status = fsl_esdhc_initialize(bis, &usdhc_cfg[index]);
		if (status)
			return status;
	}

	return 0;	
>
>
> Actually - are you not surprised that you have to fix the same issue
> for all boards?  This is a clear indication of duplicated code that
> needs to be factored out.

I will try factor out.

Regards,

Fabio Estevam


More information about the U-Boot mailing list