[U-Boot] [PATCH v1 09/14] colibri-imx6ull: migrate mmc to using driver model

Igor Opaniuk igor.opaniuk at toradex.com
Wed Apr 3 09:14:10 UTC 2019


Reviewed-by: Igor Opaniuk <igor.opaniuk at toradex.com>

On Fri, Mar 29, 2019 at 1:38 PM Marcel Ziswiler <marcel at ziswiler.com> wrote:
>
> From: Marcel Ziswiler <marcel.ziswiler at toradex.com>
>
> Migrate MMC to using driver model.
> Migrate USDHC to using pinctrl.
> While at it also add GPIO1_IO03__OSC32K_32K_OUT pin muxing.
> While at it also update copyright period.
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>
>
> ---
>
>  arch/arm/dts/imx6ull-colibri.dts              | 15 +++-
>  .../toradex/colibri-imx6ull/colibri-imx6ull.c | 70 -------------------
>  configs/colibri-imx6ull_defconfig             |  1 +
>  include/configs/colibri-imx6ull.h             |  6 +-
>  4 files changed, 17 insertions(+), 75 deletions(-)
>
> diff --git a/arch/arm/dts/imx6ull-colibri.dts b/arch/arm/dts/imx6ull-colibri.dts
> index 95c67be438..0d416ebd10 100644
> --- a/arch/arm/dts/imx6ull-colibri.dts
> +++ b/arch/arm/dts/imx6ull-colibri.dts
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>  /*
> - * Copyright 2018 Toradex AG
> + * Copyright 2018-2019 Toradex AG
>   */
>
>  /dts-v1/;
> @@ -11,6 +11,10 @@
>         model = "Toradex Colibri iMX6ULL";
>         compatible = "toradex,imx6ull-colibri", "fsl,imx6ull";
>
> +       aliases {
> +               mmc0 = &usdhc1;
> +       };
> +
>         chosen {
>                 stdout-path = &uart1;
>         };
> @@ -190,10 +194,18 @@
>         dr_mode = "host";
>  };
>
> +/* Colibri MMC */
>  &usdhc1 {
>         assigned-clocks = <&clks IMX6UL_CLK_USDHC1_SEL>, <&clks IMX6UL_CLK_USDHC1>;
>         assigned-clock-parents = <&clks IMX6UL_CLK_PLL2_PFD2>;
>         assigned-clock-rates = <0>, <198000000>;
> +       cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; /* MMC_CD */
> +       pinctrl-names = "default", "state_100mhz", "state_200mhz";
> +       pinctrl-0 = <&pinctrl_usdhc1 &pinctrl_snvs_usdhc1_cd>;
> +       pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
> +       pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
> +       vmmc-supply = <&reg_sd1_vmmc>;
> +       status = "okay";
>  };
>
>  &iomuxc {
> @@ -547,4 +559,3 @@
>                 >;
>         };
>  };
> -
> diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
> index 8493b1dfdd..c9af44e30e 100644
> --- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c
> +++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
> @@ -18,11 +18,9 @@
>  #include <dm.h>
>  #include <dm/platform_data/serial_mxc.h>
>  #include <fdt_support.h>
> -#include <fsl_esdhc.h>
>  #include <imx_thermal.h>
>  #include <jffs2/load_kernel.h>
>  #include <linux/sizes.h>
> -#include <mmc.h>
>  #include <miiphy.h>
>  #include <mtd_node.h>
>  #include <netdev.h>
> @@ -34,10 +32,6 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> -#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |                   \
> -       PAD_CTL_SPEED_LOW | PAD_CTL_DSE_40ohm |                 \
> -       PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
> -
>  #define LCD_PAD_CTRL    (PAD_CTL_HYS | PAD_CTL_PUS_100K_UP | \
>                 PAD_CTL_DSE_48ohm)
>
> @@ -56,19 +50,6 @@ int dram_init(void)
>         return 0;
>  }
>
> -#ifdef CONFIG_FSL_ESDHC
> -static iomux_v3_cfg_t const usdhc1_pads[] = {
> -       MX6_PAD_SD1_CLK__USDHC1_CLK     | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> -       MX6_PAD_SD1_CMD__USDHC1_CMD     | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> -       MX6_PAD_SD1_DATA0__USDHC1_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> -       MX6_PAD_SD1_DATA1__USDHC1_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> -       MX6_PAD_SD1_DATA2__USDHC1_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> -       MX6_PAD_SD1_DATA3__USDHC1_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> -
> -       MX6_PAD_SNVS_TAMPER0__GPIO5_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL),
> -};
> -#endif
> -
>  static iomux_v3_cfg_t const usb_cdet_pads[] = {
>         MX6_PAD_SNVS_TAMPER2__GPIO5_IO02 | MUX_PAD_CTRL(NO_PAD_CTRL),
>  };
> @@ -135,57 +116,6 @@ static int setup_lcd(void)
>  }
>  #endif
>
> -#ifdef CONFIG_FSL_ESDHC
> -
> -#define USDHC1_CD_GPIO IMX_GPIO_NR(5, 0)
> -
> -static struct fsl_esdhc_cfg usdhc_cfg[] = {
> -       {USDHC1_BASE_ADDR, 0, 4},
> -};
> -
> -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 USDHC1_BASE_ADDR:
> -               ret = !gpio_get_value(USDHC1_CD_GPIO);
> -               break;
> -       }
> -
> -       return ret;
> -}
> -
> -int board_mmc_init(bd_t *bis)
> -{
> -       int i, ret;
> -
> -       /* USDHC1 is mmc0 */
> -       for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
> -               switch (i) {
> -               case 0:
> -                       imx_iomux_v3_setup_multiple_pads(usdhc1_pads,
> -                                                        ARRAY_SIZE(usdhc1_pads));
> -                       gpio_request(USDHC1_CD_GPIO, "usdhc1_cd");
> -                       gpio_direction_input(USDHC1_CD_GPIO);
> -                       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
> -                       break;
> -               default:
> -                       printf("Warning: you configured more USDHC controllers"
> -                               "(%d) than supported by the board\n", i + 1);
> -                       return -EINVAL;
> -               }
> -
> -               ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
> -               if (ret)
> -                       return ret;
> -       }
> -
> -       return 0;
> -}
> -#endif
> -
>  #ifdef CONFIG_FEC_MXC
>  static int setup_fec(void)
>  {
> diff --git a/configs/colibri-imx6ull_defconfig b/configs/colibri-imx6ull_defconfig
> index ce2c09338d..69305323f2 100644
> --- a/configs/colibri-imx6ull_defconfig
> +++ b/configs/colibri-imx6ull_defconfig
> @@ -50,6 +50,7 @@ CONFIG_DFU_NAND=y
>  CONFIG_DM_GPIO=y
>  CONFIG_DM_I2C=y
>  CONFIG_SYS_I2C_MXC=y
> +CONFIG_DM_MMC=y
>  CONFIG_FSL_ESDHC=y
>  CONFIG_MTD=y
>  CONFIG_NAND=y
> diff --git a/include/configs/colibri-imx6ull.h b/include/configs/colibri-imx6ull.h
> index 31248b14a1..7a7a70e457 100644
> --- a/include/configs/colibri-imx6ull.h
> +++ b/include/configs/colibri-imx6ull.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0+ */
>  /*
> - * Copyright 2018 Toradex AG
> + * Copyright 2018-2019 Toradex AG
>   *
>   * Configuration settings for the Colibri iMX6ULL module.
>   *
> @@ -30,7 +30,7 @@
>  /* ENET1 */
>  #define IMX_FEC_BASE                   ENET2_BASE_ADDR
>
> -/* MMC Config*/
> +/* MMC Config */
>  #define CONFIG_SYS_FSL_ESDHC_ADDR      0
>  #define CONFIG_SYS_FSL_USDHC_NUM       1
>
> @@ -182,4 +182,4 @@
>  #define CONFIG_VIDEO_BMP_LOGO
>  #endif
>
> -#endif
> +#endif /* __COLIBRI_IMX6ULL_CONFIG_H */
> --
> 2.20.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot



-- 
Best regards - Freundliche GrĂ¼sse - Meilleures salutations

Senior Development Engineer,
Igor Opaniuk

Toradex AG
Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500 48
00 (main line)


More information about the U-Boot mailing list