s5pv210 uboot-2012-10移植(七) 之支持SD卡
生活随笔
收集整理的這篇文章主要介紹了
s5pv210 uboot-2012-10移植(七) 之支持SD卡
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
s5pv210?uboot-2012-10移植(七)?之支持SD卡?
?
我其實(shí)對(duì)SD卡的操作不是很熟悉,所以移植的肯定有問題,在隨機(jī)贈(zèng)送的Kingston?4G的SD卡上可以進(jìn)行讀寫,但是我換了張2G的SD卡,就不行了,原因暫時(shí)先不找了,等熟悉了SD卡的操作再看看,哪位大俠知道怎么移植的一定要告訴我,不勝感激。
1.include/configs/smdkv210.h?+94
?
#define CONFIG_GENERIC_MMC #define CONFIG_MMC #define CONFIG_SDHCI #define CONFIG_S5P_SDHCI #define CONFIG_CMD_MMC?
2.在board/samsung/smdkv210/smdkc100.c添加
int board_mmc_init (bd_t *bis) { //printf ("haha\n"); #define GPG0CON (*(volatile unsigned int *)0xE02001A0) #define GPG0DRV (*(volatile unsigned int *)0xE02001AC) #define GPG3CON (*(volatile unsigned int *)0xE0200200) #define CLK_DIV4 (*(volatile unsigned int *)0xE0100310) #define CLK_SRC4 (*(volatile unsigned int *)0xE0100210) #define MOUTMMC (50000000) /* 50MHz */ unsigned long clk_src, clk_div, mpll, div; //初始化MMC0 MM3管腳,4bit模式 GPG0CON = (0x2<<0)|(0x2<<4)|(0x2<<8)|(0x2<<12)|(0x2<<16)|(0x2<<20)|(0x2<<24); GPG3CON = (0x2<<0)|(0x2<<4)|(0x2<<8)|(0x2<<12)|(0x2<<16)|(0x2<<20)|(0x2<<24); //GPG0DRV = 0x3fdf; //初始化SD時(shí)鐘 clk_ CLK_SRC4; clk_src &= ~((0xf << 12) | 0xf); clk_src |= (0x6 << 12) | 0x6; mpll = get_pll_clk(MPLL); div = ((mpll + MOUTMMC) / MOUTMMC) - 1; clk_div = CLK_DIV4; clk_div &= ~((0xf << 12) | 0xf); clk_div |= (div << 12) | div; CLK_SRC4 = clk_src; CLK_DIV4 = clk_div; return s5p_sdhci_init(0xEB000000, 0, 4)|s5p_sdhci_init(0xEB300000, 1, 4); }
3.修改drivers/mmc/sdhci.c?+133
/* Wait max 10 ms */ timeout = 10; #if 0 sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS); mask = SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT; /* We shouldn't wait for data inihibit for stop commands, even though they might use busy signaling */ if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION) mask &= ~SDHCI_DATA_INHIBIT; #endif /* * PRNSTS * CMDINHDAT[1] : Command Inhibit (DAT) * CMDINHCMD[0] : Command Inhibit (CMD) */ mask = (1 << 0); if ((data != NULL) || (cmd->resp_type & MMC_RSP_BUSY)) mask |= (1 << 1); /* * We shouldn't wait for data inihibit for stop commands, even * though they might use busy signaling */ if (data) mask &= ~(1 << 1); //mask = 1; //printf ("mask: %08x\n read: %08x\n", mask, sdhci_readl(host, SDHCI_PRESENT_STATE)); while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) { if (timeout == 0) { printf("Controller never released inhibit bit(s).\n"); return COMM_ERR; } timeout--; udelay(1000); }
4.修改drivers/mmc/mmc.c把sd_change_freq中的最后兩個(gè)returne?err;?給屏蔽掉
?
//if (err) //return err;?
?
5.make,使用命令燒入SD卡里,啟動(dòng)開發(fā)板
?
?
???
轉(zhuǎn)載于:https://blog.51cto.com/7090376/1265343
與50位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的s5pv210 uboot-2012-10移植(七) 之支持SD卡的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: chrome ui源码剖析-Accele
- 下一篇: 1,maven简介