Commit 7784674852c66b0924bdc79062bd208aa51fd0a9
1 parent
27b207fd0a
Exists in
master
and in
54 other branches
* Allow crc32 to be used at address 0x000
* Provide consistent interface to standalone applications to access the 'global_data' structure Provide a doc/README.standalone more useful to users/developers. * Make IceCube MGT5100 FEC driver work
Showing 10 changed files with 251 additions and 202 deletions Inline Diff
CHANGELOG
1 | ====================================================================== | 1 | ====================================================================== |
2 | Changes for U-Boot 0.4.5: | 2 | Changes for U-Boot 0.4.5: |
3 | ====================================================================== | 3 | ====================================================================== |
4 | 4 | ||
5 | * Allow crc32 to be used at address 0x000 | ||
6 | |||
7 | * Provide consistent interface to standalone applications to access | ||
8 | the 'global_data' structure | ||
9 | Provide a doc/README.standalone more useful to users/developers. | ||
10 | |||
11 | * Make IceCube MGT5100 FEC driver work | ||
12 | |||
5 | * Implement new mechanism to export U-Boot's functions to standalone | 13 | * Implement new mechanism to export U-Boot's functions to standalone |
6 | applications: instead of using (PPC-specific) system calls we now | 14 | applications: instead of using (PPC-specific) system calls we now |
7 | use a jump table; please see doc/README.standalone for details | 15 | use a jump table; please see doc/README.standalone for details |
8 | 16 | ||
9 | * Patch by Dave Westwood, 24 Jul 2003: | 17 | * Patch by Dave Westwood, 24 Jul 2003: |
10 | added support for Unity OS (a proprietary OS) | 18 | added support for Unity OS (a proprietary OS) |
11 | 19 | ||
12 | * Patch by Detlev Zundel, 23 Jul 2003: | 20 | * Patch by Detlev Zundel, 23 Jul 2003: |
13 | add "imls" command to print flash table of contents | 21 | add "imls" command to print flash table of contents |
14 | 22 | ||
15 | * Fix cold boot detection for log buffer reset | 23 | * Fix cold boot detection for log buffer reset |
16 | 24 | ||
17 | * Return error for invalid length specifiers with "cp.X" etc. | 25 | * Return error for invalid length specifiers with "cp.X" etc. |
18 | 26 | ||
19 | * Fix startup problem on MIPS | 27 | * Fix startup problem on MIPS |
20 | 28 | ||
21 | * Allow for CONFIG_SPLASH_SCREEN even when no explicit | 29 | * Allow for CONFIG_SPLASH_SCREEN even when no explicit |
22 | bitmap support is configured | 30 | bitmap support is configured |
23 | 31 | ||
24 | * Patch by Bill Hargen, 18 Jul 2003: | 32 | * Patch by Bill Hargen, 18 Jul 2003: |
25 | - fix endinaness problem in cpu/mpc824x/drivers/i2c/i2c1.c | 33 | - fix endinaness problem in cpu/mpc824x/drivers/i2c/i2c1.c |
26 | 34 | ||
27 | * Patch by Denis Peter, 18 Jul 2003: | 35 | * Patch by Denis Peter, 18 Jul 2003: |
28 | - fix memory configuration for MIP405T | 36 | - fix memory configuration for MIP405T |
29 | - fix printout of baudrate for "loadb <loadaddr> <baudrate>" | 37 | - fix printout of baudrate for "loadb <loadaddr> <baudrate>" |
30 | 38 | ||
31 | * Cleanup of TQM82xx configurations; use "official" board types | 39 | * Cleanup of TQM82xx configurations; use "official" board types |
32 | to make selection easier. | 40 | to make selection easier. |
33 | 41 | ||
34 | * Patch by Martin Krause, 17 Jul 2003: | 42 | * Patch by Martin Krause, 17 Jul 2003: |
35 | add delay to get I2C working with "imm" command and s3c24x0_i2c.c | 43 | add delay to get I2C working with "imm" command and s3c24x0_i2c.c |
36 | 44 | ||
37 | * Patch by Richard Woodruff, 17 July 03: | 45 | * Patch by Richard Woodruff, 17 July 03: |
38 | - Fixed bug in OMAP1510 baud rate divisor settings. | 46 | - Fixed bug in OMAP1510 baud rate divisor settings. |
39 | 47 | ||
40 | * Patch by Nye Liu, 16 July 2003: | 48 | * Patch by Nye Liu, 16 July 2003: |
41 | MPC860FADS fixes: | 49 | MPC860FADS fixes: |
42 | - add MPC86xADS support (uses MPC86xADS.h) | 50 | - add MPC86xADS support (uses MPC86xADS.h) |
43 | - add 866P/T core support (also MPC859T/MPC859DSL/MPC852T) | 51 | - add 866P/T core support (also MPC859T/MPC859DSL/MPC852T) |
44 | o PLPRCR changes | 52 | o PLPRCR changes |
45 | o BRG changes (EXTAL/XTAL restricted to 10MHz) | 53 | o BRG changes (EXTAL/XTAL restricted to 10MHz) |
46 | o don't trust gclk() software measurement by default, depend on | 54 | o don't trust gclk() software measurement by default, depend on |
47 | CONFIG_8xx_GCLK_FREQ | 55 | CONFIG_8xx_GCLK_FREQ |
48 | - add DRAM SIMM not installed detection | 56 | - add DRAM SIMM not installed detection |
49 | - use more "correct" SDRAM initialization sequence | 57 | - use more "correct" SDRAM initialization sequence |
50 | - allow different SDRAM sizes (8xxADS has 8M) | 58 | - allow different SDRAM sizes (8xxADS has 8M) |
51 | - default DER is 0 | 59 | - default DER is 0 |
52 | - remove unused MAMR defines from FADS860T.h (all done in fads.c) | 60 | - remove unused MAMR defines from FADS860T.h (all done in fads.c) |
53 | - rename MAMR/MBMR defines to be more consistent. Should eventually | 61 | - rename MAMR/MBMR defines to be more consistent. Should eventually |
54 | be merged into MxMR to better reflect the PowerQUICC datasheet. | 62 | be merged into MxMR to better reflect the PowerQUICC datasheet. |
55 | 63 | ||
56 | * Patch by Yuli Barcohen, 16 Jul 2003: | 64 | * Patch by Yuli Barcohen, 16 Jul 2003: |
57 | support new Motorola PQ2FADS-ZU evaluation board which replaced | 65 | support new Motorola PQ2FADS-ZU evaluation board which replaced |
58 | MPC8260ADS and MPC8266ADS | 66 | MPC8260ADS and MPC8266ADS |
59 | 67 | ||
60 | ====================================================================== | 68 | ====================================================================== |
61 | Changes for U-Boot 0.4.4: | 69 | Changes for U-Boot 0.4.4: |
62 | ====================================================================== | 70 | ====================================================================== |
63 | 71 | ||
64 | * Add support for IceCube board (with MGT5100 and MPC5200 CPUs) | 72 | * Add support for IceCube board (with MGT5100 and MPC5200 CPUs) |
65 | 73 | ||
66 | * Add support for MGT5100 and MPC5200 processors | 74 | * Add support for MGT5100 and MPC5200 processors |
67 | 75 | ||
68 | * Patch by Lutz Dennig, 15 Jul 2003: | 76 | * Patch by Lutz Dennig, 15 Jul 2003: |
69 | update for R360MPI board | 77 | update for R360MPI board |
70 | 78 | ||
71 | ====================================================================== | 79 | ====================================================================== |
72 | Changes for U-Boot 0.4.3: | 80 | Changes for U-Boot 0.4.3: |
73 | ====================================================================== | 81 | ====================================================================== |
74 | 82 | ||
75 | * Patches by Kshitij, 04 Jul 2003 | 83 | * Patches by Kshitij, 04 Jul 2003 |
76 | - added support for arm925t cpu core | 84 | - added support for arm925t cpu core |
77 | - added support for TI OMAP 1510 Innovator Board | 85 | - added support for TI OMAP 1510 Innovator Board |
78 | 86 | ||
79 | * Patches by Martin Krause, 14 Jul 2003: | 87 | * Patches by Martin Krause, 14 Jul 2003: |
80 | - add I2C support for s3c2400 systems (trab board) | 88 | - add I2C support for s3c2400 systems (trab board) |
81 | - (re-) add "ping" to command table | 89 | - (re-) add "ping" to command table |
82 | 90 | ||
83 | * Fix handling of "slow" POST routines | 91 | * Fix handling of "slow" POST routines |
84 | 92 | ||
85 | * Patches by Yuli Barcohen, 13 Jul 2003: | 93 | * Patches by Yuli Barcohen, 13 Jul 2003: |
86 | - Correct flash and JFFS2 support for MPC8260ADS | 94 | - Correct flash and JFFS2 support for MPC8260ADS |
87 | - fix PVR values and clock generation for PowerQUICC II family | 95 | - fix PVR values and clock generation for PowerQUICC II family |
88 | (8270/8275/8280) | 96 | (8270/8275/8280) |
89 | 97 | ||
90 | * Patch by Bernhard Kuhn, 08 Jul 2003: | 98 | * Patch by Bernhard Kuhn, 08 Jul 2003: |
91 | - add support for M68K targets | 99 | - add support for M68K targets |
92 | 100 | ||
93 | * Patch by Ken Chou, 3 Jul: | 101 | * Patch by Ken Chou, 3 Jul: |
94 | - Fix PCI config table for A3000 | 102 | - Fix PCI config table for A3000 |
95 | - Fix iobase for natsemi.c | 103 | - Fix iobase for natsemi.c |
96 | (PCI_BASE_ADDRESS_0 is the IO base register for DP83815) | 104 | (PCI_BASE_ADDRESS_0 is the IO base register for DP83815) |
97 | 105 | ||
98 | * Allow to enable "slow" POST routines by key press on power-on | 106 | * Allow to enable "slow" POST routines by key press on power-on |
99 | * Fix temperature dependend switching of LCD backlight on LWMON | 107 | * Fix temperature dependend switching of LCD backlight on LWMON |
100 | * Tweak output format for LWMON | 108 | * Tweak output format for LWMON |
101 | 109 | ||
102 | * Patch by Stefan Roese, 11 Jul 2003: | 110 | * Patch by Stefan Roese, 11 Jul 2003: |
103 | - Fix bug in CONFIG_VERSION_VARIABLE. | 111 | - Fix bug in CONFIG_VERSION_VARIABLE. |
104 | - AR405 config updated. | 112 | - AR405 config updated. |
105 | - OCRTC/ORSG: bsp command added. | 113 | - OCRTC/ORSG: bsp command added. |
106 | - ASH405 bsp update. | 114 | - ASH405 bsp update. |
107 | 115 | ||
108 | ====================================================================== | 116 | ====================================================================== |
109 | Changes for U-Boot 0.4.2: | 117 | Changes for U-Boot 0.4.2: |
110 | ====================================================================== | 118 | ====================================================================== |
111 | 119 | ||
112 | * Add support for NSCU board | 120 | * Add support for NSCU board |
113 | 121 | ||
114 | * Add support for TQM823M, TQM850M, TQM855M and TQM860M modules | 122 | * Add support for TQM823M, TQM850M, TQM855M and TQM860M modules |
115 | 123 | ||
116 | * Add support for Am29LV160ML, Am29LV320ML, and Am29LV640ML | 124 | * Add support for Am29LV160ML, Am29LV320ML, and Am29LV640ML |
117 | mirror bit flash on TQM8xxM modules | 125 | mirror bit flash on TQM8xxM modules |
118 | 126 | ||
119 | * Patch by Kenneth Johansson, 30 Jun 2003: | 127 | * Patch by Kenneth Johansson, 30 Jun 2003: |
120 | get rid of MK_CMD_ENTRY macro; update doc/README.command | 128 | get rid of MK_CMD_ENTRY macro; update doc/README.command |
121 | 129 | ||
122 | * Patch by Seb James, 30 Jun 2003: | 130 | * Patch by Seb James, 30 Jun 2003: |
123 | Improve documentation of I2C configuration in README | 131 | Improve documentation of I2C configuration in README |
124 | 132 | ||
125 | * Fix problems with previous log buffer "fixes" | 133 | * Fix problems with previous log buffer "fixes" |
126 | 134 | ||
127 | * Fix minor help text issues | 135 | * Fix minor help text issues |
128 | 136 | ||
129 | * "log append" did not append a newline | 137 | * "log append" did not append a newline |
130 | 138 | ||
131 | ====================================================================== | 139 | ====================================================================== |
132 | Changes for U-Boot 0.4.1: | 140 | Changes for U-Boot 0.4.1: |
133 | ====================================================================== | 141 | ====================================================================== |
134 | 142 | ||
135 | * Fix some missing commands, cleanup header files | 143 | * Fix some missing commands, cleanup header files |
136 | (autoscript, bmp, bsp, fat, mmc, nand, portio, ...) | 144 | (autoscript, bmp, bsp, fat, mmc, nand, portio, ...) |
137 | 145 | ||
138 | * Rewrite command lookup and help command (fix problems with bubble | 146 | * Rewrite command lookup and help command (fix problems with bubble |
139 | sort when sorting command name list). Minor cleanup here and there. | 147 | sort when sorting command name list). Minor cleanup here and there. |
140 | 148 | ||
141 | * Merge from "stable branch", tag LABEL_2003_06_28_1800-stable: | 149 | * Merge from "stable branch", tag LABEL_2003_06_28_1800-stable: |
142 | - Allow to call sysmon function interactively | 150 | - Allow to call sysmon function interactively |
143 | - PIC on LWMON board needs delay after power-on | 151 | - PIC on LWMON board needs delay after power-on |
144 | - Add missing RSR definitions for MPC8xx | 152 | - Add missing RSR definitions for MPC8xx |
145 | - Improve log buffer handling: guarantee clean reset after power-on | 153 | - Improve log buffer handling: guarantee clean reset after power-on |
146 | - Add support for EXBITGEN board | 154 | - Add support for EXBITGEN board |
147 | - Add support for SL8245 board | 155 | - Add support for SL8245 board |
148 | 156 | ||
149 | * Code cleanup: | 157 | * Code cleanup: |
150 | - remove trailing white space, trailing empty lines, C++ comments, etc. | 158 | - remove trailing white space, trailing empty lines, C++ comments, etc. |
151 | - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) | 159 | - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) |
152 | 160 | ||
153 | * Patches by Kenneth Johansson, 25 Jun 2003: | 161 | * Patches by Kenneth Johansson, 25 Jun 2003: |
154 | - major rework of command structure | 162 | - major rework of command structure |
155 | (work done mostly by Michal Cendrowski and Joakim Kristiansen) | 163 | (work done mostly by Michal Cendrowski and Joakim Kristiansen) |
156 | 164 | ||
157 | ====================================================================== | 165 | ====================================================================== |
158 | Changes for U-Boot 0.4.0: | 166 | Changes for U-Boot 0.4.0: |
159 | ====================================================================== | 167 | ====================================================================== |
160 | 168 | ||
161 | * Patches by Robert Schwebel, 26 Jun 2003: | 169 | * Patches by Robert Schwebel, 26 Jun 2003: |
162 | - csb226 configuration updated | 170 | - csb226 configuration updated |
163 | - credits for logodl port updated | 171 | - credits for logodl port updated |
164 | - innokom configuration updated | 172 | - innokom configuration updated |
165 | - logodl tree update, still with coding style inconsistencies | 173 | - logodl tree update, still with coding style inconsistencies |
166 | - added OCM for ppc405 warning to README | 174 | - added OCM for ppc405 warning to README |
167 | 175 | ||
168 | * Patch by Pantelis Antoniou, 25 Jun 2003: | 176 | * Patch by Pantelis Antoniou, 25 Jun 2003: |
169 | update NetVia with V2 board support | 177 | update NetVia with V2 board support |
170 | 178 | ||
171 | * Header file cleanup for ARM | 179 | * Header file cleanup for ARM |
172 | 180 | ||
173 | * Patch by Murray Jensen, 24 Jun 2003: | 181 | * Patch by Murray Jensen, 24 Jun 2003: |
174 | - make sure to use only U-boot provided header files | 182 | - make sure to use only U-boot provided header files |
175 | - fix problems with ".rodata.str1.4" section as used by GCC-3.x | 183 | - fix problems with ".rodata.str1.4" section as used by GCC-3.x |
176 | 184 | ||
177 | * Patch by Stefan Roese, 24 Jun 2003: | 185 | * Patch by Stefan Roese, 24 Jun 2003: |
178 | - Update esd ASH405 board files. | 186 | - Update esd ASH405 board files. |
179 | - Update esd DASA_SIM config file. | 187 | - Update esd DASA_SIM config file. |
180 | - Add ping command to some esd boards. | 188 | - Add ping command to some esd boards. |
181 | 189 | ||
182 | * Patch by Yuli Barcohen, 23 Jun 2003: | 190 | * Patch by Yuli Barcohen, 23 Jun 2003: |
183 | Update for MPC8260ADS board | 191 | Update for MPC8260ADS board |
184 | 192 | ||
185 | * Patch by Murray Jensen, 23 Jun 2003: | 193 | * Patch by Murray Jensen, 23 Jun 2003: |
186 | - cleanup of GCC 3.x compiler warnings | 194 | - cleanup of GCC 3.x compiler warnings |
187 | 195 | ||
188 | * Patch by Rune Torgersen, 4 Jun 2003: | 196 | * Patch by Rune Torgersen, 4 Jun 2003: |
189 | add large memory support for MPC8266ADS board | 197 | add large memory support for MPC8266ADS board |
190 | 198 | ||
191 | * Patch by Richard Woodruff, 19 June 03: | 199 | * Patch by Richard Woodruff, 19 June 03: |
192 | - Enabled standard u-boot device abstraction for ARM | 200 | - Enabled standard u-boot device abstraction for ARM |
193 | - Enabled console device for ARM | 201 | - Enabled console device for ARM |
194 | - Initilized bi_baudrate for ARM | 202 | - Initilized bi_baudrate for ARM |
195 | 203 | ||
196 | * Patch by Bill Hargen, 23 Apr 2003: | 204 | * Patch by Bill Hargen, 23 Apr 2003: |
197 | fix byte order for 824x I2C addresses (write op) | 205 | fix byte order for 824x I2C addresses (write op) |
198 | 206 | ||
199 | * Patch by Murray Jensen, 20 Jun 2003: | 207 | * Patch by Murray Jensen, 20 Jun 2003: |
200 | - hymod update | 208 | - hymod update |
201 | - cleanup (especially for gcc-3.x compilers) | 209 | - cleanup (especially for gcc-3.x compilers) |
202 | 210 | ||
203 | * Patch by Tom Guilliams, 20 Jun 2003: | 211 | * Patch by Tom Guilliams, 20 Jun 2003: |
204 | added CONFIG_750FX support for IBM 750FX processors | 212 | added CONFIG_750FX support for IBM 750FX processors |
205 | 213 | ||
206 | * Patch by Devin Crumb, 02 Apr 2003: | 214 | * Patch by Devin Crumb, 02 Apr 2003: |
207 | Fix clock divider rounding problem in drivers/serial.c | 215 | Fix clock divider rounding problem in drivers/serial.c |
208 | 216 | ||
209 | * Patch by Richard Woodruff, 19 June 03: | 217 | * Patch by Richard Woodruff, 19 June 03: |
210 | - Fixed smc91c111 driver to sync with the u-boot environment | 218 | - Fixed smc91c111 driver to sync with the u-boot environment |
211 | (driver/smc91c111.c). | 219 | (driver/smc91c111.c). |
212 | - Added eth_init error return check in NetLoop (net/net.c). | 220 | - Added eth_init error return check in NetLoop (net/net.c). |
213 | 221 | ||
214 | * Patch by Ken Chou, 19 June 2003: | 222 | * Patch by Ken Chou, 19 June 2003: |
215 | Added support for A3000 SBC board (Artis Microsystems Inc.) | 223 | Added support for A3000 SBC board (Artis Microsystems Inc.) |
216 | 224 | ||
217 | * Patches by Murray Jensen, 17 Jun 2003: | 225 | * Patches by Murray Jensen, 17 Jun 2003: |
218 | - Hymod board database mods: add "who" field and new xilinx chip types | 226 | - Hymod board database mods: add "who" field and new xilinx chip types |
219 | - provide new "init_cmd_timeout()" function so code external to | 227 | - provide new "init_cmd_timeout()" function so code external to |
220 | "common/main.c" can use the "reset_cmd_timeout()" function before | 228 | "common/main.c" can use the "reset_cmd_timeout()" function before |
221 | entering the main loop | 229 | entering the main loop |
222 | - add DTT support for adm1021 (new file dtt/adm1021.c; config | 230 | - add DTT support for adm1021 (new file dtt/adm1021.c; config |
223 | slightly different. see include/configs/hymod.h for an example | 231 | slightly different. see include/configs/hymod.h for an example |
224 | (requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and | 232 | (requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and |
225 | CFG_DTT_ADM1021 defined) | 233 | CFG_DTT_ADM1021 defined) |
226 | - add new "eeprom_probe()" function which has similar args and | 234 | - add new "eeprom_probe()" function which has similar args and |
227 | behaves in a similar way to "eeprom_read()" etc. | 235 | behaves in a similar way to "eeprom_read()" etc. |
228 | - add 8260 FCC ethernet loopback code (new "eth_loopback_test()" | 236 | - add 8260 FCC ethernet loopback code (new "eth_loopback_test()" |
229 | function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST) | 237 | function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST) |
230 | - gdbtools copyright update | 238 | - gdbtools copyright update |
231 | - ensure that set_msr() executes the "sync" and "isync" instructions | 239 | - ensure that set_msr() executes the "sync" and "isync" instructions |
232 | after the "mtmsr" instruction in cpu/mpc8260/interrupts.c | 240 | after the "mtmsr" instruction in cpu/mpc8260/interrupts.c |
233 | - 8260 I/O ports fix: Open Drain should be set last when configuring | 241 | - 8260 I/O ports fix: Open Drain should be set last when configuring |
234 | - add SIU IRQ defines for 8260 | 242 | - add SIU IRQ defines for 8260 |
235 | - allow LDSCRIPT override and OBJCFLAGS initialization: change to | 243 | - allow LDSCRIPT override and OBJCFLAGS initialization: change to |
236 | config.mk to allow board configurations to override the GNU | 244 | config.mk to allow board configurations to override the GNU |
237 | linker script, selected via the LDSCRIPT, make variable, and to | 245 | linker script, selected via the LDSCRIPT, make variable, and to |
238 | give an initial value to the OBJCFLAGS make variable | 246 | give an initial value to the OBJCFLAGS make variable |
239 | - 8260 i2c enhancement: | 247 | - 8260 i2c enhancement: |
240 | o correctly extends the timeout depending on the size of all | 248 | o correctly extends the timeout depending on the size of all |
241 | queued messages for both transmit and receive | 249 | queued messages for both transmit and receive |
242 | o will not continue with receive if transmit times out | 250 | o will not continue with receive if transmit times out |
243 | o ensures that the error callback is done for all queued tx | 251 | o ensures that the error callback is done for all queued tx |
244 | and rx messages | 252 | and rx messages |
245 | o correctly detects both tx and rx timeouts, only delivers one to | 253 | o correctly detects both tx and rx timeouts, only delivers one to |
246 | the callback, and does not overwrite an earlier error | 254 | the callback, and does not overwrite an earlier error |
247 | o logic in i2c_probe now correct | 255 | o logic in i2c_probe now correct |
248 | - add "vprintf()" function so that "panic()" function can be | 256 | - add "vprintf()" function so that "panic()" function can be |
249 | technically correct | 257 | technically correct |
250 | - many Hymod board changes | 258 | - many Hymod board changes |
251 | 259 | ||
252 | * Patches by Robert Schwebel, 14 Jun 2003: | 260 | * Patches by Robert Schwebel, 14 Jun 2003: |
253 | - add support for Logotronic DL datalogger board | 261 | - add support for Logotronic DL datalogger board |
254 | - cleanup serial line after kermit binary download | 262 | - cleanup serial line after kermit binary download |
255 | - add debugX macro (debug level support) | 263 | - add debugX macro (debug level support) |
256 | - update mach-types.h to latest arm.linux.org.uk master list. | 264 | - update mach-types.h to latest arm.linux.org.uk master list. |
257 | 265 | ||
258 | * Patches by David Mรผller, 12 Jun 2003: | 266 | * Patches by David Mรผller, 12 Jun 2003: |
259 | - rewrite of the S3C24X0 register definitions stuff | 267 | - rewrite of the S3C24X0 register definitions stuff |
260 | - "driver" for the built-in S3C24X0 RTC | 268 | - "driver" for the built-in S3C24X0 RTC |
261 | 269 | ||
262 | * Patches by Yuli Barcohen, 12 Jun 2003: | 270 | * Patches by Yuli Barcohen, 12 Jun 2003: |
263 | - Add MII support and Ethernet PHY initialization for MPC8260ADS board | 271 | - Add MII support and Ethernet PHY initialization for MPC8260ADS board |
264 | - Fix incorrect SIUMCR initialisation caused by wrong Hard Reset | 272 | - Fix incorrect SIUMCR initialisation caused by wrong Hard Reset |
265 | configuration word supplied by FPGA on some MPC8260ADS boards | 273 | configuration word supplied by FPGA on some MPC8260ADS boards |
266 | 274 | ||
267 | * Patch by Pantelis Antoniou, 10 Jun 2003: | 275 | * Patch by Pantelis Antoniou, 10 Jun 2003: |
268 | Unify status LED interface | 276 | Unify status LED interface |
269 | 277 | ||
270 | * Add support for DS12887 RTC; add RTC support for ATC board | 278 | * Add support for DS12887 RTC; add RTC support for ATC board |
271 | 279 | ||
272 | * Patch by Nicolas Lacressonniere, 11 Jun 2003: | 280 | * Patch by Nicolas Lacressonniere, 11 Jun 2003: |
273 | Modifications for Atmel AT91RM9200DK ARM920T based development kit | 281 | Modifications for Atmel AT91RM9200DK ARM920T based development kit |
274 | - Add Atmel DataFlash support for reading and writing. | 282 | - Add Atmel DataFlash support for reading and writing. |
275 | - Add possibility to boot a Linux from DataFlash with BOOTM command. | 283 | - Add possibility to boot a Linux from DataFlash with BOOTM command. |
276 | - Add Flash detection on Atmel AT91RM9200DK | 284 | - Add Flash detection on Atmel AT91RM9200DK |
277 | (between Atmel AT49BV1614 and AT49BV1614A flashes) | 285 | (between Atmel AT49BV1614 and AT49BV1614A flashes) |
278 | - Replace old Ethernet PHY layer functions | 286 | - Replace old Ethernet PHY layer functions |
279 | - Change link address | 287 | - Change link address |
280 | 288 | ||
281 | * Patch by Frank Smith, 9 Jun 2003: | 289 | * Patch by Frank Smith, 9 Jun 2003: |
282 | use CRIT_EXCEPTION for machine check on 4xx | 290 | use CRIT_EXCEPTION for machine check on 4xx |
283 | 291 | ||
284 | * Patch by Detlev Zundel, 13 Jun 2003: | 292 | * Patch by Detlev Zundel, 13 Jun 2003: |
285 | added implementation of the "carinfo" command in cmd_immap.c | 293 | added implementation of the "carinfo" command in cmd_immap.c |
286 | 294 | ||
287 | * Fix CONFIG_NET_MULTI support in include/net.h | 295 | * Fix CONFIG_NET_MULTI support in include/net.h |
288 | 296 | ||
289 | * Patches by Kyle Harris, 13 Mar 2003: | 297 | * Patches by Kyle Harris, 13 Mar 2003: |
290 | - Add FAT partition support | 298 | - Add FAT partition support |
291 | - Add command support for FAT | 299 | - Add command support for FAT |
292 | - Add command support for MMC | 300 | - Add command support for MMC |
293 | ---- | 301 | ---- |
294 | - Add Intel PXA support for video | 302 | - Add Intel PXA support for video |
295 | - Add Intel PXA support for MMC | 303 | - Add Intel PXA support for MMC |
296 | ---- | 304 | ---- |
297 | - Enable MMC and FAT for lubbock board | 305 | - Enable MMC and FAT for lubbock board |
298 | - Other misc changes for lubbock board | 306 | - Other misc changes for lubbock board |
299 | 307 | ||
300 | * Patch by Robert Schwebel, April 02, 2003: | 308 | * Patch by Robert Schwebel, April 02, 2003: |
301 | fix for SMSC91111 driver | 309 | fix for SMSC91111 driver |
302 | 310 | ||
303 | * Patch by Vladimir Gurevich, 04 Jun 2003: | 311 | * Patch by Vladimir Gurevich, 04 Jun 2003: |
304 | make ppc405 ethernet driver compatible with CONFIG_NET_MULTI option | 312 | make ppc405 ethernet driver compatible with CONFIG_NET_MULTI option |
305 | 313 | ||
306 | * Patch by Stefan Roese, 05 Jun 2003: | 314 | * Patch by Stefan Roese, 05 Jun 2003: |
307 | - PPC4xx: Fix bug for initial stack in data cache as pointed out by | 315 | - PPC4xx: Fix bug for initial stack in data cache as pointed out by |
308 | Thomas Schaefer (tschaefer@giga-stream.de). Now inital stack in | 316 | Thomas Schaefer (tschaefer@giga-stream.de). Now inital stack in |
309 | data cache can be used even if the chip select is in use. | 317 | data cache can be used even if the chip select is in use. |
310 | - CFG_RX_ETH_BUFFER added to set the ethernet receive buffer count | 318 | - CFG_RX_ETH_BUFFER added to set the ethernet receive buffer count |
311 | (see README for further description). | 319 | (see README for further description). |
312 | - Changed config files of CONFIG_EEPRO100 boards to use the | 320 | - Changed config files of CONFIG_EEPRO100 boards to use the |
313 | CFG_RX_ETH_BUFFER define. | 321 | CFG_RX_ETH_BUFFER define. |
314 | 322 | ||
315 | * Add support for RMU board | 323 | * Add support for RMU board |
316 | 324 | ||
317 | * Add support for TQM862L at 100/50 MHz | 325 | * Add support for TQM862L at 100/50 MHz |
318 | 326 | ||
319 | * Patch by Pantelis Antoniou, 02 Jun 2003: | 327 | * Patch by Pantelis Antoniou, 02 Jun 2003: |
320 | major reconstruction of networking code; | 328 | major reconstruction of networking code; |
321 | add "ping" support (outgoing only!) | 329 | add "ping" support (outgoing only!) |
322 | 330 | ||
323 | * Patch by Denis Peter, 04 June 2003: | 331 | * Patch by Denis Peter, 04 June 2003: |
324 | add support for the MIP405T board | 332 | add support for the MIP405T board |
325 | 333 | ||
326 | * Patches by Udi Finkelstein, 2 June 2003: | 334 | * Patches by Udi Finkelstein, 2 June 2003: |
327 | - Added support for custom keyboards, initialized by defining a | 335 | - Added support for custom keyboards, initialized by defining a |
328 | board-specific drv_keyboard_init as well as defining CONFIG_KEYBOARD . | 336 | board-specific drv_keyboard_init as well as defining CONFIG_KEYBOARD . |
329 | - Added support for the RBC823 board. | 337 | - Added support for the RBC823 board. |
330 | - cpu/mpc8xx/lcd.c now automatically calculates the | 338 | - cpu/mpc8xx/lcd.c now automatically calculates the |
331 | Horizontal Pixel Count field. | 339 | Horizontal Pixel Count field. |
332 | 340 | ||
333 | * Fix alignment problem in BOOTP (dhcp_leasetime option) | 341 | * Fix alignment problem in BOOTP (dhcp_leasetime option) |
334 | [pointed out by Nicolas Lacressonniรจre, 2 Jun 2003] | 342 | [pointed out by Nicolas Lacressonniรจre, 2 Jun 2003] |
335 | 343 | ||
336 | * Patch by Mark Rakes, 14 May 2003: | 344 | * Patch by Mark Rakes, 14 May 2003: |
337 | add support for Intel e1000 gig cards. | 345 | add support for Intel e1000 gig cards. |
338 | 346 | ||
339 | * Patch by Nye Liu, 3 Jun 2003: | 347 | * Patch by Nye Liu, 3 Jun 2003: |
340 | fix critical typo in MAMR definition (include/mpc8xx.h) | 348 | fix critical typo in MAMR definition (include/mpc8xx.h) |
341 | 349 | ||
342 | * Fix requirement to align U-Boot image on 16 kB boundaries on PPC. | 350 | * Fix requirement to align U-Boot image on 16 kB boundaries on PPC. |
343 | 351 | ||
344 | * Patch by Klaus Heydeck, 2 Jun 2003 | 352 | * Patch by Klaus Heydeck, 2 Jun 2003 |
345 | Minor changes for KUP4K configuration | 353 | Minor changes for KUP4K configuration |
346 | 354 | ||
347 | * Patch by Marc Singer, 29 May 2003: | 355 | * Patch by Marc Singer, 29 May 2003: |
348 | Fixed rarp boot method for IA32 and other little-endian CPUs. | 356 | Fixed rarp boot method for IA32 and other little-endian CPUs. |
349 | 357 | ||
350 | * Patch by Marc Singer, 28 May 2003: | 358 | * Patch by Marc Singer, 28 May 2003: |
351 | Added port I/O commands. | 359 | Added port I/O commands. |
352 | 360 | ||
353 | * Patch by Matthew McClintock, 28 May 2003 | 361 | * Patch by Matthew McClintock, 28 May 2003 |
354 | - cpu/mpc824x/start.S: fix relocation code when booting from RAM | 362 | - cpu/mpc824x/start.S: fix relocation code when booting from RAM |
355 | - minor patches for utx8245 | 363 | - minor patches for utx8245 |
356 | 364 | ||
357 | * Patch by Daniel Engstrรถm, 28 May 2003: | 365 | * Patch by Daniel Engstrรถm, 28 May 2003: |
358 | x86 update | 366 | x86 update |
359 | 367 | ||
360 | * Patch by Dave Ellis, 9 May 2003 + 27 May 2003: | 368 | * Patch by Dave Ellis, 9 May 2003 + 27 May 2003: |
361 | add nand flash support to SXNI855T configuration | 369 | add nand flash support to SXNI855T configuration |
362 | fix/extend nand flash support: | 370 | fix/extend nand flash support: |
363 | - fix 'nand erase' command so does not erase bad blocks | 371 | - fix 'nand erase' command so does not erase bad blocks |
364 | - fix 'nand write' command so does not write to bad blocks | 372 | - fix 'nand write' command so does not write to bad blocks |
365 | - fix nand_probe() so handles no flash detected properly | 373 | - fix nand_probe() so handles no flash detected properly |
366 | - add doc/README.nand | 374 | - add doc/README.nand |
367 | - add .jffs2 and .oob options to nand read/write | 375 | - add .jffs2 and .oob options to nand read/write |
368 | - add 'nand bad' command to list bad blocks | 376 | - add 'nand bad' command to list bad blocks |
369 | - add 'clean' option to 'nand erase' to write JFFS2 clean markers | 377 | - add 'clean' option to 'nand erase' to write JFFS2 clean markers |
370 | - make NAND read/write faster | 378 | - make NAND read/write faster |
371 | 379 | ||
372 | * Patch by Rune Torgersen, 23 May 2003: | 380 | * Patch by Rune Torgersen, 23 May 2003: |
373 | Update for MPC8266ADS board | 381 | Update for MPC8266ADS board |
374 | 382 | ||
375 | * Get (mostly) rid of CFG_MONITOR_LEN definition; compute real length | 383 | * Get (mostly) rid of CFG_MONITOR_LEN definition; compute real length |
376 | instead CFG_MONITOR_LEN is now only used to determine _at_compile_ | 384 | instead CFG_MONITOR_LEN is now only used to determine _at_compile_ |
377 | _time_ (!) if the environment is embedded within the U-Boot image, | 385 | _time_ (!) if the environment is embedded within the U-Boot image, |
378 | or in a separate flash sector. | 386 | or in a separate flash sector. |
379 | 387 | ||
380 | * Cleanup CFG_DER #defines in config files (wd maintained only) | 388 | * Cleanup CFG_DER #defines in config files (wd maintained only) |
381 | 389 | ||
382 | * Fix data abort exception handling for arm920t CPU | 390 | * Fix data abort exception handling for arm920t CPU |
383 | 391 | ||
384 | * Fix alignment problems with flash driver for TRAB board | 392 | * Fix alignment problems with flash driver for TRAB board |
385 | 393 | ||
386 | * Patch by Donald White, 21 May 2003: | 394 | * Patch by Donald White, 21 May 2003: |
387 | fix calculation of base address in pci_hose_config_device() | 395 | fix calculation of base address in pci_hose_config_device() |
388 | 396 | ||
389 | * Fix bug in command line parsing: "cmd1;cmd2" is supposed to always | 397 | * Fix bug in command line parsing: "cmd1;cmd2" is supposed to always |
390 | execute "cmd2", even if "cmd1" fails. Note that this is different | 398 | execute "cmd2", even if "cmd1" fails. Note that this is different |
391 | to "run var1 var2" where the contents of "var2" will NOT be | 399 | to "run var1 var2" where the contents of "var2" will NOT be |
392 | executed when a command in "var1" fails. | 400 | executed when a command in "var1" fails. |
393 | 401 | ||
394 | * Add zero-copy ramdisk support (requires corresponding kernel support!) | 402 | * Add zero-copy ramdisk support (requires corresponding kernel support!) |
395 | 403 | ||
396 | * Patch by Kyle Harris, 20 May 2003: | 404 | * Patch by Kyle Harris, 20 May 2003: |
397 | In preparation for an ixp port, rename cpu/xscale and arch-xscale | 405 | In preparation for an ixp port, rename cpu/xscale and arch-xscale |
398 | into cpu/pxa and arch-pxa. | 406 | into cpu/pxa and arch-pxa. |
399 | 407 | ||
400 | * Patch by Stefan Roese, 23 May 2003: | 408 | * Patch by Stefan Roese, 23 May 2003: |
401 | - IBM PPC405EP port added. | 409 | - IBM PPC405EP port added. |
402 | - CONFIG_UART1_CONSOLE added. If defined internal UART1 (and not | 410 | - CONFIG_UART1_CONSOLE added. If defined internal UART1 (and not |
403 | UART0) is used as default U-Boot console. PPC4xx only! | 411 | UART0) is used as default U-Boot console. PPC4xx only! |
404 | - esd ASH405 board added (PPC405EP based). | 412 | - esd ASH405 board added (PPC405EP based). |
405 | - BUBINGA405EP board added (PPC405EP based - IBM Eval Board). | 413 | - BUBINGA405EP board added (PPC405EP based - IBM Eval Board). |
406 | - esd CPCI405AB board added. | 414 | - esd CPCI405AB board added. |
407 | - esd PMC405 board added. | 415 | - esd PMC405 board added. |
408 | - Update of some esd boards. | 416 | - Update of some esd boards. |
409 | 417 | ||
410 | * Patch by Denis Peter, 19 Mai 2003: | 418 | * Patch by Denis Peter, 19 Mai 2003: |
411 | add support for the MIP405-3 board | 419 | add support for the MIP405-3 board |
412 | 420 | ||
413 | * Patch by Dave Ellis, 22 May 2003: | 421 | * Patch by Dave Ellis, 22 May 2003: |
414 | Fix problem with only partially cleared .bss segment | 422 | Fix problem with only partially cleared .bss segment |
415 | 423 | ||
416 | * Patch by Rune Torgersen, 12 May 2003: | 424 | * Patch by Rune Torgersen, 12 May 2003: |
417 | get PCI to work on a MPC8266ADS board; incorporate change to | 425 | get PCI to work on a MPC8266ADS board; incorporate change to |
418 | cpu/mpc8260/pci.c to enable overrides of PCI memory parameters | 426 | cpu/mpc8260/pci.c to enable overrides of PCI memory parameters |
419 | 427 | ||
420 | * Patch by Nye Liu, 1 May 2003: | 428 | * Patch by Nye Liu, 1 May 2003: |
421 | minor patches for the FADS8xx | 429 | minor patches for the FADS8xx |
422 | 430 | ||
423 | * Patch by Thomas Schรคfer, 28 Apr 2003: | 431 | * Patch by Thomas Schรคfer, 28 Apr 2003: |
424 | Fix SPD handling for 256 ECC DIMM on Walnut | 432 | Fix SPD handling for 256 ECC DIMM on Walnut |
425 | 433 | ||
426 | * Add support for arbitrary bitmaps for TRAB's VFD command; | 434 | * Add support for arbitrary bitmaps for TRAB's VFD command; |
427 | allow to pass boot bitmap addresses in environment variables; | 435 | allow to pass boot bitmap addresses in environment variables; |
428 | allow for zero boot delay | 436 | allow for zero boot delay |
429 | 437 | ||
430 | * Patch by Christian Geiรinger, 19 May 2002: | 438 | * Patch by Christian Geiรinger, 19 May 2002: |
431 | On TRAB: wait until the dummy byte has been completely sent | 439 | On TRAB: wait until the dummy byte has been completely sent |
432 | 440 | ||
433 | * Patch by David Updegraff, 22 Apr 2003: | 441 | * Patch by David Updegraff, 22 Apr 2003: |
434 | update for CrayL1 board | 442 | update for CrayL1 board |
435 | 443 | ||
436 | * Patch by Pantelis Antoniou, 21 Apr 2003: | 444 | * Patch by Pantelis Antoniou, 21 Apr 2003: |
437 | add boot support for ARTOS (a proprietary OS) | 445 | add boot support for ARTOS (a proprietary OS) |
438 | 446 | ||
439 | * Patch by Steven Scholz, 11 Apr 2003: | 447 | * Patch by Steven Scholz, 11 Apr 2003: |
440 | Add support for RTC DS1338 | 448 | Add support for RTC DS1338 |
441 | 449 | ||
442 | * Patch by Rod Boyce, 24 Jan 2003: | 450 | * Patch by Rod Boyce, 24 Jan 2003: |
443 | Fix counting of extended partitions in diskboot command | 451 | Fix counting of extended partitions in diskboot command |
444 | 452 | ||
445 | * Patch by Christophe Lindheimer, 20 May 2003: | 453 | * Patch by Christophe Lindheimer, 20 May 2003: |
446 | allow the use of CFG_LOADS when CFG_NO_FLASH is set | 454 | allow the use of CFG_LOADS when CFG_NO_FLASH is set |
447 | 455 | ||
448 | * Fix SDRAM timing on Purple board | 456 | * Fix SDRAM timing on Purple board |
449 | 457 | ||
450 | * Add support for CompactFlash on ATC board | 458 | * Add support for CompactFlash on ATC board |
451 | (includes support for Intel 82365 and compatible PC Card controllers, | 459 | (includes support for Intel 82365 and compatible PC Card controllers, |
452 | and Yenta-compatible PCI-to-CardBus controllers) | 460 | and Yenta-compatible PCI-to-CardBus controllers) |
453 | 461 | ||
454 | * Patch by Mathijs Haarman, 08 May 2003: | 462 | * Patch by Mathijs Haarman, 08 May 2003: |
455 | Add lan91c96 driver (tested on Lubbock and custom PXA250 board only) | 463 | Add lan91c96 driver (tested on Lubbock and custom PXA250 board only) |
456 | 464 | ||
457 | * Fix problem with usage of "true" (undefined in current versions of bfd.h) | 465 | * Fix problem with usage of "true" (undefined in current versions of bfd.h) |
458 | 466 | ||
459 | * Add support for Promess ATC board | 467 | * Add support for Promess ATC board |
460 | 468 | ||
461 | * Patch by Keith Outwater, 28 Apr 2003: | 469 | * Patch by Keith Outwater, 28 Apr 2003: |
462 | - Miscellaneous corrections and additions to GEN860T board specific code. | 470 | - Miscellaneous corrections and additions to GEN860T board specific code. |
463 | - Added GEN860_SC variant to GEN860T. | 471 | - Added GEN860_SC variant to GEN860T. |
464 | - Miscellaneous corrections to GEN860T documentation. | 472 | - Miscellaneous corrections to GEN860T documentation. |
465 | - Correct duplicate entry in U-Boot CREDITS file. | 473 | - Correct duplicate entry in U-Boot CREDITS file. |
466 | - Add GEN860T_SC entry in MAINTAINERS file. | 474 | - Add GEN860T_SC entry in MAINTAINERS file. |
467 | - Update CREDITS file with GEN860T_SC info. | 475 | - Update CREDITS file with GEN860T_SC info. |
468 | 476 | ||
469 | * Update Smiths Aerospace addresses in MAINTAINERS file | 477 | * Update Smiths Aerospace addresses in MAINTAINERS file |
470 | 478 | ||
471 | * Fix error handling in hush's version of "run" command | 479 | * Fix error handling in hush's version of "run" command |
472 | 480 | ||
473 | * LWMON extensions: | 481 | * LWMON extensions: |
474 | - Splashscreen support | 482 | - Splashscreen support |
475 | - modem support | 483 | - modem support |
476 | - sysmon support | 484 | - sysmon support |
477 | - temperature dependend enabling of LCD | 485 | - temperature dependend enabling of LCD |
478 | 486 | ||
479 | * Allow booting from old "PPCBoot" disk partitions | 487 | * Allow booting from old "PPCBoot" disk partitions |
480 | 488 | ||
481 | * Add support for TQM8255 Board / MPC8255 CPU | 489 | * Add support for TQM8255 Board / MPC8255 CPU |
482 | 490 | ||
483 | ====================================================================== | 491 | ====================================================================== |
484 | Changes for U-Boot 0.3.1: | 492 | Changes for U-Boot 0.3.1: |
485 | ====================================================================== | 493 | ====================================================================== |
486 | 494 | ||
487 | * Make sure Block Lock Bits get cleared in R360MPI flash driver | 495 | * Make sure Block Lock Bits get cleared in R360MPI flash driver |
488 | 496 | ||
489 | * MPC823 LCD driver: Fill color map backwards, to allow for steady | 497 | * MPC823 LCD driver: Fill color map backwards, to allow for steady |
490 | display when Linux takes over | 498 | display when Linux takes over |
491 | 499 | ||
492 | * Patch by Erwin Rol, 27 Feb 2003: | 500 | * Patch by Erwin Rol, 27 Feb 2003: |
493 | Add support for RTEMS (this time for real). | 501 | Add support for RTEMS (this time for real). |
494 | 502 | ||
495 | * Add support for "bmp info" and "bmp display" commands to load | 503 | * Add support for "bmp info" and "bmp display" commands to load |
496 | bitmap images; this can be used (for example in a "preboot" | 504 | bitmap images; this can be used (for example in a "preboot" |
497 | command) to display a splash screen very quickly after poweron. | 505 | command) to display a splash screen very quickly after poweron. |
498 | 506 | ||
499 | * Add support for 133 MHz clock on INCA-IP board | 507 | * Add support for 133 MHz clock on INCA-IP board |
500 | 508 | ||
501 | * Patch by Lutz Dennig, 10 Apr 2003: | 509 | * Patch by Lutz Dennig, 10 Apr 2003: |
502 | Update for R360MPI board | 510 | Update for R360MPI board |
503 | 511 | ||
504 | * Add new meaning to "autostart" environment variable: | 512 | * Add new meaning to "autostart" environment variable: |
505 | If set to "no", a standalone image passed to the | 513 | If set to "no", a standalone image passed to the |
506 | "bootm" command will be copied to the load address | 514 | "bootm" command will be copied to the load address |
507 | (and eventually uncompressed), but NOT be started. | 515 | (and eventually uncompressed), but NOT be started. |
508 | This can be used to load and uncompress arbitrary | 516 | This can be used to load and uncompress arbitrary |
509 | data. | 517 | data. |
510 | 518 | ||
511 | * Patch by Stefan Roese, 10 Apr 2003: | 519 | * Patch by Stefan Roese, 10 Apr 2003: |
512 | Changed DHCP client to use IP address from server option field #54 | 520 | Changed DHCP client to use IP address from server option field #54 |
513 | from the OFFER packet in the server option field #54 in the REQUEST | 521 | from the OFFER packet in the server option field #54 in the REQUEST |
514 | packet. This fixes a problem using a Windows 2000 DHCP server, | 522 | packet. This fixes a problem using a Windows 2000 DHCP server, |
515 | where the DHCP-server is not the TFTP-server. | 523 | where the DHCP-server is not the TFTP-server. |
516 | 524 | ||
517 | * Set max brightness for MN11236 displays on TRAB board | 525 | * Set max brightness for MN11236 displays on TRAB board |
518 | 526 | ||
519 | * Add support for TQM862L modules | 527 | * Add support for TQM862L modules |
520 | 528 | ||
521 | ====================================================================== | 529 | ====================================================================== |
522 | Changes for U-Boot 0.3.0: | 530 | Changes for U-Boot 0.3.0: |
523 | ====================================================================== | 531 | ====================================================================== |
524 | 532 | ||
525 | * Patch by Arun Dharankar, 4 Apr 2003: | 533 | * Patch by Arun Dharankar, 4 Apr 2003: |
526 | Add IDMA example code (tested on 8260 only) | 534 | Add IDMA example code (tested on 8260 only) |
527 | 535 | ||
528 | * Add support for Purple Board (MIPS64 5Kc) | 536 | * Add support for Purple Board (MIPS64 5Kc) |
529 | 537 | ||
530 | * Add support for MIPS64 5Kc CPUs | 538 | * Add support for MIPS64 5Kc CPUs |
531 | 539 | ||
532 | * Fix missing setting of "loadaddr" and "bootfile" on ARM and MIPS | 540 | * Fix missing setting of "loadaddr" and "bootfile" on ARM and MIPS |
533 | 541 | ||
534 | * Patch by Denis Peter, 04 Apr 2003: | 542 | * Patch by Denis Peter, 04 Apr 2003: |
535 | - update MIP405-4 board | 543 | - update MIP405-4 board |
536 | 544 | ||
537 | * Patch by Stefan Roese, 4 Apr 2003: | 545 | * Patch by Stefan Roese, 4 Apr 2003: |
538 | - U-Boot version environment variable "ver" added | 546 | - U-Boot version environment variable "ver" added |
539 | (CONFIG_VERSION_VARIABLE). | 547 | (CONFIG_VERSION_VARIABLE). |
540 | - Changed PPC405GPr version from A to B. | 548 | - Changed PPC405GPr version from A to B. |
541 | - Changed CPCI405 to use CTS instead of DSR on PPC405 UART1. | 549 | - Changed CPCI405 to use CTS instead of DSR on PPC405 UART1. |
542 | 550 | ||
543 | * Patches by Denis Peter, 03 April 2003: | 551 | * Patches by Denis Peter, 03 April 2003: |
544 | - fix PCI IRQs on MPL boards | 552 | - fix PCI IRQs on MPL boards |
545 | - fix two more un-relocated pointer problems | 553 | - fix two more un-relocated pointer problems |
546 | 554 | ||
547 | * Fix behaviour of "run" command: | 555 | * Fix behaviour of "run" command: |
548 | - print error message iv variable does not exist | 556 | - print error message iv variable does not exist |
549 | - terminate processing of arguments in case of error | 557 | - terminate processing of arguments in case of error |
550 | 558 | ||
551 | * Patches by Peter Figuli, 10 Mar 2003 | 559 | * Patches by Peter Figuli, 10 Mar 2003 |
552 | - Add support for BTUART on PXA platform | 560 | - Add support for BTUART on PXA platform |
553 | - Add support for WEP EP250 (PXA) board | 561 | - Add support for WEP EP250 (PXA) board |
554 | 562 | ||
555 | * Fix flash problems on INCA-IP; add tool to allow bruning images to | 563 | * Fix flash problems on INCA-IP; add tool to allow bruning images to |
556 | flash using a BDI2000 | 564 | flash using a BDI2000 |
557 | 565 | ||
558 | * Implement fix for I2C Edge Conditions problem for all boards that | 566 | * Implement fix for I2C Edge Conditions problem for all boards that |
559 | use the bit-banging driver (common/soft_i2c.c) | 567 | use the bit-banging driver (common/soft_i2c.c) |
560 | 568 | ||
561 | * Patch by Martin Winistoerfer, 23 Mar 2003 | 569 | * Patch by Martin Winistoerfer, 23 Mar 2003 |
562 | - Add port to MPC555/556 microcontrollers | 570 | - Add port to MPC555/556 microcontrollers |
563 | - Add support for cmi customer board with | 571 | - Add support for cmi customer board with |
564 | Intel 28F128J3A, 28F320J3A or 28F640J3A flash. | 572 | Intel 28F128J3A, 28F320J3A or 28F640J3A flash. |
565 | 573 | ||
566 | * Patch by Rick Bronson, 28 Mar 2003: | 574 | * Patch by Rick Bronson, 28 Mar 2003: |
567 | - fix common/cmd_nand.c | 575 | - fix common/cmd_nand.c |
568 | 576 | ||
569 | * Patch by Arun Dharankar, 24 Mar 2003: | 577 | * Patch by Arun Dharankar, 24 Mar 2003: |
570 | - add threads / scheduler example code | 578 | - add threads / scheduler example code |
571 | 579 | ||
572 | * Add patches by Robert Schwebel, 31 Mar 2003: | 580 | * Add patches by Robert Schwebel, 31 Mar 2003: |
573 | - add ctrl-c support for kermit download | 581 | - add ctrl-c support for kermit download |
574 | - align bdinfo output on ARM | 582 | - align bdinfo output on ARM |
575 | - csb226 board: bring in sync with innokom/memsetup.S | 583 | - csb226 board: bring in sync with innokom/memsetup.S |
576 | - csb226 board: fix MDREFR handling | 584 | - csb226 board: fix MDREFR handling |
577 | - misc doc fixes / extensions | 585 | - misc doc fixes / extensions |
578 | - innokom board: cleanup, MDREFR fix in memsetup.S, config update | 586 | - innokom board: cleanup, MDREFR fix in memsetup.S, config update |
579 | - add BOOT_PROGRESS to armlinux.c | 587 | - add BOOT_PROGRESS to armlinux.c |
580 | 588 | ||
581 | * Add CPU ID, version, and clock speed for INCA-IP | 589 | * Add CPU ID, version, and clock speed for INCA-IP |
582 | 590 | ||
583 | * Patches by Dave Ellis, 18 Mar 2003 for SXNI855T board: | 591 | * Patches by Dave Ellis, 18 Mar 2003 for SXNI855T board: |
584 | - fix SRAM and SDRAM memory sizing | 592 | - fix SRAM and SDRAM memory sizing |
585 | - add status LED support | 593 | - add status LED support |
586 | - add MAC address for second (SCC1) ethernet port | 594 | - add MAC address for second (SCC1) ethernet port |
587 | 595 | ||
588 | * Update default environment for TQM8260 board | 596 | * Update default environment for TQM8260 board |
589 | 597 | ||
590 | * Patch by Rick Bronson, 16 Mar 2003: | 598 | * Patch by Rick Bronson, 16 Mar 2003: |
591 | - Add NAND flash support for reading, writing, and erasing NAND | 599 | - Add NAND flash support for reading, writing, and erasing NAND |
592 | flash (certain forms of which are called SmartMedia). | 600 | flash (certain forms of which are called SmartMedia). |
593 | - Add support for Atmel AT91RM9200DK ARM920T based development kit. | 601 | - Add support for Atmel AT91RM9200DK ARM920T based development kit. |
594 | 602 | ||
595 | * Patches by Robert Schwebel, 19 Mar 2003: | 603 | * Patches by Robert Schwebel, 19 Mar 2003: |
596 | - use arm-linux-gcc as default compiler for ARM | 604 | - use arm-linux-gcc as default compiler for ARM |
597 | - fix i2c fixup code | 605 | - fix i2c fixup code |
598 | - fix missing baudrate setting | 606 | - fix missing baudrate setting |
599 | - added $loadaddr / CFG_LOAD_ADDR support to loadb | 607 | - added $loadaddr / CFG_LOAD_ADDR support to loadb |
600 | - moved "ignoring trailing characters" _before_ u-boot wants to | 608 | - moved "ignoring trailing characters" _before_ u-boot wants to |
601 | print out diagnostics messages; removes bogus characters at the | 609 | print out diagnostics messages; removes bogus characters at the |
602 | end of transmission | 610 | end of transmission |
603 | 611 | ||
604 | * Patch by John Zhan, 18 Mar 2003: | 612 | * Patch by John Zhan, 18 Mar 2003: |
605 | Add support for SinoVee Microsystems SC8xx boards | 613 | Add support for SinoVee Microsystems SC8xx boards |
606 | 614 | ||
607 | * Patch by Rolf Offermanns, 21 Mar 2003: | 615 | * Patch by Rolf Offermanns, 21 Mar 2003: |
608 | ported the dnp1110 related changes from the current armboot cvs to | 616 | ported the dnp1110 related changes from the current armboot cvs to |
609 | current u-boot cvs. smc91111 does not work. problem marked in | 617 | current u-boot cvs. smc91111 does not work. problem marked in |
610 | smc91111.c, grep for "FIXME". | 618 | smc91111.c, grep for "FIXME". |
611 | 619 | ||
612 | * Patch by Brian Auld, 25 Mar 2003: | 620 | * Patch by Brian Auld, 25 Mar 2003: |
613 | Add support for STM flash chips on ebony board | 621 | Add support for STM flash chips on ebony board |
614 | 622 | ||
615 | * Add PCI support for MPC8250 Boards (PM825 module) | 623 | * Add PCI support for MPC8250 Boards (PM825 module) |
616 | 624 | ||
617 | * Patch by Stefan Roese, 25 Mar 2003: | 625 | * Patch by Stefan Roese, 25 Mar 2003: |
618 | - PCI405 update. | 626 | - PCI405 update. |
619 | 627 | ||
620 | * Patch by Stefan Roese, 20 Mar 2003: | 628 | * Patch by Stefan Roese, 20 Mar 2003: |
621 | - CPCI4052 update (support for revision 3). | 629 | - CPCI4052 update (support for revision 3). |
622 | - Set edge conditioning circuitry on PPC405GPr for compatibility | 630 | - Set edge conditioning circuitry on PPC405GPr for compatibility |
623 | to existing PPC405GP designs. | 631 | to existing PPC405GP designs. |
624 | - Clip udiv to 5 bits on PPC405 (serial.c). | 632 | - Clip udiv to 5 bits on PPC405 (serial.c). |
625 | 633 | ||
626 | * Extend INCAIP board support: | 634 | * Extend INCAIP board support: |
627 | - add automatic RAM size detection | 635 | - add automatic RAM size detection |
628 | - add "bdinfo" command | 636 | - add "bdinfo" command |
629 | - pass flash address and size to Linux kernel | 637 | - pass flash address and size to Linux kernel |
630 | - switch to 150 MHz clock | 638 | - switch to 150 MHz clock |
631 | 639 | ||
632 | * Avoid flicker on the TRAB's VFD by synchronizing the enable with | 640 | * Avoid flicker on the TRAB's VFD by synchronizing the enable with |
633 | the HSYNC/VSYNC. Requires new CPLD code (Version 101 for Rev. 100 | 641 | the HSYNC/VSYNC. Requires new CPLD code (Version 101 for Rev. 100 |
634 | boards, version 153 for Rev. 200 boards). | 642 | boards, version 153 for Rev. 200 boards). |
635 | 643 | ||
636 | * Patch by Vladimir Gurevich, 12 Mar 2003: | 644 | * Patch by Vladimir Gurevich, 12 Mar 2003: |
637 | Fix relocation problem of statically initialized string pointers | 645 | Fix relocation problem of statically initialized string pointers |
638 | in common/cmd_pci.c | 646 | in common/cmd_pci.c |
639 | 647 | ||
640 | * Patch by Kai-Uwe Blรถm, 12 Mar 2003: | 648 | * Patch by Kai-Uwe Blรถm, 12 Mar 2003: |
641 | Cleanup & bug fixes for JFFS2 code: | 649 | Cleanup & bug fixes for JFFS2 code: |
642 | - the memory mangement was broken. It caused havoc on malloc by | 650 | - the memory mangement was broken. It caused havoc on malloc by |
643 | writing beyond the block boundaries. | 651 | writing beyond the block boundaries. |
644 | - the length calculation for files was wrong, sometimes resulting | 652 | - the length calculation for files was wrong, sometimes resulting |
645 | in short file reads. | 653 | in short file reads. |
646 | - data copying now optionally takes fragment version numbers into | 654 | - data copying now optionally takes fragment version numbers into |
647 | account, to avoid copying from older data. | 655 | account, to avoid copying from older data. |
648 | See doc/README.JFFS2 for details. | 656 | See doc/README.JFFS2 for details. |
649 | 657 | ||
650 | * Patch by Josef Wagner, 12 Mar 2003: | 658 | * Patch by Josef Wagner, 12 Mar 2003: |
651 | - 16/32 MB and 50/80 MHz support with auto-detection for IP860 | 659 | - 16/32 MB and 50/80 MHz support with auto-detection for IP860 |
652 | - ETH05 and BEDBUG support for CU824 | 660 | - ETH05 and BEDBUG support for CU824 |
653 | - added support for MicroSys CPC45 | 661 | - added support for MicroSys CPC45 |
654 | - new BOOTROM/FLASH0 and DOC base for PM826 | 662 | - new BOOTROM/FLASH0 and DOC base for PM826 |
655 | 663 | ||
656 | * Patch by Robert Schwebel, 12 Mar 2003: | 664 | * Patch by Robert Schwebel, 12 Mar 2003: |
657 | Fix the chpart command on innokom board | 665 | Fix the chpart command on innokom board |
658 | 666 | ||
659 | * Name cleanup: | 667 | * Name cleanup: |
660 | mv include/asm-i386/ppcboot-i386.h include/asm-i386/u-boot-i386.h | 668 | mv include/asm-i386/ppcboot-i386.h include/asm-i386/u-boot-i386.h |
661 | s/PPCBoot/U-Boot/ in some files | 669 | s/PPCBoot/U-Boot/ in some files |
662 | s/pImage/uImage/ in some files | 670 | s/pImage/uImage/ in some files |
663 | 671 | ||
664 | * Patch by Detlev Zundel, 15 Jan 2003: | 672 | * Patch by Detlev Zundel, 15 Jan 2003: |
665 | Fix '' command line quoting | 673 | Fix '' command line quoting |
666 | 674 | ||
667 | * Patch by The LEOX team, 19 Jan 2003: | 675 | * Patch by The LEOX team, 19 Jan 2003: |
668 | - add support for the ELPT860 board | 676 | - add support for the ELPT860 board |
669 | - add support for Dallas ds164x RTC | 677 | - add support for Dallas ds164x RTC |
670 | 678 | ||
671 | * Patches by David Mรผller, 31 Jan 2003: | 679 | * Patches by David Mรผller, 31 Jan 2003: |
672 | - minimal setup for CardBus bridges | 680 | - minimal setup for CardBus bridges |
673 | - add EEPROM read/write support in the CS8900 driver | 681 | - add EEPROM read/write support in the CS8900 driver |
674 | - add support for the builtin I2C controller in the Samsung s3c24x0 chips | 682 | - add support for the builtin I2C controller in the Samsung s3c24x0 chips |
675 | - add support for MPL's VCMA9 (Samsung s3c2410 based) board | 683 | - add support for MPL's VCMA9 (Samsung s3c2410 based) board |
676 | 684 | ||
677 | * Patch by Steven Scholz, 04 Feb 2003: | 685 | * Patch by Steven Scholz, 04 Feb 2003: |
678 | add support for RTC DS1307 | 686 | add support for RTC DS1307 |
679 | 687 | ||
680 | * Patch by Reinhard Meyer, 5 Feb 2003: | 688 | * Patch by Reinhard Meyer, 5 Feb 2003: |
681 | fix PLPRCR/SCCR init sequence on 8xx to allow for | 689 | fix PLPRCR/SCCR init sequence on 8xx to allow for |
682 | changes of EBDF by software | 690 | changes of EBDF by software |
683 | 691 | ||
684 | * Patch by Vladimir Gurevich, 07 Feb 2003: | 692 | * Patch by Vladimir Gurevich, 07 Feb 2003: |
685 | "API-compatibility patch" for 4xx I2C driver | 693 | "API-compatibility patch" for 4xx I2C driver |
686 | 694 | ||
687 | * TRAB fixes / extensions: | 695 | * TRAB fixes / extensions: |
688 | - Restore VFD brightness as saved in environment | 696 | - Restore VFD brightness as saved in environment |
689 | - add support for Fujitsu flashes | 697 | - add support for Fujitsu flashes |
690 | - make sure both buzzers are turned off (drive low level) | 698 | - make sure both buzzers are turned off (drive low level) |
691 | 699 | ||
692 | * Patches by Robert Schwebel, 06 Mar 2003: | 700 | * Patches by Robert Schwebel, 06 Mar 2003: |
693 | - fix bug in BOOTP code (must use NetCopyIP) | 701 | - fix bug in BOOTP code (must use NetCopyIP) |
694 | - update of CSB226 port | 702 | - update of CSB226 port |
695 | - clear BSS segment on XScale | 703 | - clear BSS segment on XScale |
696 | - added support for i2c_init_board() function | 704 | - added support for i2c_init_board() function |
697 | - update to the Innokom plattform | 705 | - update to the Innokom plattform |
698 | 706 | ||
699 | * Extend support for redundand environments for configurations where | 707 | * Extend support for redundand environments for configurations where |
700 | environment size < sector size | 708 | environment size < sector size |
701 | 709 | ||
702 | * Patch by Rune Torgersen, 13 Feb 2003: | 710 | * Patch by Rune Torgersen, 13 Feb 2003: |
703 | Add support for Motorola MPC8266ADS board | 711 | Add support for Motorola MPC8266ADS board |
704 | 712 | ||
705 | * Patch by Kyle Harris, 19 Feb 2003: | 713 | * Patch by Kyle Harris, 19 Feb 2003: |
706 | patches for the Intel lubbock board: | 714 | patches for the Intel lubbock board: |
707 | memsetup.S - general cleanup (based on Robert's csb226 code) | 715 | memsetup.S - general cleanup (based on Robert's csb226 code) |
708 | flash.c - overhaul, actually works now | 716 | flash.c - overhaul, actually works now |
709 | lubbock.c - fix init funcs to return proper value | 717 | lubbock.c - fix init funcs to return proper value |
710 | 718 | ||
711 | * Patch by Kenneth Johansson, 26 Feb 2003: | 719 | * Patch by Kenneth Johansson, 26 Feb 2003: |
712 | - Fixed off by one in RFTA calculation. | 720 | - Fixed off by one in RFTA calculation. |
713 | - No need to abort when LDF is lower than we can program it's only | 721 | - No need to abort when LDF is lower than we can program it's only |
714 | minimum timing so clamp it to what we can do. | 722 | minimum timing so clamp it to what we can do. |
715 | - Takes function pointer to function for reading the spd_nvram. Usefull | 723 | - Takes function pointer to function for reading the spd_nvram. Usefull |
716 | for faking data or hardcode a module without the nvram. | 724 | for faking data or hardcode a module without the nvram. |
717 | - fix other user for above change | 725 | - fix other user for above change |
718 | - fix some comments. | 726 | - fix some comments. |
719 | 727 | ||
720 | * Patches by Brian Waite, 26 Feb 2003: | 728 | * Patches by Brian Waite, 26 Feb 2003: |
721 | - fix port for evb64260 board | 729 | - fix port for evb64260 board |
722 | - fix PCI for evb64260 board | 730 | - fix PCI for evb64260 board |
723 | - fix PCI scan | 731 | - fix PCI scan |
724 | 732 | ||
725 | * Patch by Reinhard Meyer, 1 Mar 2003: | 733 | * Patch by Reinhard Meyer, 1 Mar 2003: |
726 | Add support for EMK TOP860 Module | 734 | Add support for EMK TOP860 Module |
727 | 735 | ||
728 | * Patch by Yuli Barcohen, 02 Mar 2003: | 736 | * Patch by Yuli Barcohen, 02 Mar 2003: |
729 | Add SPD EEPROM support for MPC8260ADS board | 737 | Add SPD EEPROM support for MPC8260ADS board |
730 | 738 | ||
731 | * Patch by Robert Schwebel, 21 Jan 2003: | 739 | * Patch by Robert Schwebel, 21 Jan 2003: |
732 | - Add support for Innokom board | 740 | - Add support for Innokom board |
733 | - Don't complain if "install" fails | 741 | - Don't complain if "install" fails |
734 | - README cleanup (remove duplicated lines) | 742 | - README cleanup (remove duplicated lines) |
735 | - Update PXA header files | 743 | - Update PXA header files |
736 | 744 | ||
737 | * Add documentation for existing POST code (doc/README.POST) | 745 | * Add documentation for existing POST code (doc/README.POST) |
738 | 746 | ||
739 | * Patch by Laudney Ren, 15 Jan 2003: | 747 | * Patch by Laudney Ren, 15 Jan 2003: |
740 | Fix handling of redundand environment in "tools/envcrc.c" | 748 | Fix handling of redundand environment in "tools/envcrc.c" |
741 | 749 | ||
742 | * Patch by Detlev Zundel, 28 Feb 2003: | 750 | * Patch by Detlev Zundel, 28 Feb 2003: |
743 | Add bedbug support for 824x systems | 751 | Add bedbug support for 824x systems |
744 | 752 | ||
745 | * Add support for 16 MB flash configuration of TRAB board | 753 | * Add support for 16 MB flash configuration of TRAB board |
746 | 754 | ||
747 | * Patch by Erwin Rol, 27 Feb 2003: | 755 | * Patch by Erwin Rol, 27 Feb 2003: |
748 | Add support for RTEMS | 756 | Add support for RTEMS |
749 | 757 | ||
750 | * Add image information to README | 758 | * Add image information to README |
751 | 759 | ||
752 | * Patch by Stefan Roese, 18 Feb 2003: | 760 | * Patch by Stefan Roese, 18 Feb 2003: |
753 | CPCIISER4 configuration updated. | 761 | CPCIISER4 configuration updated. |
754 | 762 | ||
755 | * Patch by Stefan Roese, 17 Feb 2003: | 763 | * Patch by Stefan Roese, 17 Feb 2003: |
756 | Fixed bug in ext. serial clock setup on PPC405 (since PPC440 port). | 764 | Fixed bug in ext. serial clock setup on PPC405 (since PPC440 port). |
757 | 765 | ||
758 | * Patch by Stefan Roese, 13 Feb 2003: | 766 | * Patch by Stefan Roese, 13 Feb 2003: |
759 | Add "pcidelay" environment variable (in ms, enabled via | 767 | Add "pcidelay" environment variable (in ms, enabled via |
760 | CONFIG_PCI_BOOTDELAY). | 768 | CONFIG_PCI_BOOTDELAY). |
761 | PCI spec 2.2 defines, that a pci target has 2^25 pci clocks after | 769 | PCI spec 2.2 defines, that a pci target has 2^25 pci clocks after |
762 | RST# to respond to configuration cycles (33MHz -> 1s). | 770 | RST# to respond to configuration cycles (33MHz -> 1s). |
763 | 771 | ||
764 | * Fix dual PCMCIA slot support (when running with just one | 772 | * Fix dual PCMCIA slot support (when running with just one |
765 | slot populated) | 773 | slot populated) |
766 | 774 | ||
767 | * Add VFD type detection to trab board | 775 | * Add VFD type detection to trab board |
768 | 776 | ||
769 | * extend drivers/cs8900.c driver to synchronize ethaddr environment | 777 | * extend drivers/cs8900.c driver to synchronize ethaddr environment |
770 | variable with value in the EEPROM | 778 | variable with value in the EEPROM |
771 | 779 | ||
772 | * Patch by Stefan Roese, 10 Feb 2003: | 780 | * Patch by Stefan Roese, 10 Feb 2003: |
773 | Add support for 4MB and 128MB onboard SDRAM (cpu/ppc4xx/sdram.c) | 781 | Add support for 4MB and 128MB onboard SDRAM (cpu/ppc4xx/sdram.c) |
774 | 782 | ||
775 | * Add support for MIPS32 4Kc CPUs | 783 | * Add support for MIPS32 4Kc CPUs |
776 | 784 | ||
777 | * Add support for INCA-IP Board | 785 | * Add support for INCA-IP Board |
778 | 786 | ||
779 | ====================================================================== | 787 | ====================================================================== |
780 | Changes for U-Boot 0.2.2: | 788 | Changes for U-Boot 0.2.2: |
781 | ====================================================================== | 789 | ====================================================================== |
782 | 790 | ||
783 | * Add dual ethernet support on PM826 | 791 | * Add dual ethernet support on PM826 |
784 | 792 | ||
785 | * Add support for LXT971 PHY on PM826 | 793 | * Add support for LXT971 PHY on PM826 |
786 | 794 | ||
787 | * Patch by Tord Andersson, 16 Jan 2003: | 795 | * Patch by Tord Andersson, 16 Jan 2003: |
788 | Fix flash sector count for TQM8xxL | 796 | Fix flash sector count for TQM8xxL |
789 | 797 | ||
790 | * Fix I2C EEPROM problem on ICU862 board (would only write the first | 798 | * Fix I2C EEPROM problem on ICU862 board (would only write the first |
791 | 16 bytes out of each 32 byte block) | 799 | 16 bytes out of each 32 byte block) |
792 | 800 | ||
793 | ====================================================================== | 801 | ====================================================================== |
794 | Changes for U-Boot 0.2.1: | 802 | Changes for U-Boot 0.2.1: |
795 | ====================================================================== | 803 | ====================================================================== |
796 | 804 | ||
797 | * Add support for V37 board | 805 | * Add support for V37 board |
798 | (patch by Jรณn Benediktsson, 11 Dec 2002) | 806 | (patch by Jรณn Benediktsson, 11 Dec 2002) |
799 | 807 | ||
800 | * Update baudrate in bd_info when it gets changed | 808 | * Update baudrate in bd_info when it gets changed |
801 | 809 | ||
802 | * Add watchdog trigger points while waiting for serial port | 810 | * Add watchdog trigger points while waiting for serial port |
803 | (so far only 8xx -- needed on LWMON with 100ms watchdog) | 811 | (so far only 8xx -- needed on LWMON with 100ms watchdog) |
804 | 812 | ||
805 | * Improve command line tool to access the U-Boot's environment | 813 | * Improve command line tool to access the U-Boot's environment |
806 | (figuration of the utility, using a config file) | 814 | (figuration of the utility, using a config file) |
807 | 815 | ||
808 | * Add single quote support for (old) command line parser | 816 | * Add single quote support for (old) command line parser |
809 | 817 | ||
810 | * Switch LWMON board default config from FRAM to EEPROM; | 818 | * Switch LWMON board default config from FRAM to EEPROM; |
811 | in POST, EEPROM shows up on 8 addresses | 819 | in POST, EEPROM shows up on 8 addresses |
812 | 820 | ||
813 | ====================================================================== | 821 | ====================================================================== |
814 | Changes for U-Boot 0.2.0: | 822 | Changes for U-Boot 0.2.0: |
815 | ====================================================================== | 823 | ====================================================================== |
816 | 824 | ||
817 | * Use 1-byte-read instead of -write for iprobe() function | 825 | * Use 1-byte-read instead of -write for iprobe() function |
818 | Add i2c commands to PM826 config | 826 | Add i2c commands to PM826 config |
819 | 827 | ||
820 | * extend I2C POST code: check for list on known addresses | 828 | * extend I2C POST code: check for list on known addresses |
821 | 829 | ||
822 | * Improve log buffer code; use "loglevel" to decide which messages | 830 | * Improve log buffer code; use "loglevel" to decide which messages |
823 | to log on the console, too (like in Linux); get rid of "logstart" | 831 | to log on the console, too (like in Linux); get rid of "logstart" |
824 | 832 | ||
825 | * Add command line tool to access the U-Boot's environment | 833 | * Add command line tool to access the U-Boot's environment |
826 | (board-specific for TRAB now, to be fixed later) | 834 | (board-specific for TRAB now, to be fixed later) |
827 | 835 | ||
828 | * Patch by Hans-Joerg Frieden, 06 Dec 2002 | 836 | * Patch by Hans-Joerg Frieden, 06 Dec 2002 |
829 | Fix misc problems with AmigaOne support | 837 | Fix misc problems with AmigaOne support |
830 | 838 | ||
831 | * Patch by Chris Hallinan, 3 Dec 2002: | 839 | * Patch by Chris Hallinan, 3 Dec 2002: |
832 | minor cleanup to the MPC8245 EPIC driver | 840 | minor cleanup to the MPC8245 EPIC driver |
833 | 841 | ||
834 | * Patch by Pierre Aubert , 28 Nov 2002 | 842 | * Patch by Pierre Aubert , 28 Nov 2002 |
835 | Add support for external (SIU) interrupts on MPC8xx | 843 | Add support for external (SIU) interrupts on MPC8xx |
836 | 844 | ||
837 | * Patch by Pierre Aubert , 28 Nov 2002 | 845 | * Patch by Pierre Aubert , 28 Nov 2002 |
838 | Fix nested syscalls bug in standalone applications | 846 | Fix nested syscalls bug in standalone applications |
839 | 847 | ||
840 | * Patch by David Mรผller, 27 Nov 2002: | 848 | * Patch by David Mรผller, 27 Nov 2002: |
841 | fix output of "pciinfo" command for CardBus bridge devices. | 849 | fix output of "pciinfo" command for CardBus bridge devices. |
842 | 850 | ||
843 | * Fix bug in TQM8260 board detection - boards got stuck when board ID | 851 | * Fix bug in TQM8260 board detection - boards got stuck when board ID |
844 | was not readable | 852 | was not readable |
845 | 853 | ||
846 | * Add LED indication for IDE activity on KUP4K board | 854 | * Add LED indication for IDE activity on KUP4K board |
847 | 855 | ||
848 | * Fix startup problems with VFD display on TRAB | 856 | * Fix startup problems with VFD display on TRAB |
849 | 857 | ||
850 | * Patch by Pierre Aubert, 20 Nov 2002 | 858 | * Patch by Pierre Aubert, 20 Nov 2002 |
851 | Add driver for Epson SED13806 graphic controller. | 859 | Add driver for Epson SED13806 graphic controller. |
852 | Add support for BMP logos in cfb_console driver. | 860 | Add support for BMP logos in cfb_console driver. |
853 | 861 | ||
854 | * Added support for both PCMCIA slots (at the same time!) on MPC8xx | 862 | * Added support for both PCMCIA slots (at the same time!) on MPC8xx |
855 | 863 | ||
856 | * Patch by Rod Boyce, 21 Nov 2002: | 864 | * Patch by Rod Boyce, 21 Nov 2002: |
857 | fix PCMCIA on MBX8xx board | 865 | fix PCMCIA on MBX8xx board |
858 | 866 | ||
859 | * Patch by Pierre Aubert , 21 Nov 2002 | 867 | * Patch by Pierre Aubert , 21 Nov 2002 |
860 | Add CFG_CPM_POST_WORD_ADDR to make the offset of the | 868 | Add CFG_CPM_POST_WORD_ADDR to make the offset of the |
861 | bootmode word in DPRAM configurable | 869 | bootmode word in DPRAM configurable |
862 | 870 | ||
863 | * Patch by Daniel Engstrรถm, 18 Nov 2002: | 871 | * Patch by Daniel Engstrรถm, 18 Nov 2002: |
864 | Fixes for x86 port (mostly strings issues) | 872 | Fixes for x86 port (mostly strings issues) |
865 | 873 | ||
866 | * Patch by Ken Chou, 18 Nov 2002: | 874 | * Patch by Ken Chou, 18 Nov 2002: |
867 | Fix for natsemi NIC cards (DP83815) | 875 | Fix for natsemi NIC cards (DP83815) |
868 | 876 | ||
869 | * Patch by Pierre Aubert, 19 Nov 2002: | 877 | * Patch by Pierre Aubert, 19 Nov 2002: |
870 | fix a bug for the MII configuration, and some warnings | 878 | fix a bug for the MII configuration, and some warnings |
871 | 879 | ||
872 | * Patch by Thomas Frieden, 13 Nov 2002: | 880 | * Patch by Thomas Frieden, 13 Nov 2002: |
873 | Add code for AmigaOne board | 881 | Add code for AmigaOne board |
874 | (preliminary merge to U-Boot, still WIP) | 882 | (preliminary merge to U-Boot, still WIP) |
875 | 883 | ||
876 | * Patch by Jon Diekema, 12 Nov 2002: | 884 | * Patch by Jon Diekema, 12 Nov 2002: |
877 | - Adding URL for IEEE OUI lookup | 885 | - Adding URL for IEEE OUI lookup |
878 | - Making the autoboot #defines dependent on CONFIG_AUTOBOOT_KEYED | 886 | - Making the autoboot #defines dependent on CONFIG_AUTOBOOT_KEYED |
879 | being defined. | 887 | being defined. |
880 | - In the CONFIG_EXTRA_ENV_SETTINGS #define, the root-on-initrd and | 888 | - In the CONFIG_EXTRA_ENV_SETTINGS #define, the root-on-initrd and |
881 | root-on-nfs macros are designed to switch how the default boot | 889 | root-on-nfs macros are designed to switch how the default boot |
882 | method gets defined. | 890 | method gets defined. |
883 | 891 | ||
884 | * Patch by Daniel Engstrรถm, 13 Nov 2002: | 892 | * Patch by Daniel Engstrรถm, 13 Nov 2002: |
885 | Add support for i386 architecture and AMD SC520 board | 893 | Add support for i386 architecture and AMD SC520 board |
886 | 894 | ||
887 | * Patch by Pierre Aubert, 12 Nov 2002: | 895 | * Patch by Pierre Aubert, 12 Nov 2002: |
888 | Add support for DOS filesystem and booting from DOS floppy disk | 896 | Add support for DOS filesystem and booting from DOS floppy disk |
889 | 897 | ||
890 | * Patch by Jim Sandoz, 07 Nov 2002: | 898 | * Patch by Jim Sandoz, 07 Nov 2002: |
891 | Increase number of network RX buffers (PKTBUFSRX in | 899 | Increase number of network RX buffers (PKTBUFSRX in |
892 | "include/net.h") for EEPRO100 based boards (especially SP8240) | 900 | "include/net.h") for EEPRO100 based boards (especially SP8240) |
893 | which showed "Receiver is not ready" errors when U-Boot was | 901 | which showed "Receiver is not ready" errors when U-Boot was |
894 | processing the receive buffers slower than the network controller | 902 | processing the receive buffers slower than the network controller |
895 | was filling them. | 903 | was filling them. |
896 | 904 | ||
897 | * Patch by Andreas Oberritter, 09 Nov 2002: | 905 | * Patch by Andreas Oberritter, 09 Nov 2002: |
898 | Change behaviour of NetLoop(): return -1 for errors, filesize | 906 | Change behaviour of NetLoop(): return -1 for errors, filesize |
899 | otherwise; return code 0 is valid an means no file loaded - in this | 907 | otherwise; return code 0 is valid an means no file loaded - in this |
900 | case the environment still gets updated! | 908 | case the environment still gets updated! |
901 | 909 | ||
902 | * Patches by Jon Diekema, 9 Nov 2002: | 910 | * Patches by Jon Diekema, 9 Nov 2002: |
903 | - improve ADC/DAC clocking on the SACSng board to align | 911 | - improve ADC/DAC clocking on the SACSng board to align |
904 | the failing edges of LRCLK and SCLK | 912 | the failing edges of LRCLK and SCLK |
905 | - sbc8260 configuration tweaks | 913 | - sbc8260 configuration tweaks |
906 | - add status LED support for 82xx systems | 914 | - add status LED support for 82xx systems |
907 | - wire sspi/sspo commands into command handler; improved error | 915 | - wire sspi/sspo commands into command handler; improved error |
908 | handlering | 916 | handlering |
909 | - add timestamp support and alternate memory test to the | 917 | - add timestamp support and alternate memory test to the |
910 | SACSng configuration | 918 | SACSng configuration |
911 | 919 | ||
912 | * Patch by Vince Husovsky, 7 Nov 2002: | 920 | * Patch by Vince Husovsky, 7 Nov 2002: |
913 | Add "-n" to linker options to get rid of "Not enough room for | 921 | Add "-n" to linker options to get rid of "Not enough room for |
914 | program headers" problem | 922 | program headers" problem |
915 | 923 | ||
916 | * Patch by David Mรผller, 05 Nov 2002 | 924 | * Patch by David Mรผller, 05 Nov 2002 |
917 | Rename CONFIG_PLL_INPUT_FREQ to CONFIG_SYS_CLK_FREQ | 925 | Rename CONFIG_PLL_INPUT_FREQ to CONFIG_SYS_CLK_FREQ |
918 | so we can use an already existing name | 926 | so we can use an already existing name |
919 | 927 | ||
920 | * Patch by Pierre Aubert, 05 Nov 2002 | 928 | * Patch by Pierre Aubert, 05 Nov 2002 |
921 | Hardware relatied improvments in FDC boot code | 929 | Hardware relatied improvments in FDC boot code |
922 | 930 | ||
923 | * Patch by Holger Schurig, 5 Nov 2002: | 931 | * Patch by Holger Schurig, 5 Nov 2002: |
924 | Make the PXA really change it's frequency | 932 | Make the PXA really change it's frequency |
925 | 933 | ||
926 | * Patch by Pierre Aubert, 05 Nov 2002 | 934 | * Patch by Pierre Aubert, 05 Nov 2002 |
927 | Add support for slave serial Spartan 2 FPGAs | 935 | Add support for slave serial Spartan 2 FPGAs |
928 | 936 | ||
929 | * Fix uninitialized memory (MAC address) in 8xx SCC/FEC ethernet | 937 | * Fix uninitialized memory (MAC address) in 8xx SCC/FEC ethernet |
930 | drivers | 938 | drivers |
931 | 939 | ||
932 | * Add support for log buffer which can be passed to Linux kernel's | 940 | * Add support for log buffer which can be passed to Linux kernel's |
933 | syslog mechanism; used especially for POST results. | 941 | syslog mechanism; used especially for POST results. |
934 | 942 | ||
935 | * Patch by Klaus Heydeck, 31 Oct 2002: | 943 | * Patch by Klaus Heydeck, 31 Oct 2002: |
936 | Add initial support for kup4k board | 944 | Add initial support for kup4k board |
937 | 945 | ||
938 | * Patch by Robert Schwebel, 04 Nov 2002: | 946 | * Patch by Robert Schwebel, 04 Nov 2002: |
939 | - use watchdog to reset PXA250 systems | 947 | - use watchdog to reset PXA250 systems |
940 | - added progress callbacks to (some of the) ARM code | 948 | - added progress callbacks to (some of the) ARM code |
941 | - update for Cogent CSB226 board | 949 | - update for Cogent CSB226 board |
942 | 950 | ||
943 | * Add support for FPS860 board | 951 | * Add support for FPS860 board |
944 | 952 | ||
945 | * Patch by Guillaume Alexandre,, 04 Nov 2002: | 953 | * Patch by Guillaume Alexandre,, 04 Nov 2002: |
946 | Improve PCI access on 32-bits Compact PCI bus | 954 | Improve PCI access on 32-bits Compact PCI bus |
947 | 955 | ||
948 | * Fix mdelay() on TRAB - this was still the debugging version with | 956 | * Fix mdelay() on TRAB - this was still the debugging version with |
949 | seconds instead of ms. | 957 | seconds instead of ms. |
950 | 958 | ||
951 | * Patch by Robert Schwebel, 1 Nov 2002: | 959 | * Patch by Robert Schwebel, 1 Nov 2002: |
952 | XScale related cleanup (affects all ARM boards) | 960 | XScale related cleanup (affects all ARM boards) |
953 | 961 | ||
954 | * Cleanup of names and README. | 962 | * Cleanup of names and README. |
955 | 963 | ||
956 | ====================================================================== | 964 | ====================================================================== |
957 | Notes for U-Boot 0.1.0: | 965 | Notes for U-Boot 0.1.0: |
958 | ====================================================================== | 966 | ====================================================================== |
959 | 967 | ||
960 | This is the initial version of "Das U-Boot", the Universal Boot Loader. | 968 | This is the initial version of "Das U-Boot", the Universal Boot Loader. |
961 | 969 | ||
962 | It is based on version 2.0.0 (the "Halloween Release") of PPCBoot. | 970 | It is based on version 2.0.0 (the "Halloween Release") of PPCBoot. |
963 | For information about the history of the project please see the | 971 | For information about the history of the project please see the |
964 | PPCBoot project page at http://sourceforge.net/projects/ppcboot | 972 | PPCBoot project page at http://sourceforge.net/projects/ppcboot |
965 | 973 | ||
966 | ====================================================================== | 974 | ====================================================================== |
967 | 975 |
cpu/mpc5xxx/fec.c
1 | /* | 1 | /* |
2 | * (C) Copyright 2003 | 2 | * (C) Copyright 2003 |
3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
4 | * | 4 | * |
5 | * This file is based on mpc4200fec.c, | 5 | * This file is based on mpc4200fec.c, |
6 | * (C) Copyright Motorola, Inc., 2000 | 6 | * (C) Copyright Motorola, Inc., 2000 |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <common.h> | 9 | #include <common.h> |
10 | #include <mpc5xxx.h> | 10 | #include <mpc5xxx.h> |
11 | #include <malloc.h> | 11 | #include <malloc.h> |
12 | #include <net.h> | 12 | #include <net.h> |
13 | #include <miiphy.h> | 13 | #include <miiphy.h> |
14 | #include "sdma.h" | 14 | #include "sdma.h" |
15 | #include "fec.h" | 15 | #include "fec.h" |
16 | 16 | ||
17 | #define DEBUG 0x8 | 17 | /* #define DEBUG 0x28 */ |
18 | 18 | ||
19 | #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \ | 19 | #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \ |
20 | defined(CONFIG_MPC5XXX_FEC) | 20 | defined(CONFIG_MPC5XXX_FEC) |
21 | 21 | ||
22 | #if (DEBUG & 0x60) | 22 | #if (DEBUG & 0x60) |
23 | static void tfifo_print(mpc5xxx_fec_priv *fec); | 23 | static void tfifo_print(mpc5xxx_fec_priv *fec); |
24 | static void rfifo_print(mpc5xxx_fec_priv *fec); | 24 | static void rfifo_print(mpc5xxx_fec_priv *fec); |
25 | #endif /* DEBUG */ | 25 | #endif /* DEBUG */ |
26 | 26 | ||
27 | #if (DEBUG & 0x40) | 27 | #if (DEBUG & 0x40) |
28 | static uint32 local_crc32(char *string, unsigned int crc_value, int len); | 28 | static uint32 local_crc32(char *string, unsigned int crc_value, int len); |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | typedef struct { | ||
32 | uint8 data[1500]; /* actual data */ | ||
33 | int length; /* actual length */ | ||
34 | int used; /* buffer in use or not */ | ||
35 | uint8 head[16]; /* MAC header(6 + 6 + 2) + 2(aligned) */ | ||
36 | } NBUF; | ||
37 | |||
31 | /********************************************************************/ | 38 | /********************************************************************/ |
32 | static int mpc5xxx_fec_rbd_init(mpc5xxx_fec_priv *fec) | 39 | static int mpc5xxx_fec_rbd_init(mpc5xxx_fec_priv *fec) |
33 | { | 40 | { |
34 | int ix; | 41 | int ix; |
35 | char *data; | 42 | char *data; |
43 | static int once = 0; | ||
36 | 44 | ||
37 | /* | ||
38 | * the receive ring is located right after the transmit one | ||
39 | */ | ||
40 | for (ix = 0; ix < FEC_RBD_NUM; ix++) { | 45 | for (ix = 0; ix < FEC_RBD_NUM; ix++) { |
41 | data = (char *)malloc(FEC_MAX_PKT_SIZE); | 46 | if (!once) { |
42 | if (data == NULL) { | 47 | data = (char *)malloc(FEC_MAX_PKT_SIZE); |
43 | printf ("RBD INIT FAILED\n"); | 48 | if (data == NULL) { |
44 | return -1; | 49 | printf ("RBD INIT FAILED\n"); |
50 | return -1; | ||
51 | } | ||
52 | fec->rbdBase[ix].dataPointer = (uint32)data; | ||
45 | } | 53 | } |
46 | fec->rbdBase[ix].status = FEC_RBD_EMPTY; | 54 | fec->rbdBase[ix].status = FEC_RBD_EMPTY; |
47 | fec->rbdBase[ix].dataLength = 0; | 55 | fec->rbdBase[ix].dataLength = 0; |
48 | fec->rbdBase[ix].dataPointer = (uint32)data; | ||
49 | } | 56 | } |
57 | once ++; | ||
50 | 58 | ||
51 | /* | 59 | /* |
52 | * have the last RBD to close the ring | 60 | * have the last RBD to close the ring |
53 | */ | 61 | */ |
54 | fec->rbdBase[ix - 1].status |= FEC_RBD_WRAP; | 62 | fec->rbdBase[ix - 1].status |= FEC_RBD_WRAP; |
55 | fec->rbdIndex = 0; | 63 | fec->rbdIndex = 0; |
56 | 64 | ||
57 | return 0; | 65 | return 0; |
58 | } | 66 | } |
59 | 67 | ||
60 | /********************************************************************/ | 68 | /********************************************************************/ |
61 | static void mpc5xxx_fec_tbd_init(mpc5xxx_fec_priv *fec) | 69 | static void mpc5xxx_fec_tbd_init(mpc5xxx_fec_priv *fec) |
62 | { | 70 | { |
63 | int ix; | 71 | int ix; |
64 | 72 | ||
65 | for (ix = 0; ix < FEC_TBD_NUM; ix++) { | 73 | for (ix = 0; ix < FEC_TBD_NUM; ix++) { |
66 | fec->tbdBase[ix].status = 0; | 74 | fec->tbdBase[ix].status = 0; |
67 | } | 75 | } |
68 | 76 | ||
69 | /* | 77 | /* |
70 | * Have the last TBD to close the ring | 78 | * Have the last TBD to close the ring |
71 | */ | 79 | */ |
72 | fec->tbdBase[ix - 1].status |= FEC_TBD_WRAP; | 80 | fec->tbdBase[ix - 1].status |= FEC_TBD_WRAP; |
73 | 81 | ||
74 | /* | 82 | /* |
75 | * Initialize some indices | 83 | * Initialize some indices |
76 | */ | 84 | */ |
77 | fec->tbdIndex = 0; | 85 | fec->tbdIndex = 0; |
78 | fec->usedTbdIndex = 0; | 86 | fec->usedTbdIndex = 0; |
79 | fec->cleanTbdNum = FEC_TBD_NUM; | 87 | fec->cleanTbdNum = FEC_TBD_NUM; |
80 | } | 88 | } |
81 | 89 | ||
82 | /********************************************************************/ | 90 | /********************************************************************/ |
83 | static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, FEC_RBD * pRbd) | 91 | static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, FEC_RBD * pRbd) |
84 | { | 92 | { |
85 | /* | 93 | /* |
86 | * Reset buffer descriptor as empty | 94 | * Reset buffer descriptor as empty |
87 | */ | 95 | */ |
88 | if ((fec->rbdIndex) == (FEC_RBD_NUM - 1)) | 96 | if ((fec->rbdIndex) == (FEC_RBD_NUM - 1)) |
89 | pRbd->status = (FEC_RBD_WRAP | FEC_RBD_EMPTY); | 97 | pRbd->status = (FEC_RBD_WRAP | FEC_RBD_EMPTY); |
90 | else | 98 | else |
91 | pRbd->status = FEC_RBD_EMPTY; | 99 | pRbd->status = FEC_RBD_EMPTY; |
92 | 100 | ||
93 | pRbd->dataLength = 0; | 101 | pRbd->dataLength = 0; |
94 | 102 | ||
95 | /* | 103 | /* |
96 | * Now, we have an empty RxBD, restart the SmartDMA receive task | 104 | * Now, we have an empty RxBD, restart the SmartDMA receive task |
97 | */ | 105 | */ |
98 | SDMA_TASK_ENABLE(FEC_RECV_TASK_NO); | 106 | SDMA_TASK_ENABLE(FEC_RECV_TASK_NO); |
99 | 107 | ||
100 | /* | 108 | /* |
101 | * Increment BD count | 109 | * Increment BD count |
102 | */ | 110 | */ |
103 | fec->rbdIndex = (fec->rbdIndex + 1) % FEC_RBD_NUM; | 111 | fec->rbdIndex = (fec->rbdIndex + 1) % FEC_RBD_NUM; |
104 | } | 112 | } |
105 | 113 | ||
106 | /********************************************************************/ | 114 | /********************************************************************/ |
107 | static void mpc5xxx_fec_tbd_scrub(mpc5xxx_fec_priv *fec) | 115 | static void mpc5xxx_fec_tbd_scrub(mpc5xxx_fec_priv *fec) |
108 | { | 116 | { |
109 | FEC_TBD *pUsedTbd; | 117 | FEC_TBD *pUsedTbd; |
110 | 118 | ||
111 | #if (DEBUG & 0x1) | 119 | #if (DEBUG & 0x1) |
112 | printf ("tbd_scrub: fec->cleanTbdNum = %d, fec->usedTbdIndex = %d\n", | 120 | printf ("tbd_scrub: fec->cleanTbdNum = %d, fec->usedTbdIndex = %d\n", |
113 | fec->cleanTbdNum, fec->usedTbdIndex); | 121 | fec->cleanTbdNum, fec->usedTbdIndex); |
114 | #endif | 122 | #endif |
115 | 123 | ||
116 | /* | 124 | /* |
117 | * process all the consumed TBDs | 125 | * process all the consumed TBDs |
118 | */ | 126 | */ |
119 | while (fec->cleanTbdNum < FEC_TBD_NUM) { | 127 | while (fec->cleanTbdNum < FEC_TBD_NUM) { |
120 | pUsedTbd = &fec->tbdBase[fec->usedTbdIndex]; | 128 | pUsedTbd = &fec->tbdBase[fec->usedTbdIndex]; |
121 | if (pUsedTbd->status & FEC_TBD_READY) { | 129 | if (pUsedTbd->status & FEC_TBD_READY) { |
122 | #if (DEBUG & 0x20) | 130 | #if (DEBUG & 0x20) |
123 | printf("Cannot clean TBD %d, in use\n", fec->cleanTbdNum); | 131 | printf("Cannot clean TBD %d, in use\n", fec->cleanTbdNum); |
124 | #endif | 132 | #endif |
125 | return; | 133 | return; |
126 | } | 134 | } |
127 | 135 | ||
128 | /* | 136 | /* |
129 | * clean this buffer descriptor | 137 | * clean this buffer descriptor |
130 | */ | 138 | */ |
131 | if (fec->usedTbdIndex == (FEC_TBD_NUM - 1)) | 139 | if (fec->usedTbdIndex == (FEC_TBD_NUM - 1)) |
132 | pUsedTbd->status = FEC_TBD_WRAP; | 140 | pUsedTbd->status = FEC_TBD_WRAP; |
133 | else | 141 | else |
134 | pUsedTbd->status = 0; | 142 | pUsedTbd->status = 0; |
135 | 143 | ||
136 | /* | 144 | /* |
137 | * update some indeces for a correct handling of the TBD ring | 145 | * update some indeces for a correct handling of the TBD ring |
138 | */ | 146 | */ |
139 | fec->cleanTbdNum++; | 147 | fec->cleanTbdNum++; |
140 | fec->usedTbdIndex = (fec->usedTbdIndex + 1) % FEC_TBD_NUM; | 148 | fec->usedTbdIndex = (fec->usedTbdIndex + 1) % FEC_TBD_NUM; |
141 | } | 149 | } |
142 | } | 150 | } |
143 | 151 | ||
144 | /********************************************************************/ | 152 | /********************************************************************/ |
145 | static void mpc5xxx_fec_set_hwaddr(mpc5xxx_fec_priv *fec, char *mac) | 153 | static void mpc5xxx_fec_set_hwaddr(mpc5xxx_fec_priv *fec, char *mac) |
146 | { | 154 | { |
147 | uint8 currByte; /* byte for which to compute the CRC */ | 155 | uint8 currByte; /* byte for which to compute the CRC */ |
148 | int byte; /* loop - counter */ | 156 | int byte; /* loop - counter */ |
149 | int bit; /* loop - counter */ | 157 | int bit; /* loop - counter */ |
150 | uint32 crc = 0xffffffff; /* initial value */ | 158 | uint32 crc = 0xffffffff; /* initial value */ |
151 | 159 | ||
152 | /* | 160 | /* |
153 | * The algorithm used is the following: | 161 | * The algorithm used is the following: |
154 | * we loop on each of the six bytes of the provided address, | 162 | * we loop on each of the six bytes of the provided address, |
155 | * and we compute the CRC by left-shifting the previous | 163 | * and we compute the CRC by left-shifting the previous |
156 | * value by one position, so that each bit in the current | 164 | * value by one position, so that each bit in the current |
157 | * byte of the address may contribute the calculation. If | 165 | * byte of the address may contribute the calculation. If |
158 | * the latter and the MSB in the CRC are different, then | 166 | * the latter and the MSB in the CRC are different, then |
159 | * the CRC value so computed is also ex-ored with the | 167 | * the CRC value so computed is also ex-ored with the |
160 | * "polynomium generator". The current byte of the address | 168 | * "polynomium generator". The current byte of the address |
161 | * is also shifted right by one bit at each iteration. | 169 | * is also shifted right by one bit at each iteration. |
162 | * This is because the CRC generatore in hardware is implemented | 170 | * This is because the CRC generatore in hardware is implemented |
163 | * as a shift-register with as many ex-ores as the radixes | 171 | * as a shift-register with as many ex-ores as the radixes |
164 | * in the polynomium. This suggests that we represent the | 172 | * in the polynomium. This suggests that we represent the |
165 | * polynomiumm itself as a 32-bit constant. | 173 | * polynomiumm itself as a 32-bit constant. |
166 | */ | 174 | */ |
167 | for (byte = 0; byte < 6; byte++) { | 175 | for (byte = 0; byte < 6; byte++) { |
168 | currByte = mac[byte]; | 176 | currByte = mac[byte]; |
169 | for (bit = 0; bit < 8; bit++) { | 177 | for (bit = 0; bit < 8; bit++) { |
170 | if ((currByte & 0x01) ^ (crc & 0x01)) { | 178 | if ((currByte & 0x01) ^ (crc & 0x01)) { |
171 | crc >>= 1; | 179 | crc >>= 1; |
172 | crc = crc ^ 0xedb88320; | 180 | crc = crc ^ 0xedb88320; |
173 | } else { | 181 | } else { |
174 | crc >>= 1; | 182 | crc >>= 1; |
175 | } | 183 | } |
176 | currByte >>= 1; | 184 | currByte >>= 1; |
177 | } | 185 | } |
178 | } | 186 | } |
179 | 187 | ||
180 | crc = crc >> 26; | 188 | crc = crc >> 26; |
181 | 189 | ||
182 | /* | 190 | /* |
183 | * Set individual hash table register | 191 | * Set individual hash table register |
184 | */ | 192 | */ |
185 | if (crc >= 32) { | 193 | if (crc >= 32) { |
186 | fec->eth->iaddr1 = (1 << (crc - 32)); | 194 | fec->eth->iaddr1 = (1 << (crc - 32)); |
187 | fec->eth->iaddr2 = 0; | 195 | fec->eth->iaddr2 = 0; |
188 | } else { | 196 | } else { |
189 | fec->eth->iaddr1 = 0; | 197 | fec->eth->iaddr1 = 0; |
190 | fec->eth->iaddr2 = (1 << crc); | 198 | fec->eth->iaddr2 = (1 << crc); |
191 | } | 199 | } |
192 | 200 | ||
193 | /* | 201 | /* |
194 | * Set physical address | 202 | * Set physical address |
195 | */ | 203 | */ |
196 | fec->eth->paddr1 = (mac[0] << 24) + (mac[1] << 16) + (mac[2] << 8) + mac[3]; | 204 | fec->eth->paddr1 = (mac[0] << 24) + (mac[1] << 16) + (mac[2] << 8) + mac[3]; |
197 | fec->eth->paddr2 = (mac[4] << 24) + (mac[5] << 16) + 0x8808; | 205 | fec->eth->paddr2 = (mac[4] << 24) + (mac[5] << 16) + 0x8808; |
198 | } | 206 | } |
199 | 207 | ||
200 | /********************************************************************/ | 208 | /********************************************************************/ |
201 | static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis) | 209 | static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis) |
202 | { | 210 | { |
203 | mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv; | 211 | mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv; |
204 | struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; | 212 | struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; |
205 | const uint8 phyAddr = 0; /* Only one PHY */ | 213 | const uint8 phyAddr = 0; /* Only one PHY */ |
206 | 214 | ||
207 | #if (DEBUG & 0x1) | 215 | #if (DEBUG & 0x1) |
208 | printf ("mpc5xxx_fec_init... Begin\n"); | 216 | printf ("mpc5xxx_fec_init... Begin\n"); |
209 | #endif | 217 | #endif |
210 | 218 | ||
211 | /* | 219 | /* |
212 | * Initialize RxBD/TxBD rings | 220 | * Initialize RxBD/TxBD rings |
213 | */ | 221 | */ |
214 | mpc5xxx_fec_rbd_init(fec); | 222 | mpc5xxx_fec_rbd_init(fec); |
215 | mpc5xxx_fec_tbd_init(fec); | 223 | mpc5xxx_fec_tbd_init(fec); |
216 | 224 | ||
217 | /* | 225 | /* |
218 | * Initialize GPIO pins | 226 | * Initialize GPIO pins |
219 | */ | 227 | */ |
220 | if (fec->xcv_type == SEVENWIRE) { | 228 | if (fec->xcv_type == SEVENWIRE) { |
221 | /* 10MBit with 7-wire operation */ | 229 | /* 10MBit with 7-wire operation */ |
222 | *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000; | 230 | *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000; |
223 | } else { | 231 | } else { |
224 | /* 100MBit with MD operation */ | 232 | /* 100MBit with MD operation */ |
225 | *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000; | 233 | *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000; |
226 | } | 234 | } |
227 | 235 | ||
228 | /* | 236 | /* |
229 | * Clear FEC-Lite interrupt event register(IEVENT) | 237 | * Clear FEC-Lite interrupt event register(IEVENT) |
230 | */ | 238 | */ |
231 | fec->eth->ievent = 0xffffffff; | 239 | fec->eth->ievent = 0xffffffff; |
232 | 240 | ||
233 | /* | 241 | /* |
234 | * Set interrupt mask register | 242 | * Set interrupt mask register |
235 | */ | 243 | */ |
236 | fec->eth->imask = 0x00000000; | 244 | fec->eth->imask = 0x00000000; |
237 | 245 | ||
238 | /* | 246 | /* |
239 | * Set FEC-Lite receive control register(R_CNTRL): | 247 | * Set FEC-Lite receive control register(R_CNTRL): |
240 | */ | 248 | */ |
241 | if (fec->xcv_type == SEVENWIRE) { | 249 | if (fec->xcv_type == SEVENWIRE) { |
242 | /* | 250 | /* |
243 | * Frame length=1518; 7-wire mode | 251 | * Frame length=1518; 7-wire mode |
244 | */ | 252 | */ |
245 | fec->eth->r_cntrl = 0x05ee0020; /*0x05ee0000;FIXME */ | 253 | fec->eth->r_cntrl = 0x05ee0020; /*0x05ee0000;FIXME */ |
246 | } else { | 254 | } else { |
247 | /* | 255 | /* |
248 | * Frame length=1518; MII mode; | 256 | * Frame length=1518; MII mode; |
249 | */ | 257 | */ |
250 | fec->eth->r_cntrl = 0x05ee0024; /*0x05ee0004;FIXME */ | 258 | fec->eth->r_cntrl = 0x05ee0024; /*0x05ee0004;FIXME */ |
251 | } | 259 | } |
252 | 260 | ||
253 | if (fec->xcv_type == SEVENWIRE) { | 261 | if (fec->xcv_type == SEVENWIRE) { |
254 | /* | 262 | /* |
255 | * Set FEC-Lite transmit control register(X_CNTRL): | 263 | * Set FEC-Lite transmit control register(X_CNTRL): |
256 | */ | 264 | */ |
257 | /*fec->eth->x_cntrl = 0x00000002; */ /* half-duplex, heartbeat */ | 265 | /*fec->eth->x_cntrl = 0x00000002; */ /* half-duplex, heartbeat */ |
258 | fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */ | 266 | fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */ |
259 | } else { | 267 | } else { |
260 | /*fec->eth->x_cntrl = 0x00000006; */ /* full-duplex, heartbeat */ | 268 | /*fec->eth->x_cntrl = 0x00000006; */ /* full-duplex, heartbeat */ |
261 | fec->eth->x_cntrl = 0x00000004; /* full-duplex, heartbeat disabled */ | 269 | fec->eth->x_cntrl = 0x00000004; /* full-duplex, heartbeat disabled */ |
262 | 270 | ||
263 | /* | 271 | /* |
264 | * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock(25Mhz) | 272 | * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock(25Mhz) |
265 | * and do not drop the Preamble. | 273 | * and do not drop the Preamble. |
266 | */ | 274 | */ |
267 | fec->eth->mii_speed = (0x5 << 1); /* No MII for 7-wire mode */ | 275 | fec->eth->mii_speed = (0x5 << 1); /* No MII for 7-wire mode */ |
268 | } | 276 | } |
269 | 277 | ||
270 | /* | 278 | /* |
271 | * Set Opcode/Pause Duration Register | 279 | * Set Opcode/Pause Duration Register |
272 | */ | 280 | */ |
273 | fec->eth->op_pause = 0x00010020; /*FIXME0xffff0020; */ | 281 | fec->eth->op_pause = 0x00010020; /*FIXME0xffff0020; */ |
274 | 282 | ||
275 | /* | 283 | /* |
276 | * Set Rx FIFO alarm and granularity value | 284 | * Set Rx FIFO alarm and granularity value |
277 | */ | 285 | */ |
278 | fec->eth->rfifo_cntrl = 0x0c000000; | 286 | fec->eth->rfifo_cntrl = 0x0c000000; |
279 | fec->eth->rfifo_alarm = 0x0000030c; | 287 | fec->eth->rfifo_alarm = 0x0000030c; |
280 | #if (DEBUG & 0x22) | 288 | #if (DEBUG & 0x22) |
281 | if (fec->eth->rfifo_status & 0x00700000 ) { | 289 | if (fec->eth->rfifo_status & 0x00700000 ) { |
282 | printf("mpc5xxx_fec_init() RFIFO error\n"); | 290 | printf("mpc5xxx_fec_init() RFIFO error\n"); |
283 | } | 291 | } |
284 | #endif | 292 | #endif |
285 | 293 | ||
286 | /* | 294 | /* |
287 | * Set Tx FIFO granularity value | 295 | * Set Tx FIFO granularity value |
288 | */ | 296 | */ |
289 | fec->eth->tfifo_cntrl = 0x0c000000; | 297 | fec->eth->tfifo_cntrl = 0x0c000000; |
290 | #if (DEBUG & 0x2) | 298 | #if (DEBUG & 0x2) |
291 | printf("tfifo_status: 0x%08x\n", fec->eth->tfifo_status); | 299 | printf("tfifo_status: 0x%08x\n", fec->eth->tfifo_status); |
292 | printf("tfifo_alarm: 0x%08x\n", fec->eth->tfifo_alarm); | 300 | printf("tfifo_alarm: 0x%08x\n", fec->eth->tfifo_alarm); |
293 | #endif | 301 | #endif |
294 | 302 | ||
295 | /* | 303 | /* |
296 | * Set transmit fifo watermark register(X_WMRK), default = 64 | 304 | * Set transmit fifo watermark register(X_WMRK), default = 64 |
297 | */ | 305 | */ |
298 | fec->eth->tfifo_alarm = 0x00000080; | 306 | fec->eth->tfifo_alarm = 0x00000080; |
299 | fec->eth->x_wmrk = 0x2; | 307 | fec->eth->x_wmrk = 0x2; |
300 | 308 | ||
301 | /* | 309 | /* |
302 | * Set individual address filter for unicast address | 310 | * Set individual address filter for unicast address |
303 | * and set physical address registers. | 311 | * and set physical address registers. |
304 | */ | 312 | */ |
305 | mpc5xxx_fec_set_hwaddr(fec, dev->enetaddr); | 313 | mpc5xxx_fec_set_hwaddr(fec, dev->enetaddr); |
306 | 314 | ||
307 | /* | 315 | /* |
308 | * Set multicast address filter | 316 | * Set multicast address filter |
309 | */ | 317 | */ |
310 | fec->eth->gaddr1 = 0x00000000; | 318 | fec->eth->gaddr1 = 0x00000000; |
311 | fec->eth->gaddr2 = 0x00000000; | 319 | fec->eth->gaddr2 = 0x00000000; |
312 | 320 | ||
313 | /* | 321 | /* |
314 | * Turn ON cheater FSM: ???? | 322 | * Turn ON cheater FSM: ???? |
315 | */ | 323 | */ |
316 | fec->eth->xmit_fsm = 0x03000000; | 324 | fec->eth->xmit_fsm = 0x03000000; |
317 | 325 | ||
318 | #if defined(CONFIG_MPC5200) | 326 | #if defined(CONFIG_MPC5200) |
319 | /* | 327 | /* |
320 | * Turn off COMM bus prefetch in the MGT5200 BestComm. It doesn't | 328 | * Turn off COMM bus prefetch in the MGT5200 BestComm. It doesn't |
321 | * work w/ the current receive task. | 329 | * work w/ the current receive task. |
322 | */ | 330 | */ |
323 | sdma->PtdCntrl |= 0x00000001; | 331 | sdma->PtdCntrl |= 0x00000001; |
324 | #endif | 332 | #endif |
325 | 333 | ||
326 | /* | 334 | /* |
327 | * Set priority of different initiators | 335 | * Set priority of different initiators |
328 | */ | 336 | */ |
329 | sdma->IPR0 = 7; /* always */ | 337 | sdma->IPR0 = 7; /* always */ |
330 | sdma->IPR3 = 6; /* Eth RX */ | 338 | sdma->IPR3 = 6; /* Eth RX */ |
331 | sdma->IPR4 = 5; /* Eth Tx */ | 339 | sdma->IPR4 = 5; /* Eth Tx */ |
332 | 340 | ||
333 | /* | 341 | /* |
334 | * Clear SmartDMA task interrupt pending bits | 342 | * Clear SmartDMA task interrupt pending bits |
335 | */ | 343 | */ |
336 | SDMA_CLEAR_IEVENT(FEC_RECV_TASK_NO); | 344 | SDMA_CLEAR_IEVENT(FEC_RECV_TASK_NO); |
337 | 345 | ||
338 | /* | 346 | /* |
339 | * Set SmartDMA intMask register to enable SmartDMA task interrupts | ||
340 | */ | ||
341 | SDMA_INT_ENABLE(FEC_RECV_TASK_NO); | ||
342 | |||
343 | /* | ||
344 | * Initialize SmartDMA parameters stored in SRAM | 347 | * Initialize SmartDMA parameters stored in SRAM |
345 | */ | 348 | */ |
346 | *(int *)FEC_TBD_BASE = (int)fec->tbdBase; | 349 | *(int *)FEC_TBD_BASE = (int)fec->tbdBase; |
347 | *(int *)FEC_RBD_BASE = (int)fec->rbdBase; | 350 | *(int *)FEC_RBD_BASE = (int)fec->rbdBase; |
348 | *(int *)FEC_TBD_NEXT = (int)fec->tbdBase; | 351 | *(int *)FEC_TBD_NEXT = (int)fec->tbdBase; |
349 | *(int *)FEC_RBD_NEXT = (int)fec->rbdBase; | 352 | *(int *)FEC_RBD_NEXT = (int)fec->rbdBase; |
350 | 353 | ||
351 | if (fec->xcv_type != SEVENWIRE) { | 354 | if (fec->xcv_type != SEVENWIRE) { |
352 | /* | 355 | /* |
353 | * Initialize PHY(LXT971A): | 356 | * Initialize PHY(LXT971A): |
354 | * | 357 | * |
355 | * Generally, on power up, the LXT971A reads its configuration | 358 | * Generally, on power up, the LXT971A reads its configuration |
356 | * pins to check for forced operation, If not cofigured for | 359 | * pins to check for forced operation, If not cofigured for |
357 | * forced operation, it uses auto-negotiation/parallel detection | 360 | * forced operation, it uses auto-negotiation/parallel detection |
358 | * to automatically determine line operating conditions. | 361 | * to automatically determine line operating conditions. |
359 | * If the PHY device on the other side of the link supports | 362 | * If the PHY device on the other side of the link supports |
360 | * auto-negotiation, the LXT971A auto-negotiates with it | 363 | * auto-negotiation, the LXT971A auto-negotiates with it |
361 | * using Fast Link Pulse(FLP) Bursts. If the PHY partner does not | 364 | * using Fast Link Pulse(FLP) Bursts. If the PHY partner does not |
362 | * support auto-negotiation, the LXT971A automatically detects | 365 | * support auto-negotiation, the LXT971A automatically detects |
363 | * the presence of either link pulses(10Mbps PHY) or Idle | 366 | * the presence of either link pulses(10Mbps PHY) or Idle |
364 | * symbols(100Mbps) and sets its operating conditions accordingly. | 367 | * symbols(100Mbps) and sets its operating conditions accordingly. |
365 | * | 368 | * |
366 | * When auto-negotiation is controlled by software, the following | 369 | * When auto-negotiation is controlled by software, the following |
367 | * steps are recommended. | 370 | * steps are recommended. |
368 | * | 371 | * |
369 | * Note: | 372 | * Note: |
370 | * The physical address is dependent on hardware configuration. | 373 | * The physical address is dependent on hardware configuration. |
371 | * | 374 | * |
372 | */ | 375 | */ |
373 | int timeout = 1; | 376 | int timeout = 1; |
374 | uint16 phyStatus; | 377 | uint16 phyStatus; |
375 | 378 | ||
376 | /* | 379 | /* |
377 | * Reset PHY, then delay 300ns | 380 | * Reset PHY, then delay 300ns |
378 | */ | 381 | */ |
379 | miiphy_write(phyAddr, 0x0, 0x8000); | 382 | miiphy_write(phyAddr, 0x0, 0x8000); |
380 | udelay(1000); | 383 | udelay(1000); |
381 | 384 | ||
382 | if (fec->xcv_type == MII10) { | 385 | if (fec->xcv_type == MII10) { |
383 | /* | 386 | /* |
384 | * Force 10Base-T, FDX operation | 387 | * Force 10Base-T, FDX operation |
385 | */ | 388 | */ |
386 | printf("Forcing 10 Mbps ethernet link... "); | 389 | printf("Forcing 10 Mbps ethernet link... "); |
387 | miiphy_read(phyAddr, 0x1, &phyStatus); | 390 | miiphy_read(phyAddr, 0x1, &phyStatus); |
388 | /* | 391 | /* |
389 | miiphy_write(fec, phyAddr, 0x0, 0x0100); | 392 | miiphy_write(fec, phyAddr, 0x0, 0x0100); |
390 | */ | 393 | */ |
391 | miiphy_write(phyAddr, 0x0, 0x0180); | 394 | miiphy_write(phyAddr, 0x0, 0x0180); |
392 | 395 | ||
393 | timeout = 20; | 396 | timeout = 20; |
394 | do { /* wait for link status to go down */ | 397 | do { /* wait for link status to go down */ |
395 | udelay(10000); | 398 | udelay(10000); |
396 | if ((timeout--) == 0) { | 399 | if ((timeout--) == 0) { |
397 | #if (DEBUG & 0x2) | 400 | #if (DEBUG & 0x2) |
398 | printf("hmmm, should not have waited..."); | 401 | printf("hmmm, should not have waited..."); |
399 | #endif | 402 | #endif |
400 | break; | 403 | break; |
401 | } | 404 | } |
402 | miiphy_read(phyAddr, 0x1, &phyStatus); | 405 | miiphy_read(phyAddr, 0x1, &phyStatus); |
403 | #if (DEBUG & 0x2) | 406 | #if (DEBUG & 0x2) |
404 | printf("="); | 407 | printf("="); |
405 | #endif | 408 | #endif |
406 | } while ((phyStatus & 0x0004)); /* !link up */ | 409 | } while ((phyStatus & 0x0004)); /* !link up */ |
407 | 410 | ||
408 | timeout = 1000; | 411 | timeout = 1000; |
409 | do { /* wait for link status to come back up */ | 412 | do { /* wait for link status to come back up */ |
410 | udelay(10000); | 413 | udelay(10000); |
411 | if ((timeout--) == 0) { | 414 | if ((timeout--) == 0) { |
412 | printf("failed. Link is down.\n"); | 415 | printf("failed. Link is down.\n"); |
413 | break; | 416 | break; |
414 | } | 417 | } |
415 | miiphy_read(phyAddr, 0x1, &phyStatus); | 418 | miiphy_read(phyAddr, 0x1, &phyStatus); |
416 | #if (DEBUG & 0x2) | 419 | #if (DEBUG & 0x2) |
417 | printf("+"); | 420 | printf("+"); |
418 | #endif | 421 | #endif |
419 | } while (!(phyStatus & 0x0004)); /* !link up */ | 422 | } while (!(phyStatus & 0x0004)); /* !link up */ |
420 | 423 | ||
421 | printf ("done.\n"); | 424 | printf ("done.\n"); |
422 | } else { /* MII100 */ | 425 | } else { /* MII100 */ |
423 | /* | 426 | /* |
424 | * Set the auto-negotiation advertisement register bits | 427 | * Set the auto-negotiation advertisement register bits |
425 | */ | 428 | */ |
426 | miiphy_write(phyAddr, 0x4, 0x01e1); | 429 | miiphy_write(phyAddr, 0x4, 0x01e1); |
427 | 430 | ||
428 | /* | 431 | /* |
429 | * Set MDIO bit 0.12 = 1(&& bit 0.9=1?) to enable auto-negotiation | 432 | * Set MDIO bit 0.12 = 1(&& bit 0.9=1?) to enable auto-negotiation |
430 | */ | 433 | */ |
431 | miiphy_write(phyAddr, 0x0, 0x1200); | 434 | miiphy_write(phyAddr, 0x0, 0x1200); |
432 | 435 | ||
433 | /* | 436 | /* |
434 | * Wait for AN completion | 437 | * Wait for AN completion |
435 | */ | 438 | */ |
436 | timeout = 5000; | 439 | timeout = 5000; |
437 | do { | 440 | do { |
438 | udelay(1000); | 441 | udelay(1000); |
439 | 442 | ||
440 | if ((timeout--) == 0) { | 443 | if ((timeout--) == 0) { |
441 | #if (DEBUG & 0x2) | 444 | #if (DEBUG & 0x2) |
442 | printf("PHY auto neg 0 failed...\n"); | 445 | printf("PHY auto neg 0 failed...\n"); |
443 | #endif | 446 | #endif |
444 | return -1; | 447 | return -1; |
445 | } | 448 | } |
446 | 449 | ||
447 | if (miiphy_read(phyAddr, 0x1, &phyStatus) != 0) { | 450 | if (miiphy_read(phyAddr, 0x1, &phyStatus) != 0) { |
448 | #if (DEBUG & 0x2) | 451 | #if (DEBUG & 0x2) |
449 | printf("PHY auto neg 1 failed 0x%04x...\n", phyStatus); | 452 | printf("PHY auto neg 1 failed 0x%04x...\n", phyStatus); |
450 | #endif | 453 | #endif |
451 | return -1; | 454 | return -1; |
452 | } | 455 | } |
453 | } while ((phyStatus & 0x0020) != 0x0020); | 456 | } while ((phyStatus & 0x0020) != 0x0020); |
454 | 457 | ||
455 | #if (DEBUG & 0x2) | 458 | #if (DEBUG & 0x2) |
456 | printf("PHY auto neg complete! \n"); | 459 | printf("PHY auto neg complete! \n"); |
457 | #endif | 460 | #endif |
458 | } | 461 | } |
459 | 462 | ||
460 | } | 463 | } |
461 | 464 | ||
462 | /* | 465 | /* |
463 | * Enable FEC-Lite controller | 466 | * Enable FEC-Lite controller |
464 | */ | 467 | */ |
465 | fec->eth->ecntrl |= 0x00000006; | 468 | fec->eth->ecntrl |= 0x00000006; |
466 | 469 | ||
467 | if (fec->xcv_type != SEVENWIRE) { | 470 | if (fec->xcv_type != SEVENWIRE) { |
468 | #if (DEBUG & 0x2) | 471 | #if (DEBUG & 0x2) |
469 | uint16 phyStatus, i; | 472 | uint16 phyStatus, i; |
470 | uint8 phyAddr = 0; | 473 | uint8 phyAddr = 0; |
471 | 474 | ||
472 | for (i = 0; i < 9; i++) { | 475 | for (i = 0; i < 9; i++) { |
473 | miiphy_read(phyAddr, i, &phyStatus); | 476 | miiphy_read(phyAddr, i, &phyStatus); |
474 | printf("Mii reg %d: 0x%04x\n", i, phyStatus); | 477 | printf("Mii reg %d: 0x%04x\n", i, phyStatus); |
475 | } | 478 | } |
476 | for (i = 16; i < 21; i++) { | 479 | for (i = 16; i < 21; i++) { |
477 | miiphy_read(phyAddr, i, &phyStatus); | 480 | miiphy_read(phyAddr, i, &phyStatus); |
478 | printf("Mii reg %d: 0x%04x\n", i, phyStatus); | 481 | printf("Mii reg %d: 0x%04x\n", i, phyStatus); |
479 | } | 482 | } |
480 | #endif | 483 | #endif |
481 | } | 484 | } |
482 | /* | 485 | /* |
483 | * Enable SmartDMA receive task | 486 | * Enable SmartDMA receive task |
484 | */ | 487 | */ |
485 | SDMA_TASK_ENABLE(FEC_RECV_TASK_NO); | 488 | SDMA_TASK_ENABLE(FEC_RECV_TASK_NO); |
486 | 489 | ||
487 | #if (DEBUG & 0x1) | 490 | #if (DEBUG & 0x1) |
488 | printf("mpc5xxx_fec_init... Done \n"); | 491 | printf("mpc5xxx_fec_init... Done \n"); |
489 | #endif | 492 | #endif |
490 | 493 | ||
491 | return 0; | 494 | return 0; |
492 | } | 495 | } |
493 | 496 | ||
494 | /********************************************************************/ | 497 | /********************************************************************/ |
495 | static void mpc5xxx_fec_halt(struct eth_device *dev) | 498 | static void mpc5xxx_fec_halt(struct eth_device *dev) |
496 | { | 499 | { |
497 | mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv; | 500 | #if defined(CONFIG_MPC5200) |
498 | struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; | 501 | struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; |
502 | #endif | ||
503 | mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv; | ||
499 | int counter = 0xffff; | 504 | int counter = 0xffff; |
500 | 505 | ||
501 | #if (DEBUG & 0x2) | 506 | #if (DEBUG & 0x2) |
502 | if (fec->xcv_type != SEVENWIRE) { | 507 | if (fec->xcv_type != SEVENWIRE) { |
503 | uint16 phyStatus, i; | 508 | uint16 phyStatus, i; |
504 | uint8 phyAddr = 0; | 509 | uint8 phyAddr = 0; |
505 | 510 | ||
506 | for (i = 0; i < 9; i++) { | 511 | for (i = 0; i < 9; i++) { |
507 | miiphy_read(phyAddr, i, &phyStatus); | 512 | miiphy_read(phyAddr, i, &phyStatus); |
508 | printf("Mii reg %d: 0x%04x\n", i, phyStatus); | 513 | printf("Mii reg %d: 0x%04x\n", i, phyStatus); |
509 | } | 514 | } |
510 | for (i = 16; i < 21; i++) { | 515 | for (i = 16; i < 21; i++) { |
511 | miiphy_read(phyAddr, i, &phyStatus); | 516 | miiphy_read(phyAddr, i, &phyStatus); |
512 | printf ("Mii reg %d: 0x%04x\n", i, phyStatus); | 517 | printf ("Mii reg %d: 0x%04x\n", i, phyStatus); |
513 | } | 518 | } |
514 | } | 519 | } |
515 | #endif | 520 | #endif |
516 | 521 | ||
517 | 522 | ||
518 | /* | 523 | /* |
519 | * mask FEC chip interrupts | 524 | * mask FEC chip interrupts |
520 | */ | 525 | */ |
521 | fec->eth->imask = 0; | 526 | fec->eth->imask = 0; |
522 | 527 | ||
523 | /* | 528 | /* |
524 | * issue graceful stop command to the FEC transmitter if necessary | 529 | * issue graceful stop command to the FEC transmitter if necessary |
525 | */ | 530 | */ |
526 | fec->eth->x_cntrl |= 0x00000001; | 531 | fec->eth->x_cntrl |= 0x00000001; |
527 | 532 | ||
528 | /* | 533 | /* |
529 | * wait for graceful stop to register | 534 | * wait for graceful stop to register |
530 | */ | 535 | */ |
531 | while ((counter--) && (!(fec->eth->ievent & 0x10000000))) ; | 536 | while ((counter--) && (!(fec->eth->ievent & 0x10000000))) ; |
532 | 537 | ||
533 | SDMA_INT_DISABLE (FEC_RECV_TASK_NO); | ||
534 | |||
535 | /* | 538 | /* |
536 | * Disable SmartDMA tasks | 539 | * Disable SmartDMA tasks |
537 | */ | 540 | */ |
538 | SDMA_TASK_DISABLE (FEC_XMIT_TASK_NO); | 541 | SDMA_TASK_DISABLE (FEC_XMIT_TASK_NO); |
539 | SDMA_TASK_DISABLE (FEC_RECV_TASK_NO); | 542 | SDMA_TASK_DISABLE (FEC_RECV_TASK_NO); |
540 | 543 | ||
541 | #if defined(CONFIG_MPC5200) | 544 | #if defined(CONFIG_MPC5200) |
542 | /* | 545 | /* |
543 | * Turn on COMM bus prefetch in the MGT5200 BestComm after we're | 546 | * Turn on COMM bus prefetch in the MGT5200 BestComm after we're |
544 | * done. It doesn't work w/ the current receive task. | 547 | * done. It doesn't work w/ the current receive task. |
545 | */ | 548 | */ |
546 | sdma->PtdCntrl &= ~0x00000001; | 549 | sdma->PtdCntrl &= ~0x00000001; |
547 | #endif | 550 | #endif |
548 | 551 | ||
549 | /* | 552 | /* |
550 | * Disable the Ethernet Controller | 553 | * Disable the Ethernet Controller |
551 | */ | 554 | */ |
552 | fec->eth->ecntrl &= 0xfffffffd; | 555 | fec->eth->ecntrl &= 0xfffffffd; |
553 | 556 | ||
554 | /* | 557 | /* |
555 | * Clear FIFO status registers | 558 | * Clear FIFO status registers |
556 | */ | 559 | */ |
557 | fec->eth->rfifo_status &= 0x00700000; | 560 | fec->eth->rfifo_status &= 0x00700000; |
558 | fec->eth->tfifo_status &= 0x00700000; | 561 | fec->eth->tfifo_status &= 0x00700000; |
559 | 562 | ||
560 | fec->eth->reset_cntrl = 0x01000000; | 563 | fec->eth->reset_cntrl = 0x01000000; |
561 | 564 | ||
562 | /* | 565 | /* |
563 | * Issue a reset command to the FEC chip | 566 | * Issue a reset command to the FEC chip |
564 | */ | 567 | */ |
565 | fec->eth->ecntrl |= 0x1; | 568 | fec->eth->ecntrl |= 0x1; |
566 | 569 | ||
567 | /* | 570 | /* |
568 | * wait at least 16 clock cycles | 571 | * wait at least 16 clock cycles |
569 | */ | 572 | */ |
570 | udelay(10); | 573 | udelay(10); |
571 | 574 | ||
572 | #if (DEBUG & 0x3) | 575 | #if (DEBUG & 0x3) |
573 | printf("Ethernet task stopped\n"); | 576 | printf("Ethernet task stopped\n"); |
574 | #endif | 577 | #endif |
575 | } | 578 | } |
576 | 579 | ||
577 | #if (DEBUG & 0x60) | 580 | #if (DEBUG & 0x60) |
578 | /********************************************************************/ | 581 | /********************************************************************/ |
579 | 582 | ||
580 | static void tfifo_print(mpc5xxx_fec_priv *fec) | 583 | static void tfifo_print(mpc5xxx_fec_priv *fec) |
581 | { | 584 | { |
582 | uint16 phyAddr = 0; | 585 | uint16 phyAddr = 0; |
583 | uint16 phyStatus; | 586 | uint16 phyStatus; |
584 | 587 | ||
585 | if ((fec->eth->tfifo_lrf_ptr != fec->eth->tfifo_lwf_ptr) | 588 | if ((fec->eth->tfifo_lrf_ptr != fec->eth->tfifo_lwf_ptr) |
586 | || (fec->eth->tfifo_rdptr != fec->eth->tfifo_wrptr)) { | 589 | || (fec->eth->tfifo_rdptr != fec->eth->tfifo_wrptr)) { |
587 | 590 | ||
588 | miiphy_read(phyAddr, 0x1, &phyStatus); | 591 | miiphy_read(phyAddr, 0x1, &phyStatus); |
589 | printf("\nphyStatus: 0x%04x\n", phyStatus); | 592 | printf("\nphyStatus: 0x%04x\n", phyStatus); |
590 | printf("ecntrl: 0x%08x\n", fec->eth->ecntrl); | 593 | printf("ecntrl: 0x%08x\n", fec->eth->ecntrl); |
591 | printf("ievent: 0x%08x\n", fec->eth->ievent); | 594 | printf("ievent: 0x%08x\n", fec->eth->ievent); |
592 | printf("x_status: 0x%08x\n", fec->eth->x_status); | 595 | printf("x_status: 0x%08x\n", fec->eth->x_status); |
593 | printf("tfifo: status 0x%08x\n", fec->eth->tfifo_status); | 596 | printf("tfifo: status 0x%08x\n", fec->eth->tfifo_status); |
594 | 597 | ||
595 | printf(" control 0x%08x\n", fec->eth->tfifo_cntrl); | 598 | printf(" control 0x%08x\n", fec->eth->tfifo_cntrl); |
596 | printf(" lrfp 0x%08x\n", fec->eth->tfifo_lrf_ptr); | 599 | printf(" lrfp 0x%08x\n", fec->eth->tfifo_lrf_ptr); |
597 | printf(" lwfp 0x%08x\n", fec->eth->tfifo_lwf_ptr); | 600 | printf(" lwfp 0x%08x\n", fec->eth->tfifo_lwf_ptr); |
598 | printf(" alarm 0x%08x\n", fec->eth->tfifo_alarm); | 601 | printf(" alarm 0x%08x\n", fec->eth->tfifo_alarm); |
599 | printf(" readptr 0x%08x\n", fec->eth->tfifo_rdptr); | 602 | printf(" readptr 0x%08x\n", fec->eth->tfifo_rdptr); |
600 | printf(" writptr 0x%08x\n", fec->eth->tfifo_wrptr); | 603 | printf(" writptr 0x%08x\n", fec->eth->tfifo_wrptr); |
601 | } | 604 | } |
602 | } | 605 | } |
603 | 606 | ||
604 | static void rfifo_print(mpc5xxx_fec_priv *fec) | 607 | static void rfifo_print(mpc5xxx_fec_priv *fec) |
605 | { | 608 | { |
606 | uint16 phyAddr = 0; | 609 | uint16 phyAddr = 0; |
607 | uint16 phyStatus; | 610 | uint16 phyStatus; |
608 | 611 | ||
609 | if ((fec->eth->rfifo_lrf_ptr != fec->eth->rfifo_lwf_ptr) | 612 | if ((fec->eth->rfifo_lrf_ptr != fec->eth->rfifo_lwf_ptr) |
610 | || (fec->eth->rfifo_rdptr != fec->eth->rfifo_wrptr)) { | 613 | || (fec->eth->rfifo_rdptr != fec->eth->rfifo_wrptr)) { |
611 | 614 | ||
612 | miiphy_read(phyAddr, 0x1, &phyStatus); | 615 | miiphy_read(phyAddr, 0x1, &phyStatus); |
613 | printf("\nphyStatus: 0x%04x\n", phyStatus); | 616 | printf("\nphyStatus: 0x%04x\n", phyStatus); |
614 | printf("ecntrl: 0x%08x\n", fec->eth->ecntrl); | 617 | printf("ecntrl: 0x%08x\n", fec->eth->ecntrl); |
615 | printf("ievent: 0x%08x\n", fec->eth->ievent); | 618 | printf("ievent: 0x%08x\n", fec->eth->ievent); |
616 | printf("x_status: 0x%08x\n", fec->eth->x_status); | 619 | printf("x_status: 0x%08x\n", fec->eth->x_status); |
617 | printf("rfifo: status 0x%08x\n", fec->eth->rfifo_status); | 620 | printf("rfifo: status 0x%08x\n", fec->eth->rfifo_status); |
618 | 621 | ||
619 | printf(" control 0x%08x\n", fec->eth->rfifo_cntrl); | 622 | printf(" control 0x%08x\n", fec->eth->rfifo_cntrl); |
620 | printf(" lrfp 0x%08x\n", fec->eth->rfifo_lrf_ptr); | 623 | printf(" lrfp 0x%08x\n", fec->eth->rfifo_lrf_ptr); |
621 | printf(" lwfp 0x%08x\n", fec->eth->rfifo_lwf_ptr); | 624 | printf(" lwfp 0x%08x\n", fec->eth->rfifo_lwf_ptr); |
622 | printf(" alarm 0x%08x\n", fec->eth->rfifo_alarm); | 625 | printf(" alarm 0x%08x\n", fec->eth->rfifo_alarm); |
623 | printf(" readptr 0x%08x\n", fec->eth->rfifo_rdptr); | 626 | printf(" readptr 0x%08x\n", fec->eth->rfifo_rdptr); |
624 | printf(" writptr 0x%08x\n", fec->eth->rfifo_wrptr); | 627 | printf(" writptr 0x%08x\n", fec->eth->rfifo_wrptr); |
625 | } | 628 | } |
626 | } | 629 | } |
627 | #endif /* DEBUG */ | 630 | #endif /* DEBUG */ |
628 | 631 | ||
629 | /********************************************************************/ | 632 | /********************************************************************/ |
630 | 633 | ||
631 | static int mpc5xxx_fec_send(struct eth_device *dev, volatile void *eth_data, | 634 | static int mpc5xxx_fec_send(struct eth_device *dev, volatile void *eth_data, |
632 | int data_length) | 635 | int data_length) |
633 | { | 636 | { |
634 | /* | 637 | /* |
635 | * This routine transmits one frame. This routine only accepts | 638 | * This routine transmits one frame. This routine only accepts |
636 | * 6-byte Ethernet addresses. | 639 | * 6-byte Ethernet addresses. |
637 | */ | 640 | */ |
638 | mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv; | 641 | mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv; |
639 | FEC_TBD *pTbd; | 642 | FEC_TBD *pTbd; |
640 | 643 | ||
641 | #if (DEBUG & 0x20) | 644 | #if (DEBUG & 0x20) |
642 | printf("tbd status: 0x%04x\n", fec->tbdBase[0].status); | 645 | printf("tbd status: 0x%04x\n", fec->tbdBase[0].status); |
643 | tfifo_print(fec); | 646 | tfifo_print(fec); |
644 | #endif | 647 | #endif |
645 | 648 | ||
646 | /* | 649 | /* |
647 | * Clear Tx BD ring at first | 650 | * Clear Tx BD ring at first |
648 | */ | 651 | */ |
649 | mpc5xxx_fec_tbd_scrub(fec); | 652 | mpc5xxx_fec_tbd_scrub(fec); |
650 | 653 | ||
651 | /* | 654 | /* |
652 | * Check for valid length of data. | 655 | * Check for valid length of data. |
653 | */ | 656 | */ |
654 | if ((data_length > 1500) || (data_length <= 0)) { | 657 | if ((data_length > 1500) || (data_length <= 0)) { |
655 | return -1; | 658 | return -1; |
656 | } | 659 | } |
657 | 660 | ||
658 | /* | 661 | /* |
659 | * Check the number of vacant TxBDs. | 662 | * Check the number of vacant TxBDs. |
660 | */ | 663 | */ |
661 | if (fec->cleanTbdNum < 1) { | 664 | if (fec->cleanTbdNum < 1) { |
662 | #if (DEBUG & 0x20) | 665 | #if (DEBUG & 0x20) |
663 | printf("No available TxBDs ...\n"); | 666 | printf("No available TxBDs ...\n"); |
664 | #endif | 667 | #endif |
665 | return -1; | 668 | return -1; |
666 | } | 669 | } |
667 | 670 | ||
668 | /* | 671 | /* |
669 | * Get the first TxBD to send the mac header | 672 | * Get the first TxBD to send the mac header |
670 | */ | 673 | */ |
671 | pTbd = &fec->tbdBase[fec->tbdIndex]; | 674 | pTbd = &fec->tbdBase[fec->tbdIndex]; |
672 | pTbd->dataLength = data_length; | 675 | pTbd->dataLength = data_length; |
673 | pTbd->dataPointer = (uint32)eth_data; | 676 | pTbd->dataPointer = (uint32)eth_data; |
674 | pTbd->status |= FEC_TBD_READY; | 677 | pTbd->status |= FEC_TBD_LAST | FEC_TBD_TC | FEC_TBD_READY; |
675 | fec->tbdIndex = (fec->tbdIndex + 1) % FEC_TBD_NUM; | 678 | fec->tbdIndex = (fec->tbdIndex + 1) % FEC_TBD_NUM; |
676 | 679 | ||
677 | #if (DEBUG & 0x100) | 680 | #if (DEBUG & 0x100) |
678 | printf("SDMA_TASK_ENABLE, fec->tbdIndex = %d \n", fec->tbdIndex); | 681 | printf("SDMA_TASK_ENABLE, fec->tbdIndex = %d \n", fec->tbdIndex); |
679 | #endif | 682 | #endif |
680 | 683 | ||
681 | /* | 684 | /* |
682 | * Kick the MII i/f | 685 | * Kick the MII i/f |
683 | */ | 686 | */ |
684 | if (fec->xcv_type != SEVENWIRE) { | 687 | if (fec->xcv_type != SEVENWIRE) { |
685 | uint16 phyStatus; | 688 | uint16 phyStatus; |
686 | miiphy_read(0, 0x1, &phyStatus); | 689 | miiphy_read(0, 0x1, &phyStatus); |
687 | } | 690 | } |
688 | 691 | ||
689 | /* | 692 | /* |
690 | * Enable SmartDMA transmit task | 693 | * Enable SmartDMA transmit task |
691 | */ | 694 | */ |
692 | 695 | ||
693 | #if (DEBUG & 0x20) | 696 | #if (DEBUG & 0x20) |
694 | tfifo_print(fec); | 697 | tfifo_print(fec); |
695 | #endif | 698 | #endif |
696 | SDMA_TASK_ENABLE (FEC_XMIT_TASK_NO); | 699 | SDMA_TASK_ENABLE (FEC_XMIT_TASK_NO); |
697 | #if (DEBUG & 0x20) | 700 | #if (DEBUG & 0x20) |
698 | tfifo_print(fec); | 701 | tfifo_print(fec); |
699 | #endif | 702 | #endif |
700 | #if (DEBUG & 0x8) | 703 | #if (DEBUG & 0x8) |
701 | printf( "+" ); | 704 | printf( "+" ); |
702 | #endif | 705 | #endif |
703 | 706 | ||
704 | fec->cleanTbdNum -= 1; | 707 | fec->cleanTbdNum -= 1; |
705 | 708 | ||
706 | #if (DEBUG & 0x129) && (DEBUG & 0x80000000) | 709 | #if (DEBUG & 0x129) && (DEBUG & 0x80000000) |
707 | printf ("smartDMA ethernet Tx task enabled\n"); | 710 | printf ("smartDMA ethernet Tx task enabled\n"); |
708 | #endif | 711 | #endif |
709 | /* | 712 | /* |
710 | * wait until frame is sent . | 713 | * wait until frame is sent . |
711 | */ | 714 | */ |
712 | while (pTbd->status & FEC_TBD_READY) { | 715 | while (pTbd->status & FEC_TBD_READY) { |
713 | udelay(10); | 716 | udelay(10); |
714 | #if (DEBUG & 0x8) | 717 | #if (DEBUG & 0x8) |
715 | printf ("TDB status = %04x\n", pTbd->status); | 718 | printf ("TDB status = %04x\n", pTbd->status); |
716 | #endif | 719 | #endif |
717 | } | 720 | } |
718 | 721 | ||
719 | return 0; | 722 | return 0; |
720 | } | 723 | } |
721 | 724 | ||
722 | 725 | ||
723 | /********************************************************************/ | 726 | /********************************************************************/ |
724 | static int mpc5xxx_fec_recv(struct eth_device *dev) | 727 | static int mpc5xxx_fec_recv(struct eth_device *dev) |
725 | { | 728 | { |
726 | /* | 729 | /* |
727 | * This command pulls one frame from the card | 730 | * This command pulls one frame from the card |
728 | */ | 731 | */ |
729 | mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv; | 732 | mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv; |
730 | FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex]; | 733 | FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex]; |
731 | unsigned long ievent; | 734 | unsigned long ievent; |
732 | int frame_length; | 735 | int frame_length, len = 0; |
733 | char *frame; | 736 | NBUF *frame; |
737 | char buff[FEC_MAX_PKT_SIZE]; | ||
734 | 738 | ||
735 | #if (DEBUG & 0x1) | 739 | #if (DEBUG & 0x1) |
736 | printf ("mpc5xxx_fec_recv %d Start...\n", fec->rbdIndex); | 740 | printf ("mpc5xxx_fec_recv %d Start...\n", fec->rbdIndex); |
737 | #endif | 741 | #endif |
738 | #if (DEBUG & 0x8) | 742 | #if (DEBUG & 0x8) |
739 | printf( "-" ); | 743 | printf( "-" ); |
740 | #endif | 744 | #endif |
741 | 745 | ||
742 | /* | 746 | /* |
743 | * Check if any critical events have happened | 747 | * Check if any critical events have happened |
744 | */ | 748 | */ |
745 | ievent = fec->eth->ievent; | 749 | ievent = fec->eth->ievent; |
746 | fec->eth->ievent = ievent; | 750 | fec->eth->ievent = ievent; |
747 | if (ievent & 0x20060000) { | 751 | if (ievent & 0x20060000) { |
748 | /* BABT, Rx/Tx FIFO errors */ | 752 | /* BABT, Rx/Tx FIFO errors */ |
749 | mpc5xxx_fec_halt(dev); | 753 | mpc5xxx_fec_halt(dev); |
750 | mpc5xxx_fec_init(dev, NULL); | 754 | mpc5xxx_fec_init(dev, NULL); |
751 | return 0; | 755 | return 0; |
752 | } | 756 | } |
753 | if (ievent & 0x80000000) { | 757 | if (ievent & 0x80000000) { |
754 | /* Heartbeat error */ | 758 | /* Heartbeat error */ |
755 | fec->eth->x_cntrl |= 0x00000001; | 759 | fec->eth->x_cntrl |= 0x00000001; |
756 | } | 760 | } |
757 | if (ievent & 0x10000000) { | 761 | if (ievent & 0x10000000) { |
758 | /* Graceful stop complete */ | 762 | /* Graceful stop complete */ |
759 | if (fec->eth->x_cntrl & 0x00000001) { | 763 | if (fec->eth->x_cntrl & 0x00000001) { |
760 | mpc5xxx_fec_halt(dev); | 764 | mpc5xxx_fec_halt(dev); |
761 | fec->eth->x_cntrl &= ~0x00000001; | 765 | fec->eth->x_cntrl &= ~0x00000001; |
762 | mpc5xxx_fec_init(dev, NULL); | 766 | mpc5xxx_fec_init(dev, NULL); |
763 | } | 767 | } |
764 | } | 768 | } |
765 | 769 | ||
766 | /* | 770 | if (!(pRbd->status & FEC_RBD_EMPTY)) { |
767 | * Do we have data in Rx FIFO? | 771 | if ((pRbd->status & FEC_RBD_LAST) && !(pRbd->status & FEC_RBD_ERR) && |
768 | */ | 772 | ((pRbd->dataLength - 4) > 14)) { |
769 | if ((pRbd->status & FEC_RBD_EMPTY) || !(pRbd->status & FEC_RBD_LAST)){ | ||
770 | return 0; | ||
771 | } | ||
772 | 773 | ||
773 | /* | 774 | /* |
774 | * Pass the packet up only if reception was Ok | 775 | * Get buffer address and size |
775 | */ | 776 | */ |
776 | if ((pRbd->dataLength <= 14) || (pRbd->status & FEC_RBD_ERR)) { | 777 | frame = (NBUF *)pRbd->dataPointer; |
777 | mpc5xxx_fec_rbd_clean(fec, pRbd); | 778 | frame_length = pRbd->dataLength - 4; |
778 | #if (DEBUG & 0x8) | 779 | |
779 | printf( "X0" ); | 780 | #if (DEBUG & 0x20) |
781 | { | ||
782 | int i; | ||
783 | printf("recv data hdr:"); | ||
784 | for (i = 0; i < 14; i++) | ||
785 | printf("%x ", *(frame->head + i)); | ||
786 | printf("\n"); | ||
787 | } | ||
780 | #endif | 788 | #endif |
781 | return 0; | 789 | /* |
790 | * Fill the buffer and pass it to upper layers | ||
791 | */ | ||
792 | memcpy(buff, frame->head, 14); | ||
793 | memcpy(buff + 14, frame->data, frame_length); | ||
794 | NetReceive(buff, frame_length); | ||
795 | len = frame_length; | ||
796 | } | ||
797 | /* | ||
798 | * Reset buffer descriptor as empty | ||
799 | */ | ||
800 | mpc5xxx_fec_rbd_clean(fec, pRbd); | ||
782 | } | 801 | } |
783 | 802 | SDMA_CLEAR_IEVENT (FEC_RECV_TASK_NO); | |
784 | /* | 803 | return len; |
785 | * Get buffer address and size | ||
786 | */ | ||
787 | frame = (char *)pRbd->dataPointer; | ||
788 | frame_length = pRbd->dataLength; | ||
789 | |||
790 | /* | ||
791 | * Pass the buffer to upper layers | ||
792 | */ | ||
793 | NetReceive(frame, frame_length); | ||
794 | |||
795 | /* | ||
796 | * Reset buffer descriptor as empty | ||
797 | */ | ||
798 | mpc5xxx_fec_rbd_clean(fec, pRbd); | ||
799 | |||
800 | return frame_length; | ||
801 | } | 804 | } |
802 | 805 | ||
803 | 806 | ||
804 | /********************************************************************/ | 807 | /********************************************************************/ |
805 | int mpc5xxx_fec_initialize(bd_t * bis) | 808 | int mpc5xxx_fec_initialize(bd_t * bis) |
806 | { | 809 | { |
807 | mpc5xxx_fec_priv *fec; | 810 | mpc5xxx_fec_priv *fec; |
808 | struct eth_device *dev; | 811 | struct eth_device *dev; |
809 | 812 | ||
810 | fec = (mpc5xxx_fec_priv *)malloc(sizeof(*fec)); | 813 | fec = (mpc5xxx_fec_priv *)malloc(sizeof(*fec)); |
811 | dev = (struct eth_device *)malloc(sizeof(*dev)); | 814 | dev = (struct eth_device *)malloc(sizeof(*dev)); |
812 | 815 | ||
813 | fec->eth = (ethernet_regs *)MPC5XXX_FEC; | 816 | fec->eth = (ethernet_regs *)MPC5XXX_FEC; |
814 | fec->tbdBase = (FEC_TBD *)FEC_BD_BASE; | 817 | fec->tbdBase = (FEC_TBD *)FEC_BD_BASE; |
815 | fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD)); | 818 | fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD)); |
816 | #ifdef CONFIG_ICECUBE | 819 | #ifdef CONFIG_ICECUBE |
817 | fec->xcv_type = MII100; | 820 | fec->xcv_type = MII100; |
818 | #endif | 821 | #endif |
819 | 822 | ||
820 | dev->priv = (void *)fec; | 823 | dev->priv = (void *)fec; |
821 | dev->iobase = MPC5XXX_FEC; | 824 | dev->iobase = MPC5XXX_FEC; |
822 | dev->init = mpc5xxx_fec_init; | 825 | dev->init = mpc5xxx_fec_init; |
823 | dev->halt = mpc5xxx_fec_halt; | 826 | dev->halt = mpc5xxx_fec_halt; |
824 | dev->send = mpc5xxx_fec_send; | 827 | dev->send = mpc5xxx_fec_send; |
825 | dev->recv = mpc5xxx_fec_recv; | 828 | dev->recv = mpc5xxx_fec_recv; |
826 | 829 | ||
830 | sprintf(dev->name, "FEC ETHERNET"); | ||
827 | eth_register(dev); | 831 | eth_register(dev); |
828 | 832 | ||
829 | return 1; | 833 | return 1; |
830 | } | 834 | } |
831 | 835 | ||
832 | /* MII-interface related functions */ | 836 | /* MII-interface related functions */ |
833 | /********************************************************************/ | 837 | /********************************************************************/ |
834 | int miiphy_read(uint8 phyAddr, uint8 regAddr, uint16 * retVal) | 838 | int miiphy_read(uint8 phyAddr, uint8 regAddr, uint16 * retVal) |
835 | { | 839 | { |
836 | ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC; | 840 | ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC; |
837 | uint32 reg; /* convenient holder for the PHY register */ | 841 | uint32 reg; /* convenient holder for the PHY register */ |
838 | uint32 phy; /* convenient holder for the PHY */ | 842 | uint32 phy; /* convenient holder for the PHY */ |
839 | int timeout = 0xffff; | 843 | int timeout = 0xffff; |
840 | 844 | ||
841 | /* | 845 | /* |
842 | * reading from any PHY's register is done by properly | 846 | * reading from any PHY's register is done by properly |
843 | * programming the FEC's MII data register. | 847 | * programming the FEC's MII data register. |
844 | */ | 848 | */ |
845 | reg = regAddr << FEC_MII_DATA_RA_SHIFT; | 849 | reg = regAddr << FEC_MII_DATA_RA_SHIFT; |
846 | phy = phyAddr << FEC_MII_DATA_PA_SHIFT; | 850 | phy = phyAddr << FEC_MII_DATA_PA_SHIFT; |
847 | 851 | ||
848 | eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA | phy | reg); | 852 | eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA | phy | reg); |
849 | 853 | ||
850 | /* | 854 | /* |
851 | * wait for the related interrupt | 855 | * wait for the related interrupt |
852 | */ | 856 | */ |
853 | while ((timeout--) && (!(eth->ievent & 0x00800000))) ; | 857 | while ((timeout--) && (!(eth->ievent & 0x00800000))) ; |
854 | 858 | ||
855 | if (timeout == 0) { | 859 | if (timeout == 0) { |
856 | #if (DEBUG & 0x2) | 860 | #if (DEBUG & 0x2) |
857 | printf ("Read MDIO failed...\n"); | 861 | printf ("Read MDIO failed...\n"); |
858 | #endif | 862 | #endif |
859 | return -1; | 863 | return -1; |
860 | } | 864 | } |
861 | 865 | ||
862 | /* | 866 | /* |
863 | * clear mii interrupt bit | 867 | * clear mii interrupt bit |
864 | */ | 868 | */ |
865 | eth->ievent = 0x00800000; | 869 | eth->ievent = 0x00800000; |
866 | 870 | ||
867 | /* | 871 | /* |
868 | * it's now safe to read the PHY's register | 872 | * it's now safe to read the PHY's register |
869 | */ | 873 | */ |
870 | *retVal = (uint16) eth->mii_data; | 874 | *retVal = (uint16) eth->mii_data; |
871 | 875 | ||
872 | return 0; | 876 | return 0; |
873 | } | 877 | } |
874 | 878 | ||
875 | /********************************************************************/ | 879 | /********************************************************************/ |
876 | int miiphy_write(uint8 phyAddr, uint8 regAddr, uint16 data) | 880 | int miiphy_write(uint8 phyAddr, uint8 regAddr, uint16 data) |
877 | { | 881 | { |
878 | ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC; | 882 | ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC; |
879 | uint32 reg; /* convenient holder for the PHY register */ | 883 | uint32 reg; /* convenient holder for the PHY register */ |
880 | uint32 phy; /* convenient holder for the PHY */ | 884 | uint32 phy; /* convenient holder for the PHY */ |
881 | int timeout = 0xffff; | 885 | int timeout = 0xffff; |
882 | 886 | ||
883 | reg = regAddr << FEC_MII_DATA_RA_SHIFT; | 887 | reg = regAddr << FEC_MII_DATA_RA_SHIFT; |
884 | phy = phyAddr << FEC_MII_DATA_PA_SHIFT; | 888 | phy = phyAddr << FEC_MII_DATA_PA_SHIFT; |
885 | 889 | ||
886 | eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR | | 890 | eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR | |
887 | FEC_MII_DATA_TA | phy | reg | data); | 891 | FEC_MII_DATA_TA | phy | reg | data); |
888 | 892 | ||
889 | /* | 893 | /* |
890 | * wait for the MII interrupt | 894 | * wait for the MII interrupt |
891 | */ | 895 | */ |
892 | while ((timeout--) && (!(eth->ievent & 0x00800000))) ; | 896 | while ((timeout--) && (!(eth->ievent & 0x00800000))) ; |
893 | 897 | ||
894 | if (timeout == 0) { | 898 | if (timeout == 0) { |
895 | #if (DEBUG & 0x2) | 899 | #if (DEBUG & 0x2) |
896 | printf ("Write MDIO failed...\n"); | 900 | printf ("Write MDIO failed...\n"); |
897 | #endif | 901 | #endif |
898 | return -1; | 902 | return -1; |
899 | } | 903 | } |
900 | 904 | ||
901 | /* | 905 | /* |
902 | * clear MII interrupt bit | 906 | * clear MII interrupt bit |
903 | */ | 907 | */ |
904 | eth->ievent = 0x00800000; | 908 | eth->ievent = 0x00800000; |
905 | 909 | ||
906 | return 0; | 910 | return 0; |
907 | } | 911 | } |
908 | 912 | ||
909 | #if (DEBUG & 0x40) | 913 | #if (DEBUG & 0x40) |
910 | static uint32 local_crc32(char *string, unsigned int crc_value, int len) | 914 | static uint32 local_crc32(char *string, unsigned int crc_value, int len) |
911 | { | 915 | { |
912 | int i; | 916 | int i; |
913 | char c; | 917 | char c; |
914 | unsigned int crc, count; | 918 | unsigned int crc, count; |
915 | 919 |
doc/README.standalone
1 | Design Notes on Exporting U-Boot Functions to Standalone Applications: | 1 | Design Notes on Exporting U-Boot Functions to Standalone Applications: |
2 | ====================================================================== | 2 | ====================================================================== |
3 | 3 | ||
4 | 1. Add a field to the global_data structure, the pointer to a jump | 4 | 1. The functions are exported by U-Boot via a jump table. The jump |
5 | table. | 5 | table is allocated and initialized in the jumptable_init() routine |
6 | (common/exports.c). Other routines may also modify the jump table, | ||
7 | however. The jump table can be accessed as the 'jt' field of the | ||
8 | 'global_data' structure. The slot numbers for the jump table are | ||
9 | defined in the <include/exports.h> header. E.g., to substitute the | ||
10 | malloc() and free() functions that will be available to standalone | ||
11 | applications, one should do the following: | ||
6 | 12 | ||
7 | 2. Jump table itself is allocated and filled in the same way as the | 13 | DECLARE_GLOBAL_DATA_PTR; |
8 | syscall table is (allocated with malloc() after the code has been | ||
9 | relocated to RAM); a special function, fixed to the table element | ||
10 | number 0, will be added which returns the ABI version so | ||
11 | applications can check for compatibility issues. | ||
12 | 14 | ||
13 | 3. It is application's responsibility to check the ABI version and | 15 | gd->jt[XF_malloc] = my_malloc; |
14 | act accordingly. | 16 | gd->jt[XF_free] = my_free; |
15 | 17 | ||
16 | 4. Pointer to the global_data is passed to the application in the | 18 | Note that the pointers to the functions all have 'void *' type and |
17 | dedicated register that is used in the U-Boot to hold this | 19 | thus the compiler cannot perform type checks on these assignments. |
18 | pointer. This assumes that the application is built with the same | ||
19 | register- allocation flags as the U-Boot itself. (Actually, this | ||
20 | is a requirement even now, as the 'go' command does not perform | ||
21 | any actions to protect this register against being clobbered by | ||
22 | the application). | ||
23 | 20 | ||
24 | This approach won't work on the x86 architecture. See below. | 21 | 2. The pointer to the jump table is passed to the application in a |
22 | machine-dependent way. PowerPC, ARM and MIPS architectures use a | ||
23 | dedicated register to hold the pointer to the 'global_data' | ||
24 | structure: r29 on PowerPC, r8 on ARM and k0 on MIPS. The x86 | ||
25 | architecture does not use such a register; instead, the pointer to | ||
26 | the 'global_data' structure is passed as 'argv[-1]' pointer. | ||
25 | 27 | ||
26 | 5. Application now calls standard library functions like printf() | 28 | The application can access the 'global_data' structure in the same |
27 | instead of specially prefixed names like mon_printf() as it did | 29 | way as U-Boot does: |
28 | before. Present implementation of these functions (using the | ||
29 | system calls mechanism) will be replaced with jump stubs. | ||
30 | 30 | ||
31 | 6. To export additional functions, the following steps will have to be | 31 | DECLARE_GLOBAL_DATA_PTR; |
32 | taken: | ||
33 | 32 | ||
34 | - Add the xxx() U-Boot function to the EXPORT_FUNC list | 33 | printf("U-Boot relocation offset: %x\n", gd->reloc_off); |
35 | - Add initialization of the appropriate slot in the jump table | ||
36 | 34 | ||
37 | 7. To port to a new architecture, the appropriate stub code should be | 35 | 3. The application should call the app_startup() function before any |
38 | provided. No other machine-dependent code is used. Once the stub | 36 | call to the exported functions. Also, implementor of the |
39 | template is available, no additional coding is needed when | 37 | application may want to check the version of the ABI provided by |
40 | exporting new U-Boot functions. A pre-processor macro will be used | 38 | U-Boot. To facilitate this, a get_version() function is exported |
41 | to automatically instantiate the stub definition for each exported | 39 | that returns the ABI version of the running U-Boot. I.e., a |
42 | function. | 40 | typical application startup may look like this: |
43 | 41 | ||
44 | Note the following: | 42 | int my_app (int argc, char *argv[]) |
43 | { | ||
44 | app_startup (argv); | ||
45 | if (get_version () != XF_VERSION) | ||
46 | return 1; | ||
47 | } | ||
45 | 48 | ||
46 | - This approach uses a jump table with fixed slot allocation. That | 49 | 4. The default load and start addresses of the applications are as |
47 | said, to retain the ABI compatibility, no table reordering, | 50 | follows: |
48 | inserting new functions in the middle of the list or deleting | ||
49 | functions from the list is allowed. Any such action will break the | ||
50 | ABI compatibility. | ||
51 | 51 | ||
52 | - The x86 architecture does not use a dedicated register to store the | 52 | Load address Start address |
53 | pointer to the global_data structure. There are the following | 53 | x86 0x00040000 0x00040000 |
54 | approaches available: | 54 | PowerPC 0x00040000 0x00040004 |
55 | ARM 0x0c100000 0x0c100000 | ||
56 | MIPS 0x80200000 0x80200000 | ||
55 | 57 | ||
56 | * Pass the global_data pointer to the application in a register or | 58 | For example, the "hello world" application may be loaded and |
57 | as an additional argument. This requires special machine- | 59 | executed on a PowerPC board with the following commands: |
58 | dependent startup code to be compiled into the application. | ||
59 | 60 | ||
60 | * Make the x86 consistent with the rest of architectures and use a | 61 | => tftp 0x40000 hello_world.bin |
61 | dedicated register. This renders one register unusable in the | ||
62 | rest of the U-Boot code and thus increases the size of the U-Boot | ||
63 | binary and decreases it performance. | ||
64 | |||
65 | The following changes will be made: | ||
66 | |||
67 | - The syscall handling code will be removed. | ||
68 | |||
69 | - The include/_exports.h file will be introduced, containing the list | ||
70 | of the exported functions in the following form: | ||
71 | |||
72 | EXPORT_FUNC(getc) | ||
73 | EXPORT_FUNC(tstc) | ||
74 | ... | ||
75 | |||
76 | This list will be used to assign the slot numbers in the jump | ||
77 | table, to determine the size of the jump table and to generate the | ||
78 | code for the stub functions. | ||
79 | |||
80 | - The include/exports.h file will be introduced, containing the | ||
81 | prototypes of the exported functions and the assigned slot numbers. | ||
82 | |||
83 | - The examples/stubs.c file will be introduced, containing the code | ||
84 | for the jump stubs for each of the exported functions. | ||
85 | |||
86 | Implementation Notes on Exporting U-Boot Functions: | ||
87 | =================================================== | ||
88 | |||
89 | 1. The patch was applied against TOT as of 7/24 12:50 MEST; the | ||
90 | resulting images were tested on the following boards: | ||
91 | |||
92 | * lwmon (PowerPC) | ||
93 | * trab (ARM) | ||
94 | * inca (MIPS) | ||
95 | |||
96 | The hello_world application was loaded and executed then: | ||
97 | |||
98 | [lwmon] | ||
99 | => tftp 0x40000 /tftpboot/LWMON/hello_world.bin-avn | ||
100 | => go 0x40004 | 62 | => go 0x40004 |
101 | 63 | ||
102 | [trab] | 64 | 5. To export some additional function foobar(), the following steps |
103 | TRAB # tftp 0xc100000 /tftpboot/TRAB/hello_world.bin-avn | 65 | should be undertaken: |
104 | TRAB # go 0xc100000 | ||
105 | 66 | ||
106 | [inca] | 67 | - Append the following line at the end of the include/_exports.h |
107 | INCA-IP # tftp 0x80200000 /tftpboot/INCA/hello_world.bin-avn | 68 | file: |
108 | INCA-IP # go 0x80200000 | ||
109 | 69 | ||
110 | 2. As neither of supported x86 boards can be built from the TOT | 70 | EXPORT_FUNC(foobar) |
111 | sources currently, the patch build was verified by manually | ||
112 | running the following command in the U-Boot top directory: | ||
113 | 71 | ||
114 | > make -C examples TOPDIR=`pwd` ARCH=i386 CROSS_COMPILE= | 72 | - Add the prototype for this function to the include/exports.h |
73 | file: | ||
115 | 74 | ||
116 | The rest of the code is mostly machine-independent and was not | 75 | void foobar(void); |
117 | verified. | ||
118 | 76 | ||
119 | 3. To test the x86 assembly code, a small standalone application was | 77 | - Add the initialization of the jump table slot wherever |
120 | written. It was built and run on the RedHat Linux 8.0 (x86). The | 78 | appropriate (most likely, to the jumptable_init() function): |
121 | application performs a jump using a pointer to jump table and a | ||
122 | function's index in it. | ||
123 | 79 | ||
124 | 4. For the MIPS architecture, the linker script is also provided for | 80 | gd->jt[XF_foobar] = foobar; |
125 | linking applications. The default linker script places the .text | ||
126 | and .data sections too far from each other so that the resulting | ||
127 | .bin files span about 256Mb in size. | ||
128 | 81 | ||
129 | 5. Several example applications required updating for the new API. | 82 | - Increase the XF_VERSION value by one in the include/exports.h |
130 | These applications relied upon the bd_t pointer being passed as | 83 | file |
131 | the 1st argument to the main function; this had changed when the | ||
132 | system calls were introduced, but apparently, these applications | ||
133 | weren't fixed at that moment. This is fixed now. | ||
134 | 84 | ||
135 | 6. GCC issues warnings for the 'sched' application. Since now the | 85 | 6. The code for exporting the U-Boot functions to applications is |
136 | mon_printf() function is renamed to printf(), GCC applies its | 86 | mostly machine-independent. The only places written in assembly |
137 | knowledge of the format specifiers to check the arguments, | 87 | language are stub functions that perform the jump through the jump |
138 | complaining about ints passed as longs and vice versa. This is not | 88 | table. That said, to port this code to a new architecture, the |
examples/stubs.c
1 | #include <exports.h> | 1 | #include <exports.h> |
2 | 2 | ||
3 | #if defined(CONFIG_I386) | 3 | #if defined(CONFIG_I386) |
4 | /* | 4 | /* |
5 | * x86 does not have a dedicated register to store the pointer to | 5 | * x86 does not have a dedicated register to store the pointer to |
6 | * the global_data. Thus the jump table address is stored in a | 6 | * the global_data. Thus the jump table address is stored in a |
7 | * global variable, but such approach does not allow for execution | 7 | * global variable, but such approach does not allow for execution |
8 | * from flash memory. The global_data address is passed as argv[-1] | 8 | * from flash memory. The global_data address is passed as argv[-1] |
9 | * to the application program. | 9 | * to the application program. |
10 | */ | 10 | */ |
11 | static void **jt; | 11 | static void **jt; |
12 | gd_t *global_data; | ||
12 | 13 | ||
13 | #define EXPORT_FUNC(x) \ | 14 | #define EXPORT_FUNC(x) \ |
14 | asm volatile ( \ | 15 | asm volatile ( \ |
15 | " .globl " #x "\n" \ | 16 | " .globl " #x "\n" \ |
16 | #x ":\n" \ | 17 | #x ":\n" \ |
17 | " movl %0, %%eax\n" \ | 18 | " movl %0, %%eax\n" \ |
18 | " movl jt, %%ecx\n" \ | 19 | " movl jt, %%ecx\n" \ |
19 | " jmp *(%%ecx, %%eax)\n" \ | 20 | " jmp *(%%ecx, %%eax)\n" \ |
20 | : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx"); | 21 | : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx"); |
21 | #elif defined(CONFIG_PPC) | 22 | #elif defined(CONFIG_PPC) |
22 | /* | 23 | /* |
23 | * r29 holds the pointer to the global_data, r11 is a call-clobbered | 24 | * r29 holds the pointer to the global_data, r11 is a call-clobbered |
24 | * register | 25 | * register |
25 | */ | 26 | */ |
26 | #define EXPORT_FUNC(x) \ | 27 | #define EXPORT_FUNC(x) \ |
27 | asm volatile ( \ | 28 | asm volatile ( \ |
28 | " .globl " #x "\n" \ | 29 | " .globl " #x "\n" \ |
29 | #x ":\n" \ | 30 | #x ":\n" \ |
30 | " lwz %%r11, %0(%%r29)\n" \ | 31 | " lwz %%r11, %0(%%r29)\n" \ |
31 | " lwz %%r11, %1(%%r11)\n" \ | 32 | " lwz %%r11, %1(%%r11)\n" \ |
32 | " mtctr %%r11\n" \ | 33 | " mtctr %%r11\n" \ |
33 | " bctr\n" \ | 34 | " bctr\n" \ |
34 | : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11"); | 35 | : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11"); |
35 | #elif defined(CONFIG_ARM) | 36 | #elif defined(CONFIG_ARM) |
36 | /* | 37 | /* |
37 | * r8 holds the pointer to the global_data, ip is a call-clobbered | 38 | * r8 holds the pointer to the global_data, ip is a call-clobbered |
38 | * register | 39 | * register |
39 | */ | 40 | */ |
40 | #define EXPORT_FUNC(x) \ | 41 | #define EXPORT_FUNC(x) \ |
41 | asm volatile ( \ | 42 | asm volatile ( \ |
42 | " .globl " #x "\n" \ | 43 | " .globl " #x "\n" \ |
43 | #x ":\n" \ | 44 | #x ":\n" \ |
44 | " ldr ip, [r8, %0]\n" \ | 45 | " ldr ip, [r8, %0]\n" \ |
45 | " ldr pc, [ip, %1]\n" \ | 46 | " ldr pc, [ip, %1]\n" \ |
46 | : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "ip"); | 47 | : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "ip"); |
47 | #elif defined(CONFIG_MIPS) | 48 | #elif defined(CONFIG_MIPS) |
48 | /* | 49 | /* |
49 | * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call- | 50 | * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call- |
50 | * clobbered register that is also used to set gp ($26). Note that the | 51 | * clobbered register that is also used to set gp ($26). Note that the |
51 | * jr instruction also executes the instruction immediately following | 52 | * jr instruction also executes the instruction immediately following |
52 | * it; however, GCC/mips generates an additional `nop' after each asm | 53 | * it; however, GCC/mips generates an additional `nop' after each asm |
53 | * statement | 54 | * statement |
54 | */ | 55 | */ |
55 | #define EXPORT_FUNC(x) \ | 56 | #define EXPORT_FUNC(x) \ |
56 | asm volatile ( \ | 57 | asm volatile ( \ |
57 | " .globl " #x "\n" \ | 58 | " .globl " #x "\n" \ |
58 | #x ":\n" \ | 59 | #x ":\n" \ |
59 | " lw $25, %0($26)\n" \ | 60 | " lw $25, %0($26)\n" \ |
60 | " lw $25, %1($25)\n" \ | 61 | " lw $25, %1($25)\n" \ |
61 | " jr $25\n" \ | 62 | " jr $25\n" \ |
62 | : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9"); | 63 | : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9"); |
63 | #else | 64 | #else |
64 | #error stubs definition missing for this architecture | 65 | #error stubs definition missing for this architecture |
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | /* This function is necessary to prevent the compiler from | 68 | /* This function is necessary to prevent the compiler from |
68 | * generating prologue/epilogue, preparing stack frame etc. | 69 | * generating prologue/epilogue, preparing stack frame etc. |
69 | * The stub functions are special, they do not use the stack | 70 | * The stub functions are special, they do not use the stack |
70 | * frame passed to them, but pass it intact to the actual | 71 | * frame passed to them, but pass it intact to the actual |
71 | * implementation. On the other hand, asm() statements with | 72 | * implementation. On the other hand, asm() statements with |
72 | * arguments can be used only inside the functions (gcc limitation) | 73 | * arguments can be used only inside the functions (gcc limitation) |
73 | */ | 74 | */ |
74 | static void __attribute__((unused)) dummy(void) | 75 | static void __attribute__((unused)) dummy(void) |
75 | { | 76 | { |
76 | #include <_exports.h> | 77 | #include <_exports.h> |
77 | } | 78 | } |
78 | 79 | ||
79 | void app_startup(char **argv) | 80 | void app_startup(char **argv) |
80 | { | 81 | { |
81 | #if defined(CONFIG_I386) | 82 | #if defined(CONFIG_I386) |
82 | /* x86 does not have a dedicated register for passing global_data */ | 83 | /* x86 does not have a dedicated register for passing global_data */ |
83 | jt = ((gd_t *)argv[-1])->jt; | 84 | global_data = (gd_t *)argv[-1]; |
85 | jt = global_data->jt; | ||
84 | #endif | 86 | #endif |
85 | } | 87 | } |
86 | 88 | ||
87 | #undef EXPORT_FUNC | 89 | #undef EXPORT_FUNC |
88 | 90 |
examples/x86-testapp.c
File was created | 1 | #include <stddef.h> | |
2 | #include <stdio.h> | ||
3 | #include <string.h> | ||
4 | |||
5 | void *func[8], **pfunc; | ||
6 | |||
7 | typedef struct xxx xxx_t; | ||
8 | struct xxx { | ||
9 | int dummy; | ||
10 | void **pfunc; | ||
11 | } q; | ||
12 | |||
13 | #define XF_strcpy 3 | ||
14 | #define XF_printf 4 | ||
15 | |||
16 | #define LABEL(x) \ | ||
17 | asm volatile ( \ | ||
18 | |||
19 | #if defined(__i386__) | ||
20 | #define EXPORT_FUNC(x) \ | ||
21 | asm volatile ( \ | ||
22 | " .globl mon_" #x "\n" \ | ||
23 | "mon_" #x ":\n" \ | ||
24 | " movl %0, %%eax\n" \ | ||
25 | " movl pfunc, %%ecx\n" \ | ||
26 | " jmp *(%%ecx,%%eax)\n" \ | ||
27 | : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx"); | ||
28 | #elif defined(__powerpc__) | ||
29 | #define EXPORT_FUNC(x) \ | ||
30 | asm volatile ( \ | ||
31 | " .globl mon_" #x "\n" \ | ||
32 | "mon_" #x ":\n" \ | ||
33 | " lwz %%r11, %0(%%r29)\n" \ | ||
34 | " lwz %%r11, %1(%%r11)\n" \ | ||
35 | " mtctr %%r11\n" \ | ||
36 | " bctr\n" \ | ||
37 | : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "r11", "r29"); | ||
38 | #elif defined(__arm__) | ||
39 | #define EXPORT_FUNC(x) \ | ||
40 | asm volatile ( \ | ||
41 | " .globl mon_" #x "\n" \ | ||
42 | "mon_" #x ":\n" \ | ||
43 | " ldr ip, [r8, %0]\n" \ | ||
44 | " ldr pc, [ip, %1]\n" \ | ||
45 | : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "ip"); | ||
46 | #elif defined(__mips__) | ||
47 | #define EXPORT_FUNC(x) \ | ||
48 | asm volatile ( \ | ||
49 | " .globl mon_" #x "\n" \ | ||
50 | "mon_" #x ":\n" \ | ||
51 | " lw $25, %0($26)\n" \ | ||
52 | " lw $25, %1($25)\n" \ | ||
53 | " jr $25\n" \ | ||
54 | : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "t9"); | ||
55 | #else | ||
56 | #error [No stub code for this arch] | ||
57 | #endif | ||
58 | |||
59 | void dummy(void) | ||
60 | { | ||
61 | EXPORT_FUNC(printf) | ||
62 | EXPORT_FUNC(strcpy) | ||
63 | } | ||
64 | |||
65 | int main(void) | ||
66 | { | ||
67 | #if defined(__i386__) | ||
68 | xxx_t *pq; | ||
69 | #elif defined(__powerpc__) | ||
70 | register volatile xxx_t *pq asm("r29"); | ||
71 | #elif defined(__arm__) | ||
72 | register volatile xxx_t *pq asm("r8"); | ||
73 | #elif defined(__mips__) | ||
74 | register volatile xxx_t *pq asm("k0"); | ||
75 | #endif | ||
76 | char buf[32]; | ||
77 | |||
78 | func[XF_strcpy] = strcpy; | ||
79 | func[XF_printf] = printf; | ||
80 | pq = &q; | ||
81 | pq->pfunc = pfunc = func; | ||
82 | |||
83 | mon_strcpy(buf, "test"); | ||
84 | mon_printf("hi %s %d z\n", buf, 444); | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 |
include/configs/IceCube.h
1 | /* | 1 | /* |
2 | * (C) Copyright 2003 | 2 | * (C) Copyright 2003 |
3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
4 | * | 4 | * |
5 | * See file CREDITS for list of people who contributed to this | 5 | * See file CREDITS for list of people who contributed to this |
6 | * project. | 6 | * project. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License as | 9 | * modify it under the terms of the GNU General Public License as |
10 | * published by the Free Software Foundation; either version 2 of | 10 | * published by the Free Software Foundation; either version 2 of |
11 | * the License, or (at your option) any later version. | 11 | * the License, or (at your option) any later version. |
12 | * | 12 | * |
13 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | 17 | * |
18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
21 | * MA 02111-1307 USA | 21 | * MA 02111-1307 USA |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef __CONFIG_H | 24 | #ifndef __CONFIG_H |
25 | #define __CONFIG_H | 25 | #define __CONFIG_H |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * High Level Configuration Options | 28 | * High Level Configuration Options |
29 | * (easy to change) | 29 | * (easy to change) |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define CONFIG_MPC5XXX 1 /* This is an MPC5xxx CPU */ | 32 | #define CONFIG_MPC5XXX 1 /* This is an MPC5xxx CPU */ |
33 | #define CONFIG_ICECUBE 1 /* ... on IceCube board */ | 33 | #define CONFIG_ICECUBE 1 /* ... on IceCube board */ |
34 | 34 | ||
35 | #define CFG_MPC5XXX_CLKIN 33333333 /* ... running at 33MHz */ | 35 | #define CFG_MPC5XXX_CLKIN 33333333 /* ... running at 33MHz */ |
36 | 36 | ||
37 | #define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */ | 37 | #define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */ |
38 | #define BOOTFLAG_WARM 0x02 /* Software reboot */ | 38 | #define BOOTFLAG_WARM 0x02 /* Software reboot */ |
39 | 39 | ||
40 | #define CFG_CACHELINE_SIZE 32 /* For MPC8260 CPU */ | 40 | #define CFG_CACHELINE_SIZE 32 /* For MPC8260 CPU */ |
41 | #if (CONFIG_COMMANDS & CFG_CMD_KGDB) | 41 | #if (CONFIG_COMMANDS & CFG_CMD_KGDB) |
42 | # define CFG_CACHELINE_SHIFT 5 /* log base 2 of the above value */ | 42 | # define CFG_CACHELINE_SHIFT 5 /* log base 2 of the above value */ |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Serial console configuration | 46 | * Serial console configuration |
47 | */ | 47 | */ |
48 | #define CONFIG_PSC_CONSOLE 1 /* console is on PSC1 */ | 48 | #define CONFIG_PSC_CONSOLE 1 /* console is on PSC1 */ |
49 | #define CONFIG_BAUDRATE 115200 /* ... at 115200 bps */ | 49 | #define CONFIG_BAUDRATE 115200 /* ... at 115200 bps */ |
50 | #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } | 50 | #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * Supported commands | 53 | * Supported commands |
54 | */ | 54 | */ |
55 | #define CONFIG_COMMANDS (CONFIG_CMD_DFL & ~(CFG_CMD_NET)) | 55 | #define CONFIG_COMMANDS CONFIG_CMD_DFL |
56 | 56 | ||
57 | /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ | 57 | /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ |
58 | #include <cmd_confdefs.h> | 58 | #include <cmd_confdefs.h> |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * Autobooting | 61 | * Autobooting |
62 | */ | 62 | */ |
63 | #define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */ | 63 | #define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */ |
64 | #define CONFIG_BOOTCOMMAND "bootm 100000" /* autoboot command */ | 64 | #define CONFIG_BOOTCOMMAND "bootm 100000" /* autoboot command */ |
65 | #define CONFIG_BOOTARGS "root=/dev/ram rw" | 65 | #define CONFIG_BOOTARGS "root=/dev/ram rw" |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * I2C configuration | 68 | * I2C configuration |
69 | */ | 69 | */ |
70 | 70 | ||
71 | /* | 71 | /* |
72 | * Flash configuration | 72 | * Flash configuration |
73 | */ | 73 | */ |
74 | #define CFG_FLASH_BASE 0xff800000 | 74 | #define CFG_FLASH_BASE 0xff800000 |
75 | #define CFG_FLASH_SIZE 0x00800000 | 75 | #define CFG_FLASH_SIZE 0x00800000 |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Flash organization | 78 | * Flash organization |
79 | */ | 79 | */ |
80 | #define CFG_MAX_FLASH_BANKS 1 /* max num of memory banks */ | 80 | #define CFG_MAX_FLASH_BANKS 1 /* max num of memory banks */ |
81 | #define CFG_MAX_FLASH_SECT 128 /* max num of sects on one chip */ | 81 | #define CFG_MAX_FLASH_SECT 128 /* max num of sects on one chip */ |
82 | 82 | ||
83 | #define CFG_FLASH_ERASE_TOUT 240000 /* Flash Erase Timeout (in ms) */ | 83 | #define CFG_FLASH_ERASE_TOUT 240000 /* Flash Erase Timeout (in ms) */ |
84 | #define CFG_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (in ms) */ | 84 | #define CFG_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (in ms) */ |
85 | 85 | ||
86 | #undef CONFIG_FLASH_16BIT /* Flash is 8-bit */ | 86 | #undef CONFIG_FLASH_16BIT /* Flash is 8-bit */ |
87 | 87 | ||
88 | 88 | ||
89 | /* | 89 | /* |
90 | * Environment settings | 90 | * Environment settings |
91 | */ | 91 | */ |
92 | #define CFG_ENV_IS_IN_FLASH 1 | 92 | #define CFG_ENV_IS_IN_FLASH 1 |
93 | #define CFG_ENV_SIZE 0x10000 | 93 | #define CFG_ENV_SIZE 0x10000 |
94 | #define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x740000) | 94 | #define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x740000) |
95 | #define CFG_ENV_SECT_SIZE 0x10000 | 95 | #define CFG_ENV_SECT_SIZE 0x10000 |
96 | 96 | ||
97 | 97 | ||
98 | /* | 98 | /* |
99 | * Memory map | 99 | * Memory map |
100 | */ | 100 | */ |
101 | #define CFG_MBAR 0xf0000000 | 101 | #define CFG_MBAR 0xf0000000 |
102 | #define CFG_SDRAM_BASE 0x00000000 | 102 | #define CFG_SDRAM_BASE 0x00000000 |
103 | 103 | ||
104 | /* Use SRAM until RAM will be available */ | 104 | /* Use SRAM until RAM will be available */ |
105 | #define CFG_INIT_RAM_ADDR MPC5XXX_SRAM | 105 | #define CFG_INIT_RAM_ADDR MPC5XXX_SRAM |
106 | #define CFG_INIT_RAM_END MPC5XXX_SRAM_SIZE /* End of used area in DPRAM */ | 106 | #define CFG_INIT_RAM_END MPC5XXX_SRAM_SIZE /* End of used area in DPRAM */ |
107 | 107 | ||
108 | 108 | ||
109 | #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ | 109 | #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ |
110 | #define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE) | 110 | #define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE) |
111 | #define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET | 111 | #define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET |
112 | 112 | ||
113 | #define CFG_MONITOR_BASE TEXT_BASE | 113 | #define CFG_MONITOR_BASE TEXT_BASE |
114 | #if (CFG_MONITOR_BASE < CFG_FLASH_BASE) | 114 | #if (CFG_MONITOR_BASE < CFG_FLASH_BASE) |
115 | # define CFG_RAMBOOT 1 | 115 | # define CFG_RAMBOOT 1 |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ | 118 | #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ |
119 | #define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ | 119 | #define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ |
120 | #define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */ | 120 | #define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */ |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * Ethernet configuration | 123 | * Ethernet configuration |
124 | */ | 124 | */ |
125 | #if 0 | ||
126 | #define CONFIG_NET_MULTI 1 | ||
127 | #define CONFIG_MPC5XXX_FEC 1 | 125 | #define CONFIG_MPC5XXX_FEC 1 |
128 | #endif | ||
129 | 126 | ||
130 | /* | 127 | /* |
131 | * GPIO configuration | 128 | * GPIO configuration |
132 | */ | 129 | */ |
133 | #define CFG_GPS_PORT_CONFIG 0x00000004 | 130 | #define CFG_GPS_PORT_CONFIG 0x00000004 |
134 | 131 | ||
135 | /* | 132 | /* |
136 | * Miscellaneous configurable options | 133 | * Miscellaneous configurable options |
137 | */ | 134 | */ |
138 | #define CFG_LONGHELP /* undef to save memory */ | 135 | #define CFG_LONGHELP /* undef to save memory */ |
139 | #define CFG_PROMPT "=> " /* Monitor Command Prompt */ | 136 | #define CFG_PROMPT "=> " /* Monitor Command Prompt */ |
140 | #if (CONFIG_COMMANDS & CFG_CMD_KGDB) | 137 | #if (CONFIG_COMMANDS & CFG_CMD_KGDB) |
141 | #define CFG_CBSIZE 1024 /* Console I/O Buffer Size */ | 138 | #define CFG_CBSIZE 1024 /* Console I/O Buffer Size */ |
142 | #else | 139 | #else |
143 | #define CFG_CBSIZE 256 /* Console I/O Buffer Size */ | 140 | #define CFG_CBSIZE 256 /* Console I/O Buffer Size */ |
144 | #endif | 141 | #endif |
145 | #define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */ | 142 | #define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */ |
146 | #define CFG_MAXARGS 16 /* max number of command args */ | 143 | #define CFG_MAXARGS 16 /* max number of command args */ |
147 | #define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ | 144 | #define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ |
148 | 145 | ||
149 | #define CFG_MEMTEST_START 0x00100000 /* memtest works on */ | 146 | #define CFG_MEMTEST_START 0x00100000 /* memtest works on */ |
150 | #define CFG_MEMTEST_END 0x00f00000 /* 1 ... 15 MB in DRAM */ | 147 | #define CFG_MEMTEST_END 0x00f00000 /* 1 ... 15 MB in DRAM */ |
151 | 148 | ||
152 | #define CFG_LOAD_ADDR 0x100000 /* default load address */ | 149 | #define CFG_LOAD_ADDR 0x100000 /* default load address */ |
153 | 150 | ||
154 | #define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */ | 151 | #define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */ |
155 | 152 | ||
156 | /* | 153 | /* |
157 | * Various low-level settings | 154 | * Various low-level settings |
158 | */ | 155 | */ |
159 | #define CFG_HID0_INIT 0 | 156 | #define CFG_HID0_INIT 0 |
160 | #define CFG_HID0_FINAL 0 | 157 | #define CFG_HID0_FINAL 0 |
161 | 158 | ||
162 | #define CFG_BOOTCS_START CFG_FLASH_BASE | 159 | #define CFG_BOOTCS_START CFG_FLASH_BASE |
163 | #define CFG_BOOTCS_SIZE CFG_FLASH_SIZE | 160 | #define CFG_BOOTCS_SIZE CFG_FLASH_SIZE |
164 | #define CFG_BOOTCS_CFG 0x00047801 | 161 | #define CFG_BOOTCS_CFG 0x00047801 |
165 | #define CFG_CS0_START CFG_FLASH_BASE | 162 | #define CFG_CS0_START CFG_FLASH_BASE |
166 | #define CFG_CS0_SIZE CFG_FLASH_SIZE | 163 | #define CFG_CS0_SIZE CFG_FLASH_SIZE |
167 | 164 | ||
168 | #define CFG_CS_BURST 0x00000000 | 165 | #define CFG_CS_BURST 0x00000000 |
169 | #define CFG_CS_DEADCYCLE 0x33333333 | 166 | #define CFG_CS_DEADCYCLE 0x33333333 |
170 | 167 | ||
171 | #define CFG_RESET_ADDRESS 0xff000000 | 168 | #define CFG_RESET_ADDRESS 0xff000000 |
172 | 169 | ||
173 | #endif /* __CONFIG_H */ | 170 | #endif /* __CONFIG_H */ |
174 | 171 |
include/exports.h
1 | #ifndef __MON_SYS_CALL_H__ | 1 | #ifndef __MON_SYS_CALL_H__ |
2 | #define __MON_SYS_CALL_H__ | 2 | #define __MON_SYS_CALL_H__ |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | 5 | ||
6 | #include <common.h> | 6 | #include <common.h> |
7 | 7 | ||
8 | /* These are declarations of exported functions available in C code */ | 8 | /* These are declarations of exported functions available in C code */ |
9 | unsigned long get_version(void); | 9 | unsigned long get_version(void); |
10 | int getc(void); | 10 | int getc(void); |
11 | int tstc(void); | 11 | int tstc(void); |
12 | void putc(const char); | 12 | void putc(const char); |
13 | void puts(const char*); | 13 | void puts(const char*); |
14 | void printf(const char* fmt, ...); | 14 | void printf(const char* fmt, ...); |
15 | void install_hdlr(int, interrupt_handler_t*, void*); | 15 | void install_hdlr(int, interrupt_handler_t*, void*); |
16 | void free_hdlr(int); | 16 | void free_hdlr(int); |
17 | void *malloc(size_t); | 17 | void *malloc(size_t); |
18 | void free(void*); | 18 | void free(void*); |
19 | void udelay(unsigned long); | 19 | void udelay(unsigned long); |
20 | unsigned long get_timer(unsigned long); | 20 | unsigned long get_timer(unsigned long); |
21 | 21 | ||
22 | void app_startup(char **); | 22 | void app_startup(char **); |
23 | 23 | ||
24 | #endif /* ifndef __ASSEMBLY__ */ | 24 | #endif /* ifndef __ASSEMBLY__ */ |
25 | 25 | ||
26 | enum { | 26 | enum { |
27 | #define EXPORT_FUNC(x) XF_ ## x , | 27 | #define EXPORT_FUNC(x) XF_ ## x , |
28 | #include <_exports.h> | 28 | #include <_exports.h> |
29 | #undef EXPORT_FUNC | 29 | #undef EXPORT_FUNC |
30 | 30 | ||
31 | XF_MAX | 31 | XF_MAX |
32 | }; | 32 | }; |
33 | 33 | ||
34 | #define XF_VERSION 1 | 34 | #define XF_VERSION 1 |
35 | 35 | ||
36 | #if defined(CONFIG_I386) | ||
37 | extern gd_t *global_data; | ||
38 | #endif | ||
39 | |||
36 | #endif | 40 | #endif |
37 | 41 |
include/net.h
1 | /* | 1 | /* |
2 | * LiMon Monitor (LiMon) - Network. | 2 | * LiMon Monitor (LiMon) - Network. |
3 | * | 3 | * |
4 | * Copyright 1994 - 2000 Neil Russell. | 4 | * Copyright 1994 - 2000 Neil Russell. |
5 | * (See License) | 5 | * (See License) |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * History | 8 | * History |
9 | * 9/16/00 bor adapted to TQM823L/STK8xxL board, RARP/TFTP boot added | 9 | * 9/16/00 bor adapted to TQM823L/STK8xxL board, RARP/TFTP boot added |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #ifndef __NET_H__ | 12 | #ifndef __NET_H__ |
13 | #define __NET_H__ | 13 | #define __NET_H__ |
14 | 14 | ||
15 | #if defined(CONFIG_8xx) | 15 | #if defined(CONFIG_8xx) |
16 | #include <commproc.h> | 16 | #include <commproc.h> |
17 | # if !defined(CONFIG_NET_MULTI) | 17 | # if !defined(CONFIG_NET_MULTI) |
18 | # if defined(FEC_ENET) || defined(SCC_ENET) | 18 | # if defined(FEC_ENET) || defined(SCC_ENET) |
19 | # define CONFIG_NET_MULTI | 19 | # define CONFIG_NET_MULTI |
20 | # endif | 20 | # endif |
21 | # endif | 21 | # endif |
22 | #endif /* CONFIG_8xx */ | 22 | #endif /* CONFIG_8xx */ |
23 | 23 | ||
24 | #if defined(CONFIG_MPC5XXX) | ||
25 | # if !defined(CONFIG_NET_MULTI) | ||
26 | # if defined(CONFIG_MPC5XXX_FEC) | ||
27 | # define CONFIG_NET_MULTI | ||
28 | # endif | ||
29 | # endif | ||
30 | #endif /* CONFIG_MPC5XXX */ | ||
31 | |||
24 | #if !defined(CONFIG_NET_MULTI) && defined(CONFIG_8260) | 32 | #if !defined(CONFIG_NET_MULTI) && defined(CONFIG_8260) |
25 | #include <config.h> | 33 | #include <config.h> |
26 | #if defined(CONFIG_ETHER_ON_FCC) | 34 | #if defined(CONFIG_ETHER_ON_FCC) |
27 | #if defined(CONFIG_ETHER_ON_SCC) | 35 | #if defined(CONFIG_ETHER_ON_SCC) |
28 | #error "Ethernet not correctly defined" | 36 | #error "Ethernet not correctly defined" |
29 | #endif /* CONFIG_ETHER_ON_SCC */ | 37 | #endif /* CONFIG_ETHER_ON_SCC */ |
30 | #define CONFIG_NET_MULTI | 38 | #define CONFIG_NET_MULTI |
31 | #if (CONFIG_ETHER_INDEX == 1) | 39 | #if (CONFIG_ETHER_INDEX == 1) |
32 | #define CONFIG_ETHER_ON_FCC1 | 40 | #define CONFIG_ETHER_ON_FCC1 |
33 | # define CFG_CMXFCR_MASK1 CFG_CMXFCR_MASK | 41 | # define CFG_CMXFCR_MASK1 CFG_CMXFCR_MASK |
34 | # define CFG_CMXFCR_VALUE1 CFG_CMXFCR_VALUE | 42 | # define CFG_CMXFCR_VALUE1 CFG_CMXFCR_VALUE |
35 | #elif (CONFIG_ETHER_INDEX == 2) | 43 | #elif (CONFIG_ETHER_INDEX == 2) |
36 | #define CONFIG_ETHER_ON_FCC2 | 44 | #define CONFIG_ETHER_ON_FCC2 |
37 | # define CFG_CMXFCR_MASK2 CFG_CMXFCR_MASK | 45 | # define CFG_CMXFCR_MASK2 CFG_CMXFCR_MASK |
38 | # define CFG_CMXFCR_VALUE2 CFG_CMXFCR_VALUE | 46 | # define CFG_CMXFCR_VALUE2 CFG_CMXFCR_VALUE |
39 | #elif (CONFIG_ETHER_INDEX == 3) | 47 | #elif (CONFIG_ETHER_INDEX == 3) |
40 | #define CONFIG_ETHER_ON_FCC3 | 48 | #define CONFIG_ETHER_ON_FCC3 |
41 | # define CFG_CMXFCR_MASK3 CFG_CMXFCR_MASK | 49 | # define CFG_CMXFCR_MASK3 CFG_CMXFCR_MASK |
42 | # define CFG_CMXFCR_VALUE3 CFG_CMXFCR_VALUE | 50 | # define CFG_CMXFCR_VALUE3 CFG_CMXFCR_VALUE |
43 | #endif /* CONFIG_ETHER_INDEX */ | 51 | #endif /* CONFIG_ETHER_INDEX */ |
44 | #endif /* CONFIG_ETHER_ON_FCC */ | 52 | #endif /* CONFIG_ETHER_ON_FCC */ |
45 | #endif /* !CONFIG_NET_MULTI && CONFIG_8260 */ | 53 | #endif /* !CONFIG_NET_MULTI && CONFIG_8260 */ |
46 | 54 | ||
47 | #include <asm/byteorder.h> /* for nton* / ntoh* stuff */ | 55 | #include <asm/byteorder.h> /* for nton* / ntoh* stuff */ |
48 | 56 | ||
49 | 57 | ||
50 | /* | 58 | /* |
51 | * The number of receive packet buffers, and the required packet buffer | 59 | * The number of receive packet buffers, and the required packet buffer |
52 | * alignment in memory. | 60 | * alignment in memory. |
53 | * | 61 | * |
54 | */ | 62 | */ |
55 | 63 | ||
56 | #ifdef CFG_RX_ETH_BUFFER | 64 | #ifdef CFG_RX_ETH_BUFFER |
57 | # define PKTBUFSRX CFG_RX_ETH_BUFFER | 65 | # define PKTBUFSRX CFG_RX_ETH_BUFFER |
58 | #else | 66 | #else |
59 | # define PKTBUFSRX 4 | 67 | # define PKTBUFSRX 4 |
60 | #endif | 68 | #endif |
61 | 69 | ||
62 | #define PKTALIGN 32 | 70 | #define PKTALIGN 32 |
63 | 71 | ||
64 | typedef ulong IPaddr_t; | 72 | typedef ulong IPaddr_t; |
65 | 73 | ||
66 | 74 | ||
67 | /* | 75 | /* |
68 | * The current receive packet handler. Called with a pointer to the | 76 | * The current receive packet handler. Called with a pointer to the |
69 | * application packet, and a protocol type (PORT_BOOTPC or PORT_TFTP). | 77 | * application packet, and a protocol type (PORT_BOOTPC or PORT_TFTP). |
70 | * All other packets are dealt with without calling the handler. | 78 | * All other packets are dealt with without calling the handler. |
71 | */ | 79 | */ |
72 | typedef void rxhand_f(uchar *, unsigned, unsigned, unsigned); | 80 | typedef void rxhand_f(uchar *, unsigned, unsigned, unsigned); |
73 | 81 | ||
74 | /* | 82 | /* |
75 | * A timeout handler. Called after time interval has expired. | 83 | * A timeout handler. Called after time interval has expired. |
76 | */ | 84 | */ |
77 | typedef void thand_f(void); | 85 | typedef void thand_f(void); |
78 | 86 | ||
79 | #define NAMESIZE 16 | 87 | #define NAMESIZE 16 |
80 | 88 | ||
81 | enum eth_state_t { | 89 | enum eth_state_t { |
82 | ETH_STATE_INIT, | 90 | ETH_STATE_INIT, |
83 | ETH_STATE_PASSIVE, | 91 | ETH_STATE_PASSIVE, |
84 | ETH_STATE_ACTIVE | 92 | ETH_STATE_ACTIVE |
85 | }; | 93 | }; |
86 | 94 | ||
87 | struct eth_device { | 95 | struct eth_device { |
88 | char name[NAMESIZE]; | 96 | char name[NAMESIZE]; |
89 | unsigned char enetaddr[6]; | 97 | unsigned char enetaddr[6]; |
90 | int iobase; | 98 | int iobase; |
91 | int state; | 99 | int state; |
92 | 100 | ||
93 | int (*init) (struct eth_device*, bd_t*); | 101 | int (*init) (struct eth_device*, bd_t*); |
94 | int (*send) (struct eth_device*, volatile void* pachet, int length); | 102 | int (*send) (struct eth_device*, volatile void* pachet, int length); |
95 | int (*recv) (struct eth_device*); | 103 | int (*recv) (struct eth_device*); |
96 | void (*halt) (struct eth_device*); | 104 | void (*halt) (struct eth_device*); |
97 | 105 | ||
98 | struct eth_device *next; | 106 | struct eth_device *next; |
99 | void *priv; | 107 | void *priv; |
100 | }; | 108 | }; |
101 | 109 | ||
102 | extern int eth_initialize(bd_t *bis); /* Initialize network subsystem */ | 110 | extern int eth_initialize(bd_t *bis); /* Initialize network subsystem */ |
103 | extern int eth_register(struct eth_device* dev);/* Register network device */ | 111 | extern int eth_register(struct eth_device* dev);/* Register network device */ |
104 | extern void eth_try_another(int first_restart); /* Change the device */ | 112 | extern void eth_try_another(int first_restart); /* Change the device */ |
105 | extern struct eth_device *eth_get_dev(void); /* get the current device MAC */ | 113 | extern struct eth_device *eth_get_dev(void); /* get the current device MAC */ |
106 | extern void eth_set_enetaddr(int num, char* a); /* Set new MAC address */ | 114 | extern void eth_set_enetaddr(int num, char* a); /* Set new MAC address */ |
107 | 115 | ||
108 | extern int eth_init(bd_t *bis); /* Initialize the device */ | 116 | extern int eth_init(bd_t *bis); /* Initialize the device */ |
109 | extern int eth_send(volatile void *packet, int length); /* Send a packet */ | 117 | extern int eth_send(volatile void *packet, int length); /* Send a packet */ |
110 | extern int eth_rx(void); /* Check for received packets */ | 118 | extern int eth_rx(void); /* Check for received packets */ |
111 | extern void eth_halt(void); /* stop SCC */ | 119 | extern void eth_halt(void); /* stop SCC */ |
112 | 120 | ||
113 | 121 | ||
114 | /**********************************************************************/ | 122 | /**********************************************************************/ |
115 | /* | 123 | /* |
116 | * Protocol headers. | 124 | * Protocol headers. |
117 | */ | 125 | */ |
118 | 126 | ||
119 | /* | 127 | /* |
120 | * Ethernet header | 128 | * Ethernet header |
121 | */ | 129 | */ |
122 | typedef struct { | 130 | typedef struct { |
123 | uchar et_dest[6]; /* Destination node */ | 131 | uchar et_dest[6]; /* Destination node */ |
124 | uchar et_src[6]; /* Source node */ | 132 | uchar et_src[6]; /* Source node */ |
125 | ushort et_protlen; /* Protocol or length */ | 133 | ushort et_protlen; /* Protocol or length */ |
126 | uchar et_dsap; /* 802 DSAP */ | 134 | uchar et_dsap; /* 802 DSAP */ |
127 | uchar et_ssap; /* 802 SSAP */ | 135 | uchar et_ssap; /* 802 SSAP */ |
128 | uchar et_ctl; /* 802 control */ | 136 | uchar et_ctl; /* 802 control */ |
129 | uchar et_snap1; /* SNAP */ | 137 | uchar et_snap1; /* SNAP */ |
130 | uchar et_snap2; | 138 | uchar et_snap2; |
131 | uchar et_snap3; | 139 | uchar et_snap3; |
132 | ushort et_prot; /* 802 protocol */ | 140 | ushort et_prot; /* 802 protocol */ |
133 | } Ethernet_t; | 141 | } Ethernet_t; |
134 | 142 | ||
135 | #define ETHER_HDR_SIZE 14 /* Ethernet header size */ | 143 | #define ETHER_HDR_SIZE 14 /* Ethernet header size */ |
136 | #define E802_HDR_SIZE 22 /* 802 ethernet header size */ | 144 | #define E802_HDR_SIZE 22 /* 802 ethernet header size */ |
137 | #define PROT_IP 0x0800 /* IP protocol */ | 145 | #define PROT_IP 0x0800 /* IP protocol */ |
138 | #define PROT_ARP 0x0806 /* IP ARP protocol */ | 146 | #define PROT_ARP 0x0806 /* IP ARP protocol */ |
139 | #define PROT_RARP 0x8035 /* IP ARP protocol */ | 147 | #define PROT_RARP 0x8035 /* IP ARP protocol */ |
140 | 148 | ||
141 | #define IPPROTO_ICMP 1 /* Internet Control Message Protocol */ | 149 | #define IPPROTO_ICMP 1 /* Internet Control Message Protocol */ |
142 | #define IPPROTO_UDP 17 /* User Datagram Protocol */ | 150 | #define IPPROTO_UDP 17 /* User Datagram Protocol */ |
143 | 151 | ||
144 | /* | 152 | /* |
145 | * Internet Protocol (IP) header. | 153 | * Internet Protocol (IP) header. |
146 | */ | 154 | */ |
147 | typedef struct { | 155 | typedef struct { |
148 | uchar ip_hl_v; /* header length and version */ | 156 | uchar ip_hl_v; /* header length and version */ |
149 | uchar ip_tos; /* type of service */ | 157 | uchar ip_tos; /* type of service */ |
150 | ushort ip_len; /* total length */ | 158 | ushort ip_len; /* total length */ |
151 | ushort ip_id; /* identification */ | 159 | ushort ip_id; /* identification */ |
152 | ushort ip_off; /* fragment offset field */ | 160 | ushort ip_off; /* fragment offset field */ |
153 | uchar ip_ttl; /* time to live */ | 161 | uchar ip_ttl; /* time to live */ |
154 | uchar ip_p; /* protocol */ | 162 | uchar ip_p; /* protocol */ |
155 | ushort ip_sum; /* checksum */ | 163 | ushort ip_sum; /* checksum */ |
156 | IPaddr_t ip_src; /* Source IP address */ | 164 | IPaddr_t ip_src; /* Source IP address */ |
157 | IPaddr_t ip_dst; /* Destination IP address */ | 165 | IPaddr_t ip_dst; /* Destination IP address */ |
158 | ushort udp_src; /* UDP source port */ | 166 | ushort udp_src; /* UDP source port */ |
159 | ushort udp_dst; /* UDP destination port */ | 167 | ushort udp_dst; /* UDP destination port */ |
160 | ushort udp_len; /* Length of UDP packet */ | 168 | ushort udp_len; /* Length of UDP packet */ |
161 | ushort udp_xsum; /* Checksum */ | 169 | ushort udp_xsum; /* Checksum */ |
162 | } IP_t; | 170 | } IP_t; |
163 | 171 | ||
164 | #define IP_HDR_SIZE_NO_UDP (sizeof (IP_t) - 8) | 172 | #define IP_HDR_SIZE_NO_UDP (sizeof (IP_t) - 8) |
165 | #define IP_HDR_SIZE (sizeof (IP_t)) | 173 | #define IP_HDR_SIZE (sizeof (IP_t)) |
166 | 174 | ||
167 | 175 | ||
168 | /* | 176 | /* |
169 | * Address Resolution Protocol (ARP) header. | 177 | * Address Resolution Protocol (ARP) header. |
170 | */ | 178 | */ |
171 | typedef struct | 179 | typedef struct |
172 | { | 180 | { |
173 | ushort ar_hrd; /* Format of hardware address */ | 181 | ushort ar_hrd; /* Format of hardware address */ |
174 | # define ARP_ETHER 1 /* Ethernet hardware address */ | 182 | # define ARP_ETHER 1 /* Ethernet hardware address */ |
175 | ushort ar_pro; /* Format of protocol address */ | 183 | ushort ar_pro; /* Format of protocol address */ |
176 | uchar ar_hln; /* Length of hardware address */ | 184 | uchar ar_hln; /* Length of hardware address */ |
177 | uchar ar_pln; /* Length of protocol address */ | 185 | uchar ar_pln; /* Length of protocol address */ |
178 | ushort ar_op; /* Operation */ | 186 | ushort ar_op; /* Operation */ |
179 | # define ARPOP_REQUEST 1 /* Request to resolve address */ | 187 | # define ARPOP_REQUEST 1 /* Request to resolve address */ |
180 | # define ARPOP_REPLY 2 /* Response to previous request */ | 188 | # define ARPOP_REPLY 2 /* Response to previous request */ |
181 | 189 | ||
182 | # define RARPOP_REQUEST 3 /* Request to resolve address */ | 190 | # define RARPOP_REQUEST 3 /* Request to resolve address */ |
183 | # define RARPOP_REPLY 4 /* Response to previous request */ | 191 | # define RARPOP_REPLY 4 /* Response to previous request */ |
184 | 192 | ||
185 | /* | 193 | /* |
186 | * The remaining fields are variable in size, according to | 194 | * The remaining fields are variable in size, according to |
187 | * the sizes above, and are defined as appropriate for | 195 | * the sizes above, and are defined as appropriate for |
188 | * specific hardware/protocol combinations. | 196 | * specific hardware/protocol combinations. |
189 | */ | 197 | */ |
190 | uchar ar_data[0]; | 198 | uchar ar_data[0]; |
191 | #if 0 | 199 | #if 0 |
192 | uchar ar_sha[]; /* Sender hardware address */ | 200 | uchar ar_sha[]; /* Sender hardware address */ |
193 | uchar ar_spa[]; /* Sender protocol address */ | 201 | uchar ar_spa[]; /* Sender protocol address */ |
194 | uchar ar_tha[]; /* Target hardware address */ | 202 | uchar ar_tha[]; /* Target hardware address */ |
195 | uchar ar_tpa[]; /* Target protocol address */ | 203 | uchar ar_tpa[]; /* Target protocol address */ |
196 | #endif /* 0 */ | 204 | #endif /* 0 */ |
197 | } ARP_t; | 205 | } ARP_t; |
198 | 206 | ||
199 | #define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */ | 207 | #define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */ |
200 | 208 | ||
201 | /* | 209 | /* |
202 | * ICMP stuff (just enough to handle (host) redirect messages) | 210 | * ICMP stuff (just enough to handle (host) redirect messages) |
203 | */ | 211 | */ |
204 | #define ICMP_ECHO_REPLY 0 /* Echo reply */ | 212 | #define ICMP_ECHO_REPLY 0 /* Echo reply */ |
205 | #define ICMP_REDIRECT 5 /* Redirect (change route) */ | 213 | #define ICMP_REDIRECT 5 /* Redirect (change route) */ |
206 | #define ICMP_ECHO_REQUEST 8 /* Echo request */ | 214 | #define ICMP_ECHO_REQUEST 8 /* Echo request */ |
207 | 215 | ||
208 | /* Codes for REDIRECT. */ | 216 | /* Codes for REDIRECT. */ |
209 | #define ICMP_REDIR_NET 0 /* Redirect Net */ | 217 | #define ICMP_REDIR_NET 0 /* Redirect Net */ |
210 | #define ICMP_REDIR_HOST 1 /* Redirect Host */ | 218 | #define ICMP_REDIR_HOST 1 /* Redirect Host */ |
211 | 219 | ||
212 | typedef struct icmphdr { | 220 | typedef struct icmphdr { |
213 | uchar type; | 221 | uchar type; |
214 | uchar code; | 222 | uchar code; |
215 | ushort checksum; | 223 | ushort checksum; |
216 | union { | 224 | union { |
217 | struct { | 225 | struct { |
218 | ushort id; | 226 | ushort id; |
219 | ushort sequence; | 227 | ushort sequence; |
220 | } echo; | 228 | } echo; |
221 | ulong gateway; | 229 | ulong gateway; |
222 | struct { | 230 | struct { |
223 | ushort __unused; | 231 | ushort __unused; |
224 | ushort mtu; | 232 | ushort mtu; |
225 | } frag; | 233 | } frag; |
226 | } un; | 234 | } un; |
227 | } ICMP_t; | 235 | } ICMP_t; |
228 | 236 | ||
229 | 237 | ||
230 | /* | 238 | /* |
231 | * Maximum packet size; used to allocate packet storage. | 239 | * Maximum packet size; used to allocate packet storage. |
232 | * TFTP packets can be 524 bytes + IP header + ethernet header. | 240 | * TFTP packets can be 524 bytes + IP header + ethernet header. |
233 | * Lets be conservative, and go for 38 * 16. (Must also be | 241 | * Lets be conservative, and go for 38 * 16. (Must also be |
234 | * a multiple of 32 bytes). | 242 | * a multiple of 32 bytes). |
235 | */ | 243 | */ |
236 | /* | 244 | /* |
237 | * AS.HARNOIS : Better to set PKTSIZE to maximum size because | 245 | * AS.HARNOIS : Better to set PKTSIZE to maximum size because |
238 | * traffic type is not always controlled | 246 | * traffic type is not always controlled |
239 | * maximum packet size = 1518 | 247 | * maximum packet size = 1518 |
240 | * maximum packet size and multiple of 32 bytes = 1536 | 248 | * maximum packet size and multiple of 32 bytes = 1536 |
241 | */ | 249 | */ |
242 | #define PKTSIZE 1518 | 250 | #define PKTSIZE 1518 |
243 | #define PKTSIZE_ALIGN 1536 | 251 | #define PKTSIZE_ALIGN 1536 |
244 | /*#define PKTSIZE 608*/ | 252 | /*#define PKTSIZE 608*/ |
245 | 253 | ||
246 | /* | 254 | /* |
247 | * Maximum receive ring size; that is, the number of packets | 255 | * Maximum receive ring size; that is, the number of packets |
248 | * we can buffer before overflow happens. Basically, this just | 256 | * we can buffer before overflow happens. Basically, this just |
249 | * needs to be enough to prevent a packet being discarded while | 257 | * needs to be enough to prevent a packet being discarded while |
250 | * we are processing the previous one. | 258 | * we are processing the previous one. |
251 | */ | 259 | */ |
252 | #define RINGSZ 4 | 260 | #define RINGSZ 4 |
253 | #define RINGSZ_LOG2 2 | 261 | #define RINGSZ_LOG2 2 |
254 | 262 | ||
255 | /**********************************************************************/ | 263 | /**********************************************************************/ |
256 | /* | 264 | /* |
257 | * Globals. | 265 | * Globals. |
258 | * | 266 | * |
259 | * Note: | 267 | * Note: |
260 | * | 268 | * |
261 | * All variables of type IPaddr_t are stored in NETWORK byte order | 269 | * All variables of type IPaddr_t are stored in NETWORK byte order |
262 | * (big endian). | 270 | * (big endian). |
263 | */ | 271 | */ |
264 | 272 | ||
265 | /* net.c */ | 273 | /* net.c */ |
266 | /** BOOTP EXTENTIONS **/ | 274 | /** BOOTP EXTENTIONS **/ |
267 | extern IPaddr_t NetOurGatewayIP; /* Our gateway IP addresse */ | 275 | extern IPaddr_t NetOurGatewayIP; /* Our gateway IP addresse */ |
268 | extern IPaddr_t NetOurSubnetMask; /* Our subnet mask (0 = unknown)*/ | 276 | extern IPaddr_t NetOurSubnetMask; /* Our subnet mask (0 = unknown)*/ |
269 | extern IPaddr_t NetOurDNSIP; /* Our Domain Name Server (0 = unknown)*/ | 277 | extern IPaddr_t NetOurDNSIP; /* Our Domain Name Server (0 = unknown)*/ |
270 | extern char NetOurNISDomain[32]; /* Our NIS domain */ | 278 | extern char NetOurNISDomain[32]; /* Our NIS domain */ |
271 | extern char NetOurHostName[32]; /* Our hostname */ | 279 | extern char NetOurHostName[32]; /* Our hostname */ |
272 | extern char NetOurRootPath[64]; /* Our root path */ | 280 | extern char NetOurRootPath[64]; /* Our root path */ |
273 | extern ushort NetBootFileSize; /* Our boot file size in blocks */ | 281 | extern ushort NetBootFileSize; /* Our boot file size in blocks */ |
274 | /** END OF BOOTP EXTENTIONS **/ | 282 | /** END OF BOOTP EXTENTIONS **/ |
275 | extern ulong NetBootFileXferSize; /* size of bootfile in bytes */ | 283 | extern ulong NetBootFileXferSize; /* size of bootfile in bytes */ |
276 | extern uchar NetOurEther[6]; /* Our ethernet address */ | 284 | extern uchar NetOurEther[6]; /* Our ethernet address */ |
277 | extern uchar NetServerEther[6]; /* Boot server enet address */ | 285 | extern uchar NetServerEther[6]; /* Boot server enet address */ |
278 | extern IPaddr_t NetOurIP; /* Our IP addr (0 = unknown) */ | 286 | extern IPaddr_t NetOurIP; /* Our IP addr (0 = unknown) */ |
279 | extern IPaddr_t NetServerIP; /* Server IP addr (0 = unknown) */ | 287 | extern IPaddr_t NetServerIP; /* Server IP addr (0 = unknown) */ |
280 | extern volatile uchar * NetTxPacket; /* THE transmit packet */ | 288 | extern volatile uchar * NetTxPacket; /* THE transmit packet */ |
281 | extern volatile uchar * NetRxPackets[PKTBUFSRX];/* Receive packets */ | 289 | extern volatile uchar * NetRxPackets[PKTBUFSRX];/* Receive packets */ |
282 | extern volatile uchar * NetRxPkt; /* Current receive packet */ | 290 | extern volatile uchar * NetRxPkt; /* Current receive packet */ |
283 | extern int NetRxPktLen; /* Current rx packet length */ | 291 | extern int NetRxPktLen; /* Current rx packet length */ |
284 | extern unsigned NetIPID; /* IP ID (counting) */ | 292 | extern unsigned NetIPID; /* IP ID (counting) */ |
285 | extern uchar NetBcastAddr[6]; /* Ethernet boardcast address */ | 293 | extern uchar NetBcastAddr[6]; /* Ethernet boardcast address */ |
286 | 294 | ||
287 | extern int NetState; /* Network loop state */ | 295 | extern int NetState; /* Network loop state */ |
288 | #define NETLOOP_CONTINUE 1 | 296 | #define NETLOOP_CONTINUE 1 |
289 | #define NETLOOP_RESTART 2 | 297 | #define NETLOOP_RESTART 2 |
290 | #define NETLOOP_SUCCESS 3 | 298 | #define NETLOOP_SUCCESS 3 |
291 | #define NETLOOP_FAIL 4 | 299 | #define NETLOOP_FAIL 4 |
292 | 300 | ||
293 | #ifdef CONFIG_NET_MULTI | 301 | #ifdef CONFIG_NET_MULTI |
294 | extern int NetRestartWrap; /* Tried all network devices */ | 302 | extern int NetRestartWrap; /* Tried all network devices */ |
295 | #endif | 303 | #endif |
296 | 304 | ||
297 | typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS } proto_t; | 305 | typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS } proto_t; |
298 | 306 | ||
299 | /* from net/net.c */ | 307 | /* from net/net.c */ |
300 | extern char BootFile[128]; /* Boot File name */ | 308 | extern char BootFile[128]; /* Boot File name */ |
301 | 309 | ||
302 | #if (CONFIG_COMMANDS & CFG_CMD_PING) | 310 | #if (CONFIG_COMMANDS & CFG_CMD_PING) |
303 | extern IPaddr_t NetPingIP; /* the ip address to ping */ | 311 | extern IPaddr_t NetPingIP; /* the ip address to ping */ |
304 | #endif | 312 | #endif |
305 | 313 | ||
306 | /* Initialize the network adapter */ | 314 | /* Initialize the network adapter */ |
307 | extern int NetLoop(proto_t); | 315 | extern int NetLoop(proto_t); |
308 | 316 | ||
309 | /* Shutdown adapters and cleanup */ | 317 | /* Shutdown adapters and cleanup */ |
310 | extern void NetStop(void); | 318 | extern void NetStop(void); |
311 | 319 | ||
312 | /* Load failed. Start again. */ | 320 | /* Load failed. Start again. */ |
313 | extern void NetStartAgain(void); | 321 | extern void NetStartAgain(void); |
314 | 322 | ||
315 | /* Set ethernet header */ | 323 | /* Set ethernet header */ |
316 | extern void NetSetEther(volatile uchar *, uchar *, uint); | 324 | extern void NetSetEther(volatile uchar *, uchar *, uint); |
317 | 325 | ||
318 | /* Set IP header */ | 326 | /* Set IP header */ |
319 | extern void NetSetIP(volatile uchar *, IPaddr_t, int, int, int); | 327 | extern void NetSetIP(volatile uchar *, IPaddr_t, int, int, int); |
320 | 328 | ||
321 | /* Checksum */ | 329 | /* Checksum */ |
322 | extern int NetCksumOk(uchar *, int); /* Return true if cksum OK */ | 330 | extern int NetCksumOk(uchar *, int); /* Return true if cksum OK */ |
323 | extern uint NetCksum(uchar *, int); /* Calculate the checksum */ | 331 | extern uint NetCksum(uchar *, int); /* Calculate the checksum */ |
324 | 332 | ||
325 | /* Set callbacks */ | 333 | /* Set callbacks */ |
326 | extern void NetSetHandler(rxhand_f *); /* Set RX packet handler */ | 334 | extern void NetSetHandler(rxhand_f *); /* Set RX packet handler */ |
327 | extern void NetSetTimeout(int, thand_f *); /* Set timeout handler */ | 335 | extern void NetSetTimeout(int, thand_f *); /* Set timeout handler */ |
328 | 336 | ||
329 | /* Transmit "NetTxPacket" */ | 337 | /* Transmit "NetTxPacket" */ |
330 | extern void NetSendPacket(volatile uchar *, int); | 338 | extern void NetSendPacket(volatile uchar *, int); |
331 | 339 | ||
332 | /* Transmit UDP packet, performing ARP request if needed */ | 340 | /* Transmit UDP packet, performing ARP request if needed */ |
333 | extern int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len); | 341 | extern int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len); |
334 | 342 | ||
335 | /* Processes a received packet */ | 343 | /* Processes a received packet */ |
336 | extern void NetReceive(volatile uchar *, int); | 344 | extern void NetReceive(volatile uchar *, int); |
337 | 345 | ||
338 | /* Print an IP address on the console */ | 346 | /* Print an IP address on the console */ |
339 | extern void print_IPaddr (IPaddr_t); | 347 | extern void print_IPaddr (IPaddr_t); |
340 | 348 | ||
341 | /* | 349 | /* |
342 | * The following functions are a bit ugly, but necessary to deal with | 350 | * The following functions are a bit ugly, but necessary to deal with |
343 | * alignment restrictions on ARM. | 351 | * alignment restrictions on ARM. |
344 | * | 352 | * |
345 | * We're using inline functions, which had the smallest memory | 353 | * We're using inline functions, which had the smallest memory |
346 | * footprint in our tests. | 354 | * footprint in our tests. |
347 | */ | 355 | */ |
348 | /* return IP *in network byteorder* */ | 356 | /* return IP *in network byteorder* */ |
349 | static inline IPaddr_t NetReadIP(void *from) | 357 | static inline IPaddr_t NetReadIP(void *from) |
350 | { | 358 | { |
351 | IPaddr_t ip; | 359 | IPaddr_t ip; |
352 | memcpy((void*)&ip, from, sizeof(ip)); | 360 | memcpy((void*)&ip, from, sizeof(ip)); |
353 | return ip; | 361 | return ip; |
354 | } | 362 | } |
355 | 363 | ||
356 | /* return ulong *in network byteorder* */ | 364 | /* return ulong *in network byteorder* */ |
357 | static inline ulong NetReadLong(ulong *from) | 365 | static inline ulong NetReadLong(ulong *from) |
358 | { | 366 | { |
359 | ulong l; | 367 | ulong l; |
360 | memcpy((void*)&l, (void*)from, sizeof(l)); | 368 | memcpy((void*)&l, (void*)from, sizeof(l)); |
361 | return l; | 369 | return l; |
362 | } | 370 | } |
363 | 371 | ||
364 | /* write IP *in network byteorder* */ | 372 | /* write IP *in network byteorder* */ |
365 | static inline void NetWriteIP(void *to, IPaddr_t ip) | 373 | static inline void NetWriteIP(void *to, IPaddr_t ip) |
366 | { | 374 | { |
367 | memcpy(to, (void*)&ip, sizeof(ip)); | 375 | memcpy(to, (void*)&ip, sizeof(ip)); |
368 | } | 376 | } |
369 | 377 | ||
370 | /* copy IP */ | 378 | /* copy IP */ |
371 | static inline void NetCopyIP(void *to, void *from) | 379 | static inline void NetCopyIP(void *to, void *from) |
372 | { | 380 | { |
373 | memcpy(to, from, sizeof(IPaddr_t)); | 381 | memcpy(to, from, sizeof(IPaddr_t)); |
374 | } | 382 | } |
375 | 383 | ||
376 | /* copy ulong */ | 384 | /* copy ulong */ |
377 | static inline void NetCopyLong(ulong *to, ulong *from) | 385 | static inline void NetCopyLong(ulong *to, ulong *from) |
378 | { | 386 | { |
379 | memcpy((void*)to, (void*)from, sizeof(ulong)); | 387 | memcpy((void*)to, (void*)from, sizeof(ulong)); |
380 | } | 388 | } |
381 | 389 | ||
382 | /* Convert an IP address to a string */ | 390 | /* Convert an IP address to a string */ |
383 | extern void ip_to_string (IPaddr_t x, char *s); | 391 | extern void ip_to_string (IPaddr_t x, char *s); |
384 | 392 | ||
385 | /* Convert a string to ip address */ | 393 | /* Convert a string to ip address */ |
386 | extern IPaddr_t string_to_ip(char *s); | 394 | extern IPaddr_t string_to_ip(char *s); |
387 | 395 | ||
388 | /* read an IP address from a environment variable */ | 396 | /* read an IP address from a environment variable */ |
389 | extern IPaddr_t getenv_IPaddr (char *); | 397 | extern IPaddr_t getenv_IPaddr (char *); |
390 | 398 | ||
391 | /* copy a filename (allow for "..." notation, limit length) */ | 399 | /* copy a filename (allow for "..." notation, limit length) */ |
392 | extern void copy_filename (uchar *dst, uchar *src, int size); | 400 | extern void copy_filename (uchar *dst, uchar *src, int size); |
393 | 401 | ||
394 | /**********************************************************************/ | 402 | /**********************************************************************/ |
395 | 403 | ||
396 | #endif /* __NET_H__ */ | 404 | #endif /* __NET_H__ */ |
397 | 405 |
lib_arm/armlinux.c
1 | /* | 1 | /* |
2 | * (C) Copyright 2002 | 2 | * (C) Copyright 2002 |
3 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> | 3 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
4 | * Marius Groeger <mgroeger@sysgo.de> | 4 | * Marius Groeger <mgroeger@sysgo.de> |
5 | * | 5 | * |
6 | * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) | 6 | * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or | 10 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. | 11 | * (at your option) any later version. |
12 | * | 12 | * |
13 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | 17 | * |
18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <common.h> | 24 | #include <common.h> |
25 | #include <command.h> | 25 | #include <command.h> |
26 | #include <image.h> | 26 | #include <image.h> |
27 | #include <zlib.h> | 27 | #include <zlib.h> |
28 | #include <asm/byteorder.h> | 28 | #include <asm/byteorder.h> |
29 | #ifdef CONFIG_HAS_DATAFLASH | 29 | #ifdef CONFIG_HAS_DATAFLASH |
30 | #include <dataflash.h> | 30 | #include <dataflash.h> |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #include <asm/setup.h> | 33 | #include <asm/setup.h> |
34 | #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) | 34 | #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) |
35 | #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) | 35 | #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) |
36 | 36 | ||
37 | /*cmd_boot.c*/ | 37 | /*cmd_boot.c*/ |
38 | extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); | 38 | extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); |
39 | 39 | ||
40 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ | 40 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ |
41 | defined (CONFIG_CMDLINE_TAG) || \ | 41 | defined (CONFIG_CMDLINE_TAG) || \ |
42 | defined (CONFIG_INITRD_TAG) || \ | 42 | defined (CONFIG_INITRD_TAG) || \ |
43 | defined (CONFIG_VFD) | 43 | defined (CONFIG_VFD) |
44 | static void setup_start_tag(bd_t *bd); | 44 | static void setup_start_tag(bd_t *bd); |
45 | # ifdef CONFIG_SETUP_MEMORY_TAGS | 45 | # ifdef CONFIG_SETUP_MEMORY_TAGS |
46 | static void setup_memory_tags(bd_t *bd); | 46 | static void setup_memory_tags(bd_t *bd); |
47 | # endif | 47 | # endif |
48 | static void setup_commandline_tag(bd_t *bd, char *commandline); | 48 | static void setup_commandline_tag(bd_t *bd, char *commandline); |
49 | #if 0 | 49 | #if 0 |
50 | static void setup_ramdisk_tag(bd_t *bd); | 50 | static void setup_ramdisk_tag(bd_t *bd); |
51 | #endif | 51 | #endif |
52 | # ifdef CONFIG_INITRD_TAG | 52 | # ifdef CONFIG_INITRD_TAG |
53 | static void setup_initrd_tag(bd_t *bd, ulong initrd_start, ulong initrd_end); | 53 | static void setup_initrd_tag(bd_t *bd, ulong initrd_start, ulong initrd_end); |
54 | # endif | 54 | # endif |
55 | static void setup_end_tag(bd_t *bd); | 55 | static void setup_end_tag(bd_t *bd); |
56 | # if defined (CONFIG_VFD) | 56 | # if defined (CONFIG_VFD) |
57 | static void setup_videolfb_tag(gd_t *gd); | 57 | static void setup_videolfb_tag(gd_t *gd); |
58 | # endif | 58 | # endif |
59 | 59 | ||
60 | 60 | ||
61 | static struct tag *params; | 61 | static struct tag *params; |
62 | #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */ | 62 | #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */ |
63 | 63 | ||
64 | #ifdef CONFIG_SHOW_BOOT_PROGRESS | 64 | #ifdef CONFIG_SHOW_BOOT_PROGRESS |
65 | # include <status_led.h> | 65 | # include <status_led.h> |
66 | # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg) | 66 | # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg) |
67 | #else | 67 | #else |
68 | # define SHOW_BOOT_PROGRESS(arg) | 68 | # define SHOW_BOOT_PROGRESS(arg) |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | extern image_header_t header; /* from cmd_bootm.c */ | 71 | extern image_header_t header; /* from cmd_bootm.c */ |
72 | 72 | ||
73 | 73 | ||
74 | void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], | 74 | void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], |
75 | ulong addr, ulong *len_ptr, int verify) | 75 | ulong addr, ulong *len_ptr, int verify) |
76 | { | 76 | { |
77 | DECLARE_GLOBAL_DATA_PTR; | 77 | DECLARE_GLOBAL_DATA_PTR; |
78 | 78 | ||
79 | ulong len = 0, checksum; | 79 | ulong len = 0, checksum; |
80 | ulong initrd_start, initrd_end; | 80 | ulong initrd_start, initrd_end; |
81 | ulong data; | 81 | ulong data; |
82 | void (*theKernel)(int zero, int arch); | 82 | void (*theKernel)(int zero, int arch); |
83 | image_header_t *hdr = &header; | 83 | image_header_t *hdr = &header; |
84 | bd_t *bd = gd->bd; | 84 | bd_t *bd = gd->bd; |
85 | #ifdef CONFIG_CMDLINE_TAG | 85 | #ifdef CONFIG_CMDLINE_TAG |
86 | char *commandline = getenv("bootargs"); | 86 | char *commandline = getenv("bootargs"); |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | theKernel = (void (*)(int, int))ntohl(hdr->ih_ep); | 89 | theKernel = (void (*)(int, int))ntohl(hdr->ih_ep); |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Check if there is an initrd image | 92 | * Check if there is an initrd image |
93 | */ | 93 | */ |
94 | if (argc >= 3) { | 94 | if (argc >= 3) { |
95 | SHOW_BOOT_PROGRESS (9); | 95 | SHOW_BOOT_PROGRESS (9); |
96 | 96 | ||
97 | addr = simple_strtoul(argv[2], NULL, 16); | 97 | addr = simple_strtoul(argv[2], NULL, 16); |
98 | 98 | ||
99 | printf ("## Loading Ramdisk Image at %08lx ...\n", addr); | 99 | printf ("## Loading Ramdisk Image at %08lx ...\n", addr); |
100 | 100 | ||
101 | /* Copy header so we can blank CRC field for re-calculation */ | 101 | /* Copy header so we can blank CRC field for re-calculation */ |
102 | #ifdef CONFIG_HAS_DATAFLASH | 102 | #ifdef CONFIG_HAS_DATAFLASH |
103 | if (addr_dataflash(addr)){ | 103 | if (addr_dataflash(addr)){ |
104 | read_dataflash(addr, sizeof(image_header_t), (char *)&header); | 104 | read_dataflash(addr, sizeof(image_header_t), (char *)&header); |
105 | } else | 105 | } else |
106 | #endif | 106 | #endif |
107 | memcpy (&header, (char *)addr, sizeof(image_header_t)); | 107 | memcpy (&header, (char *)addr, sizeof(image_header_t)); |
108 | 108 | ||
109 | if (ntohl(hdr->ih_magic) != IH_MAGIC) { | 109 | if (ntohl(hdr->ih_magic) != IH_MAGIC) { |
110 | printf ("Bad Magic Number\n"); | 110 | printf ("Bad Magic Number\n"); |
111 | SHOW_BOOT_PROGRESS (-10); | 111 | SHOW_BOOT_PROGRESS (-10); |
112 | do_reset (cmdtp, flag, argc, argv); | 112 | do_reset (cmdtp, flag, argc, argv); |
113 | } | 113 | } |
114 | 114 | ||
115 | data = (ulong)&header; | 115 | data = (ulong)&header; |
116 | len = sizeof(image_header_t); | 116 | len = sizeof(image_header_t); |
117 | 117 | ||
118 | checksum = ntohl(hdr->ih_hcrc); | 118 | checksum = ntohl(hdr->ih_hcrc); |
119 | hdr->ih_hcrc = 0; | 119 | hdr->ih_hcrc = 0; |
120 | 120 | ||
121 | if (crc32 (0, (char *)data, len) != checksum) { | 121 | if (crc32 (0, (char *)data, len) != checksum) { |
122 | printf ("Bad Header Checksum\n"); | 122 | printf ("Bad Header Checksum\n"); |
123 | SHOW_BOOT_PROGRESS (-11); | 123 | SHOW_BOOT_PROGRESS (-11); |
124 | do_reset (cmdtp, flag, argc, argv); | 124 | do_reset (cmdtp, flag, argc, argv); |
125 | } | 125 | } |
126 | 126 | ||
127 | SHOW_BOOT_PROGRESS (10); | 127 | SHOW_BOOT_PROGRESS (10); |
128 | 128 | ||
129 | print_image_hdr (hdr); | 129 | print_image_hdr (hdr); |
130 | 130 | ||
131 | data = addr + sizeof(image_header_t); | 131 | data = addr + sizeof(image_header_t); |
132 | len = ntohl(hdr->ih_size); | 132 | len = ntohl(hdr->ih_size); |
133 | 133 | ||
134 | #ifdef CONFIG_HAS_DATAFLASH | 134 | #ifdef CONFIG_HAS_DATAFLASH |
135 | if (addr_dataflash(addr)){ | 135 | if (addr_dataflash(addr)){ |
136 | read_dataflash(data, len, (char *)CFG_LOAD_ADDR); | 136 | read_dataflash(data, len, (char *)CFG_LOAD_ADDR); |
137 | data = CFG_LOAD_ADDR; | 137 | data = CFG_LOAD_ADDR; |
138 | } | 138 | } |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | if (verify) { | 141 | if (verify) { |
142 | ulong csum = 0; | 142 | ulong csum = 0; |
143 | 143 | ||
144 | printf (" Verifying Checksum ... "); | 144 | printf (" Verifying Checksum ... "); |
145 | csum = crc32 (0, (char *)data, len); | 145 | csum = crc32 (0, (char *)data, len); |
146 | if (csum != ntohl(hdr->ih_dcrc)) { | 146 | if (csum != ntohl(hdr->ih_dcrc)) { |
147 | printf ("Bad Data CRC\n"); | 147 | printf ("Bad Data CRC\n"); |
148 | SHOW_BOOT_PROGRESS (-12); | 148 | SHOW_BOOT_PROGRESS (-12); |
149 | do_reset (cmdtp, flag, argc, argv); | 149 | do_reset (cmdtp, flag, argc, argv); |
150 | } | 150 | } |
151 | printf ("OK\n"); | 151 | printf ("OK\n"); |
152 | } | 152 | } |
153 | 153 | ||
154 | SHOW_BOOT_PROGRESS (11); | 154 | SHOW_BOOT_PROGRESS (11); |
155 | 155 | ||
156 | if ((hdr->ih_os != IH_OS_LINUX) || | 156 | if ((hdr->ih_os != IH_OS_LINUX) || |
157 | (hdr->ih_arch != IH_CPU_ARM) || | 157 | (hdr->ih_arch != IH_CPU_ARM) || |
158 | (hdr->ih_type != IH_TYPE_RAMDISK) ) { | 158 | (hdr->ih_type != IH_TYPE_RAMDISK) ) { |
159 | printf ("No Linux ARM Ramdisk Image\n"); | 159 | printf ("No Linux ARM Ramdisk Image\n"); |
160 | SHOW_BOOT_PROGRESS (-13); | 160 | SHOW_BOOT_PROGRESS (-13); |
161 | do_reset (cmdtp, flag, argc, argv); | 161 | do_reset (cmdtp, flag, argc, argv); |
162 | } | 162 | } |
163 | 163 | ||
164 | /* | 164 | /* |
165 | * Now check if we have a multifile image | 165 | * Now check if we have a multifile image |
166 | */ | 166 | */ |
167 | } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1])) { | 167 | } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1])) { |
168 | ulong tail = ntohl(len_ptr[0]) % 4; | 168 | ulong tail = ntohl(len_ptr[0]) % 4; |
169 | int i; | 169 | int i; |
170 | 170 | ||
171 | SHOW_BOOT_PROGRESS (13); | 171 | SHOW_BOOT_PROGRESS (13); |
172 | 172 | ||
173 | /* skip kernel length and terminator */ | 173 | /* skip kernel length and terminator */ |
174 | data = (ulong)(&len_ptr[2]); | 174 | data = (ulong)(&len_ptr[2]); |
175 | /* skip any additional image length fields */ | 175 | /* skip any additional image length fields */ |
176 | for (i=1; len_ptr[i]; ++i) | 176 | for (i=1; len_ptr[i]; ++i) |
177 | data += 4; | 177 | data += 4; |
178 | /* add kernel length, and align */ | 178 | /* add kernel length, and align */ |
179 | data += ntohl(len_ptr[0]); | 179 | data += ntohl(len_ptr[0]); |
180 | if (tail) { | 180 | if (tail) { |
181 | data += 4 - tail; | 181 | data += 4 - tail; |
182 | } | 182 | } |
183 | 183 | ||
184 | len = ntohl(len_ptr[1]); | 184 | len = ntohl(len_ptr[1]); |
185 | 185 | ||
186 | } else { | 186 | } else { |
187 | /* | 187 | /* |
188 | * no initrd image | 188 | * no initrd image |
189 | */ | 189 | */ |
190 | SHOW_BOOT_PROGRESS (14); | 190 | SHOW_BOOT_PROGRESS (14); |
191 | 191 | ||
192 | data = 0; | 192 | data = 0; |
193 | } | 193 | } |
194 | 194 | ||
195 | #ifdef DEBUG | 195 | #ifdef DEBUG |
196 | if (!data) { | 196 | if (!data) { |
197 | printf ("No initrd\n"); | 197 | printf ("No initrd\n"); |
198 | } | 198 | } |
199 | #endif | 199 | #endif |
200 | 200 | ||
201 | if (data) { | 201 | if (data) { |
202 | initrd_start = data; | 202 | initrd_start = data; |
203 | initrd_end = initrd_start + len; | 203 | initrd_end = initrd_start + len; |
204 | } else { | 204 | } else { |
205 | initrd_start = 0; | 205 | initrd_start = 0; |
206 | initrd_end = 0; | 206 | initrd_end = 0; |
207 | } | 207 | } |
208 | 208 | ||
209 | SHOW_BOOT_PROGRESS (15); | 209 | SHOW_BOOT_PROGRESS (15); |
210 | 210 | ||
211 | #ifdef DEBUG | 211 | #ifdef DEBUG |
212 | printf ("## Transferring control to Linux (at address %08lx) ...\n", | 212 | printf ("## Transferring control to Linux (at address %08lx) ...\n", |
213 | (ulong)theKernel); | 213 | (ulong)theKernel); |
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ | 216 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ |
217 | defined (CONFIG_CMDLINE_TAG) || \ | 217 | defined (CONFIG_CMDLINE_TAG) || \ |
218 | defined (CONFIG_INITRD_TAG) || \ | 218 | defined (CONFIG_INITRD_TAG) || \ |
219 | defined (CONFIG_VFD) | 219 | defined (CONFIG_VFD) |
220 | setup_start_tag(bd); | 220 | setup_start_tag(bd); |
221 | #ifdef CONFIG_SETUP_MEMORY_TAGS | 221 | #ifdef CONFIG_SETUP_MEMORY_TAGS |
222 | setup_memory_tags(bd); | 222 | setup_memory_tags(bd); |
223 | #endif | 223 | #endif |
224 | #ifdef CONFIG_CMDLINE_TAG | 224 | #ifdef CONFIG_CMDLINE_TAG |
225 | setup_commandline_tag(bd, commandline); | 225 | setup_commandline_tag(bd, commandline); |
226 | #endif | 226 | #endif |
227 | #ifdef CONFIG_INITRD_TAG | 227 | #ifdef CONFIG_INITRD_TAG |
228 | setup_initrd_tag(bd, initrd_start, initrd_end); | 228 | setup_initrd_tag(bd, initrd_start, initrd_end); |
229 | #endif | 229 | #endif |
230 | #if 0 | 230 | #if 0 |
231 | setup_ramdisk_tag(bd); | 231 | setup_ramdisk_tag(bd); |
232 | #endif | 232 | #endif |
233 | #if defined (CONFIG_VFD) | 233 | #if defined (CONFIG_VFD) |
234 | setup_videolfb_tag(gd); | 234 | setup_videolfb_tag((gd_t *)gd); |
235 | #endif | 235 | #endif |
236 | setup_end_tag(bd); | 236 | setup_end_tag(bd); |
237 | #endif | 237 | #endif |
238 | 238 | ||
239 | /* we assume that the kernel is in place */ | 239 | /* we assume that the kernel is in place */ |
240 | printf("\nStarting kernel ...\n\n"); | 240 | printf("\nStarting kernel ...\n\n"); |
241 | 241 | ||
242 | cleanup_before_linux(); | 242 | cleanup_before_linux(); |
243 | 243 | ||
244 | theKernel(0, bd->bi_arch_number); | 244 | theKernel(0, bd->bi_arch_number); |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ | 248 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ |
249 | defined (CONFIG_CMDLINE_TAG) || \ | 249 | defined (CONFIG_CMDLINE_TAG) || \ |
250 | defined (CONFIG_INITRD_TAG) || \ | 250 | defined (CONFIG_INITRD_TAG) || \ |
251 | defined (CONFIG_VFD) | 251 | defined (CONFIG_VFD) |
252 | static void setup_start_tag(bd_t *bd) | 252 | static void setup_start_tag(bd_t *bd) |
253 | { | 253 | { |
254 | params = (struct tag *)bd->bi_boot_params; | 254 | params = (struct tag *)bd->bi_boot_params; |
255 | 255 | ||
256 | params->hdr.tag = ATAG_CORE; | 256 | params->hdr.tag = ATAG_CORE; |
257 | params->hdr.size = tag_size(tag_core); | 257 | params->hdr.size = tag_size(tag_core); |
258 | 258 | ||
259 | params->u.core.flags = 0; | 259 | params->u.core.flags = 0; |
260 | params->u.core.pagesize = 0; | 260 | params->u.core.pagesize = 0; |
261 | params->u.core.rootdev = 0; | 261 | params->u.core.rootdev = 0; |
262 | 262 | ||
263 | params = tag_next(params); | 263 | params = tag_next(params); |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | #ifdef CONFIG_SETUP_MEMORY_TAGS | 267 | #ifdef CONFIG_SETUP_MEMORY_TAGS |
268 | static void setup_memory_tags(bd_t *bd) | 268 | static void setup_memory_tags(bd_t *bd) |
269 | { | 269 | { |
270 | int i; | 270 | int i; |
271 | 271 | ||
272 | for(i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { | 272 | for(i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
273 | params->hdr.tag = ATAG_MEM; | 273 | params->hdr.tag = ATAG_MEM; |
274 | params->hdr.size = tag_size(tag_mem32); | 274 | params->hdr.size = tag_size(tag_mem32); |
275 | 275 | ||
276 | params->u.mem.start = bd->bi_dram[i].start; | 276 | params->u.mem.start = bd->bi_dram[i].start; |
277 | params->u.mem.size = bd->bi_dram[i].size; | 277 | params->u.mem.size = bd->bi_dram[i].size; |
278 | 278 | ||
279 | params = tag_next(params); | 279 | params = tag_next(params); |
280 | } | 280 | } |
281 | } | 281 | } |
282 | #endif /* CONFIG_SETUP_MEMORY_TAGS */ | 282 | #endif /* CONFIG_SETUP_MEMORY_TAGS */ |
283 | 283 | ||
284 | 284 | ||
285 | static void setup_commandline_tag(bd_t *bd, char *commandline) | 285 | static void setup_commandline_tag(bd_t *bd, char *commandline) |
286 | { | 286 | { |
287 | char *p; | 287 | char *p; |
288 | 288 | ||
289 | /* eat leading white space */ | 289 | /* eat leading white space */ |
290 | for(p = commandline; *p == ' '; p++) | 290 | for(p = commandline; *p == ' '; p++) |
291 | ; | 291 | ; |
292 | 292 | ||
293 | /* skip non-existent command lines so the kernel will still | 293 | /* skip non-existent command lines so the kernel will still |
294 | * use its default command line. | 294 | * use its default command line. |
295 | */ | 295 | */ |
296 | if(*p == '\0') | 296 | if(*p == '\0') |
297 | return; | 297 | return; |
298 | 298 | ||
299 | params->hdr.tag = ATAG_CMDLINE; | 299 | params->hdr.tag = ATAG_CMDLINE; |
300 | params->hdr.size = (sizeof(struct tag_header) + strlen(p) + 1 + 4) >> 2; | 300 | params->hdr.size = (sizeof(struct tag_header) + strlen(p) + 1 + 4) >> 2; |
301 | 301 | ||
302 | strcpy(params->u.cmdline.cmdline, p); | 302 | strcpy(params->u.cmdline.cmdline, p); |
303 | 303 | ||
304 | params = tag_next(params); | 304 | params = tag_next(params); |
305 | } | 305 | } |
306 | 306 | ||
307 | 307 | ||
308 | #ifndef ATAG_INITRD2 | 308 | #ifndef ATAG_INITRD2 |
309 | #define ATAG_INITRD2 0x54420005 | 309 | #define ATAG_INITRD2 0x54420005 |
310 | #endif | 310 | #endif |
311 | 311 | ||
312 | #ifdef CONFIG_INITRD_TAG | 312 | #ifdef CONFIG_INITRD_TAG |
313 | static void setup_initrd_tag(bd_t *bd, ulong initrd_start, ulong initrd_end) | 313 | static void setup_initrd_tag(bd_t *bd, ulong initrd_start, ulong initrd_end) |
314 | { | 314 | { |
315 | /* an ATAG_INITRD node tells the kernel where the compressed | 315 | /* an ATAG_INITRD node tells the kernel where the compressed |
316 | * ramdisk can be found. ATAG_RDIMG is a better name, actually. | 316 | * ramdisk can be found. ATAG_RDIMG is a better name, actually. |
317 | */ | 317 | */ |
318 | params->hdr.tag = ATAG_INITRD2; | 318 | params->hdr.tag = ATAG_INITRD2; |
319 | params->hdr.size = tag_size(tag_initrd); | 319 | params->hdr.size = tag_size(tag_initrd); |
320 | 320 | ||
321 | params->u.initrd.start = initrd_start; | 321 | params->u.initrd.start = initrd_start; |
322 | params->u.initrd.size = initrd_end - initrd_start; | 322 | params->u.initrd.size = initrd_end - initrd_start; |
323 | 323 | ||
324 | params = tag_next(params); | 324 | params = tag_next(params); |
325 | } | 325 | } |
326 | #endif /* CONFIG_INITRD_TAG */ | 326 | #endif /* CONFIG_INITRD_TAG */ |
327 | 327 | ||
328 | 328 | ||
329 | #if 0 | 329 | #if 0 |
330 | static void setup_ramdisk_tag(bd_t *bd) | 330 | static void setup_ramdisk_tag(bd_t *bd) |
331 | { | 331 | { |
332 | /* an ATAG_RAMDISK node tells the kernel how large the | 332 | /* an ATAG_RAMDISK node tells the kernel how large the |
333 | * decompressed ramdisk will become. | 333 | * decompressed ramdisk will become. |
334 | */ | 334 | */ |
335 | params->hdr.tag = ATAG_RAMDISK; | 335 | params->hdr.tag = ATAG_RAMDISK; |
336 | params->hdr.size = tag_size(tag_ramdisk); | 336 | params->hdr.size = tag_size(tag_ramdisk); |
337 | 337 | ||
338 | params->u.ramdisk.start = 0; | 338 | params->u.ramdisk.start = 0; |
339 | /*params->u.ramdisk.size = RAMDISK_SIZE; */ | 339 | /*params->u.ramdisk.size = RAMDISK_SIZE; */ |
340 | params->u.ramdisk.flags = 1; /* automatically load ramdisk */ | 340 | params->u.ramdisk.flags = 1; /* automatically load ramdisk */ |
341 | 341 | ||
342 | params = tag_next(params); | 342 | params = tag_next(params); |
343 | } | 343 | } |
344 | #endif /* 0 */ | 344 | #endif /* 0 */ |
345 | 345 | ||
346 | #if defined (CONFIG_VFD) | 346 | #if defined (CONFIG_VFD) |
347 | static void setup_videolfb_tag(gd_t *gd) | 347 | static void setup_videolfb_tag(gd_t *gd) |
348 | { | 348 | { |
349 | /* An ATAG_VIDEOLFB node tells the kernel where and how large | 349 | /* An ATAG_VIDEOLFB node tells the kernel where and how large |
350 | * the framebuffer for video was allocated (among other things). | 350 | * the framebuffer for video was allocated (among other things). |
351 | * Note that a _physical_ address is passed ! | 351 | * Note that a _physical_ address is passed ! |
352 | * | 352 | * |
353 | * We only use it to pass the address and size, the other entries | 353 | * We only use it to pass the address and size, the other entries |
354 | * in the tag_videolfb are not of interest. | 354 | * in the tag_videolfb are not of interest. |
355 | */ | 355 | */ |
356 | params->hdr.tag = ATAG_VIDEOLFB; | 356 | params->hdr.tag = ATAG_VIDEOLFB; |
357 | params->hdr.size = tag_size(tag_videolfb); | 357 | params->hdr.size = tag_size(tag_videolfb); |
358 | 358 | ||
359 | params->u.videolfb.lfb_base = (u32)gd->fb_base; | 359 | params->u.videolfb.lfb_base = (u32)gd->fb_base; |
360 | /* 7168 = 256*4*56/8 - actually 2 pages (8192 bytes) are allocated */ | 360 | /* 7168 = 256*4*56/8 - actually 2 pages (8192 bytes) are allocated */ |
361 | params->u.videolfb.lfb_size = 7168; | 361 | params->u.videolfb.lfb_size = 7168; |
362 | 362 | ||
363 | params = tag_next(params); | 363 | params = tag_next(params); |
364 | } | 364 | } |
365 | #endif | 365 | #endif |
366 | 366 | ||
367 | static void setup_end_tag(bd_t *bd) | 367 | static void setup_end_tag(bd_t *bd) |
368 | { | 368 | { |
369 | params->hdr.tag = ATAG_NONE; | 369 | params->hdr.tag = ATAG_NONE; |
370 | params->hdr.size = 0; | 370 | params->hdr.size = 0; |
371 | } | 371 | } |
372 | 372 | ||
373 | #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */ | 373 | #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */ |
374 | 374 |
lib_generic/crc32.c
1 | /* | 1 | /* |
2 | * This file is derived from crc32.c from the zlib-1.1.3 distribution | 2 | * This file is derived from crc32.c from the zlib-1.1.3 distribution |
3 | * by Jean-loup Gailly and Mark Adler. | 3 | * by Jean-loup Gailly and Mark Adler. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | /* crc32.c -- compute the CRC-32 of a data stream | 6 | /* crc32.c -- compute the CRC-32 of a data stream |
7 | * Copyright (C) 1995-1998 Mark Adler | 7 | * Copyright (C) 1995-1998 Mark Adler |
8 | * For conditions of distribution and use, see copyright notice in zlib.h | 8 | * For conditions of distribution and use, see copyright notice in zlib.h |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef USE_HOSTCC /* Shut down "ANSI does not permit..." warnings */ | 11 | #ifndef USE_HOSTCC /* Shut down "ANSI does not permit..." warnings */ |
12 | #include <common.h> /* to get command definitions like CFG_CMD_JFFS2 */ | 12 | #include <common.h> /* to get command definitions like CFG_CMD_JFFS2 */ |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include "zlib.h" | 15 | #include "zlib.h" |
16 | 16 | ||
17 | #define local static | 17 | #define local static |
18 | #define ZEXPORT /* empty */ | 18 | #define ZEXPORT /* empty */ |
19 | unsigned long crc32 (unsigned long, const unsigned char *, unsigned int); | 19 | unsigned long crc32 (unsigned long, const unsigned char *, unsigned int); |
20 | 20 | ||
21 | #ifdef DYNAMIC_CRC_TABLE | 21 | #ifdef DYNAMIC_CRC_TABLE |
22 | 22 | ||
23 | local int crc_table_empty = 1; | 23 | local int crc_table_empty = 1; |
24 | local uLongf crc_table[256]; | 24 | local uLongf crc_table[256]; |
25 | local void make_crc_table OF((void)); | 25 | local void make_crc_table OF((void)); |
26 | 26 | ||
27 | /* | 27 | /* |
28 | Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: | 28 | Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: |
29 | x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. | 29 | x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. |
30 | 30 | ||
31 | Polynomials over GF(2) are represented in binary, one bit per coefficient, | 31 | Polynomials over GF(2) are represented in binary, one bit per coefficient, |
32 | with the lowest powers in the most significant bit. Then adding polynomials | 32 | with the lowest powers in the most significant bit. Then adding polynomials |
33 | is just exclusive-or, and multiplying a polynomial by x is a right shift by | 33 | is just exclusive-or, and multiplying a polynomial by x is a right shift by |
34 | one. If we call the above polynomial p, and represent a byte as the | 34 | one. If we call the above polynomial p, and represent a byte as the |
35 | polynomial q, also with the lowest power in the most significant bit (so the | 35 | polynomial q, also with the lowest power in the most significant bit (so the |
36 | byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, | 36 | byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, |
37 | where a mod b means the remainder after dividing a by b. | 37 | where a mod b means the remainder after dividing a by b. |
38 | 38 | ||
39 | This calculation is done using the shift-register method of multiplying and | 39 | This calculation is done using the shift-register method of multiplying and |
40 | taking the remainder. The register is initialized to zero, and for each | 40 | taking the remainder. The register is initialized to zero, and for each |
41 | incoming bit, x^32 is added mod p to the register if the bit is a one (where | 41 | incoming bit, x^32 is added mod p to the register if the bit is a one (where |
42 | x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by | 42 | x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by |
43 | x (which is shifting right by one and adding x^32 mod p if the bit shifted | 43 | x (which is shifting right by one and adding x^32 mod p if the bit shifted |
44 | out is a one). We start with the highest power (least significant bit) of | 44 | out is a one). We start with the highest power (least significant bit) of |
45 | q and repeat for all eight bits of q. | 45 | q and repeat for all eight bits of q. |
46 | 46 | ||
47 | The table is simply the CRC of all possible eight bit values. This is all | 47 | The table is simply the CRC of all possible eight bit values. This is all |
48 | the information needed to generate CRC's on data a byte at a time for all | 48 | the information needed to generate CRC's on data a byte at a time for all |
49 | combinations of CRC register values and incoming bytes. | 49 | combinations of CRC register values and incoming bytes. |
50 | */ | 50 | */ |
51 | local void make_crc_table() | 51 | local void make_crc_table() |
52 | { | 52 | { |
53 | uLong c; | 53 | uLong c; |
54 | int n, k; | 54 | int n, k; |
55 | uLong poly; /* polynomial exclusive-or pattern */ | 55 | uLong poly; /* polynomial exclusive-or pattern */ |
56 | /* terms of polynomial defining this crc (except x^32): */ | 56 | /* terms of polynomial defining this crc (except x^32): */ |
57 | static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; | 57 | static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; |
58 | 58 | ||
59 | /* make exclusive-or pattern from polynomial (0xedb88320L) */ | 59 | /* make exclusive-or pattern from polynomial (0xedb88320L) */ |
60 | poly = 0L; | 60 | poly = 0L; |
61 | for (n = 0; n < sizeof(p)/sizeof(Byte); n++) | 61 | for (n = 0; n < sizeof(p)/sizeof(Byte); n++) |
62 | poly |= 1L << (31 - p[n]); | 62 | poly |= 1L << (31 - p[n]); |
63 | 63 | ||
64 | for (n = 0; n < 256; n++) | 64 | for (n = 0; n < 256; n++) |
65 | { | 65 | { |
66 | c = (uLong)n; | 66 | c = (uLong)n; |
67 | for (k = 0; k < 8; k++) | 67 | for (k = 0; k < 8; k++) |
68 | c = c & 1 ? poly ^ (c >> 1) : c >> 1; | 68 | c = c & 1 ? poly ^ (c >> 1) : c >> 1; |
69 | crc_table[n] = c; | 69 | crc_table[n] = c; |
70 | } | 70 | } |
71 | crc_table_empty = 0; | 71 | crc_table_empty = 0; |
72 | } | 72 | } |
73 | #else | 73 | #else |
74 | /* ======================================================================== | 74 | /* ======================================================================== |
75 | * Table of CRC-32's of all single-byte values (made by make_crc_table) | 75 | * Table of CRC-32's of all single-byte values (made by make_crc_table) |
76 | */ | 76 | */ |
77 | local const uLongf crc_table[256] = { | 77 | local const uLongf crc_table[256] = { |
78 | 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, | 78 | 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, |
79 | 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, | 79 | 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, |
80 | 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, | 80 | 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, |
81 | 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, | 81 | 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, |
82 | 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, | 82 | 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, |
83 | 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, | 83 | 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, |
84 | 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, | 84 | 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, |
85 | 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, | 85 | 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, |
86 | 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, | 86 | 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, |
87 | 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, | 87 | 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, |
88 | 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, | 88 | 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, |
89 | 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, | 89 | 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, |
90 | 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, | 90 | 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, |
91 | 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, | 91 | 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, |
92 | 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, | 92 | 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, |
93 | 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, | 93 | 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, |
94 | 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, | 94 | 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, |
95 | 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, | 95 | 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, |
96 | 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, | 96 | 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, |
97 | 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, | 97 | 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, |
98 | 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, | 98 | 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, |
99 | 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, | 99 | 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, |
100 | 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, | 100 | 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, |
101 | 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, | 101 | 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, |
102 | 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, | 102 | 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, |
103 | 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, | 103 | 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, |
104 | 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, | 104 | 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, |
105 | 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, | 105 | 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, |
106 | 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, | 106 | 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, |
107 | 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, | 107 | 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, |
108 | 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, | 108 | 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, |
109 | 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, | 109 | 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, |
110 | 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, | 110 | 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, |
111 | 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, | 111 | 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, |
112 | 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, | 112 | 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, |
113 | 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, | 113 | 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, |
114 | 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, | 114 | 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, |
115 | 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, | 115 | 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, |
116 | 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, | 116 | 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, |
117 | 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, | 117 | 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, |
118 | 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, | 118 | 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, |
119 | 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, | 119 | 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, |
120 | 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, | 120 | 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, |
121 | 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, | 121 | 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, |
122 | 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, | 122 | 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, |
123 | 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, | 123 | 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, |
124 | 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, | 124 | 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, |
125 | 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, | 125 | 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, |
126 | 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, | 126 | 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, |
127 | 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, | 127 | 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, |
128 | 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, | 128 | 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, |
129 | 0x2d02ef8dL | 129 | 0x2d02ef8dL |
130 | }; | 130 | }; |
131 | #endif | 131 | #endif |
132 | 132 | ||
133 | #if 0 | 133 | #if 0 |
134 | /* ========================================================================= | 134 | /* ========================================================================= |
135 | * This function can be used by asm versions of crc32() | 135 | * This function can be used by asm versions of crc32() |
136 | */ | 136 | */ |
137 | const uLongf * ZEXPORT get_crc_table() | 137 | const uLongf * ZEXPORT get_crc_table() |
138 | { | 138 | { |
139 | #ifdef DYNAMIC_CRC_TABLE | 139 | #ifdef DYNAMIC_CRC_TABLE |
140 | if (crc_table_empty) make_crc_table(); | 140 | if (crc_table_empty) make_crc_table(); |
141 | #endif | 141 | #endif |
142 | return (const uLongf *)crc_table; | 142 | return (const uLongf *)crc_table; |
143 | } | 143 | } |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | /* ========================================================================= */ | 146 | /* ========================================================================= */ |
147 | #define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); | 147 | #define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); |
148 | #define DO2(buf) DO1(buf); DO1(buf); | 148 | #define DO2(buf) DO1(buf); DO1(buf); |
149 | #define DO4(buf) DO2(buf); DO2(buf); | 149 | #define DO4(buf) DO2(buf); DO2(buf); |
150 | #define DO8(buf) DO4(buf); DO4(buf); | 150 | #define DO8(buf) DO4(buf); DO4(buf); |
151 | 151 | ||
152 | /* ========================================================================= */ | 152 | /* ========================================================================= */ |
153 | uLong ZEXPORT crc32(crc, buf, len) | 153 | uLong ZEXPORT crc32(crc, buf, len) |
154 | uLong crc; | 154 | uLong crc; |
155 | const Bytef *buf; | 155 | const Bytef *buf; |
156 | uInt len; | 156 | uInt len; |
157 | { | 157 | { |
158 | if (buf == Z_NULL) return 0L; | ||
159 | #ifdef DYNAMIC_CRC_TABLE | 158 | #ifdef DYNAMIC_CRC_TABLE |
160 | if (crc_table_empty) | 159 | if (crc_table_empty) |
161 | make_crc_table(); | 160 | make_crc_table(); |
162 | #endif | 161 | #endif |
163 | crc = crc ^ 0xffffffffL; | 162 | crc = crc ^ 0xffffffffL; |
164 | while (len >= 8) | 163 | while (len >= 8) |
165 | { | 164 | { |
166 | DO8(buf); | 165 | DO8(buf); |
167 | len -= 8; | 166 | len -= 8; |
168 | } | 167 | } |
169 | if (len) do { | 168 | if (len) do { |
170 | DO1(buf); | 169 | DO1(buf); |
171 | } while (--len); | 170 | } while (--len); |
172 | return crc ^ 0xffffffffL; | 171 | return crc ^ 0xffffffffL; |
173 | } | 172 | } |
174 | 173 | ||
175 | #if (CONFIG_COMMANDS & CFG_CMD_JFFS2) | 174 | #if (CONFIG_COMMANDS & CFG_CMD_JFFS2) |
176 | 175 | ||
177 | /* No ones complement version. JFFS2 (and other things ?) | 176 | /* No ones complement version. JFFS2 (and other things ?) |
178 | * don't use ones compliment in their CRC calculations. | 177 | * don't use ones compliment in their CRC calculations. |
179 | */ | 178 | */ |
180 | uLong ZEXPORT crc32_no_comp(uLong crc, const Bytef *buf, uInt len) | 179 | uLong ZEXPORT crc32_no_comp(uLong crc, const Bytef *buf, uInt len) |
181 | { | 180 | { |
182 | if (buf == Z_NULL) return 0L; | 181 | if (buf == Z_NULL) return 0L; |
183 | #ifdef DYNAMIC_CRC_TABLE | 182 | #ifdef DYNAMIC_CRC_TABLE |
184 | if (crc_table_empty) | 183 | if (crc_table_empty) |
185 | make_crc_table(); | 184 | make_crc_table(); |
186 | #endif | 185 | #endif |
187 | while (len >= 8) | 186 | while (len >= 8) |
188 | { | 187 | { |
189 | DO8(buf); | 188 | DO8(buf); |
190 | len -= 8; | 189 | len -= 8; |
191 | } | 190 | } |
192 | if (len) do { | 191 | if (len) do { |
193 | DO1(buf); | 192 | DO1(buf); |
194 | } while (--len); | 193 | } while (--len); |
195 | 194 | ||
196 | return crc; | 195 | return crc; |
197 | } | 196 | } |
198 | 197 | ||
199 | #endif /* CFG_CMD_JFFS2 */ | 198 | #endif /* CFG_CMD_JFFS2 */ |
200 | 199 |