源代码https://github.com/jimingkang/news5pv210/tree/master/u-boot-2013.10
参考 https://github.com/jimingkang/news5pv210/tree/master/aston_u-boot-2013.10
A)改动文件:
modified: u-boot-2013.10/include/configs/s5p_goni.h
modified: u-boot-2013.10/board/samsung/goni/goni.c
modified: u-boot-2013.10/net/eth.c
1)s5p_goni.h中添加net相关配置:
//#define CONFIG_CMD_NET // 添加网络支持 ,这里不需要,因为在config_default_cmd.h中已经有了
#define CONFIG_CMD_PING // 添加ping命令支持
#define DM9000_16BIT_DATA
#define CONFIG_DRIVER_DM9000 1
#ifdef CONFIG_DRIVER_DM9000
//#define CONFIG_DM9000_BASE (0xA8000000)
#define CONFIG_DM9000_BASE (0x88000300)
#define DM9000_IO (CONFIG_DM9000_BASE)
#if defined(DM9000_16BIT_DATA)
//#define DM9000_DATA (CONFIG_DM9000_BASE+2)
#define DM9000_DATA (CONFIG_DM9000_BASE+4)
#else
#define DM9000_DATA (CONFIG_DM9000_BASE+1)
#endif
#endif
//jimmy comment #undef CONFIG_CMD_NET //记得把这行注释
2)goni.c
static void dm9000_pre_init(void)
{
unsigned int tmp;
#if defined(DM9000_16BIT_DATA)
// SROM_BW_REG &= ~(0xf << 20);
// SROM_BW_REG |= (0<<23) | (0<<22) | (0<<21) | (1<<20);
SROM_BW_REG &= ~(0xf << 4);
SROM_BW_REG |= (1<<7) | (1<<6) | (1<<5) | (1<<4);
#else
SROM_BW_REG &= ~(0xf << 20);
SROM_BW_REG |= (0<<19) | (0<<18) | (0<<16);
#endif
// SROM_BC5_REG = ((0<<28)|(1<<24)|(5<<16)|(1<<12)|(4<<8)|(6<<4)|(0<<0));
SROM_BC1_REG = ((0<<28)|(1<<24)|(5<<16)|(1<<12)|(4<<8)|(6<<4)|(0<<0));
tmp = MP01CON_REG;
// tmp &=~(0xf<<20);
// tmp |=(2<<20);
tmp &=~(0xf<<4);
tmp |=(2<<4);
MP01CON_REG = tmp;
}
int board_init(void)
{
/* Set Initial global variables */
s5pc110_gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE;
gd->bd->bi_arch_number = MACH_TYPE_SMDKV210; // 在这里更改
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
// 添加网卡初始化
#ifdef CONFIG_DRIVER_DM9000
dm9000_pre_init();
#endif
return 0;
}
3) eth.c
extern int dm9000_initialize(bd_t *bis);
// 自己定义一个board_eth_init函数,做网卡驱动添加工作
static int board_eth_init(bd_t *bis)
{
return dm9000_initialize(bis); //设置eth_device
注销下面一行,否则编译不过
//int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
B)烧写启动
》./sd_fusing.sh /dev/sdb
uboot输出
---------------------------------------------------------
Goni # ping 131.128.52.96
dm9000 i/o: 0x88000300, 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 131.128.52.96 is alive