zoukankan      html  css  js  c++  java
  • (五)DM9000网卡移植


     

    dm9000 的片选信号使用的是 nGCS4,所以 CONFIG_DM9000_BASE 要定义为0x20000000,有 CMD 接到了 s3c2440 的地址线 2 上,所以 DM9000_IO 定义为 0x20000000,DM9000_DATA 定义 0x20000004.

      修改include/configs/TX2440.h :

    /*
    * Hardware drivers
    */
    #if 0
    #define CONFIG_NET_MULTI
    #define CONFIG_CS8900  /* we have a CS8900 on-board */
    #define CONFIG_CS8900_BASE 0x19000300
    #define CONFIG_CS8900_BUS16  /* the Linux driver does accesses as shorts */
    #endif
    #define CONFIG_DRIVER_DM9000 1
    #define CONFIG_NET_MULTI 1
    #define CONFIG_DM9000_NO_SROM 1
    #define CONFIG_DM9000_BASE 0x20000300
    #define DM9000_IO CONFIG_DM9000_BASE
    #define DM9000_DATA (CONFIG_DM9000_BASE + 4)
      给u-boot 加上ping 命令,用来测试网络通不通
    #define CONFIG_CMD_PING
      恢复被注释掉的网卡MAC 地址和修改你合适的开发板IP 地址
    #define CONFIG_ETHADDR  12:34:56:78:90:ab
    #define CONFIG_NETMASK 255.255.255.0
    #define CONFIG_IPADDR 192.168.1.103
    #define CONFIG_SERVERIP 192.168.1.102
    #define CONFIG_GATEWAYIP  192.168.1.1
    说明:CONFIG_IPADDR 指的是开发板的IP 地址,CONFIG_SERVERIP 指的是服务器的IP地址,这两个IP 地址必须在同一网段上,在使用网络时,必须保证电脑服务器端的IP 地址和CONFIG_SERVERIP的值保持一致。

     修改board/samsung/TX2440/TX2440.c

    1. int board_eth_init(bd_t *bis)  
    2. {  
    3. int rc = 0;  
    4. #ifdef CONFIG_CS8900  
    5. rc = cs8900_initialize(0, CONFIG_CS8900_BASE);  
    6. #endif  
    7. #ifdef CONFIG_DRIVER_DM9000  
    8.     rc = dm9000_initialize(bis);  
    9. #endif  
    10. return rc;  
    修改drivers/net/dm9000x.c
    屏蔽掉dm9000_init函数中的这一部分,不然使用网卡的时候会报“could not establish link”的
    错误。修改
    1. #if 0  
    2. i = 0;  
    3. while (!(phy_read(1) & 0x20)) { /* autonegation complete bit */  
    4. udelay(1000);  
    5. i++;  
    6. if (i == 10000) {  
    7. printf("could not establish link ");  
    8. return 0;  
    9. }  
    10. }  
    11. #endif

    屏蔽掉dm9000_halt函数中的内容: 

    1. static void dm9000_halt(struct eth_device *netdev)  
    2. {  
    3. #if 0  
    4. DM9000_DBG("%s ", __func__);  
    5. /* RESET devie */  
    6. phy_write(0, 0x8000);  /* PHY RESET */  
    7. DM9000_iow(DM9000_GPR, 0x01); /* Power-Down PHY */  
    8. DM9000_iow(DM9000_IMR, 0x80); /* Disable all interrupt */  
    9. DM9000_iow(DM9000_RCR, 0x00); /* Disable RX */  
    10. #endif  
    11. }

    设置开发板ip

    set ipaddr 192.168.1.103

    saveenv 

     

  • 相关阅读:
    计算机程序的构造和解释 1.21 寻找素数因子
    迭代法对数计算B的N次方 SICP 计算机程序的构造和解释 1.16
    斐波那契算法的对数解法 计算机程序的构造和解释 习题1.19
    MS SQL SERVER数据库简单回顾
    SICP~计算机程序的构造和解释~ 1.12 c++实现
    论5级流水32bit risc cpu设计
    mdk编译器起到的boot作用详解
    处理器boot的简单概念及误区
    搬砖两年感受
    操作系统方面的两本好书
  • 原文地址:https://www.cnblogs.com/liuchengchuxiao/p/4246155.html
Copyright © 2011-2022 走看看