U-BOOT移植总结

来源:互联网 发布:win7不能网络访问 编辑:程序博客网 时间:2024/04/27 17:40

1,../cpu/arm9926ejs

 bl lowlevel_init /* go setup pll,mux,memory */  注释掉此句

现象:直接导致UBL启动后,死机

2,../lib_arm/board.c-->start_armboot()

修改serial_init的初始化。

修改../driver/serial.c-->serial_init()-->calc_divisor中

//return (CFG_NS16550_CLK / MODE_X_DIV / gd->baudrate);
return ((CFG_NS16550_CLK /gd->baudrate + MODE_X_DIV/2)/ MODE_X_DIV);//提高精度

现象:直接导致串口输出乱码。

3,../board/davinci/davinci.c

修改misc_init_r()为以下
int misc_init_r (void)
{
 char temp[20];
 char emac_read_addr [10] = { 0x00, 0x0a,0xa4,0x11,0x22,0x33 }, i= 0;
 char *addr;
 int clk = 0;
 
 clk = ((PLL2_PLLM + 1) * 27) / (PLL2_DIV2 + 1);

#if 1
        printf ("ARM Clock :- %dMZ/n", ((((PLL1_PLLM + 1) * 27 ) / 2)) );
        printf ("DDR Clock :- %dMZ/n", (clk/2) );

// i2c_write (0x50, 0x00, 1, emac_read_addr, 2);
// i2c_read (0x50, 0x00, 1, emac_read_addr, 6);
#if 1
 addr = getenv ("ethaddr");
 if(addr)
 {
                emac_read_addr[0]=get_hex(addr[0])*16+get_hex(addr[1]);
                emac_read_addr[1]=get_hex(addr[3])*16+get_hex(addr[4]);
                emac_read_addr[2]=get_hex(addr[6])*16+get_hex(addr[7]);
                emac_read_addr[3]=get_hex(addr[9])*16+get_hex(addr[10]);
                emac_read_addr[4]=get_hex(addr[12])*16+get_hex(addr[13]);
                emac_read_addr[5]=get_hex(addr[15])*16+get_hex(addr[16]);
 }
#if 0
 else
 {
      emac_read_addr[0]=0x00;
         emac_read_addr[1]=0x0e;
         emac_read_addr[2]=0x99;
         emac_read_addr[3]=0x02;
         emac_read_addr[4]=0x53;
         emac_read_addr[5]=0x96;
        }
#endif
 temp[0] = (emac_read_addr[0] & 0xF0) >> 4;
        temp[1] = (emac_read_addr[0] & 0x0F);
        temp[2] = ':';
        temp[3] = (emac_read_addr[1] & 0xF0) >> 4;
        temp[4] = (emac_read_addr[1] & 0x0F);
        temp[5] = ':';
        temp[6] = (emac_read_addr[2] & 0xF0) >> 4;
        temp[7] = (emac_read_addr[2] & 0x0F);
        temp[8] = ':';
        temp[9] = (emac_read_addr[3] & 0xF0) >> 4;
        temp[10]= (emac_read_addr[3] & 0x0F);
        temp[11]= ':';
        temp[12]= (emac_read_addr[4] & 0xF0) >> 4;
        temp[13]= (emac_read_addr[4] & 0x0F);
        temp[14]= ':';
        temp[15]= (emac_read_addr[5] & 0xF0) >> 4;
        temp[16]= (emac_read_addr[5] & 0x0F);
#else
 for(i=0;i<6;i++)
 {
  printf("emac_read_addr[%d]=0x%x;/n",i,emac_read_addr[i]);
 }
 temp[0] = 1;
        temp[1] = 2;
        temp[2] = &apos;:&apos;;
        temp[3] = 3;
        temp[4] = 4;
        temp[5] = &apos;:&apos;;
        temp[6] = 5;
        temp[7] = 6;
        temp[8] = &apos;:&apos;;
        temp[9] = 7;
        temp[10]= 6;
        temp[11]= &apos;:&apos;;
        temp[12]= 5;
        temp[13]= 4;
        temp[14]= &apos;:&apos;;
        temp[15]= 3;
        temp[16]= 2;

#endif 
                                                                           
        for (i = 0; i < 17; i++)
        {
        if (temp[i] == &apos;:&apos;)
                continue;
        else if (temp[i] >= 0 && temp[i] <= 9)
                temp[i] = temp[i] + 48;
        else
                temp[i] = temp[i] + 87;
        }
                  
 temp [17] = 0;                                                           
 if ((emac_read_addr [0] != 0xFF) ||
     (emac_read_addr [1] != 0xFF) || 
     (emac_read_addr [2] != 0xFF) || 
     (emac_read_addr [3] != 0xFF) || 
     (emac_read_addr [4] != 0xFF) || 
     (emac_read_addr [5] != 0xFF))
 {
  setenv ("ethaddr", temp);
 }
#endif 
        return (0);
}


现象:网络功能不能实现

4.修改../include/asm_arm/arch-arm926ejs/nand_defs.h

NAND_CE0CLE和NAND_CE0ALE修改为:
#define NAND_CE0CLE ((volatile u_int8_t *)(CFG_NAND_BASE + 0x10))
#define NAND_CE0ALE ((volatile u_int8_t *)(CFG_NAND_BASE + 0x0A))

现象:nand每次读状态失败!

原创粉丝点击