1*4882a593SmuzhiyunThis is the readme for the Das U-Boot standalone program smc91111 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunThe main purpose of this is to manage MAC addresses on platforms 4*4882a593Smuzhiyunwhich include the SMC91111 integrated 10/100 MAC Phy, with attached 5*4882a593SmuzhiyunEEPROMs. 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunContents: 9*4882a593Smuzhiyun------------------------ 10*4882a593Smuzhiyun1. Ensuring U-Boot's MAC address can be set in hardware 11*4882a593Smuzhiyun2. Running the smc91111_eeprom program 12*4882a593Smuzhiyun3. Setting MAC addresses 13*4882a593Smuzhiyun4. Other things you can do with this 14*4882a593Smuzhiyun5. Things to be done. 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun1. Ensuring U-Boot's MAC address can be set in hardware 18*4882a593Smuzhiyun-------------------------------------------------------------------------- 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunOn the Internet - MAC addresses are very important. Short for Media 21*4882a593SmuzhiyunAccess Control address, a hardware address that uniquely identifies 22*4882a593Smuzhiyuneach node of a network. When things are not unique - bad things 23*4882a593Smuzhiyuncan happen. This is why U-Boot makes it difficult to change MAC 24*4882a593Smuzhiyunaddresses. 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunTo find out who has a MAC address, or to purchase MAC addresses, goto 27*4882a593Smuzhiyunthe IEEE, at: 28*4882a593Smuzhiyunhttp://standards.ieee.org/regauth/oui/index.shtml 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun2. Running the smc91111_eeprom program 31*4882a593Smuzhiyun--------------------------------------------------------------------- 32*4882a593Smuzhiyun 33*4882a593SmuzhiyunAfter Uboot is compiled, there should be three files of interest: 34*4882a593Smuzhiyun-rwxr-xr-x 1 8806 2004-10-11 14:00 smc91111_eeprom <- ELF 35*4882a593Smuzhiyun-rwxr-xr-x 1 3440 2004-10-11 14:00 smc91111_eeprom.bin <- BIN 36*4882a593Smuzhiyun-rwxr-xr-x 1 9524 2004-10-11 14:00 smc91111_eeprom.srec <- SREC 37*4882a593Smuzhiyun 38*4882a593Smuzhiyunif there is not, check the examples/Makefile, and ensure there is something 39*4882a593Smuzhiyunlike for your architecture: 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun ifeq ($(ARCH),blackfin) 42*4882a593Smuzhiyun SREC += smc91111_eeprom.srec 43*4882a593Smuzhiyun BIN += smc91111_eeprom.bin smc91111_eeprom 44*4882a593Smuzhiyun endif 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunTo load the files: there are two methods: a) serial or b) network. Since 47*4882a593Smuzhiyunit is not a good idea to start doing things on the network before the 48*4882a593SmuzhiyunMAC address is set, this example will do things over serial. 49*4882a593Smuzhiyun 50*4882a593Smuzhiyuna) Loading the elf file via the serial port 51*4882a593Smuzhiyun-------------------------------------------- 52*4882a593SmuzhiyunLoading the elf is very easy - just ensure that the location 53*4882a593Smuzhiyunyou specify things to load as is not the load address specified 54*4882a593Smuzhiyunin the Makefile. 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunBOOT> loadb 0x1000000 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun## Ready for binary (kermit) download to 0x01000000 at 57600 bps... 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun(type CNTL-\ then C) 61*4882a593Smuzhiyun(Back at local machine) 62*4882a593Smuzhiyun---------------------------------------------------- 63*4882a593SmuzhiyunKermit>send ~/u-boot_1.1.1/examples/smc91111_eeprom 64*4882a593SmuzhiyunKermit>connect 65*4882a593Smuzhiyun 66*4882a593SmuzhiyunConnecting to /dev/ttyS0, speed 57600 67*4882a593Smuzhiyun Escape character: Ctrl-\ (ASCII 28, FS): enabled 68*4882a593SmuzhiyunType the escape character followed by C to get back, 69*4882a593Smuzhiyunor followed by ? to see other options. 70*4882a593Smuzhiyun---------------------------------------------------- 71*4882a593Smuzhiyun## Total Size = 0x00002266 = 8806 Bytes 72*4882a593Smuzhiyun## Start Addr = 0x01000000 73*4882a593Smuzhiyun 74*4882a593SmuzhiyunBOOT> bootelf 0x1000000 75*4882a593Smuzhiyun 76*4882a593SmuzhiyunLoading .text @ 0x00001000 (3440 bytes) 77*4882a593Smuzhiyun## Starting application at 0x000010d8 ... 78*4882a593Smuzhiyun 79*4882a593SmuzhiyunSMC91111> 80*4882a593Smuzhiyun 81*4882a593Smuzhiyunb) Loading the binary file via the serial port 82*4882a593Smuzhiyun----------------------------------------------- 83*4882a593SmuzhiyunFor many toolchains, the entry point is not the load point. 84*4882a593SmuzhiyunThe Load point is a hard coded address from the 85*4882a593Smuzhiyunexamples/Makefile. The entry point can be found by doing something 86*4882a593Smuzhiyunlike: 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun u-boot_1.1.1/examples> bfin-elf-objdump -d smc91111_eeprom |less 89*4882a593Smuzhiyun 90*4882a593Smuzhiyun smc91111_eeprom: file format elf32-bfin 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun Disassembly of section .text: 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun 00001000 <smc91111_eeprom-0xd8>: 95*4882a593Smuzhiyun 1000: 96*4882a593Smuzhiyun 000010d8 <smc91111_eeprom>: 97*4882a593Smuzhiyun 98*4882a593SmuzhiyunYou can see that the entry point (or the address that should be 99*4882a593Smuzhiyunjumped to is 0x10d8). This is also the same as the entry point 100*4882a593Smuzhiyunof the elf file. 101*4882a593Smuzhiyun 102*4882a593SmuzhiyunNow we load it to the actual load location: 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunBOOT> loadb 0x1000 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun## Ready for binary (kermit) download to 0x00001000 at 57600 bps... 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun(Back at pinky.dsl-only.net) 109*4882a593Smuzhiyun---------------------------------------------------- 110*4882a593SmuzhiyunKermit>send /tftpboot/eeprom.bin 111*4882a593SmuzhiyunKermit>connect 112*4882a593Smuzhiyun 113*4882a593SmuzhiyunConnecting to /dev/ttyS0, speed 57600 114*4882a593Smuzhiyun Escape character: Ctrl-\ (ASCII 28, FS): enabled 115*4882a593SmuzhiyunType the escape character followed by C to get back, 116*4882a593Smuzhiyunor followed by ? to see other options. 117*4882a593Smuzhiyun---------------------------------------------------- 118*4882a593Smuzhiyun## Total Size = 0x00000d70 = 3440 Bytes 119*4882a593Smuzhiyun## Start Addr = 0x00001000 120*4882a593Smuzhiyun 121*4882a593SmuzhiyunBOOT> go 0x10D8 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun## Starting application at 0x000010D8 ... 124*4882a593Smuzhiyun 125*4882a593SmuzhiyunSMC91111> 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun3. Setting MAC addresses 128*4882a593Smuzhiyun-------------------------------------------------------------------------- 129*4882a593Smuzhiyun 130*4882a593SmuzhiyunThe MAC address can be stored in four locations: 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun-Boot environmental variable in Flash <- can not change, without 133*4882a593Smuzhiyun re-flashing U-Boot. 134*4882a593SmuzhiyunU-Boot environmental variable <- can not change, without 135*4882a593Smuzhiyun resetting board/U-Boot 136*4882a593SmuzhiyunLAN91C111 Registers <- volatile 137*4882a593SmuzhiyunLAN91C111 EEPROM <- Non-volatile 138*4882a593Smuzhiyun 139*4882a593SmuzhiyunIf you have not activated the network, and do not have a hardcoded 140*4882a593Smuzhiyunor pre-assigned MAC address in U-Boot, the environmental variables 141*4882a593Smuzhiyunshould be blank, and allow you to set things one time. 142*4882a593Smuzhiyun 143*4882a593SmuzhiyunTo set the EEPROM MAC address to 12:34:56:78:9A:BC 144*4882a593Smuzhiyun 145*4882a593SmuzhiyunSMC91111> W E 20 3412 146*4882a593Smuzhiyun 147*4882a593SmuzhiyunWriting EEPROM register 20 with 3412 148*4882a593SmuzhiyunSMC91111> W E 21 7856 149*4882a593Smuzhiyun 150*4882a593SmuzhiyunWriting EEPROM register 21 with 7856 151*4882a593SmuzhiyunSMC91111> W E 22 BC9A 152*4882a593Smuzhiyun 153*4882a593SmuzhiyunWriting EEPROM register 22 with bc9a 154*4882a593SmuzhiyunEEPROM contents copied to MAC 155*4882a593SmuzhiyunSMC91111> P 156*4882a593Smuzhiyun 157*4882a593SmuzhiyunCurrent MAC Address in SMSC91111 12:34:56:78:9a:bc 158*4882a593SmuzhiyunCurrent MAC Address in EEPROM 12:34:56:78:9a:bc 159*4882a593Smuzhiyun 160*4882a593Smuzhiyun(CNTRL-C to exit) 161*4882a593SmuzhiyunSMC91111> ## Application terminated, rc = 0x0 162*4882a593Smuzhiyun 163*4882a593SmuzhiyunBOOT> reset 164*4882a593SmuzhiyunU-Boot 1.1.1 (gcc version: 3.3.3) 165*4882a593SmuzhiyunRelease Version Beta released on Oct 10 2004 - 00:34:35 166*4882a593SmuzhiyunBlackfin support by LG Soft India 167*4882a593SmuzhiyunFor further information please check this link http://www.blackfin.uclinux.org 168*4882a593SmuzhiyunBOOT> ping 192.168.0.4 169*4882a593Smuzhiyun 170*4882a593SmuzhiyunUsing MAC Address 12:34:56:78:9A:BC 171*4882a593Smuzhiyunhost 192.168.0.4 is alive 172*4882a593Smuzhiyun 173*4882a593Smuzhiyun 174*4882a593Smuzhiyun4. Other things that you can do 175*4882a593Smuzhiyun-------------------------------------------------------------------------- 176*4882a593SmuzhiyunAfter the stand alone application is running, there are a few options: 177*4882a593Smuzhiyun - P : Print the MAC 178*4882a593Smuzhiyun - D : Dump the LAN91C111 EEPROM contents 179*4882a593Smuzhiyun - M : Dump the LAN91C111 MAC contents 180*4882a593Smuzhiyun - C : Copies the MAC address from the EEPROM to the LAN91C111 181*4882a593Smuzhiyun - W : Write a register in the EEPROM or in the MAC 182*4882a593Smuzhiyun 183*4882a593SmuzhiyunSMC91111> P 184*4882a593Smuzhiyun 185*4882a593SmuzhiyunCurrent MAC Address in SMSC91111 12:34:56:78:9a:bc 186*4882a593SmuzhiyunCurrent MAC Address in EEPROM 12:34:56:78:9a:bc 187*4882a593Smuzhiyun 188*4882a593SmuzhiyunSMC91111> D 189*4882a593Smuzhiyun 190*4882a593SmuzhiyunIOS2-0 000 001 002 003 004 005 006 007 191*4882a593SmuzhiyunCONFIG 00:ffff 04:ffff 08:ffff 0c:ffff 10:ffff 14:ffff 18:ffff 1c:ffff 192*4882a593SmuzhiyunBASE 01:ffff 05:ffff 09:ffff 0d:ffff 11:ffff 15:ffff 19:ffff 1d:ffff 193*4882a593Smuzhiyun 02:ffff 06:ffff 0a:ffff 0e:0020 12:ffff 16:ffff 1a:ffff 1e:ffff 194*4882a593Smuzhiyun 03:ffff 07:ffff 0b:ffff 0f:ffff 13:ffff 17:ffff 1b:ffff 1f:ffff 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun20:3412 21:7856 22:bc9a 23:ffff 24:ffff 25:ffff 26:ffff 27:ffff 197*4882a593Smuzhiyun28:ffff 29:ffff 2a:ffff 2b:ffff 2c:ffff 2d:ffff 2e:ffff 2f:ffff 198*4882a593Smuzhiyun30:ffff 31:ffff 32:ffff 33:ffff 34:ffff 35:ffff 36:ffff 37:ffff 199*4882a593Smuzhiyun38:ffff 39:ffff 3a:ffff 3b:ffff 3c:ffff 3d:ffff 3e:ffff 3f:ffff 200*4882a593Smuzhiyun 201*4882a593SmuzhiyunSMC91111> M 202*4882a593Smuzhiyun 203*4882a593Smuzhiyun Bank0 Bank1 Bank2 Bank3 204*4882a593Smuzhiyun00 0000 a0b1 3332 0000 205*4882a593Smuzhiyun02 0000 1801 8000 0000 206*4882a593Smuzhiyun04 0000 3412 8080 0000 207*4882a593Smuzhiyun06 0000 7856 003f 0000 208*4882a593Smuzhiyun08 0404 bc9a 02df 3332 209*4882a593Smuzhiyun0a 0000 ffff 02df 3391 210*4882a593Smuzhiyun0c 0000 1214 0004 001f 211*4882a593Smuzhiyun0e 3300 3301 3302 3303 212*4882a593Smuzhiyun 213*4882a593SmuzhiyunSMC91111> C 214*4882a593Smuzhiyun 215*4882a593SmuzhiyunEEPROM contents copied to MAC 216*4882a593Smuzhiyun 217*4882a593SmuzhiyunSMC91111> W E 2A ABCD 218*4882a593Smuzhiyun 219*4882a593SmuzhiyunWriting EEPROM register 2a with abcd 220*4882a593Smuzhiyun 221*4882a593SmuzhiyunSMC91111> W M 14 FF00 222*4882a593Smuzhiyun 223*4882a593SmuzhiyunWriting MAC register bank 1, reg 04 with ff00 224