Commit 06d01dbe000057e5df4af0f113242f0eba716340
1 parent
09127c6096
Exists in
master
and in
54 other branches
* Avoid flicker on the TRAB's VFD by synchronizing the enable with
the HSYNC/VSYNC. Requires new CPLD code (Version 101 for Rev. 100 boards, version 153 for Rev. 200 boards). * Patch by Vladimir Gurevich, 12 Mar 2003: Fix relocation problem of statically initialized string pointers in common/cmd_pci.c * Patch by Kai-Uwe Blöm, 12 Mar 2003: Cleanup & bug fixes for JFFS2 code: - the memory mangement was broken. It caused havoc on malloc by writing beyond the block boundaries. - the length calculation for files was wrong, sometimes resulting in short file reads. - data copying now optionally takes fragment version numbers into account, to avoid copying from older data. See doc/README.JFFS2 for details.
Showing 22 changed files with 842 additions and 614 deletions Side-by-side Diff
- CHANGELOG
- board/csb226/csb226.c
- board/emk/top860/config.mk
- board/innokom/innokom.c
- board/lubbock/flash.c
- board/mpl/common/common_util.c
- board/mpl/vcma9/cmd_vcma9.c
- board/mpl/vcma9/vcma9.c
- board/trab/vfd.c
- common/cmd_pci.c
- cpu/arm920t/interrupts.c
- cpu/arm920t/start.S
- doc/README.JFFS2
- drivers/cs8900.c
- drivers/cs8900.h
- drivers/s3c24x0_i2c.c
- fs/jffs2/jffs2_1pass.c
- fs/jffs2/jffs2_private.h
- include/asm-arm/global_data.h
- include/asm-arm/io.h
- include/configs/innokom.h
- include/i2c.h
CHANGELOG
... | ... | @@ -2,6 +2,24 @@ |
2 | 2 | Changes since U-Boot 0.2.2: |
3 | 3 | ====================================================================== |
4 | 4 | |
5 | +* Avoid flicker on the TRAB's VFD by synchronizing the enable with | |
6 | + the HSYNC/VSYNC. Requires new CPLD code (Version 101 for Rev. 100 | |
7 | + boards, version 153 for Rev. 200 boards). | |
8 | + | |
9 | +* Patch by Vladimir Gurevich, 12 Mar 2003: | |
10 | + Fix relocation problem of statically initialized string pointers | |
11 | + in common/cmd_pci.c | |
12 | + | |
13 | +* Patch by Kai-Uwe Blöm, 12 Mar 2003: | |
14 | + Cleanup & bug fixes for JFFS2 code: | |
15 | + - the memory mangement was broken. It caused havoc on malloc by | |
16 | + writing beyond the block boundaries. | |
17 | + - the length calculation for files was wrong, sometimes resulting | |
18 | + in short file reads. | |
19 | + - data copying now optionally takes fragment version numbers into | |
20 | + account, to avoid copying from older data. | |
21 | + See doc/README.JFFS2 for details. | |
22 | + | |
5 | 23 | * Patch by Josef Wagner, 12 Mar 2003: |
6 | 24 | - 16/32 MB and 50/80 MHz support with auto-detection for IP860 |
7 | 25 | - ETH05 and BEDBUG support for CU824 |
board/csb226/csb226.c
... | ... | @@ -38,10 +38,10 @@ |
38 | 38 | |
39 | 39 | int misc_init_r(void) |
40 | 40 | { |
41 | +#if 0 | |
41 | 42 | uchar *str; |
42 | 43 | |
43 | 44 | /* determine if the software update key is pressed during startup */ |
44 | -#if 0 | |
45 | 45 | /* not ported yet... */ |
46 | 46 | if (GPLR0 & 0x00000800) { |
47 | 47 | printf("using bootcmd_normal (sw-update button not pressed)\n"); |
board/emk/top860/config.mk
board/innokom/innokom.c
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | * The Innokom board has GPIO70 connected to SCLK which can be toggled |
40 | 40 | * until all chips think that their current cycles are finished. |
41 | 41 | */ |
42 | -int i2c_init_board(void) | |
42 | +void i2c_init_board(void) | |
43 | 43 | { |
44 | 44 | int i; |
45 | 45 | |
... | ... | @@ -53,8 +53,6 @@ |
53 | 53 | } |
54 | 54 | /* set gpio pin to input */ |
55 | 55 | GPDR(70) &= ~GPIO_bit(70); |
56 | - | |
57 | - return 0; | |
58 | 56 | } |
59 | 57 | |
60 | 58 |
board/lubbock/flash.c
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | #include <linux/byteorder/swab.h> |
29 | 29 | |
30 | 30 | |
31 | -flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ | |
31 | +flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ | |
32 | 32 | |
33 | 33 | /* Board support for 1 or 2 flash devices */ |
34 | 34 | #define FLASH_PORT_WIDTH32 |
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | 39 | |
... | ... | @@ -53,50 +53,47 @@ |
53 | 53 | * Functions |
54 | 54 | */ |
55 | 55 | static ulong flash_get_size (FPW *addr, flash_info_t *info); |
56 | -static int write_data (flash_info_t *info, ulong dest, FPW data); | |
57 | -static void flash_get_offsets (ulong base, flash_info_t *info); | |
58 | -void inline spin_wheel(void); | |
56 | +static int write_data (flash_info_t *info, ulong dest, FPW data); | |
57 | +static void flash_get_offsets (ulong base, flash_info_t *info); | |
58 | +void inline spin_wheel (void); | |
59 | 59 | |
60 | 60 | /*----------------------------------------------------------------------- |
61 | 61 | */ |
62 | 62 | |
63 | 63 | unsigned long flash_init (void) |
64 | 64 | { |
65 | - int i; | |
66 | - ulong size = 0; | |
65 | + int i; | |
66 | + ulong size = 0; | |
67 | 67 | |
68 | - for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) | |
69 | - { | |
70 | - switch (i) | |
71 | - { | |
72 | - case 0: | |
73 | - flash_get_size((FPW *)PHYS_FLASH_1, &flash_info[i]); | |
74 | - flash_get_offsets(PHYS_FLASH_1, &flash_info[i]); | |
75 | - break; | |
76 | - case 1: | |
77 | - flash_get_size((FPW *)PHYS_FLASH_2, &flash_info[i]); | |
78 | - flash_get_offsets(PHYS_FLASH_2, &flash_info[i]); | |
79 | - break; | |
80 | - default: | |
81 | - panic("configured to many flash banks!\n"); | |
82 | - break; | |
83 | - } | |
84 | - size += flash_info[i].size; | |
85 | - } | |
68 | + for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) { | |
69 | + switch (i) { | |
70 | + case 0: | |
71 | + flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]); | |
72 | + flash_get_offsets (PHYS_FLASH_1, &flash_info[i]); | |
73 | + break; | |
74 | + case 1: | |
75 | + flash_get_size ((FPW *) PHYS_FLASH_2, &flash_info[i]); | |
76 | + flash_get_offsets (PHYS_FLASH_2, &flash_info[i]); | |
77 | + break; | |
78 | + default: | |
79 | + panic ("configured to many flash banks!\n"); | |
80 | + break; | |
81 | + } | |
82 | + size += flash_info[i].size; | |
83 | + } | |
86 | 84 | |
87 | - /* Protect monitor and environment sectors | |
88 | - */ | |
89 | - flash_protect(FLAG_PROTECT_SET, | |
90 | - CFG_FLASH_BASE, | |
91 | - CFG_FLASH_BASE + _armboot_end_data - _armboot_start, | |
92 | - &flash_info[0]); | |
85 | + /* Protect monitor and environment sectors | |
86 | + */ | |
87 | + flash_protect ( FLAG_PROTECT_SET, | |
88 | + CFG_FLASH_BASE, | |
89 | + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, | |
90 | + &flash_info[0] ); | |
93 | 91 | |
94 | - flash_protect(FLAG_PROTECT_SET, | |
95 | - CFG_ENV_ADDR, | |
96 | - CFG_ENV_ADDR + CFG_ENV_SIZE - 1, | |
97 | - &flash_info[0]); | |
92 | + flash_protect ( FLAG_PROTECT_SET, | |
93 | + CFG_ENV_ADDR, | |
94 | + CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0] ); | |
98 | 95 | |
99 | - return size; | |
96 | + return size; | |
100 | 97 | } |
101 | 98 | |
102 | 99 | /*----------------------------------------------------------------------- |
103 | 100 | |
104 | 101 | |
105 | 102 | |
106 | 103 | |
107 | 104 | |
108 | 105 | |
... | ... | @@ -119,39 +116,45 @@ |
119 | 116 | |
120 | 117 | /*----------------------------------------------------------------------- |
121 | 118 | */ |
122 | -void flash_print_info (flash_info_t *info) | |
119 | +void flash_print_info (flash_info_t *info) | |
123 | 120 | { |
124 | 121 | int i; |
125 | 122 | |
126 | 123 | if (info->flash_id == FLASH_UNKNOWN) { |
127 | 124 | printf ("missing or unknown FLASH type\n"); |
128 | 125 | return; |
129 | - } | |
126 | + } | |
130 | 127 | |
131 | 128 | switch (info->flash_id & FLASH_VENDMASK) { |
132 | - case FLASH_MAN_INTEL: printf ("INTEL "); break; | |
133 | - default: printf ("Unknown Vendor "); break; | |
129 | + case FLASH_MAN_INTEL: | |
130 | + printf ("INTEL "); | |
131 | + break; | |
132 | + default: | |
133 | + printf ("Unknown Vendor "); | |
134 | + break; | |
134 | 135 | } |
135 | 136 | |
136 | 137 | switch (info->flash_id & FLASH_TYPEMASK) { |
137 | - case FLASH_28F128J3A: | |
138 | - printf ("28F128J3A\n"); break; | |
139 | - default: printf ("Unknown Chip Type\n"); break; | |
140 | - } | |
138 | + case FLASH_28F128J3A: | |
139 | + printf ("28F128J3A\n"); | |
140 | + break; | |
141 | + default: | |
142 | + printf ("Unknown Chip Type\n"); | |
143 | + break; | |
144 | + } | |
141 | 145 | |
142 | 146 | printf (" Size: %ld MB in %d Sectors\n", |
143 | - info->size >> 20, info->sector_count); | |
147 | + info->size >> 20, info->sector_count); | |
144 | 148 | |
145 | 149 | printf (" Sector Start Addresses:"); |
146 | - for (i=0; i<info->sector_count; ++i) { | |
147 | - if ((i % 5) == 0) | |
148 | - printf ("\n "); | |
150 | + for (i = 0; i < info->sector_count; ++i) { | |
151 | + if ((i % 5) == 0) | |
152 | + printf ("\n "); | |
149 | 153 | printf (" %08lX%s", |
150 | 154 | info->start[i], |
151 | - info->protect[i] ? " (RO)" : " " | |
152 | - ); | |
153 | - } | |
154 | - printf ("\n"); | |
155 | + info->protect[i] ? " (RO)" : " "); | |
156 | + } | |
157 | + printf ("\n"); | |
155 | 158 | return; |
156 | 159 | } |
157 | 160 | |
158 | 161 | |
159 | 162 | |
160 | 163 | |
161 | 164 | |
162 | 165 | |
163 | 166 | |
164 | 167 | |
... | ... | @@ -163,37 +166,37 @@ |
163 | 166 | volatile FPW value; |
164 | 167 | |
165 | 168 | /* Write auto select command: read Manufacturer ID */ |
166 | - addr[0x5555] = (FPW)0x00AA00AA; | |
167 | - addr[0x2AAA] = (FPW)0x00550055; | |
168 | - addr[0x5555] = (FPW)0x00900090; | |
169 | + addr[0x5555] = (FPW) 0x00AA00AA; | |
170 | + addr[0x2AAA] = (FPW) 0x00550055; | |
171 | + addr[0x5555] = (FPW) 0x00900090; | |
169 | 172 | |
170 | - mb(); | |
173 | + mb (); | |
171 | 174 | value = addr[0]; |
172 | 175 | |
173 | - switch (value) { | |
176 | + switch (value) { | |
174 | 177 | |
175 | - case (FPW)INTEL_MANUFACT: | |
176 | - info->flash_id = FLASH_MAN_INTEL; | |
177 | - break; | |
178 | + case (FPW) INTEL_MANUFACT: | |
179 | + info->flash_id = FLASH_MAN_INTEL; | |
180 | + break; | |
178 | 181 | |
179 | 182 | default: |
180 | 183 | info->flash_id = FLASH_UNKNOWN; |
181 | 184 | info->sector_count = 0; |
182 | 185 | info->size = 0; |
183 | - addr[0] = (FPW)0x00FF00FF; /* restore read mode */ | |
184 | - return (0); /* no or unknown flash */ | |
186 | + addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ | |
187 | + return (0); /* no or unknown flash */ | |
185 | 188 | } |
186 | 189 | |
187 | - mb(); | |
188 | - value = addr[1]; /* device ID */ | |
190 | + mb (); | |
191 | + value = addr[1]; /* device ID */ | |
189 | 192 | |
190 | - switch (value) { | |
193 | + switch (value) { | |
191 | 194 | |
192 | - case (FPW)INTEL_ID_28F128J3A: | |
193 | - info->flash_id += FLASH_28F128J3A; | |
194 | - info->sector_count = 128; | |
195 | - info->size = 0x02000000; | |
196 | - break; /* => 16 MB */ | |
195 | + case (FPW) INTEL_ID_28F128J3A: | |
196 | + info->flash_id += FLASH_28F128J3A; | |
197 | + info->sector_count = 128; | |
198 | + info->size = 0x02000000; | |
199 | + break; /* => 16 MB */ | |
197 | 200 | |
198 | 201 | default: |
199 | 202 | info->flash_id = FLASH_UNKNOWN; |
200 | 203 | |
... | ... | @@ -204,9 +207,9 @@ |
204 | 207 | printf ("** ERROR: sector count %d > max (%d) **\n", |
205 | 208 | info->sector_count, CFG_MAX_FLASH_SECT); |
206 | 209 | info->sector_count = CFG_MAX_FLASH_SECT; |
207 | - } | |
210 | + } | |
208 | 211 | |
209 | - addr[0] = (FPW)0x00FF00FF; /* restore read mode */ | |
212 | + addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ | |
210 | 213 | |
211 | 214 | return (info->size); |
212 | 215 | } |
213 | 216 | |
214 | 217 | |
215 | 218 | |
216 | 219 | |
217 | 220 | |
218 | 221 | |
... | ... | @@ -215,34 +218,34 @@ |
215 | 218 | /*----------------------------------------------------------------------- |
216 | 219 | */ |
217 | 220 | |
218 | -int flash_erase (flash_info_t *info, int s_first, int s_last) | |
221 | +int flash_erase (flash_info_t *info, int s_first, int s_last) | |
219 | 222 | { |
220 | - int flag, prot, sect; | |
221 | - ulong type, start, now, last; | |
223 | + int flag, prot, sect; | |
224 | + ulong type, start, last; | |
222 | 225 | int rcode = 0; |
223 | 226 | |
224 | - if ((s_first < 0) || (s_first > s_last)) { | |
227 | + if ((s_first < 0) || (s_first > s_last)) { | |
225 | 228 | if (info->flash_id == FLASH_UNKNOWN) { |
226 | 229 | printf ("- missing\n"); |
227 | 230 | } else { |
228 | 231 | printf ("- no sectors to erase\n"); |
229 | 232 | } |
230 | 233 | return 1; |
231 | - } | |
234 | + } | |
232 | 235 | |
233 | 236 | type = (info->flash_id & FLASH_VENDMASK); |
234 | 237 | if ((type != FLASH_MAN_INTEL)) { |
235 | 238 | printf ("Can't erase unknown flash type %08lx - aborted\n", |
236 | 239 | info->flash_id); |
237 | 240 | return 1; |
238 | - } | |
241 | + } | |
239 | 242 | |
240 | - prot = 0; | |
241 | - for (sect=s_first; sect<=s_last; ++sect) { | |
242 | - if (info->protect[sect]) { | |
243 | - prot++; | |
243 | + prot = 0; | |
244 | + for (sect = s_first; sect <= s_last; ++sect) { | |
245 | + if (info->protect[sect]) { | |
246 | + prot++; | |
247 | + } | |
244 | 248 | } |
245 | - } | |
246 | 249 | |
247 | 250 | if (prot) { |
248 | 251 | printf ("- Warning: %d protected sectors will not be erased!\n", |
249 | 252 | |
250 | 253 | |
251 | 254 | |
252 | 255 | |
253 | 256 | |
254 | 257 | |
255 | 258 | |
256 | 259 | |
257 | 260 | |
258 | 261 | |
259 | 262 | |
... | ... | @@ -252,42 +255,42 @@ |
252 | 255 | } |
253 | 256 | |
254 | 257 | start = get_timer (0); |
255 | - last = start; | |
258 | + last = start; | |
256 | 259 | |
257 | - /* Disable interrupts which might cause a timeout here */ | |
258 | - flag = disable_interrupts(); | |
260 | + /* Disable interrupts which might cause a timeout here */ | |
261 | + flag = disable_interrupts (); | |
259 | 262 | |
260 | - /* Start erase on unprotected sectors */ | |
261 | - for (sect = s_first; sect<=s_last; sect++) { | |
263 | + /* Start erase on unprotected sectors */ | |
264 | + for (sect = s_first; sect <= s_last; sect++) { | |
262 | 265 | if (info->protect[sect] == 0) { /* not protected */ |
263 | - FPWV *addr = (FPWV *)(info->start[sect]); | |
266 | + FPWV *addr = (FPWV *) (info->start[sect]); | |
264 | 267 | FPW status; |
265 | 268 | |
266 | - printf("Erasing sector %2d ... ", sect); | |
269 | + printf ("Erasing sector %2d ... ", sect); | |
267 | 270 | |
268 | - /* arm simple, non interrupt dependent timer */ | |
269 | - reset_timer_masked(); | |
271 | + /* arm simple, non interrupt dependent timer */ | |
272 | + reset_timer_masked (); | |
270 | 273 | |
271 | - *addr = (FPW)0x00500050; /* clear status register */ | |
272 | - *addr = (FPW)0x00200020; /* erase setup */ | |
273 | - *addr = (FPW)0x00D000D0; /* erase confirm */ | |
274 | + *addr = (FPW) 0x00500050; /* clear status register */ | |
275 | + *addr = (FPW) 0x00200020; /* erase setup */ | |
276 | + *addr = (FPW) 0x00D000D0; /* erase confirm */ | |
274 | 277 | |
275 | - while (((status = *addr) & (FPW)0x00800080) != (FPW)0x00800080) { | |
276 | - if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) { | |
278 | + while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) { | |
279 | + if (get_timer_masked () > CFG_FLASH_ERASE_TOUT) { | |
277 | 280 | printf ("Timeout\n"); |
278 | - *addr = (FPW)0x00B000B0; /* suspend erase */ | |
279 | - *addr = (FPW)0x00FF00FF; /* reset to read mode */ | |
281 | + *addr = (FPW) 0x00B000B0; /* suspend erase */ | |
282 | + *addr = (FPW) 0x00FF00FF; /* reset to read mode */ | |
280 | 283 | rcode = 1; |
281 | 284 | break; |
282 | - } | |
283 | - } | |
285 | + } | |
286 | + } | |
284 | 287 | |
285 | - *addr = 0x00500050; /* clear status register cmd. */ | |
286 | - *addr = 0x00FF00FF; /* resest to read mode */ | |
288 | + *addr = 0x00500050; /* clear status register cmd. */ | |
289 | + *addr = 0x00FF00FF; /* resest to read mode */ | |
287 | 290 | |
288 | 291 | printf (" done\n"); |
289 | - } | |
290 | - } | |
292 | + } | |
293 | + } | |
291 | 294 | return rcode; |
292 | 295 | } |
293 | 296 | |
... | ... | @@ -301,7 +304,7 @@ |
301 | 304 | |
302 | 305 | int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) |
303 | 306 | { |
304 | - ulong cp, wp; | |
307 | + ulong cp, wp; | |
305 | 308 | FPW data; |
306 | 309 | int count, i, l, rc, port_width; |
307 | 310 | |
308 | 311 | |
309 | 312 | |
310 | 313 | |
311 | 314 | |
312 | 315 | |
313 | 316 | |
314 | 317 | |
315 | 318 | |
316 | 319 | |
317 | 320 | |
318 | 321 | |
319 | 322 | |
320 | 323 | |
321 | 324 | |
... | ... | @@ -317,67 +320,66 @@ |
317 | 320 | port_width = 4; |
318 | 321 | #endif |
319 | 322 | |
320 | - /* | |
321 | - * handle unaligned start bytes | |
322 | - */ | |
323 | - if ((l = addr - wp) != 0) { | |
324 | - data = 0; | |
325 | - for (i=0, cp=wp; i<l; ++i, ++cp) { | |
326 | - data = (data << 8) | (*(uchar *)cp); | |
327 | - } | |
328 | - for (; i<port_width && cnt>0; ++i) { | |
323 | + /* | |
324 | + * handle unaligned start bytes | |
325 | + */ | |
326 | + if ((l = addr - wp) != 0) { | |
327 | + data = 0; | |
328 | + for (i = 0, cp = wp; i < l; ++i, ++cp) { | |
329 | + data = (data << 8) | (*(uchar *) cp); | |
330 | + } | |
331 | + for (; i < port_width && cnt > 0; ++i) { | |
329 | 332 | data = (data << 8) | *src++; |
330 | - --cnt; | |
331 | - ++cp; | |
332 | - } | |
333 | - for (; cnt==0 && i<port_width; ++i, ++cp) { | |
334 | - data = (data << 8) | (*(uchar *)cp); | |
335 | - } | |
333 | + --cnt; | |
334 | + ++cp; | |
335 | + } | |
336 | + for (; cnt == 0 && i < port_width; ++i, ++cp) { | |
337 | + data = (data << 8) | (*(uchar *) cp); | |
338 | + } | |
336 | 339 | |
337 | - if ((rc = write_data(info, wp, SWAP(data))) != 0) { | |
338 | - return (rc); | |
339 | - } | |
340 | + if ((rc = write_data (info, wp, SWAP (data))) != 0) { | |
341 | + return (rc); | |
342 | + } | |
340 | 343 | wp += port_width; |
341 | - } | |
344 | + } | |
342 | 345 | |
343 | - /* | |
344 | - * handle word aligned part | |
345 | - */ | |
346 | + /* | |
347 | + * handle word aligned part | |
348 | + */ | |
346 | 349 | count = 0; |
347 | 350 | while (cnt >= port_width) { |
348 | 351 | data = 0; |
349 | - for (i=0; i<port_width; ++i) { | |
352 | + for (i = 0; i < port_width; ++i) { | |
350 | 353 | data = (data << 8) | *src++; |
351 | 354 | } |
352 | - if ((rc = write_data(info, wp, SWAP(data))) != 0) { | |
353 | - return (rc); | |
354 | - } | |
355 | - wp += port_width; | |
355 | + if ((rc = write_data (info, wp, SWAP (data))) != 0) { | |
356 | + return (rc); | |
357 | + } | |
358 | + wp += port_width; | |
356 | 359 | cnt -= port_width; |
357 | - if (count++ > 0x800) | |
358 | - { | |
359 | - spin_wheel(); | |
360 | + if (count++ > 0x800) { | |
361 | + spin_wheel (); | |
360 | 362 | count = 0; |
361 | 363 | } |
362 | - } | |
364 | + } | |
363 | 365 | |
364 | - if (cnt == 0) { | |
366 | + if (cnt == 0) { | |
365 | 367 | return (0); |
366 | - } | |
368 | + } | |
367 | 369 | |
368 | - /* | |
369 | - * handle unaligned tail bytes | |
370 | - */ | |
371 | - data = 0; | |
372 | - for (i=0, cp=wp; i<port_width && cnt>0; ++i, ++cp) { | |
370 | + /* | |
371 | + * handle unaligned tail bytes | |
372 | + */ | |
373 | + data = 0; | |
374 | + for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) { | |
373 | 375 | data = (data << 8) | *src++; |
374 | - --cnt; | |
375 | - } | |
376 | - for (; i<port_width; ++i, ++cp) { | |
377 | - data = (data << 8) | (*(uchar *)cp); | |
376 | + --cnt; | |
378 | 377 | } |
378 | + for (; i < port_width; ++i, ++cp) { | |
379 | + data = (data << 8) | (*(uchar *) cp); | |
380 | + } | |
379 | 381 | |
380 | - return (write_data(info, wp, SWAP(data))); | |
382 | + return (write_data (info, wp, SWAP (data))); | |
381 | 383 | } |
382 | 384 | |
383 | 385 | /*----------------------------------------------------------------------- |
384 | 386 | |
385 | 387 | |
386 | 388 | |
387 | 389 | |
388 | 390 | |
389 | 391 | |
390 | 392 | |
391 | 393 | |
392 | 394 | |
393 | 395 | |
394 | 396 | |
... | ... | @@ -388,45 +390,43 @@ |
388 | 390 | */ |
389 | 391 | static int write_data (flash_info_t *info, ulong dest, FPW data) |
390 | 392 | { |
391 | - FPWV *addr = (FPWV *)dest; | |
393 | + FPWV *addr = (FPWV *) dest; | |
392 | 394 | ulong status; |
393 | - ulong start; | |
394 | 395 | int flag; |
395 | 396 | |
396 | 397 | /* Check if Flash is (sufficiently) erased */ |
397 | 398 | if ((*addr & data) != data) { |
398 | - printf("not erased at %08lx (%x)\n",(ulong)addr,*addr); | |
399 | + printf ("not erased at %08lx (%lx)\n", (ulong) addr, *addr); | |
399 | 400 | return (2); |
400 | 401 | } |
401 | 402 | /* Disable interrupts which might cause a timeout here */ |
402 | - flag = disable_interrupts(); | |
403 | + flag = disable_interrupts (); | |
403 | 404 | |
404 | - *addr = (FPW)0x00400040; /* write setup */ | |
405 | + *addr = (FPW) 0x00400040; /* write setup */ | |
405 | 406 | *addr = data; |
406 | 407 | |
407 | 408 | /* arm simple, non interrupt dependent timer */ |
408 | - reset_timer_masked(); | |
409 | + reset_timer_masked (); | |
409 | 410 | |
410 | 411 | /* wait while polling the status register */ |
411 | - while (((status = *addr) & (FPW)0x00800080) != (FPW)0x00800080) { | |
412 | - if (get_timer_masked() > CFG_FLASH_WRITE_TOUT) { | |
413 | - *addr = (FPW)0x00FF00FF; /* restore read mode */ | |
412 | + while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) { | |
413 | + if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) { | |
414 | + *addr = (FPW) 0x00FF00FF; /* restore read mode */ | |
414 | 415 | return (1); |
415 | 416 | } |
416 | - } | |
417 | + } | |
417 | 418 | |
418 | - *addr = (FPW)0x00FF00FF; /* restore read mode */ | |
419 | + *addr = (FPW) 0x00FF00FF; /* restore read mode */ | |
419 | 420 | |
420 | 421 | return (0); |
421 | 422 | } |
422 | 423 | |
423 | -void inline | |
424 | -spin_wheel(void) | |
424 | +void inline spin_wheel (void) | |
425 | 425 | { |
426 | - static int r=0,p=0; | |
427 | - static char w[] = "\\/-"; | |
426 | + static int p = 0; | |
427 | + static char w[] = "\\/-"; | |
428 | 428 | |
429 | - printf("\010%c", w[p]); | |
430 | - (++p == 3) ? (p = 0) : 0; | |
429 | + printf ("\010%c", w[p]); | |
430 | + (++p == 3) ? (p = 0) : 0; | |
431 | 431 | } |
board/mpl/common/common_util.c
board/mpl/vcma9/cmd_vcma9.c
... | ... | @@ -102,7 +102,7 @@ |
102 | 102 | printf("\nplease defined 'ethaddr'\n"); |
103 | 103 | } |
104 | 104 | } else if (strcmp(argv[2], "dump") == 0) { |
105 | - uchar addr, endaddr, csum; ushort data; | |
105 | + uchar addr = 0, endaddr, csum; ushort data; | |
106 | 106 | |
107 | 107 | printf("Dump of CS8900 config device: "); |
108 | 108 | cs8900_e2prom_read(addr, &data); |
board/mpl/vcma9/vcma9.c
board/trab/vfd.c
... | ... | @@ -59,10 +59,24 @@ |
59 | 59 | #define FRAME_BUF_SIZE ((256*4*56)/8) |
60 | 60 | #define frame_buf_offs 4 |
61 | 61 | |
62 | +/* defines for starting Timer3 as CPLD-Clk */ | |
63 | +#define START3 (1 << 16) | |
64 | +#define UPDATE3 (1 << 17) | |
65 | +#define INVERT3 (1 << 18) | |
66 | +#define RELOAD3 (1 << 19) | |
67 | + | |
68 | +/* CPLD-Register for controlling vfd-blank-signal */ | |
69 | +#define VFD_DISABLE (*(volatile uchar *)0x04038000=0x0000) | |
70 | +#define VFD_ENABLE (*(volatile uchar *)0x04038000=0x0001) | |
71 | + | |
62 | 72 | /* Supported VFD Types */ |
63 | 73 | #define VFD_TYPE_T119C 1 /* Noritake T119C VFD */ |
64 | 74 | #define VFD_TYPE_MN11236 2 |
65 | 75 | |
76 | +/*#define NEW_CPLD_CLK*/ | |
77 | + | |
78 | +int vfd_board_id; | |
79 | + | |
66 | 80 | /* taken from armboot/common/vfd.c */ |
67 | 81 | unsigned long adr_vfd_table[112][18][2][4][2]; |
68 | 82 | unsigned char bit_vfd_table[112][18][2][4][2]; |
... | ... | @@ -80,9 +94,7 @@ |
80 | 94 | /* |
81 | 95 | * clear frame buffer (logical clear => set to "black") |
82 | 96 | */ |
83 | - memset ((void *)(gd->fb_base), | |
84 | - gd->vfd_inv_data ? 0xFF : 0, | |
85 | - FRAME_BUF_SIZE); | |
97 | + memset ((void *)(gd->fb_base), 0, FRAME_BUF_SIZE); | |
86 | 98 | |
87 | 99 | switch (gd->vfd_type) { |
88 | 100 | case VFD_TYPE_T119C: |
... | ... | @@ -98,10 +110,7 @@ |
98 | 110 | bit_nr = bit % 8; |
99 | 111 | bit_nr = (bit_nr > 3) ? bit_nr-4 : bit_nr+4; |
100 | 112 | temp=(*(volatile unsigned char*)(adr)); |
101 | - if (gd->vfd_inv_data) | |
102 | - temp &= ~(1<<bit_nr); | |
103 | - else | |
104 | - temp |= (1<<bit_nr); | |
113 | + temp |= (1<<bit_nr); | |
105 | 114 | (*(volatile unsigned char*)(adr))=temp; |
106 | 115 | |
107 | 116 | if(grid_cycle<55) |
... | ... | @@ -115,10 +124,7 @@ |
115 | 124 | bit_nr = bit%8; |
116 | 125 | bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4; |
117 | 126 | temp=(*(volatile unsigned char*)(adr)); |
118 | - if (gd->vfd_inv_data) | |
119 | - temp &= ~(1<<bit_nr); | |
120 | - else | |
121 | - temp |= (1<<bit_nr); | |
127 | + temp |= (1<<bit_nr); | |
122 | 128 | (*(volatile unsigned char*)(adr))=temp; |
123 | 129 | } |
124 | 130 | } |
... | ... | @@ -136,10 +142,7 @@ |
136 | 142 | bit_nr = bit % 8; |
137 | 143 | bit_nr = (bit_nr > 3) ? bit_nr-4 : bit_nr+4; |
138 | 144 | temp=(*(volatile unsigned char*)(adr)); |
139 | - if (gd->vfd_inv_data) | |
140 | - temp &= ~(1<<bit_nr); | |
141 | - else | |
142 | - temp |= (1<<bit_nr); | |
145 | + temp |= (1<<bit_nr); | |
143 | 146 | (*(volatile unsigned char*)(adr))=temp; |
144 | 147 | |
145 | 148 | if(grid_cycle<37) |
... | ... | @@ -152,10 +155,7 @@ |
152 | 155 | bit_nr = bit%8; |
153 | 156 | bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4; |
154 | 157 | temp=(*(volatile unsigned char*)(adr)); |
155 | - if (gd->vfd_inv_data) | |
156 | - temp &= ~(1<<bit_nr); | |
157 | - else | |
158 | - temp |= (1<<bit_nr); | |
158 | + temp |= (1<<bit_nr); | |
159 | 159 | (*(volatile unsigned char*)(adr))=temp; |
160 | 160 | } |
161 | 161 | } |
... | ... | @@ -250,7 +250,7 @@ |
250 | 250 | for(entry=0;entry<2;entry++) { |
251 | 251 | unsigned long adr = gd->fb_base; |
252 | 252 | unsigned int bit_nr = 0; |
253 | - | |
253 | + | |
254 | 254 | if (vfd_table[x][y][color][display][entry]) { |
255 | 255 | |
256 | 256 | pixel = vfd_table[x][y][color][display][entry] + frame_buf_offs; |
... | ... | @@ -295,18 +295,11 @@ |
295 | 295 | bit_nr = bit_vfd_table[x][y][color][display][0]; |
296 | 296 | temp=(*(volatile unsigned char*)(adr)); |
297 | 297 | |
298 | - if (gd->vfd_inv_data) { | |
299 | - if (value) | |
300 | - temp &= ~(1<<bit_nr); | |
301 | - else | |
302 | - temp |= (1<<bit_nr); | |
303 | - } else { | |
304 | - if (value) | |
305 | - temp |= (1<<bit_nr); | |
306 | - else | |
307 | - temp &= ~(1<<bit_nr); | |
308 | - } | |
309 | - | |
298 | + if (value) | |
299 | + temp |= (1<<bit_nr); | |
300 | + else | |
301 | + temp &= ~(1<<bit_nr); | |
302 | + | |
310 | 303 | (*(volatile unsigned char*)(adr))=temp; |
311 | 304 | } |
312 | 305 | |
313 | 306 | |
314 | 307 | |
315 | 308 | |
... | ... | @@ -363,22 +356,59 @@ |
363 | 356 | * This function initializes VFD clock that is needed for the CPLD that |
364 | 357 | * manages the keyboard. |
365 | 358 | */ |
366 | -int vfd_init_clocks(void) | |
359 | +int vfd_init_clocks (void) | |
367 | 360 | { |
368 | - /* Port-Pins als LCD-Ausgang */ | |
369 | - rPCCON = (rPCCON & 0xFFFFFF00)| 0x000000AA; | |
370 | - /* Port-Pins als LCD-Ausgang */ | |
371 | - rPDCON = (rPDCON & 0xFFFFFF03)| 0x000000A8; | |
372 | -#ifdef CFG_WITH_VFRAME | |
373 | - /* mit VFRAME zum Messen */ | |
374 | - rPDCON = (rPDCON & 0xFFFFFF00)| 0x000000AA; | |
375 | -#endif | |
376 | 361 | |
377 | - rLCDCON2 = 0x000DC000; | |
378 | - rLCDCON3 = 0x0051000A; | |
379 | - rLCDCON4 = 0x00000001; | |
380 | - rLCDCON5 = 0x00000440; | |
362 | + /* try to determine display type from the value | |
363 | + * defined by pull-ups | |
364 | + */ | |
365 | + rPCUP = (rPCUP & 0xFFF0); /* activate GPC0...GPC3 pullups */ | |
366 | + rPCCON = (rPCCON & 0xFFFFFF00); /* configure GPC0...GPC3 as inputs */ | |
367 | + udelay (10); /* allow signals to settle */ | |
368 | + vfd_board_id = (~rPCDAT) & 0x000F; /* read GPC0...GPC3 port pins */ | |
369 | + | |
370 | + VFD_DISABLE; /* activate blank for the vfd */ | |
371 | + | |
372 | +#define NEW_CPLD_CLK | |
373 | + | |
374 | +#ifdef NEW_CPLD_CLK | |
375 | + if (vfd_board_id) { | |
376 | + /* If new board revision, then use PWM 3 as cpld-clock */ | |
377 | + /* Enable 500 Hz timer for fill level sensor to operate properly */ | |
378 | + /* Configure TOUT3 as functional pin, disable pull-up */ | |
379 | + rPDCON &= ~0x30000; | |
380 | + rPDCON |= 0x20000; | |
381 | + rPDUP |= (1 << 8); | |
382 | + | |
383 | + /* Configure the prescaler */ | |
384 | + rTCFG0 &= ~0xff00; | |
385 | + rTCFG0 |= 0x0f00; | |
386 | + | |
387 | + /* Select MUX input (divider) for timer3 (1/16) */ | |
388 | + rTCFG1 &= ~0xf000; | |
389 | + rTCFG1 |= 0x3000; | |
390 | + | |
391 | + /* Enable autoreload and set the counter and compare | |
392 | + * registers to values for the 500 Hz clock | |
393 | + * (for a given prescaler (15) and divider (16)): | |
394 | + * counter = (66000000 / 500) >> 9; | |
395 | + */ | |
396 | + rTCNTB3 = 0x101; | |
397 | + rTCMPB3 = 0x101 / 2; | |
398 | + | |
399 | + /* Start timer */ | |
400 | + rTCON = (rTCON | UPDATE3 | RELOAD3) & ~INVERT3; | |
401 | + rTCON = (rTCON | START3) & ~UPDATE3; | |
402 | + } | |
403 | +#endif | |
404 | + /* If old board revision, then use vm-signal as cpld-clock */ | |
405 | + rLCDCON2 = 0x00FFC000; | |
406 | + rLCDCON3 = 0x0007FF00; | |
407 | + rLCDCON4 = 0x00000000; | |
408 | + rLCDCON5 = 0x00000400; | |
381 | 409 | rLCDCON1 = 0x00000B75; |
410 | + /* VM (GPD1) is used as clock for the CPLD */ | |
411 | + rPDCON = (rPDCON & 0xFFFFFFF3) | 0x00000008; | |
382 | 412 | |
383 | 413 | return 0; |
384 | 414 | } |
... | ... | @@ -397,7 +427,7 @@ |
397 | 427 | char *tmp; |
398 | 428 | ulong palette; |
399 | 429 | static int vfd_init_done = 0; |
400 | - int vfd_id; | |
430 | + int vfd_inv_data = 0; | |
401 | 431 | |
402 | 432 | DECLARE_GLOBAL_DATA_PTR; |
403 | 433 | |
404 | 434 | |
... | ... | @@ -405,17 +435,9 @@ |
405 | 435 | return (0); |
406 | 436 | vfd_init_done = 1; |
407 | 437 | |
408 | - /* try to determine display type from the value | |
409 | - * defined by pull-ups | |
410 | - */ | |
411 | - rPCUP = (rPCUP & 0xFFF0); /* activate GPC0...GPC3 pullups */ | |
412 | - rPCCON = (rPCCON & 0xFFFFFF00); /* configure GPC0...GPC3 as inputs */ | |
413 | - udelay(10); /* allow signals to settle */ | |
438 | + debug("Detecting Revison of WA4-VFD: ID=0x%X\n", vfd_board_id); | |
414 | 439 | |
415 | - vfd_id = (~rPCDAT) & 0x000F; /* read GPC0...GPC3 port pins */ | |
416 | - debug("Detecting Revison of WA4-VFD: ID=0x%X\n", vfd_id); | |
417 | - | |
418 | - switch (vfd_id) { | |
440 | + switch (vfd_board_id) { | |
419 | 441 | case 0: /* board revision < Rev.200 */ |
420 | 442 | if ((tmp = getenv ("vfd_type")) == NULL) { |
421 | 443 | break; |
422 | 444 | |
423 | 445 | |
... | ... | @@ -428,19 +450,18 @@ |
428 | 450 | /* cannot use printf for a warning here */ |
429 | 451 | gd->vfd_type = 0; /* unknown */ |
430 | 452 | } |
431 | - gd->vfd_inv_data = 0; | |
432 | 453 | |
433 | 454 | break; |
434 | 455 | default: /* default to MN11236, data inverted */ |
435 | 456 | gd->vfd_type = VFD_TYPE_MN11236; |
436 | - gd->vfd_inv_data = 1; | |
457 | + vfd_inv_data = 1; | |
437 | 458 | setenv ("vfd_type", "MN11236"); |
438 | 459 | } |
439 | 460 | debug ("VFD type: %s%s\n", |
440 | 461 | (gd->vfd_type == VFD_TYPE_T119C) ? "T119C" : |
441 | 462 | (gd->vfd_type == VFD_TYPE_MN11236) ? "MN11236" : |
442 | 463 | "unknown", |
443 | - gd->vfd_inv_data ? ", inverted data" : ""); | |
464 | + vfd_inv_data ? ", inverted data" : ""); | |
444 | 465 | |
445 | 466 | gd->fb_base = gd->fb_base; |
446 | 467 | create_vfd_table(); |
447 | 468 | |
448 | 469 | |
449 | 470 | |
... | ... | @@ -458,17 +479,50 @@ |
458 | 479 | * (wrap around) |
459 | 480 | * see manual S3C2400 |
460 | 481 | */ |
482 | + /* Stopp LCD-Controller */ | |
483 | + rLCDCON1 = 0x00000000; | |
461 | 484 | /* frame buffer startadr */ |
462 | 485 | rLCDSADDR1 = gd->fb_base >> 1; |
463 | 486 | /* frame buffer endadr */ |
464 | 487 | rLCDSADDR2 = (gd->fb_base + FRAME_BUF_SIZE) >> 1; |
465 | 488 | rLCDSADDR3 = ((256/4)); |
489 | + rLCDCON2 = 0x000DC000; | |
490 | + rLCDCON3 = 0x0051000A; | |
491 | + rLCDCON4 = 0x00000001; | |
492 | + if (gd->vfd_type && vfd_inv_data) | |
493 | + rLCDCON5 = 0x000004C0; | |
494 | + else | |
495 | + rLCDCON5 = 0x00000440; | |
466 | 496 | |
497 | + /* Port pins as LCD output */ | |
498 | + rPCCON = (rPCCON & 0xFFFFFF00)| 0x000000AA; | |
499 | + rPDCON = (rPDCON & 0xFFFFFF03)| 0x000000A8; | |
500 | + | |
501 | + /* Synchronize VFD enable with LCD controller to avoid flicker */ | |
502 | + rLCDCON1 = 0x00000B75; /* Start LCD-Controller */ | |
503 | + while((rLCDCON5 & 0x180000)!=0x100000); /* Wait for end of VSYNC */ | |
504 | + while((rLCDCON5 & 0x060000)!=0x040000); /* Wait for next HSYNC */ | |
505 | + while((rLCDCON5 & 0x060000)==0x040000); | |
506 | + while((rLCDCON5 & 0x060000)!=0x000000); | |
507 | + if(gd->vfd_type) | |
508 | + VFD_ENABLE; | |
509 | + | |
467 | 510 | debug ("LCDSADDR1: %lX\n", rLCDSADDR1); |
468 | 511 | debug ("LCDSADDR2: %lX\n", rLCDSADDR2); |
469 | 512 | debug ("LCDSADDR3: %lX\n", rLCDSADDR3); |
470 | 513 | |
471 | 514 | return 0; |
515 | +} | |
516 | + | |
517 | +/* | |
518 | + * Disable VFD: should be run before resetting the system: | |
519 | + * disable VM, enable pull-up | |
520 | + */ | |
521 | +void disable_vfd (void) | |
522 | +{ | |
523 | + VFD_DISABLE; | |
524 | + rPDCON &= ~0xC; | |
525 | + rPDUP &= ~0x2; | |
472 | 526 | } |
473 | 527 | |
474 | 528 | /************************************************************************/ |
common/cmd_pci.c
... | ... | @@ -115,28 +115,65 @@ |
115 | 115 | |
116 | 116 | char* pci_classes_str(u8 class) |
117 | 117 | { |
118 | - static char *pci_classes[] = { | |
119 | - "Build before PCI Rev2.0", | |
120 | - "Mass storage controller", | |
121 | - "Network controller ", | |
122 | - "Display controller ", | |
123 | - "Multimedia device ", | |
124 | - "Memory controller ", | |
125 | - "Bridge device ", | |
126 | - "Simple comm. controller", | |
127 | - "Base system peripheral ", | |
128 | - "Input device ", | |
129 | - "Docking station ", | |
130 | - "Processor ", | |
131 | - "Serial bus controller ", | |
132 | - "Reserved entry ", | |
133 | - "Does not fit any class " | |
134 | - }; | |
135 | - | |
136 | - if (class < (sizeof pci_classes / sizeof *pci_classes)) | |
137 | - return pci_classes[(int) class]; | |
138 | - | |
118 | + switch (class) { | |
119 | + case PCI_CLASS_NOT_DEFINED: | |
120 | + return "Build before PCI Rev2.0"; | |
121 | + break; | |
122 | + case PCI_BASE_CLASS_STORAGE: | |
123 | + return "Mass storage controller"; | |
124 | + break; | |
125 | + case PCI_BASE_CLASS_NETWORK: | |
126 | + return "Network controller "; | |
127 | + break; | |
128 | + case PCI_BASE_CLASS_DISPLAY: | |
129 | + return "Display controller "; | |
130 | + break; | |
131 | + case PCI_BASE_CLASS_MULTIMEDIA: | |
132 | + return "Multimedia device "; | |
133 | + break; | |
134 | + case PCI_BASE_CLASS_MEMORY: | |
135 | + return "Memory controller "; | |
136 | + break; | |
137 | + case PCI_BASE_CLASS_BRIDGE: | |
138 | + return "Bridge device "; | |
139 | + break; | |
140 | + case PCI_BASE_CLASS_COMMUNICATION: | |
141 | + return "Simple comm. controller"; | |
142 | + break; | |
143 | + case PCI_BASE_CLASS_SYSTEM: | |
144 | + return "Base system peripheral "; | |
145 | + break; | |
146 | + case PCI_BASE_CLASS_INPUT: | |
147 | + return "Input device "; | |
148 | + break; | |
149 | + case PCI_BASE_CLASS_DOCKING: | |
150 | + return "Docking station "; | |
151 | + break; | |
152 | + case PCI_BASE_CLASS_PROCESSOR: | |
153 | + return "Processor "; | |
154 | + break; | |
155 | + case PCI_BASE_CLASS_SERIAL: | |
156 | + return "Serial bus controller "; | |
157 | + break; | |
158 | + case PCI_BASE_CLASS_INTELLIGENT: | |
159 | + return "Intelligent controller "; | |
160 | + break; | |
161 | + case PCI_BASE_CLASS_SATELLITE: | |
162 | + return "Satellite controller "; | |
163 | + break; | |
164 | + case PCI_BASE_CLASS_CRYPT: | |
165 | + return "Cryptographic device "; | |
166 | + break; | |
167 | + case PCI_BASE_CLASS_SIGNAL_PROCESSING: | |
168 | + return "DSP "; | |
169 | + break; | |
170 | + case PCI_CLASS_OTHERS: | |
171 | + return "Does not fit any class "; | |
172 | + break; | |
173 | + default: | |
139 | 174 | return "??? "; |
175 | + break; | |
176 | + }; | |
140 | 177 | } |
141 | 178 | |
142 | 179 | /* |
cpu/arm920t/interrupts.c
... | ... | @@ -199,9 +199,9 @@ |
199 | 199 | /* load value for 10 ms timeout */ |
200 | 200 | lastdec = rTCNTB4 = timer_load_val; |
201 | 201 | /* auto load, manual update of Timer 4 */ |
202 | - rTCON = 0x600000; | |
202 | + rTCON = (rTCON & ~0x0700000) | 0x600000; | |
203 | 203 | /* auto load, start Timer 4 */ |
204 | - rTCON = 0x500000; | |
204 | + rTCON = (rTCON & ~0x0700000) | 0x500000; | |
205 | 205 | timestamp = 0; |
206 | 206 | |
207 | 207 | return (0); |
208 | 208 | |
... | ... | @@ -296,8 +296,10 @@ |
296 | 296 | |
297 | 297 | #if defined(CONFIG_SMDK2400) || defined(CONFIG_TRAB) |
298 | 298 | tbclk = timer_load_val * 100; |
299 | -#elif defined(CONFIG_SMDK2410) | |
299 | +#elif defined(CONFIG_SMDK2410) || defined(CONFIG_VCMA9) | |
300 | 300 | tbclk = CFG_HZ; |
301 | +#else | |
302 | +# error "tbclk not configured" | |
301 | 303 | #endif |
302 | 304 | |
303 | 305 | return tbclk; |
cpu/arm920t/start.S
doc/README.JFFS2
... | ... | @@ -9,6 +9,14 @@ |
9 | 9 | fsinfo - print information about file systems |
10 | 10 | ls - list files in a directory |
11 | 11 | |
12 | +If you boot from a partition which is mounted writable, and you | |
13 | +update your boot environment by replacing single files on that | |
14 | +partition, you should also define CFG_JFFS2_SORT_FRAGMENTS. Scanning | |
15 | +the JFFS2 filesystem takes *much* longer with this feature, though. | |
16 | +Sorting is done while inserting into the fragment list, which is | |
17 | +more or less a bubble sort. That algorithm is known to be O(n^2), | |
18 | +thus you should really consider if you can avoid it! | |
19 | + | |
12 | 20 | |
13 | 21 | There is two ways for JFFS2 to find the disk. The default way uses |
14 | 22 | the flash_info structure to find the start of a JFFS2 disk (called |
drivers/cs8900.c
... | ... | @@ -296,7 +296,7 @@ |
296 | 296 | /* write a 16-bit word into the EEPROM */ |
297 | 297 | /***********************************************************/ |
298 | 298 | |
299 | -void cs8900_e2prom_write(unsigned char addr, unsigned short value) | |
299 | +int cs8900_e2prom_write(unsigned char addr, unsigned short value) | |
300 | 300 | { |
301 | 301 | cs8900_e2prom_ready(); |
302 | 302 | put_reg(PP_EECMD, EEPROM_WRITE_EN); |
... | ... | @@ -307,7 +307,7 @@ |
307 | 307 | put_reg(PP_EECMD, EEPROM_WRITE_DIS); |
308 | 308 | cs8900_e2prom_ready(); |
309 | 309 | |
310 | - return; | |
310 | + return 0; | |
311 | 311 | } |
312 | 312 | |
313 | 313 | #endif /* COMMANDS & CFG_NET */ |
drivers/cs8900.h
drivers/s3c24x0_i2c.c
fs/jffs2/jffs2_1pass.c
Changes suppressed. Click to show
1 | +/* vi: set sw=4 ts=4: */ | |
1 | 2 | /* |
2 | 3 | ------------------------------------------------------------------------- |
3 | 4 | * Filename: jffs2.c |
... | ... | @@ -75,6 +76,42 @@ |
75 | 76 | * |
76 | 77 | */ |
77 | 78 | |
79 | +/* | |
80 | + * Bugfixing by Kai-Uwe Bloem <kai-uwe.bloem@auerswald.de>, (C) Mar/2003 | |
81 | + * | |
82 | + * - overhaul of the memory management. Removed much of the "paper-bagging" | |
83 | + * in that part of the code, fixed several bugs, now frees memory when | |
84 | + * partition is changed. | |
85 | + * It's still ugly :-( | |
86 | + * - fixed a bug in jffs2_1pass_read_inode where the file length calculation | |
87 | + * was incorrect. Removed a bit of the paper-bagging as well. | |
88 | + * - removed double crc calculation for fragment headers in jffs2_private.h | |
89 | + * for speedup. | |
90 | + * - scan_empty rewritten in a more "standard" manner (non-paperbag, that is). | |
91 | + * - spinning wheel now spins depending on how much memory has been scanned | |
92 | + * - lots of small changes all over the place to "improve" readability. | |
93 | + * - implemented fragment sorting to ensure that the newest data is copied | |
94 | + * if there are multiple copies of fragments for a certain file offset. | |
95 | + * | |
96 | + * The fragment sorting feature must be enabled by CFG_JFFS2_SORT_FRAGMENTS. | |
97 | + * Sorting is done while adding fragments to the lists, which is more or less a | |
98 | + * bubble sort. This takes a lot of time, and is most probably not an issue if | |
99 | + * the boot filesystem is always mounted readonly. | |
100 | + * | |
101 | + * You should define it if the boot filesystem is mounted writable, and updates | |
102 | + * to the boot files are done by copying files to that filesystem. | |
103 | + * | |
104 | + * | |
105 | + * There's a big issue left: endianess is completely ignored in this code. Duh! | |
106 | + * | |
107 | + * | |
108 | + * You still should have paper bags at hand :-(. The code lacks more or less | |
109 | + * any comment, and is still arcane and difficult to read in places. As this | |
110 | + * is incompatible with any new code from the jffs2 maintainers anyway, it | |
111 | + * should probably be dumped and replaced by something like jffs2reader! | |
112 | + */ | |
113 | + | |
114 | + | |
78 | 115 | #include <common.h> |
79 | 116 | #include <config.h> |
80 | 117 | #include <malloc.h> |
81 | 118 | |
82 | 119 | |
83 | 120 | |
84 | 121 | |
85 | 122 | |
86 | 123 | |
87 | 124 | |
88 | 125 | |
89 | 126 | |
90 | 127 | |
91 | 128 | |
92 | 129 | |
93 | 130 | |
94 | 131 | |
95 | 132 | |
96 | 133 | |
97 | 134 | |
98 | 135 | |
99 | 136 | |
100 | 137 | |
101 | 138 | |
102 | 139 | |
103 | 140 | |
104 | 141 | |
105 | 142 | |
... | ... | @@ -88,125 +125,198 @@ |
88 | 125 | |
89 | 126 | #include "jffs2_private.h" |
90 | 127 | |
91 | -/* Compression names */ | |
92 | -static char *compr_names[] = { | |
93 | - "NONE", | |
94 | - "ZERO", | |
95 | - "RTIME", | |
96 | - "RUBINMIPS", | |
97 | - "COPY", | |
98 | - "DYNRUBIN", | |
99 | - "ZLIB" }; | |
100 | 128 | |
101 | -static char spinner[] = { '|', '\\', '-', '/' }; | |
129 | +#define NODE_CHUNK 1024 /* size of memory allocation chunk in b_nodes */ | |
130 | +#define SPIN_BLKSIZE 18 /* spin after having scanned 1<<BLKSIZE bytes */ | |
102 | 131 | |
103 | -#define DEBUG | |
132 | +/* Debugging switches */ | |
133 | +#undef DEBUG_DIRENTS /* print directory entry list after scan */ | |
134 | +#undef DEBUG_FRAGMENTS /* print fragment list after scan */ | |
135 | +#undef DEBUG /* enable debugging messages */ | |
136 | + | |
137 | + | |
104 | 138 | #ifdef DEBUG |
105 | 139 | # define DEBUGF(fmt,args...) printf(fmt ,##args) |
106 | 140 | #else |
107 | 141 | # define DEBUGF(fmt,args...) |
108 | 142 | #endif |
109 | 143 | |
110 | -#define MALLOC_CHUNK (10*1024) | |
111 | 144 | |
145 | +/* Compression names */ | |
146 | +static char *compr_names[] = { | |
147 | + "NONE", | |
148 | + "ZERO", | |
149 | + "RTIME", | |
150 | + "RUBINMIPS", | |
151 | + "COPY", | |
152 | + "DYNRUBIN", | |
153 | + "ZLIB" | |
154 | +}; | |
112 | 155 | |
156 | +/* Spinning wheel */ | |
157 | +static char spinner[] = { '|', '/', '-', '\\' }; | |
158 | + | |
159 | +/* Memory management */ | |
160 | +struct mem_block { | |
161 | + u32 index; | |
162 | + struct mem_block *next; | |
163 | + struct b_node nodes[NODE_CHUNK]; | |
164 | +}; | |
165 | + | |
166 | + | |
167 | +static void | |
168 | +free_nodes(struct b_list *list) | |
169 | +{ | |
170 | + while (list->listMemBase != NULL) { | |
171 | + struct mem_block *next = list->listMemBase->next; | |
172 | + free( list->listMemBase ); | |
173 | + list->listMemBase = next; | |
174 | + } | |
175 | +} | |
176 | + | |
113 | 177 | static struct b_node * |
114 | -add_node(struct b_node *tail, u32 * count, u32 * memBase) | |
178 | +add_node(struct b_list *list) | |
115 | 179 | { |
116 | - u32 index; | |
117 | - u32 memLimit; | |
180 | + u32 index = 0; | |
181 | + struct mem_block *memBase; | |
118 | 182 | struct b_node *b; |
119 | 183 | |
120 | - index = (*count) * sizeof(struct b_node) % MALLOC_CHUNK; | |
121 | - memLimit = MALLOC_CHUNK; | |
122 | - | |
184 | + memBase = list->listMemBase; | |
185 | + if (memBase != NULL) | |
186 | + index = memBase->index; | |
123 | 187 | #if 0 |
124 | 188 | putLabeledWord("add_node: index = ", index); |
125 | - putLabeledWord("add_node: memLimit = ", memLimit); | |
126 | - putLabeledWord("add_node: memBase = ", *memBase); | |
189 | + putLabeledWord("add_node: memBase = ", list->listMemBase); | |
127 | 190 | #endif |
128 | 191 | |
129 | - /* we need not keep a list of bases since we'll never free the */ | |
130 | - /* memory, just jump the the kernel */ | |
131 | - if ((index == 0) || (index > memLimit)) { /* we need mode space before we continue */ | |
132 | - if ((*memBase = (u32) mmalloc(MALLOC_CHUNK)) == (u32) NULL) { | |
192 | + if (memBase == NULL || index >= NODE_CHUNK) { | |
193 | + /* we need more space before we continue */ | |
194 | + memBase = mmalloc(sizeof(struct mem_block)); | |
195 | + if (memBase == NULL) { | |
133 | 196 | putstr("add_node: malloc failed\n"); |
134 | 197 | return NULL; |
135 | 198 | } |
199 | + memBase->next = list->listMemBase; | |
200 | + index = 0; | |
136 | 201 | #if 0 |
137 | 202 | putLabeledWord("add_node: alloced a new membase at ", *memBase); |
138 | 203 | #endif |
139 | 204 | |
140 | 205 | } |
141 | 206 | /* now we have room to add it. */ |
142 | - b = (struct b_node *) (*memBase + index); | |
207 | + b = &memBase->nodes[index]; | |
208 | + index ++; | |
143 | 209 | |
144 | - /* null on first call */ | |
145 | - if (tail) | |
146 | - tail->next = b; | |
210 | + memBase->index = index; | |
211 | + list->listMemBase = memBase; | |
212 | + list->listCount++; | |
213 | + return b; | |
214 | +} | |
147 | 215 | |
148 | -#if 0 | |
149 | - putLabeledWord("add_node: tail = ", (u32) tail); | |
150 | - if (tail) | |
151 | - putLabeledWord("add_node: tail->next = ", (u32) tail->next); | |
152 | - | |
216 | +static struct b_node * | |
217 | +insert_node(struct b_list *list, u32 offset) | |
218 | +{ | |
219 | + struct b_node *new; | |
220 | +#ifdef CFG_JFFS2_SORT_FRAGMENTS | |
221 | + struct b_node *b, *prev; | |
153 | 222 | #endif |
154 | 223 | |
155 | -#if 0 | |
156 | - putLabeledWord("add_node: mb+i = ", (u32) (*memBase + index)); | |
157 | - putLabeledWord("add_node: b = ", (u32) b); | |
224 | + if (!(new = add_node(list))) { | |
225 | + putstr("add_node failed!\r\n"); | |
226 | + return NULL; | |
227 | + } | |
228 | + new->offset = offset; | |
229 | + | |
230 | +#ifdef CFG_JFFS2_SORT_FRAGMENTS | |
231 | + if (list->listTail != NULL && list->listCompare(new, list->listTail)) | |
232 | + prev = list->listTail; | |
233 | + else if (list->listLast != NULL && list->listCompare(new, list->listLast)) | |
234 | + prev = list->listLast; | |
235 | + else | |
236 | + prev = NULL; | |
237 | + | |
238 | + for (b = (prev ? prev->next : list->listHead); | |
239 | + b != NULL && list->listCompare(new, b); | |
240 | + prev = b, b = b->next) { | |
241 | + list->listLoops++; | |
242 | + } | |
243 | + if (b != NULL) | |
244 | + list->listLast = prev; | |
245 | + | |
246 | + if (b != NULL) { | |
247 | + new->next = b; | |
248 | + if (prev != NULL) | |
249 | + prev->next = new; | |
250 | + else | |
251 | + list->listHead = new; | |
252 | + } else | |
158 | 253 | #endif |
159 | - (*count)++; | |
160 | - b->next = (struct b_node *) NULL; | |
161 | - return b; | |
254 | + { | |
255 | + new->next = (struct b_node *) NULL; | |
256 | + if (list->listTail != NULL) { | |
257 | + list->listTail->next = new; | |
258 | + list->listTail = new; | |
259 | + } else { | |
260 | + list->listTail = list->listHead = new; | |
261 | + } | |
262 | + } | |
162 | 263 | |
264 | + return new; | |
163 | 265 | } |
164 | 266 | |
165 | -/* we know we have empties at the start offset so we will hop */ | |
166 | -/* t points that would be non F if there were a node here to speed this up. */ | |
167 | -struct jffs2_empty_node { | |
168 | - u32 first; | |
169 | - u32 second; | |
170 | -}; | |
267 | +#ifdef CFG_JFFS2_SORT_FRAGMENTS | |
268 | +static int compare_inodes(struct b_node *new, struct b_node *old) | |
269 | +{ | |
270 | + struct jffs2_raw_inode *jNew = (struct jffs2_raw_inode *)new->offset; | |
271 | + struct jffs2_raw_inode *jOld = (struct jffs2_raw_inode *)old->offset; | |
171 | 272 | |
273 | + return jNew->version < jOld->version; | |
274 | +} | |
275 | + | |
276 | +static int compare_dirents(struct b_node *new, struct b_node *old) | |
277 | +{ | |
278 | + struct jffs2_raw_dirent *jNew = (struct jffs2_raw_dirent *)new->offset; | |
279 | + struct jffs2_raw_dirent *jOld = (struct jffs2_raw_dirent *)old->offset; | |
280 | + | |
281 | + return jNew->version > jOld->version; | |
282 | +} | |
283 | +#endif | |
284 | + | |
172 | 285 | static u32 |
173 | 286 | jffs2_scan_empty(u32 start_offset, struct part_info *part) |
174 | 287 | { |
175 | - u32 max = part->size - sizeof(struct jffs2_raw_inode); | |
288 | + char *max = part->offset + part->size - sizeof(struct jffs2_raw_inode); | |
289 | + char *offset = part->offset + start_offset; | |
176 | 290 | |
177 | - /* this would be either dir node_crc or frag isize */ | |
178 | - u32 offset = start_offset + 32; | |
179 | - struct jffs2_empty_node *node; | |
180 | - | |
181 | - start_offset += 4; | |
182 | - while (offset < max) { | |
183 | - node = (struct jffs2_empty_node *) (part->offset + offset); | |
184 | - if ((node->first == 0xFFFFFFFF) && (node->second == 0xFFFFFFFF)) { | |
185 | - /* we presume that there were no nodes in between and advance in a hop */ | |
186 | - /* putLabeledWord("\t\tjffs2_scan_empty: empty at offset=",offset); */ | |
187 | - start_offset = offset + 4; | |
188 | - offset = start_offset + 32; /* orig 32 + 4 bytes for the second==0xfffff */ | |
189 | - } else { | |
190 | - return start_offset; | |
191 | - } | |
291 | + while (offset < max && *(u32 *)offset == 0xFFFFFFFF) { | |
292 | + offset += sizeof(u32); | |
293 | + /* return if spinning is due */ | |
294 | + if (((u32)offset & ((1 << SPIN_BLKSIZE)-1)) == 0) break; | |
192 | 295 | } |
193 | - return start_offset; | |
296 | + | |
297 | + return offset - part->offset; | |
194 | 298 | } |
195 | 299 | |
196 | 300 | static u32 |
197 | 301 | jffs_init_1pass_list(struct part_info *part) |
198 | 302 | { |
199 | - if ( 0 != ( part->jffs2_priv=malloc(sizeof(struct b_lists)))){ | |
200 | - struct b_lists *pL =(struct b_lists *)part->jffs2_priv; | |
303 | + struct b_lists *pL; | |
201 | 304 | |
202 | - pL->dirListHead = pL->dirListTail = NULL; | |
203 | - pL->fragListHead = pL->fragListTail = NULL; | |
204 | - pL->dirListCount = 0; | |
205 | - pL->dirListMemBase = 0; | |
206 | - pL->fragListCount = 0; | |
207 | - pL->fragListMemBase = 0; | |
208 | - pL->partOffset = 0x0; | |
305 | + if (part->jffs2_priv != NULL) { | |
306 | + pL = (struct b_lists *)part->jffs2_priv; | |
307 | + free_nodes(&pL->frag); | |
308 | + free_nodes(&pL->dir); | |
309 | + free(pL); | |
209 | 310 | } |
311 | + if (NULL != (part->jffs2_priv = malloc(sizeof(struct b_lists)))) { | |
312 | + pL = (struct b_lists *)part->jffs2_priv; | |
313 | + | |
314 | + memset(pL, 0, sizeof(*pL)); | |
315 | +#ifdef CFG_JFFS2_SORT_FRAGMENTS | |
316 | + pL->dir.listCompare = compare_dirents; | |
317 | + pL->frag.listCompare = compare_inodes; | |
318 | +#endif | |
319 | + } | |
210 | 320 | return 0; |
211 | 321 | } |
212 | 322 | |
213 | 323 | |
214 | 324 | |
215 | 325 | |
... | ... | @@ -216,21 +326,18 @@ |
216 | 326 | { |
217 | 327 | struct b_node *b; |
218 | 328 | struct jffs2_raw_inode *jNode; |
219 | - u32 totalSize = 1; | |
220 | - u32 oldTotalSize = 0; | |
221 | - u32 size = 0; | |
222 | - char *lDest = (char *) dest; | |
329 | + u32 totalSize = 0; | |
330 | + u16 latestVersion = 0; | |
331 | + char *lDest; | |
223 | 332 | char *src; |
224 | 333 | long ret; |
225 | 334 | int i; |
226 | 335 | u32 counter = 0; |
227 | - char totalSizeSet = 0; | |
228 | 336 | |
229 | -#if 0 | |
230 | - b = pL->fragListHead; | |
231 | - while (b) { | |
337 | + for (b = pL->frag.listHead; b != NULL; b = b->next) { | |
232 | 338 | jNode = (struct jffs2_raw_inode *) (b->offset); |
233 | 339 | if ((inode == jNode->ino)) { |
340 | +#if 0 | |
234 | 341 | putLabeledWord("\r\n\r\nread_inode: totlen = ", jNode->totlen); |
235 | 342 | putLabeledWord("read_inode: inode = ", jNode->ino); |
236 | 343 | putLabeledWord("read_inode: version = ", jNode->version); |
237 | 344 | |
238 | 345 | |
239 | 346 | |
240 | 347 | |
241 | 348 | |
242 | 349 | |
243 | 350 | |
... | ... | @@ -241,58 +348,26 @@ |
241 | 348 | putLabeledWord("read_inode: compr = ", jNode->compr); |
242 | 349 | putLabeledWord("read_inode: usercompr = ", jNode->usercompr); |
243 | 350 | putLabeledWord("read_inode: flags = ", jNode->flags); |
244 | - } | |
245 | - | |
246 | - b = b->next; | |
247 | - } | |
248 | - | |
249 | 351 | #endif |
250 | - | |
251 | -#if 1 | |
252 | - b = pL->fragListHead; | |
253 | - while (b && (size < totalSize)) { | |
254 | - jNode = (struct jffs2_raw_inode *) (b->offset); | |
255 | - if ((inode == jNode->ino)) { | |
256 | - if ((jNode->isize == oldTotalSize) && (jNode->isize > totalSize)) { | |
257 | - /* 2 consecutive isizes indicate file length */ | |
352 | + /* get actual file length from the newest node */ | |
353 | + if (jNode->version >= latestVersion) { | |
258 | 354 | totalSize = jNode->isize; |
259 | - totalSizeSet = 1; | |
260 | - } else if (!totalSizeSet) { | |
261 | - totalSize = size + jNode->dsize + 1; | |
355 | + latestVersion = jNode->version; | |
262 | 356 | } |
263 | - oldTotalSize = jNode->isize; | |
264 | 357 | |
265 | 358 | if(dest) { |
266 | 359 | src = ((char *) jNode) + sizeof(struct jffs2_raw_inode); |
267 | - /* lDest = (char *) (dest + (jNode->offset & ~3)); */ | |
360 | + /* ignore data behind latest known EOF */ | |
361 | + if (jNode->offset > totalSize) | |
362 | + continue; | |
363 | + | |
268 | 364 | lDest = (char *) (dest + jNode->offset); |
269 | 365 | #if 0 |
270 | - putLabeledWord("\r\n\r\nread_inode: src = ", src); | |
366 | + putLabeledWord("read_inode: src = ", src); | |
271 | 367 | putLabeledWord("read_inode: dest = ", lDest); |
272 | - putLabeledWord("read_inode: dsize = ", jNode->dsize); | |
273 | - putLabeledWord("read_inode: csize = ", jNode->csize); | |
274 | - putLabeledWord("read_inode: version = ", jNode->version); | |
275 | - putLabeledWord("read_inode: isize = ", jNode->isize); | |
276 | - putLabeledWord("read_inode: offset = ", jNode->offset); | |
277 | - putLabeledWord("read_inode: compr = ", jNode->compr); | |
278 | - putLabeledWord("read_inode: flags = ", jNode->flags); | |
279 | 368 | #endif |
280 | 369 | switch (jNode->compr) { |
281 | 370 | case JFFS2_COMPR_NONE: |
282 | -#if 0 | |
283 | - { | |
284 | - int i; | |
285 | - | |
286 | - if ((dest > 0xc0092ff0) && (dest < 0xc0093000)) | |
287 | - for (i = 0; i < first->length; i++) { | |
288 | - putLabeledWord("\tCOMPR_NONE: src =", src + i); | |
289 | - putLabeledWord("\tCOMPR_NONE: length =", first->length); | |
290 | - putLabeledWord("\tCOMPR_NONE: dest =", dest + i); | |
291 | - putLabeledWord("\tCOMPR_NONE: data =", (unsigned char) *(src + i)); | |
292 | - } | |
293 | - } | |
294 | -#endif | |
295 | - | |
296 | 371 | ret = (unsigned long) ldr_memcpy(lDest, src, jNode->dsize); |
297 | 372 | break; |
298 | 373 | case JFFS2_COMPR_ZERO: |
299 | 374 | |
300 | 375 | |
301 | 376 | |
302 | 377 | |
303 | 378 | |
... | ... | @@ -320,22 +395,18 @@ |
320 | 395 | } |
321 | 396 | } |
322 | 397 | |
323 | - size += jNode->dsize; | |
324 | 398 | #if 0 |
325 | - putLabeledWord("read_inode: size = ", size); | |
326 | 399 | putLabeledWord("read_inode: totalSize = ", totalSize); |
327 | 400 | putLabeledWord("read_inode: compr ret = ", ret); |
328 | 401 | #endif |
329 | 402 | } |
330 | - b = b->next; | |
331 | 403 | counter++; |
332 | 404 | } |
333 | -#endif | |
334 | 405 | |
335 | 406 | #if 0 |
336 | - putLabeledWord("read_inode: returning = ", size); | |
407 | + putLabeledWord("read_inode: returning = ", totalSize); | |
337 | 408 | #endif |
338 | - return size; | |
409 | + return totalSize; | |
339 | 410 | } |
340 | 411 | |
341 | 412 | /* find the inode from the slashless name given a parent */ |
342 | 413 | |
343 | 414 | |
344 | 415 | |
... | ... | @@ -354,18 +425,19 @@ |
354 | 425 | |
355 | 426 | counter = 0; |
356 | 427 | /* we need to search all and return the inode with the highest version */ |
357 | - for(b = pL->dirListHead;b;b=b->next,counter++) { | |
428 | + for(b = pL->dir.listHead; b; b = b->next, counter++) { | |
358 | 429 | jDir = (struct jffs2_raw_dirent *) (b->offset); |
359 | - if ((pino == jDir->pino) && (len == jDir->nsize) && (jDir->ino) && /* 0 for unlink */ | |
430 | + if ((pino == jDir->pino) && (len == jDir->nsize) && | |
431 | + (jDir->ino) && /* 0 for unlink */ | |
360 | 432 | (!strncmp(jDir->name, name, len))) { /* a match */ |
361 | 433 | if (jDir->version < version) continue; |
362 | 434 | |
363 | - if(jDir->version==0) { | |
435 | + if(jDir->version == 0) { | |
364 | 436 | /* Is this legal? */ |
365 | 437 | putstr(" ** WARNING ** "); |
366 | 438 | putnstr(jDir->name, jDir->nsize); |
367 | 439 | putstr(" is version 0 (in find, ignoring)\r\n"); |
368 | - } else if(jDir->version==version) { | |
440 | + } else if(jDir->version == version) { | |
369 | 441 | /* Im pretty sure this isn't ... */ |
370 | 442 | putstr(" ** ERROR ** "); |
371 | 443 | putnstr(jDir->name, jDir->nsize); |
372 | 444 | |
373 | 445 | |
374 | 446 | |
375 | 447 | |
376 | 448 | |
377 | 449 | |
378 | 450 | |
379 | 451 | |
380 | 452 | |
... | ... | @@ -389,53 +461,53 @@ |
389 | 461 | |
390 | 462 | static char *mkmodestr(unsigned long mode, char *str) |
391 | 463 | { |
392 | - static const char *l="xwr"; | |
393 | - int mask=1, i; | |
394 | - char c; | |
464 | + static const char *l = "xwr"; | |
465 | + int mask = 1, i; | |
466 | + char c; | |
395 | 467 | |
396 | - switch (mode & S_IFMT) { | |
397 | - case S_IFDIR: str[0]='d'; break; | |
398 | - case S_IFBLK: str[0]='b'; break; | |
399 | - case S_IFCHR: str[0]='c'; break; | |
400 | - case S_IFIFO: str[0]='f'; break; | |
401 | - case S_IFLNK: str[0]='l'; break; | |
402 | - case S_IFSOCK: str[0]='s'; break; | |
403 | - case S_IFREG: str[0]='-'; break; | |
404 | - default: str[0]='?'; | |
405 | - } | |
468 | + switch (mode & S_IFMT) { | |
469 | + case S_IFDIR: str[0] = 'd'; break; | |
470 | + case S_IFBLK: str[0] = 'b'; break; | |
471 | + case S_IFCHR: str[0] = 'c'; break; | |
472 | + case S_IFIFO: str[0] = 'f'; break; | |
473 | + case S_IFLNK: str[0] = 'l'; break; | |
474 | + case S_IFSOCK: str[0] = 's'; break; | |
475 | + case S_IFREG: str[0] = '-'; break; | |
476 | + default: str[0] = '?'; | |
477 | + } | |
406 | 478 | |
407 | - for(i=0;i<9;i++) { | |
408 | - c=l[i%3]; | |
409 | - str[9-i]=(mode & mask)?c:'-'; | |
410 | - mask=mask<<1; | |
411 | - } | |
479 | + for(i = 0; i < 9; i++) { | |
480 | + c = l[i%3]; | |
481 | + str[9-i] = (mode & mask)?c:'-'; | |
482 | + mask = mask<<1; | |
483 | + } | |
412 | 484 | |
413 | - if(mode & S_ISUID) str[3]=(mode & S_IXUSR)?'s':'S'; | |
414 | - if(mode & S_ISGID) str[6]=(mode & S_IXGRP)?'s':'S'; | |
415 | - if(mode & S_ISVTX) str[9]=(mode & S_IXOTH)?'t':'T'; | |
416 | - str[10]='\0'; | |
417 | - return str; | |
485 | + if(mode & S_ISUID) str[3] = (mode & S_IXUSR)?'s':'S'; | |
486 | + if(mode & S_ISGID) str[6] = (mode & S_IXGRP)?'s':'S'; | |
487 | + if(mode & S_ISVTX) str[9] = (mode & S_IXOTH)?'t':'T'; | |
488 | + str[10] = '\0'; | |
489 | + return str; | |
418 | 490 | } |
419 | 491 | |
420 | 492 | static inline void dump_stat(struct stat *st, const char *name) |
421 | 493 | { |
422 | - char str[20]; | |
423 | - char s[64], *p; | |
494 | + char str[20]; | |
495 | + char s[64], *p; | |
424 | 496 | |
425 | - if (st->st_mtime == (time_t)(-1)) /* some ctimes really hate -1 */ | |
426 | - st->st_mtime = 1; | |
497 | + if (st->st_mtime == (time_t)(-1)) /* some ctimes really hate -1 */ | |
498 | + st->st_mtime = 1; | |
427 | 499 | |
428 | - ctime_r(&st->st_mtime, s/*, 64*/); /* newlib ctime doesn't have buflen */ | |
500 | + ctime_r(&st->st_mtime, s/*,64*/); /* newlib ctime doesn't have buflen */ | |
429 | 501 | |
430 | - if((p=strchr(s,'\n'))!=NULL) *p='\0'; | |
431 | - if((p=strchr(s,'\r'))!=NULL) *p='\0'; | |
502 | + if ((p = strchr(s,'\n')) != NULL) *p = '\0'; | |
503 | + if ((p = strchr(s,'\r')) != NULL) *p = '\0'; | |
432 | 504 | |
433 | 505 | /* |
434 | - printf("%6lo %s %8ld %s %s\n", st->st_mode, mkmodestr(st->st_mode, str), | |
435 | - st->st_size, s, name); | |
506 | + printf("%6lo %s %8ld %s %s\n", st->st_mode, mkmodestr(st->st_mode, str), | |
507 | + st->st_size, s, name); | |
436 | 508 | */ |
437 | 509 | |
438 | - printf(" %s %8ld %s %s", mkmodestr(st->st_mode,str), st->st_size, s, name); | |
510 | + printf(" %s %8ld %s %s", mkmodestr(st->st_mode,str), st->st_size, s, name); | |
439 | 511 | } |
440 | 512 | |
441 | 513 | static inline u32 dump_inode(struct b_lists * pL, struct jffs2_raw_dirent *d, struct jffs2_raw_inode *i) |
442 | 514 | |
443 | 515 | |
... | ... | @@ -446,16 +518,16 @@ |
446 | 518 | if(!d || !i) return -1; |
447 | 519 | |
448 | 520 | strncpy(fname, d->name, d->nsize); |
449 | - fname[d->nsize]=''\0';'; | |
521 | + fname[d->nsize] = ''\0';'; | |
450 | 522 | |
451 | 523 | memset(&st,0,sizeof(st)); |
452 | 524 | |
453 | - st.st_mtime=i->mtime; | |
454 | - st.st_mode=i->mode; | |
455 | - st.st_ino=i->ino; | |
525 | + st.st_mtime = i->mtime; | |
526 | + st.st_mode = i->mode; | |
527 | + st.st_ino = i->ino; | |
456 | 528 | |
457 | 529 | /* neither dsize nor isize help us.. do it the long way */ |
458 | - st.st_size=jffs2_1pass_read_inode(pL, i->ino, NULL); | |
530 | + st.st_size = jffs2_1pass_read_inode(pL, i->ino, NULL); | |
459 | 531 | |
460 | 532 | dump_stat(&st, fname); |
461 | 533 | |
462 | 534 | |
463 | 535 | |
... | ... | @@ -477,18 +549,18 @@ |
477 | 549 | struct b_node *b; |
478 | 550 | struct jffs2_raw_dirent *jDir; |
479 | 551 | |
480 | - for(b = pL->dirListHead;b;b=b->next) { | |
552 | + for (b = pL->dir.listHead; b; b = b->next) { | |
481 | 553 | jDir = (struct jffs2_raw_dirent *) (b->offset); |
482 | - if ((pino == jDir->pino) && (jDir->ino)) { /* 0 inode for unlink */ | |
483 | - u32 i_version=0; | |
484 | - struct jffs2_raw_inode *jNode, *i=NULL; | |
485 | - struct b_node *b2 = pL->fragListHead; | |
554 | + if ((pino == jDir->pino) && (jDir->ino)) { /* ino=0 -> unlink */ | |
555 | + u32 i_version = 0; | |
556 | + struct jffs2_raw_inode *jNode, *i = NULL; | |
557 | + struct b_node *b2 = pL->frag.listHead; | |
486 | 558 | |
487 | 559 | while (b2) { |
488 | 560 | jNode = (struct jffs2_raw_inode *) (b2->offset); |
489 | 561 | if (jNode->ino == jDir->ino |
490 | - && jNode->version>=i_version) | |
491 | - i=jNode; | |
562 | + && jNode->version >= i_version) | |
563 | + i = jNode; | |
492 | 564 | b2 = b2->next; |
493 | 565 | } |
494 | 566 | |
... | ... | @@ -568,7 +640,7 @@ |
568 | 640 | unsigned char *src; |
569 | 641 | |
570 | 642 | /* we need to search all and return the inode with the highest version */ |
571 | - for(b = pL->dirListHead; b; b=b->next) { | |
643 | + for(b = pL->dir.listHead; b; b = b->next) { | |
572 | 644 | jDir = (struct jffs2_raw_dirent *) (b->offset); |
573 | 645 | if (ino == jDir->ino) { |
574 | 646 | if(jDir->version < version) continue; |
... | ... | @@ -593,8 +665,9 @@ |
593 | 665 | /* now we found the right entry again. (shoulda returned inode*) */ |
594 | 666 | if (jDirFound->type != DT_LNK) |
595 | 667 | return jDirFound->ino; |
596 | - /* so its a soft link so we follow it again. */ | |
597 | - b2 = pL->fragListHead; | |
668 | + | |
669 | + /* it's a soft link so we follow it again. */ | |
670 | + b2 = pL->frag.listHead; | |
598 | 671 | while (b2) { |
599 | 672 | jNode = (struct jffs2_raw_inode *) (b2->offset); |
600 | 673 | if (jNode->ino == jDirFound->ino) { |
... | ... | @@ -644,7 +717,8 @@ |
644 | 717 | tmp[i] = c[i + 1]; |
645 | 718 | tmp[i] = '\0'; |
646 | 719 | /* only a failure if we arent looking at top level */ |
647 | - if (!(pino = jffs2_1pass_find_inode(pL, working_tmp, pino)) && (working_tmp[0])) { | |
720 | + if (!(pino = jffs2_1pass_find_inode(pL, working_tmp, pino)) && | |
721 | + (working_tmp[0])) { | |
648 | 722 | putstr("find_inode failed for name="); |
649 | 723 | putstr(working_tmp); |
650 | 724 | putstr("\r\n"); |
651 | 725 | |
652 | 726 | |
653 | 727 | |
654 | 728 | |
... | ... | @@ -674,29 +748,30 @@ |
674 | 748 | { |
675 | 749 | struct b_node *b; |
676 | 750 | struct jffs2_unknown_node *node; |
677 | - struct b_lists *pL=(struct b_lists *)part->jffs2_priv; | |
751 | + struct b_lists *pL = (struct b_lists *)part->jffs2_priv; | |
678 | 752 | |
679 | 753 | if (part->jffs2_priv == 0){ |
680 | 754 | DEBUGF ("rescan: First time in use\n"); |
681 | 755 | return 1; |
682 | 756 | } |
683 | 757 | /* if we have no list, we need to rescan */ |
684 | - if (pL->fragListCount == 0) { | |
758 | + if (pL->frag.listCount == 0) { | |
685 | 759 | DEBUGF ("rescan: fraglist zero\n"); |
686 | 760 | return 1; |
687 | 761 | } |
688 | 762 | |
689 | - /* or if we are scanninga new partition */ | |
763 | + /* or if we are scanning a new partition */ | |
690 | 764 | if (pL->partOffset != part->offset) { |
691 | 765 | DEBUGF ("rescan: different partition\n"); |
692 | 766 | return 1; |
693 | 767 | } |
694 | - /* but suppose someone reflashed the root partition at the same offset... */ | |
695 | - b = pL->dirListHead; | |
768 | + /* but suppose someone reflashed a partition at the same offset... */ | |
769 | + b = pL->dir.listHead; | |
696 | 770 | while (b) { |
697 | 771 | node = (struct jffs2_unknown_node *) (b->offset); |
698 | 772 | if (node->nodetype != JFFS2_NODETYPE_DIRENT) { |
699 | - DEBUGF ("rescan: fs changed beneath me? (%lx)\n", (unsigned long) b->offset); | |
773 | + DEBUGF ("rescan: fs changed beneath me? (%lx)\n", | |
774 | + (unsigned long) b->offset); | |
700 | 775 | return 1; |
701 | 776 | } |
702 | 777 | b = b->next; |
703 | 778 | |
... | ... | @@ -704,12 +779,71 @@ |
704 | 779 | return 0; |
705 | 780 | } |
706 | 781 | |
782 | +#ifdef DEBUG_FRAGMENTS | |
783 | +static void | |
784 | +dump_fragments(struct b_lists *pL) | |
785 | +{ | |
786 | + struct b_node *b; | |
787 | + struct jffs2_raw_inode *jNode; | |
788 | + | |
789 | + putstr("\r\n\r\n******The fragment Entries******\r\n"); | |
790 | + b = pL->frag.listHead; | |
791 | + while (b) { | |
792 | + jNode = (struct jffs2_raw_inode *) (b->offset); | |
793 | + putLabeledWord("\r\n\tbuild_list: FLASH_OFFSET = ", b->offset); | |
794 | + putLabeledWord("\tbuild_list: totlen = ", jNode->totlen); | |
795 | + putLabeledWord("\tbuild_list: inode = ", jNode->ino); | |
796 | + putLabeledWord("\tbuild_list: version = ", jNode->version); | |
797 | + putLabeledWord("\tbuild_list: isize = ", jNode->isize); | |
798 | + putLabeledWord("\tbuild_list: atime = ", jNode->atime); | |
799 | + putLabeledWord("\tbuild_list: offset = ", jNode->offset); | |
800 | + putLabeledWord("\tbuild_list: csize = ", jNode->csize); | |
801 | + putLabeledWord("\tbuild_list: dsize = ", jNode->dsize); | |
802 | + putLabeledWord("\tbuild_list: compr = ", jNode->compr); | |
803 | + putLabeledWord("\tbuild_list: usercompr = ", jNode->usercompr); | |
804 | + putLabeledWord("\tbuild_list: flags = ", jNode->flags); | |
805 | + putLabeledWord("\tbuild_list: offset = ", b->offset); // FIXME: ? [RS] | |
806 | + b = b->next; | |
807 | + } | |
808 | +} | |
809 | +#endif | |
810 | + | |
811 | +#ifdef DEBUG_DIRENTS | |
812 | +static void | |
813 | +dump_dirents(struct b_lists *pL) | |
814 | +{ | |
815 | + struct b_node *b; | |
816 | + struct jffs2_raw_dirent *jDir; | |
817 | + | |
818 | + putstr("\r\n\r\n******The directory Entries******\r\n"); | |
819 | + b = pL->dir.listHead; | |
820 | + while (b) { | |
821 | + jDir = (struct jffs2_raw_dirent *) (b->offset); | |
822 | + putstr("\r\n"); | |
823 | + putnstr(jDir->name, jDir->nsize); | |
824 | + putLabeledWord("\r\n\tbuild_list: magic = ", jDir->magic); | |
825 | + putLabeledWord("\tbuild_list: nodetype = ", jDir->nodetype); | |
826 | + putLabeledWord("\tbuild_list: hdr_crc = ", jDir->hdr_crc); | |
827 | + putLabeledWord("\tbuild_list: pino = ", jDir->pino); | |
828 | + putLabeledWord("\tbuild_list: version = ", jDir->version); | |
829 | + putLabeledWord("\tbuild_list: ino = ", jDir->ino); | |
830 | + putLabeledWord("\tbuild_list: mctime = ", jDir->mctime); | |
831 | + putLabeledWord("\tbuild_list: nsize = ", jDir->nsize); | |
832 | + putLabeledWord("\tbuild_list: type = ", jDir->type); | |
833 | + putLabeledWord("\tbuild_list: node_crc = ", jDir->node_crc); | |
834 | + putLabeledWord("\tbuild_list: name_crc = ", jDir->name_crc); | |
835 | + putLabeledWord("\tbuild_list: offset = ", b->offset); // FIXME: ? [RS] | |
836 | + b = b->next; | |
837 | + } | |
838 | +} | |
839 | +#endif | |
840 | + | |
707 | 841 | static u32 |
708 | 842 | jffs2_1pass_build_lists(struct part_info * part) |
709 | 843 | { |
710 | 844 | struct b_lists *pL; |
711 | 845 | struct jffs2_unknown_node *node; |
712 | - u32 offset; | |
846 | + u32 offset, oldoffset = 0; | |
713 | 847 | u32 max = part->size - sizeof(struct jffs2_raw_inode); |
714 | 848 | u32 counter = 0; |
715 | 849 | u32 counter4 = 0; |
716 | 850 | |
717 | 851 | |
718 | 852 | |
719 | 853 | |
720 | 854 | |
721 | 855 | |
722 | 856 | |
723 | 857 | |
724 | 858 | |
725 | 859 | |
... | ... | @@ -722,71 +856,52 @@ |
722 | 856 | /* lcd_off(); */ |
723 | 857 | |
724 | 858 | /* if we are building a list we need to refresh the cache. */ |
725 | - /* note that since we don't free our memory, eventually this will be bad. */ | |
726 | - /* but we're a bootldr so what the hell. */ | |
727 | 859 | jffs_init_1pass_list(part); |
728 | - pL=(struct b_lists *)part->jffs2_priv; | |
860 | + pL = (struct b_lists *)part->jffs2_priv; | |
729 | 861 | pL->partOffset = part->offset; |
730 | 862 | offset = 0; |
731 | 863 | printf("Scanning JFFS2 FS: "); |
732 | 864 | |
733 | 865 | /* start at the beginning of the partition */ |
734 | 866 | while (offset < max) { |
735 | - if (! (++counter%10000)) | |
736 | - printf("\b\b%c ", spinner[(counter / 10000) % 4]); | |
867 | + if ((oldoffset >> SPIN_BLKSIZE) != (offset >> SPIN_BLKSIZE)) { | |
868 | + printf("\b\b%c ", spinner[counter++ % sizeof(spinner)]); | |
869 | + oldoffset = offset; | |
870 | + } | |
737 | 871 | |
738 | 872 | node = (struct jffs2_unknown_node *) (part->offset + offset); |
739 | 873 | if (node->magic == JFFS2_MAGIC_BITMASK && hdr_crc(node)) { |
740 | 874 | /* if its a fragment add it */ |
741 | - if (node->nodetype == JFFS2_NODETYPE_INODE && inode_crc((struct jffs2_raw_inode *) node)) { | |
742 | - if (!(pL->fragListTail = add_node(pL->fragListTail, &(pL->fragListCount), | |
743 | - &(pL->fragListMemBase)))) { | |
744 | - putstr("add_node failed!\r\n"); | |
875 | + if (node->nodetype == JFFS2_NODETYPE_INODE && | |
876 | + inode_crc((struct jffs2_raw_inode *) node)) { | |
877 | + if (insert_node(&pL->frag, (u32) part->offset + | |
878 | + offset) == NULL) | |
745 | 879 | return 0; |
746 | - } | |
747 | - pL->fragListTail->offset = (u32) (part->offset + offset); | |
748 | - if (!pL->fragListHead) | |
749 | - pL->fragListHead = pL->fragListTail; | |
750 | 880 | } else if (node->nodetype == JFFS2_NODETYPE_DIRENT && |
751 | 881 | dirent_crc((struct jffs2_raw_dirent *) node) && |
752 | 882 | dirent_name_crc((struct jffs2_raw_dirent *) node)) { |
753 | 883 | if (! (counterN%100)) |
754 | 884 | printf("\b\b. "); |
755 | -#if 0 | |
756 | - printf("Found DIRENT @ 0x%lx\n", offset); | |
757 | - putstr("\r\nbuild_lists:p&l ->"); | |
758 | - putnstr(((struct jffs2_raw_dirent *) node)->name, ((struct jffs2_raw_dirent *) node)->nsize); | |
759 | - putstr("\r\n"); | |
760 | - putLabeledWord("\tpino = ", ((struct jffs2_raw_dirent *) node)->pino); | |
761 | - putLabeledWord("\tnsize = ", ((struct jffs2_raw_dirent *) node)->nsize); | |
762 | -#endif | |
763 | - | |
764 | - if (!(pL->dirListTail = add_node(pL->dirListTail, &(pL->dirListCount), &(pL->dirListMemBase)))) { | |
765 | - putstr("add_node failed!\r\n"); | |
885 | + if (insert_node(&pL->dir, (u32) part->offset + | |
886 | + offset) == NULL) | |
766 | 887 | return 0; |
767 | - } | |
768 | - pL->dirListTail->offset = (u32) (part->offset + offset); | |
769 | -#if 0 | |
770 | - putLabeledWord("\ttail = ", (u32) pL->dirListTail); | |
771 | - putstr("\ttailName ->"); | |
772 | - putnstr(((struct jffs2_raw_dirent *) (pL->dirListTail->offset))->name, | |
773 | - ((struct jffs2_raw_dirent *) (pL->dirListTail->offset))->nsize); | |
774 | - putstr("\r\n"); | |
775 | -#endif | |
776 | - if (!pL->dirListHead) | |
777 | - pL->dirListHead = pL->dirListTail; | |
778 | 888 | counterN++; |
779 | 889 | } else if (node->nodetype == JFFS2_NODETYPE_CLEANMARKER) { |
780 | 890 | if (node->totlen != sizeof(struct jffs2_unknown_node)) |
781 | - printf("OOPS Cleanmarker has bad size %d != %d\n", node->totlen, sizeof(struct jffs2_unknown_node)); | |
891 | + printf("OOPS Cleanmarker has bad size " | |
892 | + "%d != %d\n", node->totlen, | |
893 | + sizeof(struct jffs2_unknown_node)); | |
782 | 894 | } else { |
783 | - printf("Unknown node type: %x len %d offset 0x%x\n", node->nodetype, node->totlen, offset); | |
895 | + printf("Unknown node type: %x len %d " | |
896 | + "offset 0x%x\n", node->nodetype, | |
897 | + node->totlen, offset); | |
784 | 898 | } |
785 | 899 | offset += ((node->totlen + 3) & ~3); |
786 | 900 | counterF++; |
787 | - } else if (node->magic == JFFS2_EMPTY_BITMASK && node->nodetype == JFFS2_EMPTY_BITMASK) { | |
901 | + } else if (node->magic == JFFS2_EMPTY_BITMASK && | |
902 | + node->nodetype == JFFS2_EMPTY_BITMASK) { | |
788 | 903 | offset = jffs2_scan_empty(offset, part); |
789 | - } else { /* if we know nothing of the filesystem, we just step and look. */ | |
904 | + } else { /* if we know nothing, we just step and look. */ | |
790 | 905 | offset += 4; |
791 | 906 | counter4++; |
792 | 907 | } |
793 | 908 | |
794 | 909 | |
795 | 910 | |
... | ... | @@ -799,66 +914,21 @@ |
799 | 914 | /* splash(); */ |
800 | 915 | |
801 | 916 | #if 0 |
802 | - putLabeledWord("dir entries = ", pL->dirListCount); | |
803 | - putLabeledWord("frag entries = ", pL->fragListCount); | |
917 | + putLabeledWord("dir entries = ", pL->dir.listCount); | |
918 | + putLabeledWord("frag entries = ", pL->frag.listCount); | |
804 | 919 | putLabeledWord("+4 increments = ", counter4); |
805 | 920 | putLabeledWord("+file_offset increments = ", counterF); |
806 | 921 | |
807 | 922 | #endif |
808 | 923 | |
809 | -#undef SHOW_ALL | |
810 | -#undef SHOW_ALL_FRAGMENTS | |
924 | +#ifdef DEBUG_DIRENTS | |
925 | + dump_dirents(pL); | |
926 | +#endif | |
811 | 927 | |
812 | -#ifdef SHOW_ALL | |
813 | - { | |
814 | - struct b_node *b; | |
815 | - struct b_node *b2; | |
816 | - struct jffs2_raw_dirent *jDir; | |
817 | - struct jffs2_raw_inode *jNode; | |
928 | +#ifdef DEBUG_FRAGMENTS | |
929 | + dump_fragments(pL); | |
930 | +#endif | |
818 | 931 | |
819 | - putstr("\r\n\r\n******The directory Entries******\r\n"); | |
820 | - b = pL->dirListHead; | |
821 | - while (b) { | |
822 | - jDir = (struct jffs2_raw_dirent *) (b->offset); | |
823 | - putstr("\r\n"); | |
824 | - putnstr(jDir->name, jDir->nsize); | |
825 | - putLabeledWord("\r\n\tbuild_list: magic = ", jDir->magic); | |
826 | - putLabeledWord("\tbuild_list: nodetype = ", jDir->nodetype); | |
827 | - putLabeledWord("\tbuild_list: hdr_crc = ", jDir->hdr_crc); | |
828 | - putLabeledWord("\tbuild_list: pino = ", jDir->pino); | |
829 | - putLabeledWord("\tbuild_list: version = ", jDir->version); | |
830 | - putLabeledWord("\tbuild_list: ino = ", jDir->ino); | |
831 | - putLabeledWord("\tbuild_list: mctime = ", jDir->mctime); | |
832 | - putLabeledWord("\tbuild_list: nsize = ", jDir->nsize); | |
833 | - putLabeledWord("\tbuild_list: type = ", jDir->type); | |
834 | - putLabeledWord("\tbuild_list: node_crc = ", jDir->node_crc); | |
835 | - putLabeledWord("\tbuild_list: name_crc = ", jDir->name_crc); | |
836 | - b = b->next; | |
837 | - } | |
838 | - | |
839 | -#ifdef SHOW_ALL_FRAGMENTS | |
840 | - putstr("\r\n\r\n******The fragment Entries******\r\n"); | |
841 | - b = pL->fragListHead; | |
842 | - while (b) { | |
843 | - jNode = (struct jffs2_raw_inode *) (b->offset); | |
844 | - putLabeledWord("\r\n\tbuild_list: FLASH_OFFSET = ", b->offset); | |
845 | - putLabeledWord("\tbuild_list: totlen = ", jNode->totlen); | |
846 | - putLabeledWord("\tbuild_list: inode = ", jNode->ino); | |
847 | - putLabeledWord("\tbuild_list: version = ", jNode->version); | |
848 | - putLabeledWord("\tbuild_list: isize = ", jNode->isize); | |
849 | - putLabeledWord("\tbuild_list: atime = ", jNode->atime); | |
850 | - putLabeledWord("\tbuild_list: offset = ", jNode->offset); | |
851 | - putLabeledWord("\tbuild_list: csize = ", jNode->csize); | |
852 | - putLabeledWord("\tbuild_list: dsize = ", jNode->dsize); | |
853 | - putLabeledWord("\tbuild_list: compr = ", jNode->compr); | |
854 | - putLabeledWord("\tbuild_list: usercompr = ", jNode->usercompr); | |
855 | - putLabeledWord("\tbuild_list: flags = ", jNode->flags); | |
856 | - b = b->next; | |
857 | - } | |
858 | -#endif /* SHOW_ALL_FRAGMENTS */ | |
859 | - } | |
860 | - | |
861 | -#endif /* SHOW_ALL */ | |
862 | 932 | /* give visual feedback that we are done scanning the flash */ |
863 | 933 | led_blink(0x0, 0x0, 0x1, 0x1); /* off, forever, on 100ms, off 100ms */ |
864 | 934 | return 1; |
865 | 935 | |
... | ... | @@ -875,13 +945,13 @@ |
875 | 945 | struct jffs2_raw_inode *jNode; |
876 | 946 | int i; |
877 | 947 | |
878 | - b = pL->fragListHead; | |
879 | 948 | for (i = 0; i < JFFS2_NUM_COMPR; i++) { |
880 | 949 | piL->compr_info[i].num_frags = 0; |
881 | 950 | piL->compr_info[i].compr_sum = 0; |
882 | 951 | piL->compr_info[i].decompr_sum = 0; |
883 | 952 | } |
884 | 953 | |
954 | + b = pL->frag.listHead; | |
885 | 955 | while (b) { |
886 | 956 | jNode = (struct jffs2_raw_inode *) (b->offset); |
887 | 957 | if (jNode->compr < JFFS2_NUM_COMPR) { |
... | ... | @@ -917,7 +987,7 @@ |
917 | 987 | long ret = 0; |
918 | 988 | u32 inode; |
919 | 989 | |
920 | - if (! (pl = jffs2_get_list(part, "ls"))) | |
990 | + if (! (pl = jffs2_get_list(part, "ls"))) | |
921 | 991 | return 0; |
922 | 992 | |
923 | 993 | if (! (inode = jffs2_1pass_search_list_inodes(pl, fname, 1))) { |
... | ... | @@ -983,7 +1053,7 @@ |
983 | 1053 | return 0; |
984 | 1054 | |
985 | 1055 | jffs2_1pass_fill_info(pl, &info); |
986 | - for (i=0; i < JFFS2_NUM_COMPR; i++) { | |
1056 | + for (i = 0; i < JFFS2_NUM_COMPR; i++) { | |
987 | 1057 | printf("Compression: %s\n", compr_names[i]); |
988 | 1058 | printf("\tfrag count: %d\n", info.compr_info[i].num_frags); |
989 | 1059 | printf("\tcompressed sum: %d\n", info.compr_info[i].compr_sum); |
fs/jffs2/jffs2_private.h
... | ... | @@ -3,23 +3,31 @@ |
3 | 3 | |
4 | 4 | #include <jffs2/jffs2.h> |
5 | 5 | |
6 | + | |
6 | 7 | struct b_node { |
7 | 8 | u32 offset; |
8 | 9 | struct b_node *next; |
9 | 10 | }; |
10 | 11 | |
12 | +struct b_list { | |
13 | + struct b_node *listTail; | |
14 | + struct b_node *listHead; | |
15 | +#ifdef CFG_JFFS2_SORT_FRAGMENTS | |
16 | + struct b_node *listLast; | |
17 | + int (*listCompare)(struct b_node *new, struct b_node *node); | |
18 | + u32 listLoops; | |
19 | +#endif | |
20 | + u32 listCount; | |
21 | + struct mem_block *listMemBase; | |
22 | +}; | |
23 | + | |
11 | 24 | struct b_lists { |
12 | 25 | char *partOffset; |
13 | - struct b_node *dirListTail; | |
14 | - struct b_node *dirListHead; | |
15 | - u32 dirListCount; | |
16 | - u32 dirListMemBase; | |
17 | - struct b_node *fragListTail; | |
18 | - struct b_node *fragListHead; | |
19 | - u32 fragListCount; | |
20 | - u32 fragListMemBase; | |
26 | + struct b_list dir; | |
27 | + struct b_list frag; | |
21 | 28 | |
22 | 29 | }; |
30 | + | |
23 | 31 | struct b_compr_info { |
24 | 32 | u32 num_frags; |
25 | 33 | u32 compr_sum; |
26 | 34 | |
27 | 35 | |
... | ... | @@ -33,11 +41,14 @@ |
33 | 41 | static inline int |
34 | 42 | hdr_crc(struct jffs2_unknown_node *node) |
35 | 43 | { |
44 | +#if 1 | |
36 | 45 | u32 crc = crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); |
37 | - u32 crc_blah = crc32_no_comp(~0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); | |
46 | +#else | |
47 | + /* what's the semantics of this? why is this here? */ | |
48 | + u32 crc = crc32_no_comp(~0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); | |
38 | 49 | |
39 | - crc_blah ^= ~0; | |
40 | - | |
50 | + crc ^= ~0; | |
51 | +#endif | |
41 | 52 | if (node->hdr_crc != crc) { |
42 | 53 | return 0; |
43 | 54 | } else { |
include/asm-arm/global_data.h
... | ... | @@ -44,7 +44,6 @@ |
44 | 44 | #ifdef CONFIG_VFD |
45 | 45 | unsigned long fb_base; /* base address of frame buffer */ |
46 | 46 | unsigned char vfd_type; /* display type */ |
47 | - unsigned char vfd_inv_data; /* inverted data lines ? */ | |
48 | 47 | #endif |
49 | 48 | #if 0 |
50 | 49 | unsigned long cpu_clk; /* CPU clock in Hz! */ |
include/asm-arm/io.h
... | ... | @@ -71,22 +71,37 @@ |
71 | 71 | #include <asm/arch/io.h> |
72 | 72 | |
73 | 73 | /* |
74 | - * IO definitions. We define {out,in,outs,ins}[bwl] if __io is defined | |
75 | - * by the machine. Otherwise, these definitions are left for the machine | |
76 | - * specific header files to pick up. | |
74 | + * IO port access primitives | |
75 | + * ------------------------- | |
77 | 76 | * |
77 | + * The ARM doesn't have special IO access instructions; all IO is memory | |
78 | + * mapped. Note that these are defined to perform little endian accesses | |
79 | + * only. Their primary purpose is to access PCI and ISA peripherals. | |
80 | + * | |
81 | + * Note that for a big endian machine, this implies that the following | |
82 | + * big endian mode connectivity is in place, as described by numerious | |
83 | + * ARM documents: | |
84 | + * | |
85 | + * PCI: D0-D7 D8-D15 D16-D23 D24-D31 | |
86 | + * ARM: D24-D31 D16-D23 D8-D15 D0-D7 | |
87 | + * | |
88 | + * The machine specific io.h include defines __io to translate an "IO" | |
89 | + * address to a memory address. | |
90 | + * | |
78 | 91 | * Note that we prevent GCC re-ordering or caching values in expressions |
79 | 92 | * by introducing sequence points into the in*() definitions. Note that |
80 | 93 | * __raw_* do not guarantee this behaviour. |
94 | + * | |
95 | + * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space. | |
81 | 96 | */ |
82 | 97 | #ifdef __io |
83 | 98 | #define outb(v,p) __raw_writeb(v,__io(p)) |
84 | -#define outw(v,p) __raw_writew(v,__io(p)) | |
85 | -#define outl(v,p) __raw_writel(v,__io(p)) | |
99 | +#define outw(v,p) __raw_writew(cpu_to_le16(v),__io(p)) | |
100 | +#define outl(v,p) __raw_writel(cpu_to_le32(v),__io(p)) | |
86 | 101 | |
87 | -#define inb(p) ({ unsigned int __v = __raw_readb(__io(p)); __v; }) | |
88 | -#define inw(p) ({ unsigned int __v = __raw_readw(__io(p)); __v; }) | |
89 | -#define inl(p) ({ unsigned int __v = __raw_readl(__io(p)); __v; }) | |
102 | +#define inb(p) ({ unsigned int __v = __raw_readb(__io(p)); __v; }) | |
103 | +#define inw(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p))); __v; }) | |
104 | +#define inl(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p))); __v; }) | |
90 | 105 | |
91 | 106 | #define outsb(p,d,l) __raw_writesb(__io(p),d,l) |
92 | 107 | #define outsw(p,d,l) __raw_writesw(__io(p),d,l) |
93 | 108 | |
94 | 109 | |
95 | 110 | |
... | ... | @@ -171,20 +186,20 @@ |
171 | 186 | */ |
172 | 187 | #ifdef __mem_pci |
173 | 188 | |
174 | -#define readb(addr) ({ unsigned int __v = __raw_readb(__mem_pci(addr)); __v; }) | |
175 | -#define readw(addr) ({ unsigned int __v = __raw_readw(__mem_pci(addr)); __v; }) | |
176 | -#define readl(addr) ({ unsigned int __v = __raw_readl(__mem_pci(addr)); __v; }) | |
189 | +#define readb(c) ({ unsigned int __v = __raw_readb(__mem_pci(c)); __v; }) | |
190 | +#define readw(c) ({ unsigned int __v = le16_to_cpu(__raw_readw(__mem_pci(c))); __v; }) | |
191 | +#define readl(c) ({ unsigned int __v = le32_to_cpu(__raw_readl(__mem_pci(c))); __v; }) | |
177 | 192 | |
178 | -#define writeb(val,addr) __raw_writeb(val,__mem_pci(addr)) | |
179 | -#define writew(val,addr) __raw_writew(val,__mem_pci(addr)) | |
180 | -#define writel(val,addr) __raw_writel(val,__mem_pci(addr)) | |
193 | +#define writeb(v,c) __raw_writeb(v,__mem_pci(c)) | |
194 | +#define writew(v,c) __raw_writew(cpu_to_le16(v),__mem_pci(c)) | |
195 | +#define writel(v,c) __raw_writel(cpu_to_le32(v),__mem_pci(c)) | |
181 | 196 | |
182 | -#define memset_io(a,b,c) _memset_io(__mem_pci(a),(b),(c)) | |
183 | -#define memcpy_fromio(a,b,c) _memcpy_fromio((a),__mem_pci(b),(c)) | |
184 | -#define memcpy_toio(a,b,c) _memcpy_toio(__mem_pci(a),(b),(c)) | |
197 | +#define memset_io(c,v,l) _memset_io(__mem_pci(c),(v),(l)) | |
198 | +#define memcpy_fromio(a,c,l) _memcpy_fromio((a),__mem_pci(c),(l)) | |
199 | +#define memcpy_toio(c,a,l) _memcpy_toio(__mem_pci(c),(a),(l)) | |
185 | 200 | |
186 | -#define eth_io_copy_and_sum(a,b,c,d) \ | |
187 | - eth_copy_and_sum((a),__mem_pci(b),(c),(d)) | |
201 | +#define eth_io_copy_and_sum(s,c,l,b) \ | |
202 | + eth_copy_and_sum((s),__mem_pci(c),(l),(b)) | |
188 | 203 | |
189 | 204 | static inline int |
190 | 205 | check_signature(unsigned long io_addr, const unsigned char *signature, |
... | ... | @@ -219,14 +234,6 @@ |
219 | 234 | #endif /* __mem_pci */ |
220 | 235 | |
221 | 236 | /* |
222 | - * remap a physical address `phys' of size `size' with page protection `prot' | |
223 | - * into virtual address `from' | |
224 | - */ | |
225 | -#define io_remap_page_range(from,phys,size,prot) \ | |
226 | - remap_page_range(from,phys,size,prot) | |
227 | - | |
228 | - | |
229 | -/* | |
230 | 237 | * If this architecture has ISA IO, then define the isa_read/isa_write |
231 | 238 | * macros. |
232 | 239 | */ |
... | ... | @@ -244,6 +251,10 @@ |
244 | 251 | |
245 | 252 | #define isa_eth_io_copy_and_sum(a,b,c,d) \ |
246 | 253 | eth_copy_and_sum((a),__mem_isa(b),(c),(d)) |
254 | + | |
255 | +#ifndef PCI_MEMORY_VADDR /* XXX problem not understood -- wd */ | |
256 | +#define PCI_MEMORY_VADDR 0 | |
257 | +#endif /* XXX */ | |
247 | 258 | |
248 | 259 | static inline int |
249 | 260 | isa_check_signature(unsigned long io_addr, const unsigned char *signature, |
include/configs/innokom.h
... | ... | @@ -60,9 +60,9 @@ |
60 | 60 | #define CONFIG_ENV_OVERWRITE |
61 | 61 | |
62 | 62 | #define CONFIG_BAUDRATE 19200 |
63 | +#define CONFIG_MISC_INIT_R 1 /* we have a misc_init_r() function */ | |
63 | 64 | |
64 | -#define CONFIG_COMMANDS ((CONFIG_CMD_DFL | CFG_CMD_I2C | CFG_CMD_EEPROM) & ~CFG_CMD_NET) | |
65 | - | |
65 | +#define CONFIG_COMMANDS (CONFIG_CMD_DFL|CFG_CMD_I2C|CFG_CMD_EEPROM|CFG_CMD_NET|CFG_CMD_JFFS2|CFG_CMD_DHCP) | |
66 | 66 | /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ |
67 | 67 | #include <cmd_confdefs.h> |
68 | 68 | |
69 | 69 | |
70 | 70 | |
... | ... | @@ -90,13 +90,13 @@ |
90 | 90 | /* |
91 | 91 | * Size of malloc() pool; this lives below the uppermost 128 KiB which are |
92 | 92 | * used for the RAM copy of the uboot code |
93 | + * | |
93 | 94 | */ |
94 | -/* #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) */ | |
95 | -#define CFG_MALLOC_LEN (128*1024) | |
95 | +#define CFG_MALLOC_LEN (256*1024) | |
96 | 96 | |
97 | 97 | #define CFG_LONGHELP /* undef to save memory */ |
98 | 98 | #define CFG_PROMPT "uboot> " /* Monitor Command Prompt */ |
99 | -#define CFG_CBSIZE 128 /* Console I/O Buffer Size */ | |
99 | +#define CFG_CBSIZE 256 /* Console I/O Buffer Size */ | |
100 | 100 | #define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */ |
101 | 101 | #define CFG_MAXARGS 16 /* max number of command args */ |
102 | 102 | #define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ |
... | ... | @@ -106,10 +106,7 @@ |
106 | 106 | |
107 | 107 | #undef CFG_CLKS_IN_HZ /* everything, incl board info, in Hz */ |
108 | 108 | |
109 | -#define CFG_LOAD_ADDR 0xa7fe0000 /* default load address */ | |
110 | - /* RS: where is this documented? */ | |
111 | - /* RS: is this where U-Boot is */ | |
112 | - /* RS: relocated to in RAM? */ | |
109 | +#define CFG_LOAD_ADDR 0xa3000000 /* load kernel to this address */ | |
113 | 110 | |
114 | 111 | #define CFG_HZ 3686400 /* incrementer freq: 3.6864 MHz */ |
115 | 112 | /* RS: the oscillator is actually 3680130?? */ |
... | ... | @@ -128,9 +125,9 @@ |
128 | 125 | /* |
129 | 126 | * I2C bus |
130 | 127 | */ |
131 | -#define CONFIG_HARD_I2C 1 | |
132 | -#define CFG_I2C_SPEED 50000 | |
133 | -#define CFG_I2C_SLAVE 0xfe | |
128 | +#define CONFIG_HARD_I2C 1 | |
129 | +#define CFG_I2C_SPEED 50000 | |
130 | +#define CFG_I2C_SLAVE 0xfe | |
134 | 131 | |
135 | 132 | #define CFG_ENV_IS_IN_EEPROM 1 |
136 | 133 | |
137 | 134 | |
138 | 135 | |
... | ... | @@ -138,11 +135,22 @@ |
138 | 135 | #define CFG_ENV_SIZE 1024 /* 1 KiB */ |
139 | 136 | #define CFG_I2C_EEPROM_ADDR 0x50 /* A0 = 0 (hardwired) */ |
140 | 137 | #define CFG_EEPROM_PAGE_WRITE_BITS 5 /* 5 bits = 32 octets */ |
141 | -#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10 /* between stop and start */ | |
138 | +#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 15 /* between stop and start */ | |
142 | 139 | #define CFG_I2C_EEPROM_ADDR_LEN 2 /* length of address */ |
143 | 140 | #define CFG_EEPROM_SIZE 4096 /* size in bytes */ |
141 | +#define CFG_I2C_INIT_BOARD 1 /* board has it's own init */ | |
144 | 142 | |
145 | 143 | /* |
144 | + * SMSC91C111 Network Card | |
145 | + */ | |
146 | +#define CONFIG_DRIVER_SMC91111 1 | |
147 | +#define CONFIG_SMC91111_BASE 0x14000000 /* chip select 5 */ | |
148 | +#undef CONFIG_SMC_USE_32_BIT /* 16 bit bus access */ | |
149 | +#undef CONFIG_SMC_91111_EXT_PHY /* we use internal phy */ | |
150 | +#undef CONFIG_SHOW_ACTIVITY | |
151 | +#define CONFIG_NET_RETRY_COUNT 10 /* # of retries */ | |
152 | + | |
153 | +/* | |
146 | 154 | * Stack sizes |
147 | 155 | * |
148 | 156 | * The stack sizes are set up in start.S using the settings below |
149 | 157 | |
150 | 158 | |
151 | 159 | |
... | ... | @@ -168,11 +176,19 @@ |
168 | 176 | |
169 | 177 | #define CFG_FLASH_BASE PHYS_FLASH_1 |
170 | 178 | |
179 | + | |
171 | 180 | /* |
172 | - * GPIO settings; | |
181 | + * JFFS2 Partitions | |
173 | 182 | */ |
183 | +#define CFG_JFFS_CUSTOM_PART 1 /* see board/innokom/flash.c */ | |
184 | +#define CONFIG_MTD_INNOKOM_16MB 1 /* development flash */ | |
185 | +#undef CONFIG_MTD_INNOKOM_64MB /* production flash */ | |
174 | 186 | |
175 | -/* GP15 == nCS1 is 1 | |
187 | + | |
188 | +/* | |
189 | + * GPIO settings; see BDI2000 config file for details | |
190 | + * | |
191 | + * GP15 == nCS1 is 1 | |
176 | 192 | * GP24 == SFRM is 1 |
177 | 193 | * GP25 == TXD is 1 |
178 | 194 | * GP33 == nCS5 is 1 |
... | ... | @@ -273,6 +289,7 @@ |
273 | 289 | #define CFG_GAFR2_L_VAL 0xA0000000 |
274 | 290 | #define CFG_GAFR2_U_VAL 0x00000002 |
275 | 291 | |
292 | + | |
276 | 293 | /* FIXME: set GPIO_RER/FER */ |
277 | 294 | |
278 | 295 | /* RDH = 1 |
... | ... | @@ -285,9 +302,8 @@ |
285 | 302 | |
286 | 303 | /* |
287 | 304 | * Memory settings |
288 | - */ | |
289 | - | |
290 | -/* This is the configuration for nCS0/1 -> flash banks | |
305 | + * | |
306 | + * This is the configuration for nCS0/1 -> flash banks | |
291 | 307 | * configuration for nCS1: |
292 | 308 | * [31] 0 - Slower Device |
293 | 309 | * [30:28] 010 - CS deselect to CS time: 2*(2*MemClk) = 40 ns |
... | ... | @@ -321,7 +337,7 @@ |
321 | 337 | * [03] 1 - 16 Bit bus width |
322 | 338 | * [02:00] 100 - variable latency I/O |
323 | 339 | */ |
324 | -#define CFG_MSC1_VAL 0x132C593C /* TDM switch, DSP */ | |
340 | +#define CFG_MSC1_VAL 0x123C593C /* TDM switch, DSP */ | |
325 | 341 | |
326 | 342 | /* This is the configuration for nCS4/5 -> ExtBus, LAN Controller |
327 | 343 | * |
... | ... | @@ -340,7 +356,7 @@ |
340 | 356 | * [03] 1 - 16 Bit bus width |
341 | 357 | * [02:00] 100 - variable latency I/O |
342 | 358 | */ |
343 | -#define CFG_MSC2_VAL 0x132C6CDC /* extra bus, LAN controller */ | |
359 | +#define CFG_MSC2_VAL 0x123C6CDC /* extra bus, LAN controller */ | |
344 | 360 | |
345 | 361 | /* MDCNFG: SDRAM Configuration Register |
346 | 362 | * |
347 | 363 | |
348 | 364 | |
... | ... | @@ -359,16 +375,15 @@ |
359 | 375 | * [12] 1 - SA1111 compatiblity mode |
360 | 376 | * [11] 1 - latch return data with return clock |
361 | 377 | * [10] 0 - no alternate addressing for pair 0/1 |
362 | - * [09:08] 01 - tRP=2*MemClk; CL=2; tRCD=2*MemClk; tRAS=5*MemClk; tRC=8*MemClk | |
378 | + * [09:08] 01 - tRP=2*MemClk CL=2 tRCD=2*MemClk tRAS=5*MemClk tRC=8*MemClk | |
363 | 379 | * [7] 1 - 4 internal banks in lower partition pair |
364 | 380 | * [06:05] 10 - 13 row address bits for partition 0/1 |
365 | 381 | * [04:03] 01 - 9 column address bits for partition 0/1 |
366 | 382 | * [02] 0 - SDRAM partition 0/1 width is 32 bit |
367 | 383 | * [01] 0 - disable SDRAM partition 1 |
368 | 384 | * [00] 1 - enable SDRAM partition 0 |
369 | - * | |
370 | - * use the configuration above but disable partition 0 | |
371 | 385 | */ |
386 | +/* use the configuration above but disable partition 0 */ | |
372 | 387 | #define CFG_MDCNFG_VAL 0x000019c8 |
373 | 388 | |
374 | 389 | /* MDREFR: SDRAM Refresh Control Register |
... | ... | @@ -433,13 +448,6 @@ |
433 | 448 | /* timeout values are in ticks */ |
434 | 449 | #define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */ |
435 | 450 | #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ |
436 | - | |
437 | -#if 0 | |
438 | -#define CFG_ENV_IS_IN_FLASH 1 | |
439 | -#define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x1C000) | |
440 | - /* Addr of Environment Sector */ | |
441 | -#define CFG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */ | |
442 | -#endif | |
443 | 451 | |
444 | 452 | #endif /* __CONFIG_H */ |
include/i2c.h
... | ... | @@ -51,6 +51,9 @@ |
51 | 51 | * repeatedly to change the speed and slave addresses. |
52 | 52 | */ |
53 | 53 | void i2c_init(int speed, int slaveaddr); |
54 | +#ifdef CFG_I2C_INIT_BOARD | |
55 | +void i2c_init_board(void); | |
56 | +#endif | |
54 | 57 | |
55 | 58 | /* |
56 | 59 | * Probe the given I2C chip address. Returns 0 if a chip responded, |