【TINY4412】LINUX移植笔记:(13)SD卡驱动

环境

宿主机 : 虚拟机 Ubuntu 16.04 LTS / X64
目标板[底板]: Tiny4412SDK - 1506
目标板[核心板]: Tiny4412 - 1412
LINUX内核: 4.12.0
交叉编译器: arm-none-linux-gnueabi-gcc(gcc version 4.8.3 20140320)
日期: 2017-9-9 20:30:09
作者: SY

简介

1

1

设备树

1
2
3
4
5
6
7
8
&sdhci_2 {
bus-width = <4>;
pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
pinctrl-names = "default";
cd-gpios = <&gpk2 2 GPIO_ACTIVE_HIGH>;
cd-inverted;
status = "okay";
};
1
2
3
4
5
Device Drivers --->
<*> MMC/SD/SDIO card support --->
<*> Secure Digital Host Controller Interface support
<*> SDHCI support on Samsung S3C SoC
[*] DMA support on S3C SDHCI

测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[ 2.907962] sdhci: Secure Digital Host Controller Interface driver
[ 2.912535] sdhci: Copyright(c) Pierre Ossman
[ 2.917043] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/sdhci@12530000[0]' - status (0)
[ 2.926636] s3c-sdhci 12530000.sdhci: clock source 2: mmc_busclk.2 (100000000 Hz)
[ 2.933955] s3c-sdhci 12530000.sdhci: GPIO lookup for consumer cd
[ 2.939993] s3c-sdhci 12530000.sdhci: using device tree for GPIO lookup
[ 2.946615] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/sdhci@12530000[0]' - status (0)
[ 2.956246] s3c-sdhci 12530000.sdhci: Got CD GPIO
[ 2.960913] s3c-sdhci 12530000.sdhci: GPIO lookup for consumer wp
[ 2.967000] s3c-sdhci 12530000.sdhci: using device tree for GPIO lookup
[ 2.973598] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/sdhci@12530000[0]'
[ 2.982537] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/sdhci@12530000[0]'
[ 2.991398] usb 2-2: new high-speed USB device number 2 using exynos-ehci
[ 2.998190] s3c-sdhci 12530000.sdhci: using lookup tables for GPIO lookup
[ 3.004938] s3c-sdhci 12530000.sdhci: lookup for GPIO wp failed
[ 3.036461] [LCD] model = S702, ver = 1503
[ 3.064166] random: fast init done
[ 3.071264] mmc0: SDHCI controller on samsung-hsmmc [12530000.sdhci] using ADMA

查看设备

1
2
[root@TINY4412:~]# ls dev/mmcblk0
mmcblk0 mmcblk0p1 mmcblk0p2

插拔 sd

1
2
3
4
[root@TINY4412:~]# [ 48.882376] mmc0: card 0007 removed
[ 51.052006] mmc0: new high speed SDHC card at address 0007
[ 51.053990] mmcblk0: mmc0:0007 SD16G 14.5 GiB
[ 51.057540] mmcblk0: p1 p2

查看磁盘信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@TINY4412:~]# fdisk -l
Disk /dev/mmcblk1: 3712 MB, 3892314112 bytes, 7602176 sectors
118784 cylinders, 4 heads, 16 sectors/track
Units: cylinders of 64 * 512 = 32768 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk1p1 0,1,1 1023,3,16 16 195391 195376 95.3M b Win95 FAT32
/dev/mmcblk1p2 1023,3,16 1023,3,16 195392 2148607 1953216 953M 83 Linux
/dev/mmcblk1p3 1023,3,16 1023,3,16 2148608 4101823 1953216 953M 83 Linux
/dev/mmcblk1p4 1023,3,16 1023,3,16 4101824 7602175 3500352 1709M 83 Linux
Disk /dev/mmcblk1boot1: 4 MB, 4194304 bytes, 8192 sectors
128 cylinders, 4 heads, 16 sectors/track
Units: cylinders of 64 * 512 = 32768 bytes
Disk /dev/mmcblk1boot1 doesn't contain a valid partition table
Disk /dev/mmcblk1boot0: 4 MB, 4194304 bytes, 8192 sectors
128 cylinders, 4 heads, 16 sectors/track
Units: cylinders of 64 * 512 = 32768 bytes
Disk /dev/mmcblk1boot0 doesn't contain a valid partition table
Disk /dev/mmcblk0: 14 GB, 15544090624 bytes, 30359552 sectors
14824 cylinders, 64 heads, 32 sectors/track
Units: cylinders of 2048 * 512 = 1048576 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 1,0,1 0,63,32 2048 2099199 2097152 1024M b Win95 FAT32
/dev/mmcblk0p2 1,0,1 487,63,32 2099200 30359551 28260352 13.4G 83 Linux
SY wechat
扫一扫,用手机访问本站