天嵌 ARM开发社区

 找回密码
 注册
查看: 2946|回复: 0

I.MX6Q学习笔记——新版BSP之eMMC移植

[复制链接]
freewing 发表于 2015-5-22 10:08:19 | 显示全部楼层 |阅读模式
  本文由博主girlkoo编写,关于E9与TQIMX6Q开发平台eMMC移植的文章。
  前一篇文章已经移植好CAN,本文来移植eMMC。eMMC的移植一般来讲比较简单,因为MMC驱动是由官方维护的,一般来讲,不会有什么问题,对我们来说,只需要正确的配置各个pin脚的复用关系,这种情况也是DTS最擅长的。下面我们开始eMMC移植。

  DTS编写

  参考sabresd的DTS,我们可以如下编写DTS:

  1. &usdhc4 {  
  2.     pinctrl-names = "default";  
  3.     pinctrl-0 = <&pinctrl_usdhc4_1>;  
  4.     bus-width = <8>;  
  5.     no-removable;  
  6.     no-1-8-v;  
  7.     keep-power-in-suspend;  
  8.     status = "okay";  
  9. };  
复制代码


  由于tqimx6q的eMMC管脚复用关系与imx6qdl.dtsi中的pinctrl_usdhc4_1是完全一致的,因此,可以直接使用该组配置。修改好以上内容后重新编译并烧写DTB。

  测试方法
  测试eMMC是否好用的方法有很多,本文的测试手段是将MMC的整体划分为一个分区并格式化为FAT32文件系统,如果以上操作能够成功完成,则表示eMMC已经正常工作。

  Step1. 创建分区。使用fdisk创建分区:

  1. @tqimx6q #fdisk /dev/mmcblk1  
  2.   
  3. The number of cylinders for this disk is set to 238592.  
  4. There is nothing wrong with that, but this is larger than 1024,  
  5. and could in certain setups cause problems with:  
  6. 1) software that runs at boot time (e.g., old versions of LILO)  
  7. 2) booting and partitioning software from other OSs  
  8.    (e.g., DOS FDISK, OS/2 FDISK)  
  9.   
  10. Command (m for help): d  
  11. Selected partition 1  
  12.   
  13. Command (m for help): d  
  14. No partition is defined yet!  
  15.   
  16. Command (m for help): n  
  17. Command action  
  18.    e   extended  
  19.    p   primary partition (1-4)  
  20. p  
  21. Partition number (1-4): 1  
  22. First cylinder (1-238592, default 1): Using default value 1  
  23. Last cylinder or +size or +sizeM or +sizeK (1-238592, default 238592): Using default value 238592  
  24.   
  25. Command (m for help): w  
  26. The partition table has been altered.  
  27. Calling ioctl() to re-read partition table  
  28. mmcblk1: p1  
复制代码



  Step2. 将分区p1格式化FAT32文件系统,执行指令:
  1. mkfs.vfat /dev/mmcblk1p1
复制代码

  Step3. 将格式化好的分区p1挂载到/mnt目录,执行指令:
  1. mount /dev/mmcblk1p1 /mnt
复制代码

  Step4. 在p1中创建文件,重启检测文件是否仍然存在,执行指令:
  1. echo "test" > /mnt/test.txt  
  2. sync
复制代码

  执行以上命令之后重启开发板,重新挂载该分区后会发现test.txt文件依然存在,证明eMMC驱动已经可以正常工作了。



您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-4-25 23:12 , Processed in 1.031250 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表