移植u-boot-2010.03問題 --- 網卡DM9000

移植u-boot-2010.03問題 --- 網卡DM9000

1,找到u-boot-2010.03/include/configs/smdk6410.h

//#define CONFIG_NET_MULTI
//#define CONFIG_CS8900 /*we have aCS8900on-board*/
//#define CONFIG_CS8900_BASE 0x18800300
//#define CONFIG_CS8900_BUS16 /*follow the Linux driver*/

/**而後添加DM9000網卡的宏定義---ip以及子網掩碼等根據本身的須要修改***/

#defineCONFIG_NET_MULTI 1
#defineCONFIG_DM9000_NO_SROM 1
#defineCONFIG_dm9000
#defineCONFIG_DRIVER_DM9000 1
#defineCONFIG_DM9000_BASE 0x18800300
#defineDM9000_IO CONFIG_DM9000_BASE
#defineDM9000_DATA (CONFIG_DM9000_BASE+4)
#defineCONFIG_DM9000_USE_16BIT
#defineCONFIG_ETHADDR 00:40:5c:26:0a:5b
#defineCONFIG_NETMASK 255.255.255.0
#defineCONFIG_IPADDR 192.168.1.20
#defineCONFIG_SERVERIP 192.168.1.10
#defineCONFIG_GATEWAYIP 192.168.1.1

//#define CONFIG_DM9000_DEBUG

 

2,打開u-boot-2010.03/net/eth.c,找到int eth_initialize(bd_t *bis)函數:

#if defined(CONFIG_DB64460) || defined(CONFIG_P3Mx)
    mv6446x_eth_initialize(bis);
#endif
/**
add here
*/
#if defined(CONFIG_DRIVER_DM9000)
    dm9000_initialize(bis);
#endif
/**
add over
*/

 

3,打開u-boot-2010.03/net/net.c:

第一處:

//# define ARP_TIMEOUT        5000UL    /* Milliseconds before trying ARP again */
# define ARP_TIMEOUT        5    /* Milliseconds before trying ARP again */

第二處:

//  if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT) {
    if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT*CONFIG_SYS_HZ) {

第三處:

//  NetSetTimeout (10000UL, PingTimeout);
    NetSetTimeout (10*CONFIG_SYS_HZ, PingTimeout);

 

4,打開u-boot-2010.03/net/tftp.c,找到void TftpStart (void)函數:

#if 0
    /*
     * Allow the user to choose TFTP blocksize and timeout.
     * TFTP protocol has a minimal timeout of 1 second.
     */
    if ((ep = getenv("tftpblocksize")) != NULL)
        TftpBlkSizeOption = simple_strtol(ep, NULL, 10);

    if ((ep = getenv("tftptimeout")) != NULL)
        TftpTimeoutMSecs = simple_strtol(ep, NULL, 10);

    if (TftpTimeoutMSecs < 1000) {
        printf("TFTP timeout (%ld ms) too low, "
            "set minimum = 1000 ms\n",
            TftpTimeoutMSecs);
        TftpTimeoutMSecs = 1000;
    }

    debug("TFTP blocksize = %i, timeout = %ld ms\n",
        TftpBlkSizeOption, TftpTimeoutMSecs);
#endif

 

完成後從新編譯。函數

5,測試網卡

在開發板上經過命令 printenv 查看網卡信息。
測試

 

WU_SMDK6410 # printenv                                                          
bootargs=console=ttySAC,115200                                                  
bootcmd=nand read 0x50018000 0x60000 0x1c0000;bootm 0x50018000                  
bootdelay=10                                                                    
baudrate=115200                                                                 
ethaddr=00:40:5c:26:0a:5b                                                       
ipaddr=192.168.1.123                                                            
serverip=192.168.1.127                                                          
gatewayip=192.168.1.1                                                           
netmask=255.255.255.0                                                           
stdin=serial                                                                    
stdout=serial                                                                   
stderr=serial                                                                   
ethact=dm9000    

setenv serverip 192.168.X.XX --- 設置主機ip,該命令只是把設置保存到ram中,若是重啓的話設置會從新回到原來的設置spa

saveenv --- 保存到flash中。debug

這時,我主機的ip:192.168.1.127,經過ping命令測試是否能連通:code

WU_SMDK6410 # ping 192.168.1.127                                                
dm9000 i/o: 0x18800300, id: 0x90000a46                                          
DM9000: running in 16 bit mode                                                  
MAC: 00:40:5c:26:0a:5b                                                          
operating at 100M full duplex mode                                              
Using dm9000 device                                                             
host 192.168.1.127 is alive         

這裏成功連通,但也有時會出現開發板能ping通主機,可是主機卻ping不通開發板的奇怪現象,但不影響開發板經過tftp下載主機上的文件,暫時沒想通。server

相關文章
相關標籤/搜索