From: Peter Robinson Date: Fri, 2 Apr 2021 14:52:30 +0000 (+0100) Subject: ARM: embestmx6boards: convert the mars/riot boards to DM_MMC X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=c32d240f70c207828171c4f8a55f07db7cc677d8;p=u-boot.git ARM: embestmx6boards: convert the mars/riot boards to DM_MMC Convert the two Embest boards to use DM MMC. Signed-off-by: Peter Robinson Cc: "Eric BĂ©nard" Cc: Fabio Estevam Cc: Stefano Babic --- diff --git a/arch/arm/dts/imx6dl-riotboard-u-boot.dtsi b/arch/arm/dts/imx6dl-riotboard-u-boot.dtsi new file mode 100644 index 0000000000..e51cd24d7e --- /dev/null +++ b/arch/arm/dts/imx6dl-riotboard-u-boot.dtsi @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/ { + aliases { + mmc0 = &usdhc2; + mmc1 = &usdhc3; + }; +}; diff --git a/arch/arm/dts/imx6q-marsboard-u-boot.dtsi b/arch/arm/dts/imx6q-marsboard-u-boot.dtsi new file mode 100644 index 0000000000..e51cd24d7e --- /dev/null +++ b/arch/arm/dts/imx6q-marsboard-u-boot.dtsi @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/ { + aliases { + mmc0 = &usdhc2; + mmc1 = &usdhc3; + }; +}; diff --git a/board/embest/mx6boards/mx6boards.c b/board/embest/mx6boards/mx6boards.c index 65b3942e39..c3bbcff0cf 100644 --- a/board/embest/mx6boards/mx6boards.c +++ b/board/embest/mx6boards/mx6boards.c @@ -31,8 +31,6 @@ #include #include #include -#include -#include #include #include #include @@ -150,141 +148,6 @@ int board_phy_config(struct phy_device *phydev) return 0; } -iomux_v3_cfg_t const usdhc2_pads[] = { - MX6_PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CLK_CTRL), - MX6_PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_GPIO_2__GPIO1_IO02 | MUX_PAD_CTRL(NO_PAD_CTRL), /* WP */ - MX6_PAD_GPIO_4__GPIO1_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */ -}; - -iomux_v3_cfg_t const usdhc3_pads[] = { - MX6_PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CLK_CTRL), - MX6_PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), -}; - -iomux_v3_cfg_t const riotboard_usdhc3_pads[] = { - MX6_PAD_SD3_DAT4__GPIO7_IO01 | MUX_PAD_CTRL(NO_PAD_CTRL), /* WP */ - MX6_PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */ -}; - -iomux_v3_cfg_t const usdhc4_pads[] = { - MX6_PAD_SD4_CLK__SD4_CLK | MUX_PAD_CTRL(USDHC_PAD_CLK_CTRL), - MX6_PAD_SD4_CMD__SD4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD4_DAT0__SD4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD4_DAT1__SD4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD4_DAT2__SD4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD4_DAT3__SD4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - /* eMMC RST */ - MX6_PAD_NANDF_ALE__GPIO6_IO08 | MUX_PAD_CTRL(NO_PAD_CTRL), -}; - -#ifdef CONFIG_FSL_ESDHC_IMX -struct fsl_esdhc_cfg usdhc_cfg[3] = { - {USDHC2_BASE_ADDR}, - {USDHC3_BASE_ADDR}, - {USDHC4_BASE_ADDR}, -}; - -#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4) -#define USDHC3_CD_GPIO IMX_GPIO_NR(7, 0) - -int board_mmc_getcd(struct mmc *mmc) -{ - struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; - int ret = 0; - - switch (cfg->esdhc_base) { - case USDHC2_BASE_ADDR: - ret = !gpio_get_value(USDHC2_CD_GPIO); - break; - case USDHC3_BASE_ADDR: - if (board_type == BOARD_IS_RIOTBOARD) - ret = !gpio_get_value(USDHC3_CD_GPIO); - else if (board_type == BOARD_IS_MARSBOARD) - ret = 1; /* eMMC/uSDHC3 is always present */ - break; - case USDHC4_BASE_ADDR: - ret = 1; /* eMMC/uSDHC4 is always present */ - break; - } - - return ret; -} - -int board_mmc_init(struct bd_info *bis) -{ - int ret; - int i; - - /* - * According to the board_mmc_init() the following map is done: - * (U-Boot device node) (Physical Port) - * ** RiOTboard : - * mmc0 SDCard slot (bottom) - * mmc1 uSDCard slot (top) - * mmc2 eMMC - * ** MarSBoard : - * mmc0 uSDCard slot (bottom) - * mmc1 eMMC - */ - for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) { - switch (i) { - case 0: - imx_iomux_v3_setup_multiple_pads( - usdhc2_pads, ARRAY_SIZE(usdhc2_pads)); - gpio_direction_input(USDHC2_CD_GPIO); - usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); - usdhc_cfg[0].max_bus_width = 4; - break; - case 1: - imx_iomux_v3_setup_multiple_pads( - usdhc3_pads, ARRAY_SIZE(usdhc3_pads)); - if (board_type == BOARD_IS_RIOTBOARD) { - imx_iomux_v3_setup_multiple_pads( - riotboard_usdhc3_pads, - ARRAY_SIZE(riotboard_usdhc3_pads)); - gpio_direction_input(USDHC3_CD_GPIO); - } else { - gpio_direction_output(IMX_GPIO_NR(7, 8) , 0); - udelay(250); - gpio_set_value(IMX_GPIO_NR(7, 8), 1); - } - usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); - usdhc_cfg[1].max_bus_width = 4; - break; - case 2: - imx_iomux_v3_setup_multiple_pads( - usdhc4_pads, ARRAY_SIZE(usdhc4_pads)); - usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK); - usdhc_cfg[2].max_bus_width = 4; - gpio_direction_output(IMX_GPIO_NR(6, 8) , 0); - udelay(250); - gpio_set_value(IMX_GPIO_NR(6, 8), 1); - break; - default: - printf("Warning: you configured more USDHC controllers" - "(%d) then supported by the board (%d)\n", - i + 1, CONFIG_SYS_FSL_USDHC_NUM); - return -EINVAL; - } - - ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]); - if (ret) - return ret; - } - - return 0; -} -#endif - #ifdef CONFIG_MXC_SPI iomux_v3_cfg_t const ecspi1_pads[] = { MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL), diff --git a/configs/marsboard_defconfig b/configs/marsboard_defconfig index 4d15f0432e..63fc60a884 100644 --- a/configs/marsboard_defconfig +++ b/configs/marsboard_defconfig @@ -30,6 +30,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM=y CONFIG_DM_GPIO=y CONFIG_BOUNCE_BUFFER=y +CONFIG_DM_MMC=y CONFIG_FSL_USDHC=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y diff --git a/configs/riotboard_defconfig b/configs/riotboard_defconfig index 0284f86405..4f86a08e78 100644 --- a/configs/riotboard_defconfig +++ b/configs/riotboard_defconfig @@ -42,6 +42,7 @@ CONFIG_DM=y CONFIG_DM_GPIO=y CONFIG_BOUNCE_BUFFER=y CONFIG_SUPPORT_EMMC_BOOT=y +CONFIG_DM_MMC=y CONFIG_FSL_USDHC=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y