|
本文由博主girlkoo编写,关于E9与TQIMX6Q开发平台eMMC移植的文章。
前一篇文章已经移植好CAN,本文来移植eMMC。eMMC的移植一般来讲比较简单,因为MMC驱动是由官方维护的,一般来讲,不会有什么问题,对我们来说,只需要正确的配置各个pin脚的复用关系,这种情况也是DTS最擅长的。下面我们开始eMMC移植。
DTS编写
参考sabresd的DTS,我们可以如下编写DTS:
- &usdhc4 {
- pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_usdhc4_1>;
- bus-width = <8>;
- no-removable;
- no-1-8-v;
- keep-power-in-suspend;
- status = "okay";
- };
复制代码
由于tqimx6q的eMMC管脚复用关系与imx6qdl.dtsi中的pinctrl_usdhc4_1是完全一致的,因此,可以直接使用该组配置。修改好以上内容后重新编译并烧写DTB。
测试方法
测试eMMC是否好用的方法有很多,本文的测试手段是将MMC的整体划分为一个分区并格式化为FAT32文件系统,如果以上操作能够成功完成,则表示eMMC已经正常工作。
Step1. 创建分区。使用fdisk创建分区:
- @tqimx6q #fdisk /dev/mmcblk1
-
- The number of cylinders for this disk is set to 238592.
- There is nothing wrong with that, but this is larger than 1024,
- and could in certain setups cause problems with:
- 1) software that runs at boot time (e.g., old versions of LILO)
- 2) booting and partitioning software from other OSs
- (e.g., DOS FDISK, OS/2 FDISK)
-
- Command (m for help): d
- Selected partition 1
-
- Command (m for help): d
- No partition is defined yet!
-
- Command (m for help): n
- Command action
- e extended
- p primary partition (1-4)
- p
- Partition number (1-4): 1
- First cylinder (1-238592, default 1): Using default value 1
- Last cylinder or +size or +sizeM or +sizeK (1-238592, default 238592): Using default value 238592
-
- Command (m for help): w
- The partition table has been altered.
- Calling ioctl() to re-read partition table
- mmcblk1: p1
复制代码
Step2. 将分区p1格式化FAT32文件系统,执行指令:
Step3. 将格式化好的分区p1挂载到/mnt目录,执行指令:
- mount /dev/mmcblk1p1 /mnt
复制代码
Step4. 在p1中创建文件,重启检测文件是否仍然存在,执行指令:
- echo "test" > /mnt/test.txt
- sync
复制代码
执行以上命令之后重启开发板,重新挂载该分区后会发现test.txt文件依然存在,证明eMMC驱动已经可以正常工作了。
|
|