1This is the readme for the Das U-Boot standalone program smc91111
2
3The main purpose of this is to manage MAC addresses on platforms
4which include the SMC91111 integrated 10/100 MAC Phy, with attached
5EEPROMs.
6
7
8Contents:
9------------------------
101. Ensuring U-boot's MAC address can be set in hardware
112. Running the smc91111_eeprom program
123. Setting MAC addresses
134. Other things you can do with this
145. Things to be done.
15
16
171. Ensuring U-boot's MAC address can be set in hardware
18--------------------------------------------------------------------------
19
20On the Internet - MAC addresses are very important. Short for Media
21Access Control address, a hardware address that uniquely identifies
22each node of a network. When things are not unique - bad things
23can happen.  This is why U-Boot makes it difficult to change MAC
24addresses.
25
26To find out who has a MAC address, or to purchase MAC addresses, goto
27the IEEE, at:
28http://standards.ieee.org/regauth/oui/index.shtml
29
30To change your MAC address, there can not be a MAC address predefined in
31U-Boot. To ensure that this does not occur, check your
32include/configs/<board_name>.h file, and check to see that the following
33settings are _not_ or commented out there.
34
35#define HARDCODE_MAC			1
36#define CONFIG_ETHADDR			02:80:ad:20:31:b8
37
38The purpose of HARDCODE_MAC is to hardcode the MAC address in software,
39(not what we want), or to preset it to 02:80:ad:20:31:b8 (not what we
40want either).
41
42You can check this in a running U-Boot, by doing a power cycle, then
43before U-Boot tries to do any networking, running the 'printenv' command
44
45  BOOT> printenv
46
47  ethaddr=02:80:ad:20:31:b8
48
49If you see the 'ethaddr' variable show up, like the above, you need to
50recompile U-Boot, with the above settings commented out of the
51include/configs/<board_name>.h file.
52
532. Running the smc91111_eeprom program
54---------------------------------------------------------------------
55
56After Uboot is compiled, there should be three files of interest:
57-rwxr-xr-x    1		8806 2004-10-11 14:00 smc91111_eeprom	    <- ELF
58-rwxr-xr-x    1		3440 2004-10-11 14:00 smc91111_eeprom.bin   <- BIN
59-rwxr-xr-x    1		9524 2004-10-11 14:00 smc91111_eeprom.srec  <- SREC
60
61if there is not, check the examples/Makefile, and ensure there is something
62like for your architecture:
63
64   ifeq ($(ARCH),blackfin)
65   SREC	  += smc91111_eeprom.srec
66   BIN	  += smc91111_eeprom.bin smc91111_eeprom
67   endif
68
69To load the files: there are two methods: a) serial or b) network. Since
70it is not a good idea to start doing things on the network before the
71MAC address is set, this example will do things over serial.
72
73a) Loading the elf file via the serial port
74--------------------------------------------
75Loading the elf is very easy - just ensure that the location
76you specify things to load as is not the load address specified
77in the Makefile.
78
79BOOT> loadb 0x1000000
80
81## Ready for binary (kermit) download to 0x01000000 at 57600 bps...
82
83(type CNTL-\ then C)
84(Back at local machine)
85----------------------------------------------------
86Kermit>send ~/u-boot_1.1.1/examples/smc91111_eeprom
87Kermit>connect
88
89Connecting to /dev/ttyS0, speed 57600
90 Escape character: Ctrl-\ (ASCII 28, FS): enabled
91Type the escape character followed by C to get back,
92or followed by ? to see other options.
93----------------------------------------------------
94## Total Size	   = 0x00002266 = 8806 Bytes
95## Start Addr	   = 0x01000000
96
97BOOT> bootelf 0x1000000
98
99Loading .text @ 0x00001000 (3440 bytes)
100## Starting application at 0x000010d8 ...
101
102SMC91111>
103
104b) Loading the binary file via the serial port
105-----------------------------------------------
106For many toolchains, the entry point is not the load point.
107The Load point is a hard coded address from the
108examples/Makefile. The entry point can be found by doing something
109like:
110
111  u-boot_1.1.1/examples> bfin-elf-objdump -d smc91111_eeprom |less
112
113  smc91111_eeprom:     file format elf32-bfin
114
115  Disassembly of section .text:
116
117  00001000 <smc91111_eeprom-0xd8>:
118      1000:
119  000010d8 <smc91111_eeprom>:
120
121You can see that the entry point (or the address that should be
122jumped to is 0x10d8). This is also the same as the entry point
123of the elf file.
124
125Now we load it to the actual load location:
126
127BOOT> loadb 0x1000
128
129## Ready for binary (kermit) download to 0x00001000 at 57600 bps...
130
131(Back at pinky.dsl-only.net)
132----------------------------------------------------
133Kermit>send /tftpboot/eeprom.bin
134Kermit>connect
135
136Connecting to /dev/ttyS0, speed 57600
137 Escape character: Ctrl-\ (ASCII 28, FS): enabled
138Type the escape character followed by C to get back,
139or followed by ? to see other options.
140----------------------------------------------------
141## Total Size	   = 0x00000d70 = 3440 Bytes
142## Start Addr	   = 0x00001000
143
144BOOT> go 0x10D8
145
146## Starting application at 0x000010D8 ...
147
148SMC91111>
149
1503. Setting MAC addresses
151--------------------------------------------------------------------------
152
153The MAC address can be stored in four locations:
154
155-Boot environmental variable in Flash <- can not change, without
156					  re-flashing U-boot.
157U-Boot environmental variable	       <- can not change, without
158					  resetting board/U-Boot
159LAN91C111 Registers		       <- volatile
160LAN91C111 EEPROM		       <- Non-volatile
161
162If you have not activated the network, and do not have a hardcoded
163or pre-assigned MAC address in U-boot, the environmental variables
164should be blank, and allow you to set things one time.
165
166To set the EEPROM MAC address to 12:34:56:78:9A:BC
167
168SMC91111> W E 20 3412
169
170Writing EEPROM register 20 with 3412
171SMC91111> W E 21 7856
172
173Writing EEPROM register 21 with 7856
174SMC91111> W E 22 BC9A
175
176Writing EEPROM register 22 with bc9a
177EEPROM contents copied to MAC
178SMC91111> P
179
180Current MAC Address in SMSC91111 12:34:56:78:9a:bc
181Current MAC Address in EEPROM	 12:34:56:78:9a:bc
182
183(CNTRL-C to exit)
184SMC91111> ## Application terminated, rc = 0x0
185
186BOOT> reset
187U-Boot 1.1.1 (gcc version: 3.3.3)
188Release Version Beta released on Oct 10 2004 - 00:34:35
189Blackfin support by LG Soft India
190For further information please check this link http://www.blackfin.uclinux.org
191BOOT> ping 192.168.0.4
192
193Using MAC Address 12:34:56:78:9A:BC
194host 192.168.0.4 is alive
195
196
1974. Other things that you can do
198--------------------------------------------------------------------------
199After the stand alone application is running, there are a few options:
200 - P : Print the MAC
201 - D : Dump the LAN91C111 EEPROM contents
202 - M : Dump the LAN91C111 MAC contents
203 - C : Copies the MAC address from the EEPROM to the LAN91C111
204 - W : Write a register in the EEPROM or in the MAC
205
206SMC91111> P
207
208Current MAC Address in SMSC91111 12:34:56:78:9a:bc
209Current MAC Address in EEPROM	 12:34:56:78:9a:bc
210
211SMC91111> D
212
213IOS2-0	  000	  001	  002	  003	  004	  005	  006	  007
214CONFIG 00:ffff 04:ffff 08:ffff 0c:ffff 10:ffff 14:ffff 18:ffff 1c:ffff
215BASE   01:ffff 05:ffff 09:ffff 0d:ffff 11:ffff 15:ffff 19:ffff 1d:ffff
216       02:ffff 06:ffff 0a:ffff 0e:0020 12:ffff 16:ffff 1a:ffff 1e:ffff
217       03:ffff 07:ffff 0b:ffff 0f:ffff 13:ffff 17:ffff 1b:ffff 1f:ffff
218
21920:3412 21:7856 22:bc9a 23:ffff 24:ffff 25:ffff 26:ffff 27:ffff
22028:ffff 29:ffff 2a:ffff 2b:ffff 2c:ffff 2d:ffff 2e:ffff 2f:ffff
22130:ffff 31:ffff 32:ffff 33:ffff 34:ffff 35:ffff 36:ffff 37:ffff
22238:ffff 39:ffff 3a:ffff 3b:ffff 3c:ffff 3d:ffff 3e:ffff 3f:ffff
223
224SMC91111> M
225
226    Bank0 Bank1 Bank2 Bank3
22700  0000  a0b1	3332  0000
22802  0000  1801	8000  0000
22904  0000  3412	8080  0000
23006  0000  7856	003f  0000
23108  0404  bc9a	02df  3332
2320a  0000  ffff	02df  3391
2330c  0000  1214	0004  001f
2340e  3300  3301	3302  3303
235
236SMC91111> C
237
238EEPROM contents copied to MAC
239
240SMC91111> W E 2A ABCD
241
242Writing EEPROM register 2a with abcd
243
244SMC91111> W M 14 FF00
245
246Writing MAC register bank 1, reg 04 with ff00
247