前一篇文章已经移植好CAN,本文来移植eMMC。eMMC的移植一般来讲比较简单,因为MMC驱动是由官方维护的,一般来讲,不会有什么问题,对我们来说,只需要正确的配置各个pin脚的复用关系,这种情况也是DTS最擅长的。下面我们开始eMMC移植。
DTS编写
参考sabresd的DTS,我们可以如下编写DTS:
- &usdhc4 {
- pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_usdhc4_1>;
- bus-width = <8>;
- non-removable;
- no-1-8-v;
- keep-power-in-suspend;
- status = "okay";
- };
测试方法
测试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
- mkfs.vfat /dev/mmcblk1p1
- mount /dev/mmcblk1p1 /mnt
- echo "test" > /mnt/test.txt
- sync