雄迈400万TF卡内核补丁
需要注釋掉 drivers/mmc/host/himci/himci.c 里面的
? ? ? ? ? ? ? ? /*? ? ? ? | MMC_CAP_UHS_SDR12? ? ? ? */
? ? ? ? ? ? ? ? /*? ? ? ? | MMC_CAP_UHS_SDR25? ? ? ? */
? ? ? ? ? ? ? ? /*? ? ? ? | MMC_CAP_UHS_SDR50? ? ? ? */
? ? ? ? ? ? ? ? /*? ? ? ? | MMC_CAP_UHS_DDR50? ? ? ? */
? ? ? ? ? ? ? ? /*? ? ? ? | MMC_CAP_UHS_SDR104? ? ? ? */
另外由于CARD_DETECT是上拉到3.3V了,而且沒有導出這只引腳,因此放棄使用CARD_DETECT,使用PWR_EN引腳作為CARD_DETECT
需要修改 uboot 的reginfo.bin,修改引腳復用
200F0000
0x0EC muxctrl_reg59 SDIO1_CARD_POWER_EN 管腳的復用控制寄存器2-97
0 GPIO11_1
1 SDIO1_CARD_POWER_EN
這個復用改成0。也就是說把J21引腳功能改成GPIO11_1
還需要修改hi_mci_sys_card_detect函數的實現,下面會說怎么改
先說GPIO怎么配置
GPIO11基地址 0x201F_0000
表13-21 GPIO 寄存器概覽
偏移地址 名稱 描述 頁碼
0x000~0x3FC GPIO_DATA GPIO 數據寄存器 13-148
0x400 GPIO_DIR GPIO 方向控制寄存器 13-148? ? ? ? <<<<<<<<<<<< [0:7]有效??0輸入 1輸出 <<<<<<<<<<<<<<
0x404 GPIO_IS GPIO 中斷觸發寄存器 13-149
0x408 GPIO_IBE GPIO 雙沿觸發中斷寄存器 13-149
0x40C GPIO_IEV GPIO 觸發中斷條件寄存器 13-150
0x410 GPIO_IE GPIO 中斷屏蔽寄存器 13-150? ? ? ? <<<<<<<<<<<< [0:7]有效 0屏蔽 1不屏蔽 <<<<<<<<<<<<<<
0x414 GPIO_RIS GPIO 原始中斷狀態寄存器 13-151
0x418 GPIO_MIS GPIO 屏蔽狀態中斷寄存器 13-151
0x41C GPIO_IC GPIO 中斷清除寄存器 13-152
DATA寄存器 0~3FC [9:0] 共10比特,低2比特是 4字節對齊操作的,因此高8比特分別對應8個GPIO管腳的有效MASK
例如
如果只想寫入GPIOX_7為1,則向地址 +0x200 寫入 0x80 即可。
如果只想寫入GPIOX_1為1,則向地址 +0x8 寫入 0x02 即可。
讀取同理<<<<<<<<<<<<<
修改代碼 hi_mci.h
himci_host 結構體 追加
? ? ? ? void __iomem? ? ? ? ? ? ? ? *gpio_cd_base;
修改代碼 himci.c
hi_mci_probe函數
#ifdef CONFIG_HIMCI0
? ? ? ? ? ? ? ? host->id = 0;
? ? ? ? ? ? ? ? host->base = ioremap_nocache(CONFIG_HIMCI0_IOBASE, HI_MCI_IO_SIZE);
? ? ? ? ? ? ? ? host->gpio_cd_base = NULL;? ? ? ? //sdio0 not use
#endif
? ? ? ? } else if (1 == pdev->id) {
#ifdef CONFIG_HIMCI1
? ? ? ? ? ? ? ? unsigned int regv;
? ? ? ? ? ? ? ? host->id = 1;
? ? ? ? ? ? ? ? host->base = ioremap_nocache(CONFIG_HIMCI1_IOBASE, HI_MCI_IO_SIZE);
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? host->gpio_cd_base = ioremap_nocache(0x201F0000, 0x1000);
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? regv = readl(host->gpio_cd_base + 0x400);
? ? ? ? ? ? ? ? himci_writel(regv & (~(1<<1)), host->gpio_cd_base + 0x400);
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? regv = readl(host->gpio_cd_base + 0x410);
? ? ? ? ? ? ? ? himci_writel(regv & (~(1<<1)), host->gpio_cd_base + 0x410);
#endif
修改函數 hi_mci_sys_card_detect
/**********************************************
*1: card off
*0: card on
***********************************************/
static unsigned int hi_mci_sys_card_detect(struct himci_host *host)
{
? ? ? ? unsigned int regv;
? ? ? ??
? ? ? ? if(host->gpio_cd_base == NULL)
? ? ? ? ? ? ? ? return 1;
? ? ? ? ? ? ? ??
? ? ? ? regv = readl(host->gpio_cd_base + 0x3FC);
? ? ? ? if(regv & (1<<1))
? ? ? ? ? ? ? ? return 1;
? ? ? ? ? ? ? ??
? ? ? ? return 0;
}
這樣原P8的12pin座第七個引腳SDIO1_POWER_EN就改成了CARD_DETECT功能。注意這個引腳是直接引出的,這里使用的時候需要上拉電阻到3.3V。當CD被拉低時表示有卡插入
編譯了內核后測試正常
反復插卡拔卡日志如下
card connected!
mmc1: new high speed SDHC card at address aaaa
mmcblk0: mmc1:aaaa SL16G 14.8 GiB
mmcblk0: p1
card disconnected!
mmc1: card aaaa removed
card connected!
mmc1: new high speed SDHC card at address aaaa
mmcblk0: mmc1:aaaa SL16G 14.8 GiB
mmcblk0: p1
card disconnected!
mmc1: card aaaa removed
card connected!
mmc1: new high speed SDHC card at address aaaa
mmcblk0: mmc1:aaaa SL16G 14.8 GiB
mmcblk0: p1
連續讀寫性能測試
/mnt/mmcp1 # dd if=/dev/zero of=speedtest.bin bs=64k count=1000
1000+0 records in
1000+0 records out
65536000 bytes (62.5MB) copied, 6.113585 seconds, 10.2MB/s
/mnt/mmcp1 # dd if=/dev/zero of=speedtest.bin bs=64k count=1000
1000+0 records in
1000+0 records out
65536000 bytes (62.5MB) copied, 6.367149 seconds, 9.8MB/s
/mnt/mmcp1 # dd if=/dev/zero of=speedtest.bin bs=64k count=1000
1000+0 records in
1000+0 records out
65536000 bytes (62.5MB) copied, 6.397446 seconds, 9.8MB/s
/mnt/mmcp1 # dd if=/dev/zero of=speedtest.bin bs=64k count=1000
1000+0 records in
1000+0 records out
65536000 bytes (62.5MB) copied, 6.227193 seconds, 10.0MB/s
/mnt/mmcp1 # dd if=/dev/zero of=speedtest.bin bs=256k count=1000
1000+0 records in
1000+0 records out
262144000 bytes (250.0MB) copied, 26.237983 seconds, 9.5MB/s
/mnt/mmcp1 # dd if=speedtest.bin of=/dev/null bs=64k count=1000
1000+0 records in
1000+0 records out
65536000 bytes (62.5MB) copied, 3.138901 seconds, 19.9MB/s
/mnt/mmcp1 # dd if=speedtest.bin of=/dev/null bs=64k count=1000
1000+0 records in
1000+0 records out
65536000 bytes (62.5MB) copied, 3.118107 seconds, 20.0MB/s
/mnt/mmcp1 # dd if=speedtest.bin of=/dev/null bs=64k count=1000
1000+0 records in
1000+0 records out
65536000 bytes (62.5MB) copied, 3.118156 seconds, 20.0MB/s
/mnt/mmcp1 # dd if=speedtest.bin of=/dev/null bs=64k count=1000
1000+0 records in
1000+0 records out
65536000 bytes (62.5MB) copied, 3.173567 seconds, 19.7MB/s
總結
以上是生活随笔為你收集整理的雄迈400万TF卡内核补丁的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ubifs 提取
- 下一篇: stm32f103 spi slave从