[U-Boot] [PATCH 5/5] arm: imx: Add Engicam i.CoreM6 QDL Starter Kit initial support
Fabio Estevam
festevam at gmail.com
Wed Sep 14 00:34:24 CEST 2016
On Tue, Sep 13, 2016 at 11:24 AM, Jagan Teki <jagannadh.teki at gmail.com> wrote:
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
> + PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
> + PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
> +
> +#define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
> + PAD_CTL_PUS_22K_UP | PAD_CTL_SPEED_LOW | \
> + PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
> +
> +iomux_v3_cfg_t const usdhc1_pads[] = {
static
> + IOMUX_PADS(PAD_SD1_CLK__SD1_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
> + IOMUX_PADS(PAD_SD1_CMD__SD1_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
> + IOMUX_PADS(PAD_SD1_DAT0__SD1_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
> + IOMUX_PADS(PAD_SD1_DAT1__SD1_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
> + IOMUX_PADS(PAD_SD1_DAT2__SD1_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
> + IOMUX_PADS(PAD_SD1_DAT3__SD1_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
> + IOMUX_PADS(PAD_GPIO_1__GPIO1_IO01 | MUX_PAD_CTRL(NO_PAD_CTRL)),/* CD */
> +};
> +
> +#ifdef CONFIG_FSL_ESDHC
> +#define USDHC1_CD_GPIO IMX_GPIO_NR(1, 1)
> +#define USDHC3_CD_GPIO IMX_GPIO_NR(6, 15)
> +
> +struct fsl_esdhc_cfg usdhc_cfg[2] = {
static
> +int board_mmc_init(bd_t *bis)
> +{
> + int i;
> +
> + /*
> + * According to the board_mmc_init() the following map is done:
> + * (U-boot device node) (Physical Port)
> + * mmc0 USDHC1
> + * mmc1 USDHC3
Here you say both mmc are used.
> + */
> + for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
> + switch (i) {
> + case 0:
> + SETUP_IOMUX_PADS(usdhc1_pads);
> + gpio_direction_input(USDHC1_CD_GPIO);
> + usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
> + break;
,but here only USDHC1 is initialized.
If only USDHC1 is initialized you can skip the for loop.
> + default:
> + printf("Warning: you configured more USDHC controllers"
> + "(%d) than supported by the board\n", i + 1);
> + return 0;
> + }
> +
> + if (fsl_esdhc_initialize(bis, &usdhc_cfg[i]))
> + printf("Warning: failed to initialize mmc dev %d\n", i);
If fsl_esdhc_initialize() fails you are returning 0, whic is wrong.
You want this probably:
ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
if (ret)
return ret;
Or if only USDHC1 is used you can do:
ret = fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
if (ret)
return ret;
> + }
> +
> + return 0;
> +}
> +#endif
> +
> +iomux_v3_cfg_t const uart4_pads[] = {
static
> +int dram_init(void)
> +{
> + gd->ram_size = get_ram_size((long *)PHYS_SDRAM, MAX_SDRAM_SIZE);
You should use imx_ddr_size() here.
More information about the U-Boot
mailing list