FS_S5PC100 UBOOT2011.12移植,支持DM9000

在uboot中已经支持了DM9000
驱动代码在drivers/net/目录下的
dm9000x.c  dm9000x.h

修改include/configs/smdkc100.h 文件,注释掉SMC911X的支持,添加对DM9000的支持
//#define CONFIG_SMC911X         1       /* we have a SMC9115 on-board   */
//#define CONFIG_SMC911X_16_BIT  1       /* SMC911X_16_BIT Mode          */
//#define CONFIG_SMC911X_BASE    0x98800300      /* SMC911X Drive Base   */
在下面添加DM9000的支持
#define CONFIG_CMD_PING                 1
#define CONFIG_DRIVER_DM9000   1                    /*add by yangshuo*/
#define CONFIG_DM9000_BASE 0x88000300   //comment by yangshuo
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA (CONFIG_DM9000_BASE + 4)
#define CONFIG_DM9000_USE_16BIT
#define CONFIG_DM9000_NO_SROM   1
#define CONFIG_ETHADDR  11:22:33:44:55:66
#define CONFIG_IPADDR   192.168.1.200
#define CONFIG_SERVERIP 192.168.1.100
#define CONFIG_GATEWAYIP  192.168.1.1
#define CONFIG_NETMASK  255.255.255.0


修改board/samsung/smdkc100/smdkc100.c 文件,添加DM9000的初始化
在board_eth_init(bd_t *bis) 函数中添加
#ifdef CONFIG_DRIVER_DM9000
         rc = dm9000_initialize(bis);
#endif
在当前文件board_init(void) 函数中注释掉
smc9115_pre_init();


修改arch/arm/lib/board.c 文件

eth_initialize(gd->bd);
后面添加
eth_init(gd->bd);


修改include/net.h 文件
static inline int is_multicast_ether_addr(const u8 *addr)
{
        return (0x01 == addr[0]);
}
不然启动打印
dm9000 i/o: 0x88000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:00:00:00:00:00


修改net/eth.c 文件中eth_halt(void) 函数,屏蔽掉一下两句,不然一使用DM9000就断掉网络连接
//      eth_current->halt(eth_current);
//      eth_current->state = ETH_STATE_PASSIVE;


编译下载到DDR运行,打印效果
U-Boot 2011.12 (Sep 26 2012 - 19:54:25) for SMDKC100

CPU:    S5PC100@666MHz
Board:  SMDKC100
DRAM:  256 MiB
WARNING: Caches not enabled
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dm9000
dm9000 i/o: 0x88000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 11:22:33:44:55:66
operating at 100M full duplex mode


设置一下ipaddr , 不然ping、tftp都无法使用,打印出
SMDKC100 # ping 192.168.4.120
dm9000 i/o: 0x88000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 11:22:33:44:55:66
operating at 100M full duplex mode
Using dm9000 device
ping failed; host 192.168.4.120 is not alive

//上面是我根据网上资料改的,可是当我改完后编译的时候又出现下面的问题include/configs/smdkv210.h:error:"+" may not appear in macro parameter list

原文地址:https://www.cnblogs.com/cainiaoaixuexi/p/3037173.html