colibri-imx6ull: migrate mmc to using driver model
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>
Tue, 9 Apr 2019 15:24:15 +0000 (17:24 +0200)
committerStefano Babic <sbabic@denx.de>
Thu, 25 Apr 2019 15:03:25 +0000 (17:03 +0200)
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@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
arch/arm/dts/imx6ull-colibri.dts
board/toradex/colibri-imx6ull/colibri-imx6ull.c
configs/colibri-imx6ull_defconfig
include/configs/colibri-imx6ull.h

index 95c67be438259cc04a248b671a0e4e4073283607..0d416ebd10ab1643703237258c3644437022ae11 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Copyright 2018 Toradex AG
+ * Copyright 2018-2019 Toradex AG
  */
 
 /dts-v1/;
        model = "Toradex Colibri iMX6ULL";
        compatible = "toradex,imx6ull-colibri", "fsl,imx6ull";
 
+       aliases {
+               mmc0 = &usdhc1;
+       };
+
        chosen {
                stdout-path = &uart1;
        };
        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 {
                >;
        };
 };
-
index 8493b1dfddb72ae401a3712749868489cec6c59f..c9af44e30e59331ac7fb8bebfda04bdd53adb874 100644 (file)
 #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>
 
 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)
 {
index ce2c09338d2863e5cee8ef28b341f41a2ef38615..69305323f217e3de4c41858e734f266e92e85557 100644 (file)
@@ -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
index 31248b14a10fd6f8166ee8bdf0ddc11d48546089..7a7a70e457076e5c6d322b44bd833dc5b31acb19 100644 (file)
@@ -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
 
 #define CONFIG_VIDEO_BMP_LOGO
 #endif
 
-#endif
+#endif /* __COLIBRI_IMX6ULL_CONFIG_H */