Name Date Size #Lines LOC

..--

.gitignoreH A D05-Jun-2025133 1211

MakefileH A D05-Jun-20252.3 KiB8341

README.smc91111_eepromH A D05-Jun-20256.7 KiB224161

README_rkspi.mdH A D05-Jun-20252.6 KiB12784

atmel_df_pow2.cH A D05-Jun-20253.7 KiB211158

hello_world.cH A D05-Jun-2025694 3922

mips.ldsH A D05-Jun-2025695 4435

mips64.ldsH A D05-Jun-2025695 4435

nds32.ldsH A D05-Jun-2025662 4133

ppc_longjmp.SH A D05-Jun-20251.9 KiB6856

ppc_setjmp.SH A D05-Jun-20251.9 KiB7259

rkspi.cH A D05-Jun-20259.3 KiB455319

rkspi.hH A D05-Jun-20253.4 KiB139109

sched.cH A D05-Jun-20258 KiB357263

smc91111_eeprom.cH A D05-Jun-20257.2 KiB373298

smc911x_eeprom.cH A D05-Jun-20258.2 KiB380245

sparc.ldsH A D05-Jun-2025569 4739

stubs.cH A D05-Jun-20256.8 KiB275193

README.smc91111_eeprom

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
302. Running the smc91111_eeprom program
31---------------------------------------------------------------------
32
33After Uboot is compiled, there should be three files of interest:
34-rwxr-xr-x    1		8806 2004-10-11 14:00 smc91111_eeprom	    <- ELF
35-rwxr-xr-x    1		3440 2004-10-11 14:00 smc91111_eeprom.bin   <- BIN
36-rwxr-xr-x    1		9524 2004-10-11 14:00 smc91111_eeprom.srec  <- SREC
37
38if there is not, check the examples/Makefile, and ensure there is something
39like for your architecture:
40
41   ifeq ($(ARCH),blackfin)
42   SREC	  += smc91111_eeprom.srec
43   BIN	  += smc91111_eeprom.bin smc91111_eeprom
44   endif
45
46To load the files: there are two methods: a) serial or b) network. Since
47it is not a good idea to start doing things on the network before the
48MAC address is set, this example will do things over serial.
49
50a) Loading the elf file via the serial port
51--------------------------------------------
52Loading the elf is very easy - just ensure that the location
53you specify things to load as is not the load address specified
54in the Makefile.
55
56BOOT> loadb 0x1000000
57
58## Ready for binary (kermit) download to 0x01000000 at 57600 bps...
59
60(type CNTL-\ then C)
61(Back at local machine)
62----------------------------------------------------
63Kermit>send ~/u-boot_1.1.1/examples/smc91111_eeprom
64Kermit>connect
65
66Connecting to /dev/ttyS0, speed 57600
67 Escape character: Ctrl-\ (ASCII 28, FS): enabled
68Type the escape character followed by C to get back,
69or followed by ? to see other options.
70----------------------------------------------------
71## Total Size	   = 0x00002266 = 8806 Bytes
72## Start Addr	   = 0x01000000
73
74BOOT> bootelf 0x1000000
75
76Loading .text @ 0x00001000 (3440 bytes)
77## Starting application at 0x000010d8 ...
78
79SMC91111>
80
81b) Loading the binary file via the serial port
82-----------------------------------------------
83For many toolchains, the entry point is not the load point.
84The Load point is a hard coded address from the
85examples/Makefile. The entry point can be found by doing something
86like:
87
88  u-boot_1.1.1/examples> bfin-elf-objdump -d smc91111_eeprom |less
89
90  smc91111_eeprom:     file format elf32-bfin
91
92  Disassembly of section .text:
93
94  00001000 <smc91111_eeprom-0xd8>:
95      1000:
96  000010d8 <smc91111_eeprom>:
97
98You can see that the entry point (or the address that should be
99jumped to is 0x10d8). This is also the same as the entry point
100of the elf file.
101
102Now we load it to the actual load location:
103
104BOOT> loadb 0x1000
105
106## Ready for binary (kermit) download to 0x00001000 at 57600 bps...
107
108(Back at pinky.dsl-only.net)
109----------------------------------------------------
110Kermit>send /tftpboot/eeprom.bin
111Kermit>connect
112
113Connecting to /dev/ttyS0, speed 57600
114 Escape character: Ctrl-\ (ASCII 28, FS): enabled
115Type the escape character followed by C to get back,
116or followed by ? to see other options.
117----------------------------------------------------
118## Total Size	   = 0x00000d70 = 3440 Bytes
119## Start Addr	   = 0x00001000
120
121BOOT> go 0x10D8
122
123## Starting application at 0x000010D8 ...
124
125SMC91111>
126
1273. Setting MAC addresses
128--------------------------------------------------------------------------
129
130The MAC address can be stored in four locations:
131
132-Boot environmental variable in Flash <- can not change, without
133					  re-flashing U-Boot.
134U-Boot environmental variable	       <- can not change, without
135					  resetting board/U-Boot
136LAN91C111 Registers		       <- volatile
137LAN91C111 EEPROM		       <- Non-volatile
138
139If you have not activated the network, and do not have a hardcoded
140or pre-assigned MAC address in U-Boot, the environmental variables
141should be blank, and allow you to set things one time.
142
143To set the EEPROM MAC address to 12:34:56:78:9A:BC
144
145SMC91111> W E 20 3412
146
147Writing EEPROM register 20 with 3412
148SMC91111> W E 21 7856
149
150Writing EEPROM register 21 with 7856
151SMC91111> W E 22 BC9A
152
153Writing EEPROM register 22 with bc9a
154EEPROM contents copied to MAC
155SMC91111> P
156
157Current MAC Address in SMSC91111 12:34:56:78:9a:bc
158Current MAC Address in EEPROM	 12:34:56:78:9a:bc
159
160(CNTRL-C to exit)
161SMC91111> ## Application terminated, rc = 0x0
162
163BOOT> reset
164U-Boot 1.1.1 (gcc version: 3.3.3)
165Release Version Beta released on Oct 10 2004 - 00:34:35
166Blackfin support by LG Soft India
167For further information please check this link http://www.blackfin.uclinux.org
168BOOT> ping 192.168.0.4
169
170Using MAC Address 12:34:56:78:9A:BC
171host 192.168.0.4 is alive
172
173
1744. Other things that you can do
175--------------------------------------------------------------------------
176After the stand alone application is running, there are a few options:
177 - P : Print the MAC
178 - D : Dump the LAN91C111 EEPROM contents
179 - M : Dump the LAN91C111 MAC contents
180 - C : Copies the MAC address from the EEPROM to the LAN91C111
181 - W : Write a register in the EEPROM or in the MAC
182
183SMC91111> P
184
185Current MAC Address in SMSC91111 12:34:56:78:9a:bc
186Current MAC Address in EEPROM	 12:34:56:78:9a:bc
187
188SMC91111> D
189
190IOS2-0	  000	  001	  002	  003	  004	  005	  006	  007
191CONFIG 00:ffff 04:ffff 08:ffff 0c:ffff 10:ffff 14:ffff 18:ffff 1c:ffff
192BASE   01:ffff 05:ffff 09:ffff 0d:ffff 11:ffff 15:ffff 19:ffff 1d:ffff
193       02:ffff 06:ffff 0a:ffff 0e:0020 12:ffff 16:ffff 1a:ffff 1e:ffff
194       03:ffff 07:ffff 0b:ffff 0f:ffff 13:ffff 17:ffff 1b:ffff 1f:ffff
195
19620:3412 21:7856 22:bc9a 23:ffff 24:ffff 25:ffff 26:ffff 27:ffff
19728:ffff 29:ffff 2a:ffff 2b:ffff 2c:ffff 2d:ffff 2e:ffff 2f:ffff
19830:ffff 31:ffff 32:ffff 33:ffff 34:ffff 35:ffff 36:ffff 37:ffff
19938:ffff 39:ffff 3a:ffff 3b:ffff 3c:ffff 3d:ffff 3e:ffff 3f:ffff
200
201SMC91111> M
202
203    Bank0 Bank1 Bank2 Bank3
20400  0000  a0b1	3332  0000
20502  0000  1801	8000  0000
20604  0000  3412	8080  0000
20706  0000  7856	003f  0000
20808  0404  bc9a	02df  3332
2090a  0000  ffff	02df  3391
2100c  0000  1214	0004  001f
2110e  3300  3301	3302  3303
212
213SMC91111> C
214
215EEPROM contents copied to MAC
216
217SMC91111> W E 2A ABCD
218
219Writing EEPROM register 2a with abcd
220
221SMC91111> W M 14 FF00
222
223Writing MAC register bank 1, reg 04 with ff00
224

