(五)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
* 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
- int board_eth_init(bd_t *bis)
- {
- int rc = 0;
- #ifdef CONFIG_CS8900
- rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
- #endif
- #ifdef CONFIG_DRIVER_DM9000
- rc = dm9000_initialize(bis);
- #endif
- return rc;
- }
修改drivers/net/dm9000x.c
屏蔽掉dm9000_init函数中的这一部分,不然使用网卡的时候会报“could not establish link”的
错误。修改
- #if 0
- i = 0;
- while (!(phy_read(1) & 0x20)) { /* autonegation complete bit */
- udelay(1000);
- i++;
- if (i == 10000) {
- printf("could not establish link\n");
- return 0;
- }
- }
- #endif
屏蔽掉dm9000_halt函数中的内容:
- static void dm9000_halt(struct eth_device *netdev)
- {
- #if 0
- DM9000_DBG("%s\n", __func__);
- /* RESET devie */
- phy_write(0, 0x8000); /* PHY RESET */
- DM9000_iow(DM9000_GPR, 0x01); /* Power-Down PHY */
- DM9000_iow(DM9000_IMR, 0x80); /* Disable all interrupt */
- DM9000_iow(DM9000_RCR, 0x00); /* Disable RX */
- #endif
- }
设置开发板ip
set ipaddr 192.168.1.103
saveenv