u-boot for tiny210 ver2.2.2(by liukun321咕唧咕唧)

来源:互联网 发布:二叉树的层序遍历算法 编辑:程序博客网 时间:2024/05/17 22:53

本次更新,修复了SD卡写入出现"data CRC error"的bug。我曾在u-boot for tiny210 ver2.1做过对这个bug的修复,我也提到过上次做的修改是不安全的,可能会对其它平台的代码产生副作用。而本次修改彻底解决了这个问题。感谢kasim,本次修改的源码由kasim提供。由于时间所限这次不再详细分析过程。只贴上本次修改的补丁文件内容。以后有时间,我会具体分析修改原因。

历史版本下载:

下面的链接提供了历史版本的源码

ver2.2源码下载:  u-boot for tiny210 ver2.2

ver2.1源码下载:u-boot for tiny210 ver2.2

ver2.1源码下载:u-boot for tiny210 ver2.1

ver2.0源码下载:u-boot for tiny210 ver2.0

各版本修改分析链接:ver2.0  ver2.1  ver2.2 ver2.2.1

 

 

 

--- a/board/samsung/tiny210/tiny210.c
+++ b/board/samsung/tiny210/tiny210.c
@@ -32,6 +32,8 @@
 #include <asm/io.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/clk.h> 
+#include <asm/arch/clock.h> 
 /*Add by lk for DM9000 driver */
 //#include <drivers/net/dm9000x.h>
 #include <netdev.h>
@@ -302,9 +304,13 @@ void nand_init(void)
 #endif
 
 #ifdef CONFIG_GENERIC_MMC
+#define MOUTMMC (50000000) /* 50MHz */
 int board_mmc_init(bd_t *bis)
 {
  int i;
+ struct s5pc110_clock *clk = 
+     (struct s5pc110_clock *)samsung_get_base_clock(); 
+    unsigned long clk_src, clk_div, mpll, div; 
 
  /*
   * MMC0 GPIO
@@ -336,6 +342,19 @@ int board_mmc_init(bd_t *bis)
   /* GPG1[0:6] drv 4x */
   s5p_gpio_set_drv(&s5pc110_gpio->g1, i, GPIO_DRV_4X);
  }
+ clk_src = readl(&clk->res9[0]); /* CLK_SRC4 */ 
+    clk_src &= ~((0xf << 4) | 0xf); 
+    clk_src |= (0x6 << 4) | 0x6; /* Set MMC0/1_SEL to SCLK_MPLL */ 
+    
+    mpll = get_pll_clk(MPLL); 
+    div = ((mpll + MOUTMMC) / MOUTMMC) - 1; 
+    
+    clk_div = readl(&clk->div4); 
+    clk_div &= ~((0xf << 4) | 0xf); 
+    clk_div |= (div << 4) | div; 
+    
+    writel(clk_src, &clk->res9[0]); 
+    writel(clk_div, &clk->div4); 
 
  return (s5p_mmc_init(0, 4) || s5p_mmc_init(1, 4));
 }

 

如果您现在拿到的是从我CSDN资源上下载的源码,您还需修改drivers/mmc/s5p_mmc.c去掉对下面红色代码部分的屏蔽:

225: while (1) {
226                         mask = readl(&host->reg->norintsts);
227 
228                         if (mask & (1 << 15)) {
229                                 /* Error Interrupt */
230                                 writel(mask, &host->reg->norintsts);
231                                 printf("%s: error during transfer: 0x%08x\n"    ,                                          
232                                                 __func__, mask);
233                                 return -1;
234                         } else
 if (mask & (1 << 3)) {

原创粉丝点击