README_rkspi.md

1# RK SPI Standalone Bin
2
3This is the readme for the Das U-Boot standalone program rkspi
4
5
6How To Use
7------------------------
8### Compile
9
101.Define the standalone load address in includes/configs/rkxxxxx_common.h
11
12```shell
13#define CONFIG_STANDALONE_LOAD_ADDR    0x40000000
14```
15
162.Enable rkspi in defconfig
17
18```
19CONFIG_ROCKCHIP_SPI=y
20```
21
22### Setting SPI hardware
23
241.Setting the iomux and spiclk through:
25
26- u-boot shell command
27- define it in rkspi.c spi_hw_init
28
29Note:
30
31- spiclk is the clock for spi controller, output to IO after internal frequency division of the controller.
32
33### Load And Executable
34
351. load the bin by serial or tftp, take tftp as example:
36
37```shell
38setenv ipaddr 172.16.12.157
39setenv serverip 172.16.12.167
40tftp 0x40000000 rkspi.bin		# 0x40000000 is define by CONFIG_STANDALONE_LOAD_ADDR
41```
42
432. execute it
44
45```shell
46go 0x40000000		# 0x40000000 is define by CONFIG_STANDALONE_LOAD_ADDR
47```
48
49## Abort Codes
50
51### Introduction
52
53```c
54int rockchip_spi_probe(u8 bus, uintptr_t base_addr, u32 rsd, u32 clock_div, u32 mode);
55```
56
57- bus: spi bus
58- base_addr: spi register base address
59- rsd: read sample clock shift with spiclk which is controller working rate
60- clock_div: internal frequency division of the controller
61- mode: spi mode, support:
62
63```c
64#define SPI_CPHA	BIT(0)			/* clock phase */
65#define SPI_CPOL	BIT(1)			/* clock polarity */
66#define SPI_MODE_0	(0 | 0)			/* (original MicroWire) */
67#define SPI_MODE_1	(0 | SPI_CPHA)
68#define SPI_MODE_2	(SPI_CPOL | 0)
69#define SPI_MODE_3	(SPI_CPOL | SPI_CPHA)
70```
71
72
73
74```c
75int rockchip_spi_claim_bus(u8 bus);
76```
77
78- bus: spi bus
79
80
81
82```c
83void rockchip_spi_release_bus(u8 bus);
84```
85
86- bus: spi bus
87
88
89
90```c
91int rockchip_spi_xfer(u8 bus, u8 cs, unsigned int bitlen, const void *dout, void *din, unsigned long flags);
92```
93
94- bus: spi bus
95- cs: spi cs
96- bitlen: the transfer length in bits
97- dout: write buffer (if exits)
98- din: read buffer (if exits), if the dout and din both defined, spi work in duplex mode
99- flags: operation chip select, support:
100
101```c
102#define SPI_XFER_BEGIN		BIT(0)	/* Assert CS before transfer */
103#define SPI_XFER_END		BIT(1)	/* Deassert CS after transfer */
104#define SPI_XFER_ONCE		(SPI_XFER_BEGIN | SPI_XFER_END)
105```
106
107
108
109```c
110int rockchip_spi_write_then_read(u8 bus, u8 cs,
111				 const u8 *opcode, size_t n_opcode,
112				 const u8 *txbuf, u8 *rxbuf, size_t n_buf);
113```
114
115- bus: spi bus
116- cs: spi cs
117- opcode: command code
118- n_opcode: the numbers of command code in bytes
119- txbuf: write buffer (if exits)
120- rxbuf: read buffer (if exits), if the dout and din both defined, spi work in duplex mode
121- n_buf: the transfer length in bytes
122
123### Demo
124
125Is right in the main function of rkspi.
126
127