11bc15386SPeter TyserThis is the readme for the Das U-Boot standalone program smc91111 21bc15386SPeter Tyser 31bc15386SPeter TyserThe main purpose of this is to manage MAC addresses on platforms 41bc15386SPeter Tyserwhich include the SMC91111 integrated 10/100 MAC Phy, with attached 51bc15386SPeter TyserEEPROMs. 61bc15386SPeter Tyser 71bc15386SPeter Tyser 81bc15386SPeter TyserContents: 91bc15386SPeter Tyser------------------------ 10*a187559eSBin Meng1. Ensuring U-Boot's MAC address can be set in hardware 111bc15386SPeter Tyser2. Running the smc91111_eeprom program 121bc15386SPeter Tyser3. Setting MAC addresses 131bc15386SPeter Tyser4. Other things you can do with this 141bc15386SPeter Tyser5. Things to be done. 151bc15386SPeter Tyser 161bc15386SPeter Tyser 17*a187559eSBin Meng1. Ensuring U-Boot's MAC address can be set in hardware 181bc15386SPeter Tyser-------------------------------------------------------------------------- 191bc15386SPeter Tyser 201bc15386SPeter TyserOn the Internet - MAC addresses are very important. Short for Media 211bc15386SPeter TyserAccess Control address, a hardware address that uniquely identifies 221bc15386SPeter Tysereach node of a network. When things are not unique - bad things 231bc15386SPeter Tysercan happen. This is why U-Boot makes it difficult to change MAC 241bc15386SPeter Tyseraddresses. 251bc15386SPeter Tyser 261bc15386SPeter TyserTo find out who has a MAC address, or to purchase MAC addresses, goto 271bc15386SPeter Tyserthe IEEE, at: 281bc15386SPeter Tyserhttp://standards.ieee.org/regauth/oui/index.shtml 291bc15386SPeter Tyser 301bc15386SPeter Tyser2. Running the smc91111_eeprom program 311bc15386SPeter Tyser--------------------------------------------------------------------- 321bc15386SPeter Tyser 331bc15386SPeter TyserAfter Uboot is compiled, there should be three files of interest: 341bc15386SPeter Tyser-rwxr-xr-x 1 8806 2004-10-11 14:00 smc91111_eeprom <- ELF 351bc15386SPeter Tyser-rwxr-xr-x 1 3440 2004-10-11 14:00 smc91111_eeprom.bin <- BIN 361bc15386SPeter Tyser-rwxr-xr-x 1 9524 2004-10-11 14:00 smc91111_eeprom.srec <- SREC 371bc15386SPeter Tyser 381bc15386SPeter Tyserif there is not, check the examples/Makefile, and ensure there is something 391bc15386SPeter Tyserlike for your architecture: 401bc15386SPeter Tyser 411bc15386SPeter Tyser ifeq ($(ARCH),blackfin) 421bc15386SPeter Tyser SREC += smc91111_eeprom.srec 431bc15386SPeter Tyser BIN += smc91111_eeprom.bin smc91111_eeprom 441bc15386SPeter Tyser endif 451bc15386SPeter Tyser 461bc15386SPeter TyserTo load the files: there are two methods: a) serial or b) network. Since 471bc15386SPeter Tyserit is not a good idea to start doing things on the network before the 481bc15386SPeter TyserMAC address is set, this example will do things over serial. 491bc15386SPeter Tyser 501bc15386SPeter Tysera) Loading the elf file via the serial port 511bc15386SPeter Tyser-------------------------------------------- 521bc15386SPeter TyserLoading the elf is very easy - just ensure that the location 531bc15386SPeter Tyseryou specify things to load as is not the load address specified 541bc15386SPeter Tyserin the Makefile. 551bc15386SPeter Tyser 561bc15386SPeter TyserBOOT> loadb 0x1000000 571bc15386SPeter Tyser 581bc15386SPeter Tyser## Ready for binary (kermit) download to 0x01000000 at 57600 bps... 591bc15386SPeter Tyser 601bc15386SPeter Tyser(type CNTL-\ then C) 611bc15386SPeter Tyser(Back at local machine) 621bc15386SPeter Tyser---------------------------------------------------- 631bc15386SPeter TyserKermit>send ~/u-boot_1.1.1/examples/smc91111_eeprom 641bc15386SPeter TyserKermit>connect 651bc15386SPeter Tyser 661bc15386SPeter TyserConnecting to /dev/ttyS0, speed 57600 671bc15386SPeter Tyser Escape character: Ctrl-\ (ASCII 28, FS): enabled 681bc15386SPeter TyserType the escape character followed by C to get back, 691bc15386SPeter Tyseror followed by ? to see other options. 701bc15386SPeter Tyser---------------------------------------------------- 711bc15386SPeter Tyser## Total Size = 0x00002266 = 8806 Bytes 721bc15386SPeter Tyser## Start Addr = 0x01000000 731bc15386SPeter Tyser 741bc15386SPeter TyserBOOT> bootelf 0x1000000 751bc15386SPeter Tyser 761bc15386SPeter TyserLoading .text @ 0x00001000 (3440 bytes) 771bc15386SPeter Tyser## Starting application at 0x000010d8 ... 781bc15386SPeter Tyser 791bc15386SPeter TyserSMC91111> 801bc15386SPeter Tyser 811bc15386SPeter Tyserb) Loading the binary file via the serial port 821bc15386SPeter Tyser----------------------------------------------- 831bc15386SPeter TyserFor many toolchains, the entry point is not the load point. 841bc15386SPeter TyserThe Load point is a hard coded address from the 851bc15386SPeter Tyserexamples/Makefile. The entry point can be found by doing something 861bc15386SPeter Tyserlike: 871bc15386SPeter Tyser 881bc15386SPeter Tyser u-boot_1.1.1/examples> bfin-elf-objdump -d smc91111_eeprom |less 891bc15386SPeter Tyser 901bc15386SPeter Tyser smc91111_eeprom: file format elf32-bfin 911bc15386SPeter Tyser 921bc15386SPeter Tyser Disassembly of section .text: 931bc15386SPeter Tyser 941bc15386SPeter Tyser 00001000 <smc91111_eeprom-0xd8>: 951bc15386SPeter Tyser 1000: 961bc15386SPeter Tyser 000010d8 <smc91111_eeprom>: 971bc15386SPeter Tyser 981bc15386SPeter TyserYou can see that the entry point (or the address that should be 991bc15386SPeter Tyserjumped to is 0x10d8). This is also the same as the entry point 1001bc15386SPeter Tyserof the elf file. 1011bc15386SPeter Tyser 1021bc15386SPeter TyserNow we load it to the actual load location: 1031bc15386SPeter Tyser 1041bc15386SPeter TyserBOOT> loadb 0x1000 1051bc15386SPeter Tyser 1061bc15386SPeter Tyser## Ready for binary (kermit) download to 0x00001000 at 57600 bps... 1071bc15386SPeter Tyser 1081bc15386SPeter Tyser(Back at pinky.dsl-only.net) 1091bc15386SPeter Tyser---------------------------------------------------- 1101bc15386SPeter TyserKermit>send /tftpboot/eeprom.bin 1111bc15386SPeter TyserKermit>connect 1121bc15386SPeter Tyser 1131bc15386SPeter TyserConnecting to /dev/ttyS0, speed 57600 1141bc15386SPeter Tyser Escape character: Ctrl-\ (ASCII 28, FS): enabled 1151bc15386SPeter TyserType the escape character followed by C to get back, 1161bc15386SPeter Tyseror followed by ? to see other options. 1171bc15386SPeter Tyser---------------------------------------------------- 1181bc15386SPeter Tyser## Total Size = 0x00000d70 = 3440 Bytes 1191bc15386SPeter Tyser## Start Addr = 0x00001000 1201bc15386SPeter Tyser 1211bc15386SPeter TyserBOOT> go 0x10D8 1221bc15386SPeter Tyser 1231bc15386SPeter Tyser## Starting application at 0x000010D8 ... 1241bc15386SPeter Tyser 1251bc15386SPeter TyserSMC91111> 1261bc15386SPeter Tyser 1271bc15386SPeter Tyser3. Setting MAC addresses 1281bc15386SPeter Tyser-------------------------------------------------------------------------- 1291bc15386SPeter Tyser 1301bc15386SPeter TyserThe MAC address can be stored in four locations: 1311bc15386SPeter Tyser 1321bc15386SPeter Tyser-Boot environmental variable in Flash <- can not change, without 133*a187559eSBin Meng re-flashing U-Boot. 1341bce2aebSRobert P. J. DayU-Boot environmental variable <- can not change, without 1351bc15386SPeter Tyser resetting board/U-Boot 1361bce2aebSRobert P. J. DayLAN91C111 Registers <- volatile 1371bce2aebSRobert P. J. DayLAN91C111 EEPROM <- Non-volatile 1381bc15386SPeter Tyser 1391bc15386SPeter TyserIf you have not activated the network, and do not have a hardcoded 140*a187559eSBin Mengor pre-assigned MAC address in U-Boot, the environmental variables 1411bc15386SPeter Tysershould be blank, and allow you to set things one time. 1421bc15386SPeter Tyser 1431bc15386SPeter TyserTo set the EEPROM MAC address to 12:34:56:78:9A:BC 1441bc15386SPeter Tyser 1451bc15386SPeter TyserSMC91111> W E 20 3412 1461bc15386SPeter Tyser 1471bc15386SPeter TyserWriting EEPROM register 20 with 3412 1481bc15386SPeter TyserSMC91111> W E 21 7856 1491bc15386SPeter Tyser 1501bc15386SPeter TyserWriting EEPROM register 21 with 7856 1511bc15386SPeter TyserSMC91111> W E 22 BC9A 1521bc15386SPeter Tyser 1531bc15386SPeter TyserWriting EEPROM register 22 with bc9a 1541bc15386SPeter TyserEEPROM contents copied to MAC 1551bc15386SPeter TyserSMC91111> P 1561bc15386SPeter Tyser 1571bc15386SPeter TyserCurrent MAC Address in SMSC91111 12:34:56:78:9a:bc 1581bc15386SPeter TyserCurrent MAC Address in EEPROM 12:34:56:78:9a:bc 1591bc15386SPeter Tyser 1601bc15386SPeter Tyser(CNTRL-C to exit) 1611bc15386SPeter TyserSMC91111> ## Application terminated, rc = 0x0 1621bc15386SPeter Tyser 1631bc15386SPeter TyserBOOT> reset 1641bc15386SPeter TyserU-Boot 1.1.1 (gcc version: 3.3.3) 1651bc15386SPeter TyserRelease Version Beta released on Oct 10 2004 - 00:34:35 1661bc15386SPeter TyserBlackfin support by LG Soft India 1671bc15386SPeter TyserFor further information please check this link http://www.blackfin.uclinux.org 1681bc15386SPeter TyserBOOT> ping 192.168.0.4 1691bc15386SPeter Tyser 1701bc15386SPeter TyserUsing MAC Address 12:34:56:78:9A:BC 1711bc15386SPeter Tyserhost 192.168.0.4 is alive 1721bc15386SPeter Tyser 1731bc15386SPeter Tyser 1741bc15386SPeter Tyser4. Other things that you can do 1751bc15386SPeter Tyser-------------------------------------------------------------------------- 1761bc15386SPeter TyserAfter the stand alone application is running, there are a few options: 1771bc15386SPeter Tyser - P : Print the MAC 1781bc15386SPeter Tyser - D : Dump the LAN91C111 EEPROM contents 1791bc15386SPeter Tyser - M : Dump the LAN91C111 MAC contents 1801bc15386SPeter Tyser - C : Copies the MAC address from the EEPROM to the LAN91C111 1811bc15386SPeter Tyser - W : Write a register in the EEPROM or in the MAC 1821bc15386SPeter Tyser 1831bc15386SPeter TyserSMC91111> P 1841bc15386SPeter Tyser 1851bc15386SPeter TyserCurrent MAC Address in SMSC91111 12:34:56:78:9a:bc 1861bc15386SPeter TyserCurrent MAC Address in EEPROM 12:34:56:78:9a:bc 1871bc15386SPeter Tyser 1881bc15386SPeter TyserSMC91111> D 1891bc15386SPeter Tyser 1901bc15386SPeter TyserIOS2-0 000 001 002 003 004 005 006 007 1911bc15386SPeter TyserCONFIG 00:ffff 04:ffff 08:ffff 0c:ffff 10:ffff 14:ffff 18:ffff 1c:ffff 1921bc15386SPeter TyserBASE 01:ffff 05:ffff 09:ffff 0d:ffff 11:ffff 15:ffff 19:ffff 1d:ffff 1931bc15386SPeter Tyser 02:ffff 06:ffff 0a:ffff 0e:0020 12:ffff 16:ffff 1a:ffff 1e:ffff 1941bc15386SPeter Tyser 03:ffff 07:ffff 0b:ffff 0f:ffff 13:ffff 17:ffff 1b:ffff 1f:ffff 1951bc15386SPeter Tyser 1961bc15386SPeter Tyser20:3412 21:7856 22:bc9a 23:ffff 24:ffff 25:ffff 26:ffff 27:ffff 1971bc15386SPeter Tyser28:ffff 29:ffff 2a:ffff 2b:ffff 2c:ffff 2d:ffff 2e:ffff 2f:ffff 1981bc15386SPeter Tyser30:ffff 31:ffff 32:ffff 33:ffff 34:ffff 35:ffff 36:ffff 37:ffff 1991bc15386SPeter Tyser38:ffff 39:ffff 3a:ffff 3b:ffff 3c:ffff 3d:ffff 3e:ffff 3f:ffff 2001bc15386SPeter Tyser 2011bc15386SPeter TyserSMC91111> M 2021bc15386SPeter Tyser 2031bc15386SPeter Tyser Bank0 Bank1 Bank2 Bank3 2041bc15386SPeter Tyser00 0000 a0b1 3332 0000 2051bc15386SPeter Tyser02 0000 1801 8000 0000 2061bc15386SPeter Tyser04 0000 3412 8080 0000 2071bc15386SPeter Tyser06 0000 7856 003f 0000 2081bc15386SPeter Tyser08 0404 bc9a 02df 3332 2091bc15386SPeter Tyser0a 0000 ffff 02df 3391 2101bc15386SPeter Tyser0c 0000 1214 0004 001f 2111bc15386SPeter Tyser0e 3300 3301 3302 3303 2121bc15386SPeter Tyser 2131bc15386SPeter TyserSMC91111> C 2141bc15386SPeter Tyser 2151bc15386SPeter TyserEEPROM contents copied to MAC 2161bc15386SPeter Tyser 2171bc15386SPeter TyserSMC91111> W E 2A ABCD 2181bc15386SPeter Tyser 2191bc15386SPeter TyserWriting EEPROM register 2a with abcd 2201bc15386SPeter Tyser 2211bc15386SPeter TyserSMC91111> W M 14 FF00 2221bc15386SPeter Tyser 2231bc15386SPeter TyserWriting MAC register bank 1, reg 04 with ff00 224