将DM9000编译进u-boot,在Makefile (u-boot-2016.05\drivers\net) 中添加
obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o同时,在Smdk2440.h (u-boot-2016.05\include\configs)中定义CONFIG_DRIVER_DM9000,同时屏蔽掉CS8900相关信息。
/*
* Hardware drivers
*/
#define CONFIG_DRIVER_DM9000
//#define CONFIG_CS8900/* we have a CS8900 on-board */
//#define CONFIG_CS8900_BASE0x19000300
//#define CONFIG_CS8900_BUS16/* the Linux driver does accesses as shorts */
编译,出现BUG“DM9000_DATA ” is not define,仿照At91sam9260ek.h (u-boot-2016.05\include\configs)DM9000的相关配置,在Smdk2440.h (u-boot-2016.05\include\configs)配置
/*
* Hardware drivers
*/
#define CONFIG_DRIVER_DM9000
#define CONFIG_DM9000_BASE 0x20000000
#define DM9000_IOCONFIG_DM9000_BASE
#define DM9000_DATA(CONFIG_DM9000_BASE + 0x4)
编译烧录,
U-Boot 2016.05 (Jul 21 2017 - 12:13:39 +0800)
initcall: 3200f108
U-Boot code: 32000000 -> 3207DA14 BSS: -> 320CD068
initcall: 3200038c
CPUID: 32440001
FCLK: 405.600 MHz
HCLK: 101.400 MHz
PCLK: 50.700 MHz
initcall: 3200f360
DRAM: initcall: 3200116c
initcall: 3200f2b0
Monitor len: 000CD068
Ram size: 04000000
Ram top: 34000000
initcall: 3200eee4
initcall: 3200f0b0
TLB table from 33ff0000 to 33ff4000
initcall: 3200eefc
initcall: 3200f064
Reserving 820k for U-Boot at: 33f22000
initcall: 3200f038
Reserving 4160k for malloc() at: 33b12000
initcall: 3200f264
Reserving 80 Bytes for Board Info at: 33b11fb0
initcall: 3200ef04
initcall: 3200f004
Reserving 168 Bytes for Global Data at: 33b11f08
initcall: 3200ef8c
initcall: 3200ef38
initcall: 3200ef0c
initcall: 3200f350
initcall: 3200f1dc
RAM Configuration:
Bank #0: 30000000 64 MiB
DRAM: 64 MiB
initcall: 3200ef70
New Stack Pointer is: 33b11ee0
initcall: 3200f1a0
initcall: 3200f134
Relocation Offset is: 01f22000
Relocating to 33f22000, new gd at 33b11f08, sp at 33b11ee0
initcall: 33f313dc
initcall: 33f313e4
initcall: 3200f5c8 (relocated to 33f315c8)
WARNING: Caches not enabled
initcall: 3200f3fc (relocated to 33f313fc)
initcall: 3200f424 (relocated to 33f31424)
initcall: 3200f5ac (relocated to 33f315ac)
using memory 0x33b12000-0x33f22000 for malloc()
malloc_bin_reloc() before;
malloc_bin_reloc() after;
initcall: 3200f42c (relocated to 33f3142c)
initcall: 3200f3b8 (relocated to 33f313b8)
initcall: 3200f598 (relocated to 33f31598)
initcall: 3200119c (relocated to 33f2319c)
initcall: 3201815c (relocated to 33f3a15c)
initcall: 3200f588 (relocated to 33f31588)
initcall: 3200f4f0 (relocated to 33f314f0)
Now running in RAM - U-Boot at: 33f22000
initcall: 3200f434 (relocated to 33f31434)
initcall: 3200f50c (relocated to 33f3150c)
Flash: fwc addr 00000000 cmd f0 00f0 16bit x 16 bit
fwc addr 0000aaaa cmd aa 00aa 16bit x 16 bit
fwc addr 00005554 cmd 55 0055 16bit x 16 bit
fwc addr 0000aaaa cmd 90 0090 16bit x 16 bit
fwc addr 00000000 cmd f0 00f0 16bit x 16 bit
JEDEC PROBE: ID 1c 2249 0
fwc addr 00000000 cmd ff 00ff 16bit x 16 bit
fwc addr 00000000 cmd 90 0090 16bit x 16 bit
fwc addr 00000000 cmd ff 00ff 16bit x 16 bit
JEDEC PROBE: ID 16 ea00 0
0 Bytes
initcall: 3200f4d4 (relocated to 33f314d4)
NAND: board_nand_init()
end of nand_init
hwcontrol(): 0xff 0x83
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0x90 0x83
hwcontrol(): 0x00 0x85
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0x90 0x83
hwcontrol(): 0x00 0x85
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0x90 0x83
hwcontrol(): 0x40 0x85
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0xffffffff 0x80
0 MiB
initcall: 3200f4a4 (relocated to 33f314a4)
*** Warning - bad CRC, using default environment
Destroy Hash Table: 33f9a228 table = 00000000
Create Hash Table: N=75
INSERT: table 33f9a228, filled 1/79 rv 33b12240 ==> name="bootdelay" value="5"
INSERT: table 33f9a228, filled 2/79 rv 33b12100 ==> name="baudrate" value="115200"
INSERT: table 33f9a228, filled 3/79 rv 33b120b0 ==> name="ipaddr" value="192.168.1.3"
INSERT: table 33f9a228, filled 4/79 rv 33b12268 ==> name="serverip" value="192.168.1.135"
INSERT: table 33f9a228, filled 5/79 rv 33b124fc ==> name="netmask" value="255.255.255.0"
INSERT: free(data = 33b12008)
INSERT: done
initcall: 3200f3cc (relocated to 33f313cc)
initcall: 3201821c (relocated to 33f3a21c)
initcall: 3200f494 (relocated to 33f31494)
initcall: 32015cf8 (relocated to 33f37cf8)
Initial value for argc=3
Final value for argc=3
Initial value for argc=3
Final value for argc=3
Initial value for argc=3
Final value for argc=3
initcall: 32000bb0 (relocated to 33f22bb0)
initcall: 3200f484 (relocated to 33f31484)
initcall: 3200f464 (relocated to 33f31464)
initcall: 3200f448 (relocated to 33f31448)
Net: No ethernet found.
initcall: 3200f43c (relocated to 33f3143c)
### main_loop entered: bootdelay=5
### main_loop: bootcmd="<UNDEFINED>"
同时,也是ping不上虚拟机地址,搜索“Net: ”Board_r.c (u-boot-2016.05\common)initr_net() 定位到Eth_legacy.c eth_initialize() ->smdk2440.c board_eth_init()
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;
}
添加dm9000的相关配置,编译烧录。
Destroy Hash Table: 33f9a558 table = 00000000
Create Hash Table: N=75
INSERT: table 33f9a558, filled 1/79 rv 33b11240 ==> name="bootdelay" value="5"
INSERT: table 33f9a558, filled 2/79 rv 33b11100 ==> name="baudrate" value="115200"
INSERT: table 33f9a558, filled 3/79 rv 33b110b0 ==> name="ipaddr" value="192.168.1.3"
INSERT: table 33f9a558, filled 4/79 rv 33b11268 ==> name="serverip" value="192.168.1.135"
INSERT: table 33f9a558, filled 5/79 rv 33b114fc ==> name="netmask" value="255.255.255.0"
INSERT: free(data = 33b11008)
INSERT: done
initcall: 3200f3c8 (relocated to 33f303c8)
initcall: 32018218 (relocated to 33f39218)
initcall: 3200f490 (relocated to 33f30490)
initcall: 32015cf4 (relocated to 33f36cf4)
Initial value for argc=3
Final value for argc=3
Initial value for argc=3
Final value for argc=3
Initial value for argc=3
Final value for argc=3
initcall: 32000bb0 (relocated to 33f21bb0)
initcall: 3200f480 (relocated to 33f30480)
initcall: 3200f460 (relocated to 33f30460)
initcall: 3200f444 (relocated to 33f30444)
Net: Initial value for argc=3
Final value for argc=3
dm9000
initcall: 3200f438 (relocated to 33f30438)
### main_loop entered: bootdelay=5
### main_loop: bootcmd="<UNDEFINED>"
SMDK2440 # ping 192.168.1.135
Trying dm9000
dm9000 i/o: 0x20000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: ff:ff:ff:ff:ff:ff
WARNING: Bad MAC address (uninitialized EEPROM?)
could not establish link
Using dm9000 device
host 192.168.1.135 is alive
对于“MAC: ff:ff:ff:ff:ff:ff”这个问题,在dm9000x.c自定义
printf("MAC: %pM\n", dev->enetaddr);
if (!is_valid_ethaddr(dev->enetaddr)) {
printf("WARNING: Bad MAC address (uninitialized EEPROM?)\n");
}
#if defined(CONFIG_S3C2440)
printf("Now use the default MAC address: 10:32:54:76:98:ba\n");
dev->enetaddr[0] = 0x10;
dev->enetaddr[1] = 0x32;
dev->enetaddr[2] = 0x54;
dev->enetaddr[3] = 0x76;
dev->enetaddr[4] = 0x98;
dev->enetaddr[5] = 0xba;
#endif
/* fill device MAC address registers */
for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
DM9000_iow(oft, dev->enetaddr[i]);
for (i = 0, oft = 0x16; i < 8; i++, oft++)
DM9000_iow(oft, 0xff);
散花完结。