本帖最后由 linux54 于 2016-12-26 11:45 编辑
硬件排查:
硬件方面:采用和IMX6Q一模一样的硬件,只是贴片的时候贴的是IMX6DL的芯片,采用EMMC启动,我们使用USDHC4接口
软件方面:下面列出来详细的移植步骤,再次声明针对的BSP版本为3.14.28以及uboot版本为2014.04,不过BSP3.14.52里的uboot版本应该也一样吧。
软件移植步骤:
1. 添加板级文件目录:
u-boot-2014.04$ mkdir -p board/freescale/mx6dlemmc
2. 以mx6qsabreauto为参照,因为我们的板子跟它比较接近:
u-boot-2014.04$ cp -rf board/freescale/mx6qsabreauto/* board/freescale/mx6dlemmc/
3. 修改 board/freescale/mx6dlemmc/Makefile文件:
将obj-y := mx6qsabreauto.o 改为 obj-y := mx6dlemmc.o
4. 将board/freescale/mx6qsabreauto/mx6qsabreauto.c名字改为board/freescale/mx6qsabreauto/mx6dlemmc.c
5. 修改board/freescale/mx6qsabreauto/mx6dlemmc.c文件,具体的就是添加USDHC4支持,默认是只有USDHC1和USDHC3的:
419 int board_mmc_init(bd_t *bis)
420 {
421 int i;
422
423 /*
424 * According to the board_mmc_init() the following map is done:
425 * (U-boot device node) (Physical Port)
426 * mmc0 USDHC1
427 * mmc1 USDHC3
428 */
429 for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
430 switch (i) {
431 case 0:
432 imx_iomux_v3_setup_multiple_pads(
433 usdhc1_pads, ARRAY_SIZE(usdhc1_pads));
434 gpio_direction_input(USDHC1_CD_GPIO);
435 usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
436 break;
437+ case 1:
438+ imx_iomux_v3_setup_multiple_pads(
439+ usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
440+ //gpio_direction_input(USDHC1_CD_GPIO);
441+ usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
442+
443+ break;
444 case 2:
445 imx_iomux_v3_setup_multiple_pads(
446 usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
447 gpio_direction_input(USDHC3_CD_GPIO);
448 usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
449
450 break;
451+ case 3:
452+ imx_iomux_v3_setup_multiple_pads(
453+ usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
454+ //gpio_direction_input(USDHC4_CD_GPIO);
455+ usdhc_cfg[3].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
456+ break;
457
458 default:
459 printf("Warning: you configured more USDHC controllers"
460 "(%d) than supported by the board\n", i + 1);
461 return 0;
462 }
463
464 if (fsl_esdhc_initialize(bis, &usdhc_cfg))
465 printf("Warning: failed to initialize mmc dev %d\n", i);
466 }
467
468 return 0;
469 }
--------------------------------------------------------------------------
360 struct fsl_esdhc_cfg usdhc_cfg[4] = {
361 {USDHC1_BASE_ADDR, 0, 4},
362+ {USDHC2_BASE_ADDR},
363 {USDHC3_BASE_ADDR},
364+ {USDHC4_BASE_ADDR},
365 };
----------------------------------------------------------------------------
188 + iomux_v3_cfg_t const usdhc2_pads[] = {
189 + MX6_PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
190 + MX6_PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
191 + MX6_PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
192 + MX6_PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
193 + MX6_PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
194 + MX6_PAD_SD2_DAT3__SD2_DATA3 |MUX_PAD_CTRL(USDHC_PAD_CTRL),
195 + };
196
197 + iomux_v3_cfg_t const usdhc4_pads[] = {
198 + MX6_PAD_SD4_CLK__SD4_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
199 + MX6_PAD_SD4_CMD__SD4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
200 + MX6_PAD_SD4_DAT0__SD4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
201 + MX6_PAD_SD4_DAT1__SD4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
202 + MX6_PAD_SD4_DAT2__SD4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
203 + MX6_PAD_SD4_DAT3__SD4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
204 + MX6_PAD_SD4_DAT4__SD4_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
205 + MX6_PAD_SD4_DAT5__SD4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
206 + MX6_PAD_SD4_DAT6__SD4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
207 + MX6_PAD_SD4_DAT7__SD4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
208 + };
-------------------------------------------------------------------------------
399 int board_mmc_getcd(struct mmc *mmc)
400 {
401 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
402 int ret = 0;
403
404 switch (cfg->esdhc_base) {
405 case USDHC1_BASE_ADDR:
406 ret = !gpio_get_value(USDHC1_CD_GPIO);
407 break;
408 case USDHC3_BASE_ADDR:
409 ret = !gpio_get_value(USDHC3_CD_GPIO);
410 break;
411 + case USDHC4_BASE_ADDR:
412 + ret = 1; //这里就是获取CD脚的值来检测是否插入SD卡(EMMC和SD卡类似),EMMC是没有CD脚的,这里我不管是0还是1都试过。
413 + break;
414 }
415
416 return ret;
417 }
6. 添加头文件,并且添加USDHC4支持:
u-boot-2014.04$ cp -rf include/configs/mx6qsabreauto.h include/configs/mx6dlemmc.h
u-boot-2014.04$ vim include/configs/mx6qemmc.h
-------------------------------------------------------------
21 + //#define CONFIG_SYS_USE_NAND //取消掉使用NAND,因为它的引脚复用会和USDHC4冲突
-------------------------------------------------------------
53 + #define CONFIG_SYS_FSL_USDHC_NUM 4 //2 默认是2个USDHC,这里因为我在mx6dlemmc.c里配置了4个,所以改NUM为4
54 + #define CONFIG_SYS_MMC_ENV_DEV 3 // 使用MMC 3(这里是从0开始排的,0,1,2,3,所以是3)
------------------------------------------------------------------------
修改u-boot-2014.04$ vim include/configs/mx6sabre_common.h文件
---------------------------------------------------
56 + #define CONFIG_SYS_FSL_ESDHC_ADDR 3 //0 使用MMC 3(这里是从0开始排的,0,1,2,3,所以是3)
----------------------------------------------
7. 最后一步就是添加编译选项了,修改uboot顶层目录下的boards.cfg文件:
333 + Active arm armv7 mx6 freescale mx6dlemmc mx6dlemmc mx6dlemmc:IMX_CONFIG=board/freescale/mx6dlemmc/mx6dl.cfg,MX6DL,DEFAULT_FDT_FILE="imx6dle
+ mmc.dtb",DDR_MB=512 Fabio Estevam <fabio.estevam@freescale.com>
以上就是全部的移植步骤了,希望大家能给点意见,找下问题所在,IMX6DL+EMMC的难道不行吗?网上倒是看到有人用IMX6DL+SD卡,没见到IMX6DL+EMMC的形式,请大家指正我的移植是否哪里出了问题。。。。。。
|