Forum Discussion
Altera_Forum
Honored Contributor
20 years agoHi posix6973,
Ok, I think I found the problem ... but I have no way of testing since I don't have a board with a DM9000 ... so I'll leave that up to you ;-). The problem is in dm9000.c, eth_init routine, starting at line 303:<div class='quotetop'>QUOTE </div> --- Quote Start --- for (i = 0; i < 6; i++) ((u16 *) bd->bi_enetaddr) = read_srom_word(i);printf("mac: %02x:%02x:%02x:%02x:%02x:%02x\n", bd->bi_enetaddr[0],
bd->bi_enetaddr[1], bd->bi_enetaddr[2], bd->bi_enetaddr[3],
bd->bi_enetaddr[4], bd->bi_enetaddr[5]);
for (i = 0, oft = 0x10; i < 6; i++, oft++)
dm9000_iow(oft, bd->bi_enetaddr); for (i = 0, oft = 0x16; i < 8; i++, oft++) DM9000_iow(oft, 0xff);[/b] --- Quote End --- This is pretty brain-damaged ... and also explains why the baudrate gets corrupted as well ... as the 16-bit writes spill over into the baudrate field of the board info struct. You have a few choices here: 1. If you're not using an eeprom with your DM9000, just remove the for statement -- the driver should not be copying the MAC address into the bd struct if there is no eeprom anyway. 2. If you are using an eeprom, you will have to rewrite the code to unpack the 16-bit values into the bd struct. Maybe something like the following will do:<div class='quotetop'>QUOTE </div> --- Quote Start --- for (i = 0; i < 3; i++) { u16 val = read_srom_word (i); bd->bi_enetaddr)[(i<<1)] = val >>8 bd->bi_enetaddr)[(i<<1)+1] = val & 0x0ff; }[/b] --- Quote End --- You will, of course, have to decide if the eeprom MAC address, or the environment MAC address (if present) should be used. In general, if the user programs a MAC address (ethaddr) into the environment (which is copied into the bd struct at startup), it should be used. If the user wants to use the eeprom MAC address, the ethaddr env variable should not be defined. Based on the output you posted, you don't have an eeprom (or it is not programmed). Regardless, a patch should be submitted to the u-boot project. If you need help with this just contact me via email. Regards, --Scott