Commit 5779d8d985d95104ad74332f5fa3cb6c67645509
1 parent
8bf3b005dd
Exists in
master
and in
54 other branches
* Patch by Nicolas Lacressonnière, 12 Nov 2003:
update for for Atmel AT91RM9200DK development kit: - support for environment variables in DataFlash - Atmel DataFlash AT45DB1282 support * Patch by Jeff Carr, 11 Nov 2003: add support for new version of 8270 processors * Patches by George G. Davis, 05 Nov 2003: - only pass the ARM linux initrd tag to the kernel when an initrd is actually present - update omap1510inn configuration file
Showing 16 changed files with 652 additions and 271 deletions Side-by-side Diff
- CHANGELOG
- README
- common/Makefile
- common/cmd_flash.c
- common/cmd_mem.c
- common/cmd_nvedit.c
- common/env_dataflash.c
- cpu/at91rm9200/at45.c
- cpu/mpc8260/cpu.c
- cpu/mpc8260/speed.c
- drivers/dataflash.c
- include/asm-ppc/processor.h
- include/configs/at91rm9200dk.h
- include/configs/omap1510inn.h
- include/dataflash.h
- lib_arm/armlinux.c
CHANGELOG
... | ... | @@ -2,6 +2,19 @@ |
2 | 2 | Changes since U-Boot 1.0.0: |
3 | 3 | ====================================================================== |
4 | 4 | |
5 | +* Patch by Nicolas Lacressonnière, 12 Nov 2003: | |
6 | + update for for Atmel AT91RM9200DK development kit: | |
7 | + - support for environment variables in DataFlash | |
8 | + - Atmel DataFlash AT45DB1282 support | |
9 | + | |
10 | +* Patch by Jeff Carr, 11 Nov 2003: | |
11 | + add support for new version of 8270 processors | |
12 | + | |
13 | +* Patches by George G. Davis, 05 Nov 2003: | |
14 | + - only pass the ARM linux initrd tag to the kernel when an initrd | |
15 | + is actually present | |
16 | + - update omap1510inn configuration file | |
17 | + | |
5 | 18 | * Patches by Stephan Linz, 3 Nov 2003: |
6 | 19 | - more endianess fixes for LAN91C111 driver |
7 | 20 | - CFG_HZ configuration patch for NIOS Cyclone board |
README
... | ... | @@ -1760,6 +1760,20 @@ |
1760 | 1760 | The size in bytes of the EEPROM device. |
1761 | 1761 | |
1762 | 1762 | |
1763 | +- CFG_ENV_IS_IN_DATAFLASH: | |
1764 | + | |
1765 | + Define this if you have a DataFlash memory device which you | |
1766 | + want to use for the environment. | |
1767 | + | |
1768 | + - CFG_ENV_OFFSET: | |
1769 | + - CFG_ENV_ADDR: | |
1770 | + - CFG_ENV_SIZE: | |
1771 | + | |
1772 | + These three #defines specify the offset and size of the | |
1773 | + environment area within the total memory of your DataFlash placed | |
1774 | + at the specified address. | |
1775 | + | |
1776 | + | |
1763 | 1777 | - CFG_SPI_INIT_OFFSET |
1764 | 1778 | |
1765 | 1779 | Defines offset to the initial SPI buffer area in DPRAM. The |
common/Makefile
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | cmd_reginfo.o cmd_scsi.o cmd_spi.o cmd_usb.o cmd_vfd.o \ |
43 | 43 | command.o console.o devices.o dlmalloc.o docecc.o \ |
44 | 44 | environment.o env_common.o \ |
45 | - env_flash.o env_eeprom.o env_nvram.o env_nowhere.o exports.o \ | |
45 | + env_dataflash.o env_flash.o env_eeprom.o env_nvram.o env_nowhere.o exports.o \ | |
46 | 46 | flash.o fpga.o \ |
47 | 47 | hush.o kgdb.o lists.o lynxkdi.o miiphybb.o miiphyutil.o \ |
48 | 48 | s_record.o soft_i2c.o soft_spi.o spartan2.o \ |
common/cmd_flash.c
... | ... | @@ -307,7 +307,9 @@ |
307 | 307 | ulong bank, addr_first, addr_last; |
308 | 308 | int i, p, n, sect_first, sect_last; |
309 | 309 | int rcode = 0; |
310 | - | |
310 | +#ifdef CONFIG_HAS_DATAFLASH | |
311 | + int status; | |
312 | +#endif | |
311 | 313 | if (argc < 3) { |
312 | 314 | printf ("Usage:\n%s\n", cmdtp->usage); |
313 | 315 | return 1; |
... | ... | @@ -322,6 +324,24 @@ |
322 | 324 | return 1; |
323 | 325 | } |
324 | 326 | |
327 | +#ifdef CONFIG_HAS_DATAFLASH | |
328 | + if ((strcmp(argv[2], "all") != 0) && (strcmp(argv[2], "bank") != 0)) { | |
329 | + addr_first = simple_strtoul(argv[2], NULL, 16); | |
330 | + addr_last = simple_strtoul(argv[3], NULL, 16); | |
331 | + | |
332 | + if (addr_dataflash(addr_first) && addr_dataflash(addr_last)) { | |
333 | + status = dataflash_real_protect(p,addr_first,addr_last); | |
334 | + if (status < 0){ | |
335 | + printf("Bad DataFlash sector specification\n"); | |
336 | + return 1; | |
337 | + } | |
338 | + printf("%sProtect %d DataFlash Sectors\n", | |
339 | + p ? "" : "Un-", status); | |
340 | + return 0; | |
341 | + } | |
342 | + } | |
343 | +#endif | |
344 | + | |
325 | 345 | if (strcmp(argv[2], "all") == 0) { |
326 | 346 | for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) { |
327 | 347 | info = &flash_info[bank-1]; |
common/cmd_mem.c
... | ... | @@ -136,13 +136,19 @@ |
136 | 136 | uint *uip = (uint *)linebuf; |
137 | 137 | ushort *usp = (ushort *)linebuf; |
138 | 138 | u_char *ucp = (u_char *)linebuf; |
139 | - | |
139 | +#ifdef CONFIG_HAS_DATAFLASH | |
140 | + int rc; | |
141 | +#endif | |
140 | 142 | printf("%08lx:", addr); |
141 | 143 | linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes; |
142 | 144 | |
143 | 145 | #ifdef CONFIG_HAS_DATAFLASH |
144 | - if (read_dataflash(addr, (linebytes/size)*size, linebuf) != -1){ | |
145 | - | |
146 | + if ((rc = read_dataflash(addr, (linebytes/size)*size, linebuf)) == DATAFLASH_OK){ | |
147 | + /* if outside dataflash */ | |
148 | + /*if (rc != 1) { | |
149 | + dataflash_perror (rc); | |
150 | + return (1); | |
151 | + }*/ | |
146 | 152 | for (i=0; i<linebytes; i+= size) { |
147 | 153 | if (size == 4) { |
148 | 154 | printf(" %08x", *uip++); |
... | ... | @@ -430,7 +436,12 @@ |
430 | 436 | |
431 | 437 | /* Check if we are copying from DataFlash to RAM */ |
432 | 438 | if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){ |
433 | - read_dataflash(addr, count * size, (char *) dest); | |
439 | + int rc; | |
440 | + rc = read_dataflash(addr, count * size, (char *) dest); | |
441 | + if (rc != 1) { | |
442 | + dataflash_perror (rc); | |
443 | + return (1); | |
444 | + } | |
434 | 445 | return 0; |
435 | 446 | } |
436 | 447 |
common/cmd_nvedit.c
... | ... | @@ -49,8 +49,12 @@ |
49 | 49 | #include <net.h> |
50 | 50 | #endif |
51 | 51 | |
52 | -#if !defined(CFG_ENV_IS_IN_NVRAM) && !defined(CFG_ENV_IS_IN_EEPROM) && !defined(CFG_ENV_IS_IN_FLASH) && !defined(CFG_ENV_IS_NOWHERE) | |
53 | -# error Define one of CFG_ENV_IS_IN_NVRAM, CFG_ENV_IS_IN_EEPROM, CFG_ENV_IS_IN_FLASH, CFG_ENV_IS_NOWHERE | |
52 | +#if !defined(CFG_ENV_IS_IN_NVRAM) && \ | |
53 | + !defined(CFG_ENV_IS_IN_EEPROM) && \ | |
54 | + !defined(CFG_ENV_IS_IN_FLASH) && \ | |
55 | + !defined(CFG_ENV_IS_IN_DATAFLASH) && \ | |
56 | + !defined(CFG_ENV_IS_NOWHERE) | |
57 | +# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|NOWHERE} | |
54 | 58 | #endif |
55 | 59 | |
56 | 60 | #define XMK_STR(x) #x |
common/env_dataflash.c
1 | +/* LowLevel function for DataFlash environment support | |
2 | + * Author : Gilles Gastaldi (Atmel) | |
3 | + * | |
4 | + * This program is free software; you can redistribute it and/or | |
5 | + * modify it under the terms of the GNU General Public License as | |
6 | + * published by the Free Software Foundation; either version 2 of | |
7 | + * the License, or (at your option) any later version. | |
8 | + * | |
9 | + * This program is distributed in the hope that it will be useful, | |
10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | + * GNU General Public License for more details. | |
13 | + * | |
14 | + * You should have received a copy of the GNU General Public License | |
15 | + * along with this program; if not, write to the Free Software | |
16 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
17 | + * MA 02111-1307 USA | |
18 | + * | |
19 | + */ | |
20 | +#include <common.h> | |
21 | + | |
22 | +#if defined(CFG_ENV_IS_IN_DATAFLASH) /* Environment is in DataFlash */ | |
23 | + | |
24 | +#include <command.h> | |
25 | +#include <environment.h> | |
26 | +#include <linux/stddef.h> | |
27 | +#include <malloc.h> | |
28 | +#include <dataflash.h> | |
29 | + | |
30 | +env_t *env_ptr = NULL; | |
31 | + | |
32 | +char * env_name_spec = "dataflash"; | |
33 | + | |
34 | +extern int read_dataflash (unsigned long addr, unsigned long size, char | |
35 | +*result); | |
36 | +extern int write_dataflash (unsigned long addr_dest, unsigned long addr_src, | |
37 | + unsigned long size); | |
38 | +extern int AT91F_DataflashInit (void); | |
39 | +extern uchar default_environment[]; | |
40 | +/* extern int default_environment_size; */ | |
41 | + | |
42 | + | |
43 | +uchar env_get_char_spec (int index) | |
44 | +{ | |
45 | + uchar c; | |
46 | + read_dataflash (CFG_ENV_ADDR+index+offsetof(env_t,data),1,&c); | |
47 | + return (c); | |
48 | +} | |
49 | + | |
50 | +void env_relocate_spec (void) | |
51 | +{ | |
52 | + read_dataflash (CFG_ENV_ADDR,CFG_ENV_SIZE,(uchar *)env_ptr); | |
53 | +} | |
54 | + | |
55 | +int saveenv(void) | |
56 | +{ | |
57 | +/* env must be copied to do not alter env structure in memory*/ | |
58 | +unsigned char temp[CFG_ENV_SIZE]; | |
59 | +int i; | |
60 | + memcpy(temp, env_ptr, CFG_ENV_SIZE); | |
61 | + return write_dataflash (CFG_ENV_ADDR, (unsigned long)temp, CFG_ENV_SIZE); | |
62 | +} | |
63 | + | |
64 | +/************************************************************************ | |
65 | + * Initialize Environment use | |
66 | + * | |
67 | + * We are still running from ROM, so data use is limited | |
68 | + * Use a (moderately small) buffer on the stack | |
69 | + */ | |
70 | +int env_init(void) | |
71 | +{ | |
72 | + DECLARE_GLOBAL_DATA_PTR; | |
73 | + | |
74 | + ulong crc, len, new; | |
75 | + unsigned off; | |
76 | + uchar buf[64]; | |
77 | + if (gd->env_valid == 0){ | |
78 | + AT91F_DataflashInit(); /* prepare for DATAFLASH read/write */ | |
79 | + | |
80 | + /* read old CRC */ | |
81 | + read_dataflash (CFG_ENV_ADDR+offsetof(env_t,crc),sizeof(ulong),&crc); | |
82 | + new = 0; | |
83 | + len = ENV_SIZE; | |
84 | + off = offsetof(env_t,data); | |
85 | + while (len > 0) { | |
86 | + int n = (len > sizeof(buf)) ? sizeof(buf) : len; | |
87 | + read_dataflash (CFG_ENV_ADDR+off,n , buf); | |
88 | + new = crc32 (new, buf, n); | |
89 | + len -= n; | |
90 | + off += n; | |
91 | + } | |
92 | + if (crc == new) { | |
93 | + gd->env_addr = offsetof(env_t,data); | |
94 | + gd->env_valid = 1; | |
95 | + } else { | |
96 | + gd->env_addr = (ulong)&default_environment[0]; | |
97 | + gd->env_valid = 0; | |
98 | + } | |
99 | + } | |
100 | + | |
101 | + return (0); | |
102 | +} | |
103 | + | |
104 | +#endif /* CFG_ENV_IS_IN_DATAFLASH */ |
cpu/at91rm9200/at45.c
... | ... | @@ -26,6 +26,7 @@ |
26 | 26 | #include <dataflash.h> |
27 | 27 | |
28 | 28 | #define SPI_CLK 5000000 |
29 | +#define AT91C_TIMEOUT_WRDY 200000 | |
29 | 30 | #define AT91C_SPI_PCS0_SERIAL_DATAFLASH 0xE /* Chip Select 0 : NPCS0 %1110 */ |
30 | 31 | #define AT91C_SPI_PCS3_DATAFLASH_CARD 0x7 /* Chip Select 3 : NPCS3 %0111 */ |
31 | 32 | |
... | ... | @@ -145,10 +146,17 @@ |
145 | 146 | |
146 | 147 | /* fill the command buffer */ |
147 | 148 | pDataFlash->pDataFlashDesc->command[0] = OpCode; |
148 | - pDataFlash->pDataFlashDesc->command[1] = (unsigned char)((adr & 0x00FF0000) >> 16); | |
149 | - pDataFlash->pDataFlashDesc->command[2] = (unsigned char)((adr & 0x0000FF00) >> 8); | |
150 | - pDataFlash->pDataFlashDesc->command[3] = (unsigned char)(adr & 0x000000FF) ; | |
151 | - pDataFlash->pDataFlashDesc->command[4] = 0; | |
149 | + if (pDataFlash->pDevice->pages_number >= 16384) { | |
150 | + pDataFlash->pDataFlashDesc->command[1] = (unsigned char)((adr & 0x0F000000) >> 24); | |
151 | + pDataFlash->pDataFlashDesc->command[2] = (unsigned char)((adr & 0x00FF0000) >> 16); | |
152 | + pDataFlash->pDataFlashDesc->command[3] = (unsigned char)((adr & 0x0000FF00) >> 8); | |
153 | + pDataFlash->pDataFlashDesc->command[4] = (unsigned char)(adr & 0x000000FF); | |
154 | + } else { | |
155 | + pDataFlash->pDataFlashDesc->command[1] = (unsigned char)((adr & 0x00FF0000) >> 16); | |
156 | + pDataFlash->pDataFlashDesc->command[2] = (unsigned char)((adr & 0x0000FF00) >> 8); | |
157 | + pDataFlash->pDataFlashDesc->command[3] = (unsigned char)(adr & 0x000000FF) ; | |
158 | + pDataFlash->pDataFlashDesc->command[4] = 0; | |
159 | + } | |
152 | 160 | pDataFlash->pDataFlashDesc->command[5] = 0; |
153 | 161 | pDataFlash->pDataFlashDesc->command[6] = 0; |
154 | 162 | pDataFlash->pDataFlashDesc->command[7] = 0; |
... | ... | @@ -205,8 +213,7 @@ |
205 | 213 | do { |
206 | 214 | AT91F_DataFlashGetStatus(pDataFlashDesc); |
207 | 215 | timeout--; |
208 | - } | |
209 | - while( ((pDataFlashDesc->DataFlash_state & 0x80) != 0x80) && (timeout > 0) ); | |
216 | + } while( ((pDataFlashDesc->DataFlash_state & 0x80) != 0x80) && (timeout > 0) ); | |
210 | 217 | |
211 | 218 | if((pDataFlashDesc->DataFlash_state & 0x80) != 0x80) |
212 | 219 | return DATAFLASH_ERROR; |
... | ... | @@ -230,6 +237,7 @@ |
230 | 237 | unsigned char *dataBuffer, |
231 | 238 | int sizeToRead ) |
232 | 239 | { |
240 | + AT91S_DataFlashStatus status; | |
233 | 241 | /* Test the size to read in the device */ |
234 | 242 | if ( (src + sizeToRead) > (pDataFlash->pDevice->pages_size * (pDataFlash->pDevice->pages_number))) |
235 | 243 | return DATAFLASH_MEMORY_OVERFLOW; |
236 | 244 | |
... | ... | @@ -239,8 +247,9 @@ |
239 | 247 | pDataFlash->pDataFlashDesc->tx_data_pt = dataBuffer; |
240 | 248 | pDataFlash->pDataFlashDesc->tx_data_size = sizeToRead; |
241 | 249 | |
250 | + status = AT91F_DataFlashSendCommand (pDataFlash, DB_CONTINUOUS_ARRAY_READ, 8, src); | |
242 | 251 | /* Send the command to the dataflash */ |
243 | - return(AT91F_DataFlashSendCommand (pDataFlash, DB_CONTINUOUS_ARRAY_READ, 8, src)); | |
252 | + return(status); | |
244 | 253 | } |
245 | 254 | |
246 | 255 | |
247 | 256 | |
248 | 257 | |
... | ... | @@ -259,13 +268,17 @@ |
259 | 268 | unsigned int dest, |
260 | 269 | unsigned int SizeToWrite) |
261 | 270 | { |
271 | + int cmdsize; | |
262 | 272 | pDataFlash->pDataFlashDesc->tx_data_pt = src ; |
263 | 273 | pDataFlash->pDataFlashDesc->tx_data_size = SizeToWrite ; |
264 | 274 | pDataFlash->pDataFlashDesc->rx_data_pt = src; |
265 | 275 | pDataFlash->pDataFlashDesc->rx_data_size = SizeToWrite; |
266 | 276 | |
277 | + cmdsize = 4; | |
267 | 278 | /* Send the command to the dataflash */ |
268 | - return(AT91F_DataFlashSendCommand (pDataFlash, DB_PAGE_PGM_BUF1, 4, dest)); | |
279 | + if (pDataFlash->pDevice->pages_number >= 16384) | |
280 | + cmdsize = 5; | |
281 | + return(AT91F_DataFlashSendCommand (pDataFlash, DB_PAGE_PGM_BUF1, cmdsize, dest)); | |
269 | 282 | } |
270 | 283 | |
271 | 284 | |
272 | 285 | |
... | ... | @@ -282,14 +295,17 @@ |
282 | 295 | unsigned char BufferCommand, |
283 | 296 | unsigned int page) |
284 | 297 | { |
298 | + int cmdsize; | |
285 | 299 | /* Test if the buffer command is legal */ |
286 | 300 | if ((BufferCommand != DB_PAGE_2_BUF1_TRF) && (BufferCommand != DB_PAGE_2_BUF2_TRF)) |
287 | 301 | return DATAFLASH_BAD_COMMAND; |
288 | 302 | |
289 | 303 | /* no data to transmit or receive */ |
290 | 304 | pDataFlash->pDataFlashDesc->tx_data_size = 0; |
291 | - | |
292 | - return(AT91F_DataFlashSendCommand (pDataFlash, BufferCommand, 4, page*pDataFlash->pDevice->pages_size)); | |
305 | + cmdsize = 4; | |
306 | + if (pDataFlash->pDevice->pages_number >= 16384) | |
307 | + cmdsize = 5; | |
308 | + return(AT91F_DataFlashSendCommand (pDataFlash, BufferCommand, cmdsize, page*pDataFlash->pDevice->pages_size)); | |
293 | 309 | } |
294 | 310 | |
295 | 311 | |
... | ... | @@ -310,6 +326,7 @@ |
310 | 326 | unsigned int bufferAddress, |
311 | 327 | int SizeToWrite ) |
312 | 328 | { |
329 | + int cmdsize; | |
313 | 330 | /* Test if the buffer command is legal */ |
314 | 331 | if ((BufferCommand != DB_BUF1_WRITE) && (BufferCommand != DB_BUF2_WRITE)) |
315 | 332 | return DATAFLASH_BAD_COMMAND; |
316 | 333 | |
317 | 334 | |
318 | 335 | |
... | ... | @@ -324,14 +341,22 @@ |
324 | 341 | /* Send first Write Command */ |
325 | 342 | pDataFlash->pDataFlashDesc->command[0] = BufferCommand; |
326 | 343 | pDataFlash->pDataFlashDesc->command[1] = 0; |
327 | - pDataFlash->pDataFlashDesc->command[2] = (unsigned char)(((unsigned int)(bufferAddress & pDataFlash->pDevice->byte_mask)) >> 8) ; | |
328 | - pDataFlash->pDataFlashDesc->command[3] = (unsigned char)((unsigned int)bufferAddress & 0x00FF) ; | |
344 | + if (pDataFlash->pDevice->pages_number >= 16384) { | |
345 | + pDataFlash->pDataFlashDesc->command[2] = 0; | |
346 | + pDataFlash->pDataFlashDesc->command[3] = (unsigned char)(((unsigned int)(bufferAddress & pDataFlash->pDevice->byte_mask)) >> 8) ; | |
347 | + pDataFlash->pDataFlashDesc->command[4] = (unsigned char)((unsigned int)bufferAddress & 0x00FF) ; | |
348 | + cmdsize = 5; | |
349 | + } else { | |
350 | + pDataFlash->pDataFlashDesc->command[2] = (unsigned char)(((unsigned int)(bufferAddress & pDataFlash->pDevice->byte_mask)) >> 8) ; | |
351 | + pDataFlash->pDataFlashDesc->command[3] = (unsigned char)((unsigned int)bufferAddress & 0x00FF) ; | |
352 | + pDataFlash->pDataFlashDesc->command[4] = 0; | |
353 | + cmdsize = 4; | |
354 | + } | |
329 | 355 | |
330 | - | |
331 | 356 | pDataFlash->pDataFlashDesc->tx_cmd_pt = pDataFlash->pDataFlashDesc->command ; |
332 | - pDataFlash->pDataFlashDesc->tx_cmd_size = 4 ; | |
357 | + pDataFlash->pDataFlashDesc->tx_cmd_size = cmdsize ; | |
333 | 358 | pDataFlash->pDataFlashDesc->rx_cmd_pt = pDataFlash->pDataFlashDesc->command ; |
334 | - pDataFlash->pDataFlashDesc->rx_cmd_size = 4 ; | |
359 | + pDataFlash->pDataFlashDesc->rx_cmd_size = cmdsize ; | |
335 | 360 | |
336 | 361 | pDataFlash->pDataFlashDesc->rx_data_pt = dataBuffer ; |
337 | 362 | pDataFlash->pDataFlashDesc->tx_data_pt = dataBuffer ; |
338 | 363 | |
339 | 364 | |
... | ... | @@ -341,8 +366,53 @@ |
341 | 366 | return AT91F_SpiWrite(pDataFlash->pDataFlashDesc); |
342 | 367 | } |
343 | 368 | |
369 | +/*------------------------------------------------------------------------------*/ | |
370 | +/* Function Name : AT91F_PageErase */ | |
371 | +/* Object : Erase a page */ | |
372 | +/* Input Parameters : DataFlash Service */ | |
373 | +/* : Page concerned */ | |
374 | +/* : */ | |
375 | +/* Return value : State of the dataflash */ | |
376 | +/*------------------------------------------------------------------------------*/ | |
377 | +AT91S_DataFlashStatus AT91F_PageErase( | |
378 | + AT91PS_DataFlash pDataFlash, | |
379 | + unsigned int page) | |
380 | +{ | |
381 | + int cmdsize; | |
382 | + /* Test if the buffer command is legal */ | |
383 | + /* no data to transmit or receive */ | |
384 | + pDataFlash->pDataFlashDesc->tx_data_size = 0; | |
344 | 385 | |
386 | + cmdsize = 4; | |
387 | + if (pDataFlash->pDevice->pages_number >= 16384) | |
388 | + cmdsize = 5; | |
389 | + return(AT91F_DataFlashSendCommand (pDataFlash, DB_PAGE_ERASE, cmdsize, page*pDataFlash->pDevice->pages_size)); | |
390 | +} | |
391 | + | |
392 | + | |
345 | 393 | /*------------------------------------------------------------------------------*/ |
394 | +/* Function Name : AT91F_BlockErase */ | |
395 | +/* Object : Erase a Block */ | |
396 | +/* Input Parameters : DataFlash Service */ | |
397 | +/* : Page concerned */ | |
398 | +/* : */ | |
399 | +/* Return value : State of the dataflash */ | |
400 | +/*------------------------------------------------------------------------------*/ | |
401 | +AT91S_DataFlashStatus AT91F_BlockErase( | |
402 | + AT91PS_DataFlash pDataFlash, | |
403 | + unsigned int block) | |
404 | +{ | |
405 | + int cmdsize; | |
406 | + /* Test if the buffer command is legal */ | |
407 | + /* no data to transmit or receive */ | |
408 | + pDataFlash->pDataFlashDesc->tx_data_size = 0; | |
409 | + cmdsize = 4; | |
410 | + if (pDataFlash->pDevice->pages_number >= 16384) | |
411 | + cmdsize = 5; | |
412 | + return(AT91F_DataFlashSendCommand (pDataFlash, DB_BLOCK_ERASE,cmdsize, block*8*pDataFlash->pDevice->pages_size)); | |
413 | +} | |
414 | + | |
415 | +/*------------------------------------------------------------------------------*/ | |
346 | 416 | /* Function Name : AT91F_WriteBufferToMain */ |
347 | 417 | /* Object : Write buffer to the main memory */ |
348 | 418 | /* Input Parameters : DataFlash Service */ |
... | ... | @@ -355,6 +425,7 @@ |
355 | 425 | unsigned char BufferCommand, |
356 | 426 | unsigned int dest ) |
357 | 427 | { |
428 | + int cmdsize; | |
358 | 429 | /* Test if the buffer command is correct */ |
359 | 430 | if ((BufferCommand != DB_BUF1_PAGE_PGM) && |
360 | 431 | (BufferCommand != DB_BUF1_PAGE_ERASE_PGM) && |
361 | 432 | |
... | ... | @@ -365,8 +436,11 @@ |
365 | 436 | /* no data to transmit or receive */ |
366 | 437 | pDataFlash->pDataFlashDesc->tx_data_size = 0; |
367 | 438 | |
439 | + cmdsize = 4; | |
440 | + if (pDataFlash->pDevice->pages_number >= 16384) | |
441 | + cmdsize = 5; | |
368 | 442 | /* Send the command to the dataflash */ |
369 | - return(AT91F_DataFlashSendCommand (pDataFlash, BufferCommand, 4, dest)); | |
443 | + return(AT91F_DataFlashSendCommand (pDataFlash, BufferCommand, cmdsize, dest)); | |
370 | 444 | } |
371 | 445 | |
372 | 446 | |
373 | 447 | |
374 | 448 | |
375 | 449 | |
... | ... | @@ -391,18 +465,26 @@ |
391 | 465 | |
392 | 466 | /* Read the contents of the page in the Sram Buffer */ |
393 | 467 | AT91F_MainMemoryToBufferTransfert(pDataFlash, DB_PAGE_2_BUF1_TRF, page); |
394 | - AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, 1000); | |
468 | + AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY); | |
395 | 469 | /*Update the SRAM buffer */ |
396 | 470 | AT91F_DataFlashWriteBuffer(pDataFlash, DB_BUF1_WRITE, src, AdrInPage, size); |
397 | - AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, 1000); | |
398 | 471 | |
472 | + AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY); | |
473 | + | |
474 | + /* Erase page if a 128 Mbits device */ | |
475 | + if (pDataFlash->pDevice->pages_number >= 16384) { | |
476 | + AT91F_PageErase(pDataFlash, page); | |
477 | + /* Rewrite the modified Sram Buffer in the main memory */ | |
478 | + AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY); | |
479 | + } | |
480 | + | |
399 | 481 | /* Rewrite the modified Sram Buffer in the main memory */ |
400 | 482 | return(AT91F_WriteBufferToMain(pDataFlash, DB_BUF1_PAGE_ERASE_PGM, (page*pDataFlash->pDevice->pages_size))); |
401 | 483 | } |
402 | 484 | |
403 | 485 | |
404 | 486 | /*------------------------------------------------------------------------------*/ |
405 | -/* Function Name : AT91F_DataFlashWrite_Overloaded */ | |
487 | +/* Function Name : AT91F_DataFlashWrite */ | |
406 | 488 | /* Object : */ |
407 | 489 | /* Input Parameters : <*src> = Source buffer */ |
408 | 490 | /* : <dest> = dataflash adress */ |
... | ... | @@ -415,6 +497,8 @@ |
415 | 497 | int size ) |
416 | 498 | { |
417 | 499 | unsigned int length; |
500 | + unsigned int page; | |
501 | + unsigned int status; | |
418 | 502 | |
419 | 503 | AT91F_SpiEnable(pDataFlash->pDevice->cs); |
420 | 504 | |
... | ... | @@ -431,7 +515,7 @@ |
431 | 515 | if(!AT91F_PartialPageWrite(pDataFlash,src, dest, length)) |
432 | 516 | return DATAFLASH_ERROR; |
433 | 517 | |
434 | - AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, 1000); | |
518 | + AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY); | |
435 | 519 | |
436 | 520 | /* Update size, source and destination pointers */ |
437 | 521 | size -= length; |
438 | 522 | |
439 | 523 | |
... | ... | @@ -441,11 +525,22 @@ |
441 | 525 | |
442 | 526 | while (( size - pDataFlash->pDevice->pages_size ) >= 0 ) { |
443 | 527 | /* program dataflash page */ |
444 | - if(!AT91F_DataFlashPagePgmBuf(pDataFlash, src, dest, pDataFlash->pDevice->pages_size )) | |
528 | + page = (unsigned int)dest / (pDataFlash->pDevice->pages_size); | |
529 | + | |
530 | + status = AT91F_DataFlashWriteBuffer(pDataFlash, DB_BUF1_WRITE, src, 0, pDataFlash->pDevice->pages_size); | |
531 | + AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY); | |
532 | + | |
533 | + status = AT91F_PageErase(pDataFlash, page); | |
534 | + AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY); | |
535 | + if (!status) | |
445 | 536 | return DATAFLASH_ERROR; |
446 | 537 | |
447 | - AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, 1000); | |
538 | + status = AT91F_WriteBufferToMain (pDataFlash, DB_BUF1_PAGE_PGM, dest); | |
539 | + if(!status) | |
540 | + return DATAFLASH_ERROR; | |
448 | 541 | |
542 | + AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY); | |
543 | + | |
449 | 544 | /* Update size, source and destination pointers */ |
450 | 545 | size -= pDataFlash->pDevice->pages_size ; |
451 | 546 | dest += pDataFlash->pDevice->pages_size ; |
... | ... | @@ -458,7 +553,7 @@ |
458 | 553 | if(!AT91F_PartialPageWrite(pDataFlash, src, dest, size) ) |
459 | 554 | return DATAFLASH_ERROR; |
460 | 555 | |
461 | - AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, 1000); | |
556 | + AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY); | |
462 | 557 | } |
463 | 558 | return DATAFLASH_OK; |
464 | 559 | } |
465 | 560 | |
... | ... | @@ -480,13 +575,13 @@ |
480 | 575 | |
481 | 576 | AT91F_SpiEnable(pDataFlash->pDevice->cs); |
482 | 577 | |
483 | - if(AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, 1000) != DATAFLASH_OK) | |
578 | + if(AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY) != DATAFLASH_OK) | |
484 | 579 | return -1; |
485 | 580 | |
486 | 581 | while (size) { |
487 | 582 | SizeToRead = (size < 0x8000)? size:0x8000; |
488 | 583 | |
489 | - if (AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, 1000) != DATAFLASH_OK) | |
584 | + if (AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY) != DATAFLASH_OK) | |
490 | 585 | return -1; |
491 | 586 | |
492 | 587 | if (AT91F_DataFlashContinuousRead (pDataFlash, addr, buffer, SizeToRead) != DATAFLASH_OK) |
cpu/mpc8260/cpu.c
cpu/mpc8260/speed.c
... | ... | @@ -125,7 +125,7 @@ |
125 | 125 | busdf = (scmr & SCMR_BUSDF_MSK) >> SCMR_BUSDF_SHIFT; |
126 | 126 | cpmdf = (scmr & SCMR_CPMDF_MSK) >> SCMR_CPMDF_SHIFT; |
127 | 127 | |
128 | - if (get_pvr () == PVR_8260_HIP7) { /* HiP7 */ | |
128 | + if ((get_pvr () == PVR_8260_HIP7) || (get_pvr () == PVR_8260_HIP7R1)) { /* HiP7 */ | |
129 | 129 | pllmf = (scmr & SCMR_PLLMF_MSKH7) >> SCMR_PLLMF_SHIFT; |
130 | 130 | gd->vco_out = clkin * (pllmf + 1); |
131 | 131 | } else { /* HiP3, HiP4 */ |
drivers/dataflash.c
... | ... | @@ -31,13 +31,24 @@ |
31 | 31 | {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3} |
32 | 32 | }; |
33 | 33 | |
34 | +/*define the area offsets*/ | |
35 | +dataflash_protect_t area_list[NB_DATAFLASH_AREA] = { | |
36 | + {0, 0x7fff, FLAG_PROTECT_SET}, /* ROM code */ | |
37 | + {0x8000, 0x1ffff, FLAG_PROTECT_SET}, /* u-boot code */ | |
38 | + {0x20000, 0x27fff, FLAG_PROTECT_CLEAR}, /* u-boot environment */ | |
39 | + {0x28000, 0x1fffff, FLAG_PROTECT_CLEAR}, /* data area size to tune */ | |
40 | +}; | |
41 | + | |
34 | 42 | extern void AT91F_SpiInit (void); |
35 | 43 | extern int AT91F_DataflashProbe (int i, AT91PS_DataflashDesc pDesc); |
36 | 44 | extern int AT91F_DataFlashRead (AT91PS_DataFlash pDataFlash, |
37 | 45 | unsigned long addr, |
38 | 46 | unsigned long size, char *buffer); |
47 | +extern int AT91F_DataFlashWrite( AT91PS_DataFlash pDataFlash, | |
48 | + unsigned char *src, | |
49 | + int dest, | |
50 | + int size ); | |
39 | 51 | |
40 | - | |
41 | 52 | int AT91F_DataflashInit (void) |
42 | 53 | { |
43 | 54 | int i, j; |
... | ... | @@ -46,7 +57,7 @@ |
46 | 57 | AT91F_SpiInit (); |
47 | 58 | |
48 | 59 | for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++) { |
49 | - | |
60 | + dataflash_info[i].Desc.state = IDLE; | |
50 | 61 | dataflash_info[i].id = 0; |
51 | 62 | dataflash_info[i].Device.pages_number = 0; |
52 | 63 | dfcode = AT91F_DataflashProbe (cs[i][1], &dataflash_info[i].Desc); |
53 | 64 | |
54 | 65 | |
... | ... | @@ -84,14 +95,31 @@ |
84 | 95 | dataflash_info[i].logical_address = cs[i][0]; |
85 | 96 | dataflash_info[i].id = dfcode; |
86 | 97 | break; |
98 | + case AT45DB128: | |
99 | + dataflash_info[i].Device.pages_number = 16384; | |
100 | + dataflash_info[i].Device.pages_size = 1056; | |
101 | + dataflash_info[i].Device.page_offset = 11; | |
102 | + dataflash_info[i].Device.byte_mask = 0x700; | |
103 | + dataflash_info[i].Device.cs = cs[i][1]; | |
104 | + dataflash_info[i].Desc.DataFlash_state = IDLE; | |
105 | + dataflash_info[i].logical_address = cs[i][0]; | |
106 | + dataflash_info[i].id = dfcode; | |
107 | + break; | |
87 | 108 | |
88 | 109 | default: |
89 | 110 | break; |
90 | 111 | } |
112 | + /* set the last area end to the dataflash size*/ | |
113 | + area_list[NB_DATAFLASH_AREA -1].end = | |
114 | + (dataflash_info[i].Device.pages_number * | |
115 | + dataflash_info[i].Device.pages_size)-1; | |
91 | 116 | |
92 | - for (j = 0; j < dataflash_info[i].Device.pages_number; j++) | |
93 | - dataflash_info[i].protect[j] = FLAG_PROTECT_SET; | |
94 | - | |
117 | + /* set the area addresses */ | |
118 | + for(j = 0; j<NB_DATAFLASH_AREA; j++) { | |
119 | + dataflash_info[i].Device.area_list[j].start = area_list[j].start + dataflash_info[i].logical_address; | |
120 | + dataflash_info[i].Device.area_list[j].end = area_list[j].end + dataflash_info[i].logical_address; | |
121 | + dataflash_info[i].Device.area_list[j].protected = area_list[j].protected; | |
122 | + } | |
95 | 123 | } |
96 | 124 | return (1); |
97 | 125 | } |
... | ... | @@ -99,7 +127,7 @@ |
99 | 127 | |
100 | 128 | void dataflash_print_info (void) |
101 | 129 | { |
102 | - int i; | |
130 | + int i, j; | |
103 | 131 | |
104 | 132 | for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++) { |
105 | 133 | if (dataflash_info[i].id != 0) { |
... | ... | @@ -116,6 +144,9 @@ |
116 | 144 | case AT45DB642: |
117 | 145 | printf ("AT45DB642\n"); |
118 | 146 | break; |
147 | + case AT45DB128: | |
148 | + printf ("AT45DB128\n"); | |
149 | + break; | |
119 | 150 | } |
120 | 151 | |
121 | 152 | printf ("Nb pages: %6d\n" |
... | ... | @@ -127,6 +158,13 @@ |
127 | 158 | (unsigned int) dataflash_info[i].Device.pages_number * |
128 | 159 | dataflash_info[i].Device.pages_size, |
129 | 160 | (unsigned int) dataflash_info[i].logical_address); |
161 | + for (j=0; j< NB_DATAFLASH_AREA; j++) { | |
162 | + printf ("Area %i:\t%08X to %08X %s\n", j, | |
163 | + dataflash_info[i].Device.area_list[j].start, | |
164 | + dataflash_info[i].Device.area_list[j].end, | |
165 | + (dataflash_info[i].Device.area_list[j].protected == | |
166 | + FLAG_PROTECT_SET) ? "(RO)" : ""); | |
167 | + } | |
130 | 168 | } |
131 | 169 | } |
132 | 170 | } |
133 | 171 | |
... | ... | @@ -176,7 +214,77 @@ |
176 | 214 | |
177 | 215 | return addr_valid; |
178 | 216 | } |
217 | +/*-----------------------------------------------------------------------------*/ | |
218 | +/* Function Name : size_dataflash */ | |
219 | +/* Object : Test if address is valid regarding the size */ | |
220 | +/*-----------------------------------------------------------------------------*/ | |
221 | +int size_dataflash (AT91PS_DataFlash pdataFlash, unsigned long addr, unsigned long size) | |
222 | +{ | |
223 | + /* is outside the dataflash */ | |
224 | + if (((int)addr & 0x0FFFFFFF) > (pdataFlash->pDevice->pages_size * | |
225 | + pdataFlash->pDevice->pages_number)) return 0; | |
226 | + /* is too large for the dataflash */ | |
227 | + if (size > ((pdataFlash->pDevice->pages_size * | |
228 | + pdataFlash->pDevice->pages_number) - ((int)addr & 0x0FFFFFFF))) return 0; | |
179 | 229 | |
230 | + return 1; | |
231 | +} | |
232 | +/*-----------------------------------------------------------------------------*/ | |
233 | +/* Function Name : prot_dataflash */ | |
234 | +/* Object : Test if destination area is protected */ | |
235 | +/*-----------------------------------------------------------------------------*/ | |
236 | +int prot_dataflash (AT91PS_DataFlash pdataFlash, unsigned long addr) | |
237 | +{ | |
238 | +int area; | |
239 | + /* find area */ | |
240 | + for (area=0; area < NB_DATAFLASH_AREA; area++) { | |
241 | + if ((addr >= pdataFlash->pDevice->area_list[area].start) && | |
242 | + (addr < pdataFlash->pDevice->area_list[area].end)) | |
243 | + break; | |
244 | + } | |
245 | + if (area == NB_DATAFLASH_AREA) return -1; | |
246 | + /*test protection value*/ | |
247 | + if (pdataFlash->pDevice->area_list[area].protected == FLAG_PROTECT_SET) return 0; | |
248 | + | |
249 | + return 1; | |
250 | +} | |
251 | +/*-----------------------------------------------------------------------------*/ | |
252 | +/* Function Name : dataflash_real_protect */ | |
253 | +/* Object : protect/unprotect area */ | |
254 | +/*-----------------------------------------------------------------------------*/ | |
255 | +int dataflash_real_protect (int flag, unsigned long start_addr, unsigned long end_addr) | |
256 | +{ | |
257 | +int i,j, area1, area2, addr_valid = 0; | |
258 | + /* find dataflash */ | |
259 | + for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++) { | |
260 | + if ((((int) start_addr) & 0xF0000000) == | |
261 | + dataflash_info[i].logical_address) { | |
262 | + addr_valid = 1; | |
263 | + break; | |
264 | + } | |
265 | + } | |
266 | + if (!addr_valid) { | |
267 | + return -1; | |
268 | + } | |
269 | + /* find start area */ | |
270 | + for (area1=0; area1 < NB_DATAFLASH_AREA; area1++) { | |
271 | + if (start_addr == dataflash_info[i].Device.area_list[area1].start) break; | |
272 | + } | |
273 | + if (area1 == NB_DATAFLASH_AREA) return -1; | |
274 | + /* find end area */ | |
275 | + for (area2=0; area2 < NB_DATAFLASH_AREA; area2++) { | |
276 | + if (end_addr == dataflash_info[i].Device.area_list[area2].end) break; | |
277 | + } | |
278 | + if (area2 == NB_DATAFLASH_AREA) return -1; | |
279 | + | |
280 | + /*set protection value*/ | |
281 | + for(j = area1; j < area2+1 ; j++) | |
282 | + if (flag == 0) dataflash_info[i].Device.area_list[j].protected = FLAG_PROTECT_CLEAR; | |
283 | + else dataflash_info[i].Device.area_list[j].protected = FLAG_PROTECT_SET; | |
284 | + | |
285 | + return (area2-area1+1); | |
286 | +} | |
287 | + | |
180 | 288 | /*------------------------------------------------------------------------------*/ |
181 | 289 | /* Function Name : read_dataflash */ |
182 | 290 | /* Object : dataflash memory read */ |
183 | 291 | |
184 | 292 | |
... | ... | @@ -187,9 +295,13 @@ |
187 | 295 | AT91PS_DataFlash pFlash = &DataFlashInst; |
188 | 296 | |
189 | 297 | pFlash = AT91F_DataflashSelect (pFlash, &AddrToRead); |
298 | + | |
190 | 299 | if (pFlash == 0) |
191 | - return -1; | |
300 | + return ERR_UNKNOWN_FLASH_TYPE; | |
192 | 301 | |
302 | + if (size_dataflash(pFlash,addr,size) == 0) | |
303 | + return ERR_INVAL; | |
304 | + | |
193 | 305 | return (AT91F_DataFlashRead (pFlash, AddrToRead, size, result)); |
194 | 306 | } |
195 | 307 | |
196 | 308 | |
197 | 309 | |
... | ... | @@ -201,17 +313,24 @@ |
201 | 313 | int write_dataflash (unsigned long addr_dest, unsigned long addr_src, |
202 | 314 | unsigned long size) |
203 | 315 | { |
204 | - extern AT91S_DataFlashStatus AT91F_DataFlashWrite( | |
205 | - AT91PS_DataFlash, uchar *, int, int); | |
206 | 316 | int AddrToWrite = addr_dest; |
207 | 317 | AT91PS_DataFlash pFlash = &DataFlashInst; |
208 | 318 | |
209 | 319 | pFlash = AT91F_DataflashSelect (pFlash, &AddrToWrite); |
320 | + | |
321 | + if (pFlash == 0) | |
322 | + return ERR_UNKNOWN_FLASH_TYPE; | |
323 | + | |
324 | + if (size_dataflash(pFlash,addr_dest,size) == 0) | |
325 | + return ERR_INVAL; | |
326 | + | |
327 | + if (prot_dataflash(pFlash,addr_dest) == 0) | |
328 | + return ERR_PROTECTED; | |
329 | + | |
210 | 330 | if (AddrToWrite == -1) |
211 | 331 | return -1; |
212 | 332 | |
213 | - return AT91F_DataFlashWrite (pFlash, (char *) addr_src, AddrToWrite, | |
214 | - size); | |
333 | + return AT91F_DataFlashWrite (pFlash, (char *) addr_src, AddrToWrite, size); | |
215 | 334 | } |
216 | 335 | |
217 | 336 |
include/asm-ppc/processor.h
... | ... | @@ -732,6 +732,7 @@ |
732 | 732 | #define PVR_8260_HIP3 0x00810101 |
733 | 733 | #define PVR_8260_HIP4 0x80811014 |
734 | 734 | #define PVR_8260_HIP7 0x80822011 |
735 | +#define PVR_8260_HIP7R1 0x80822013 | |
735 | 736 | |
736 | 737 | /* I am just adding a single entry for 8260 boards. I think we may be |
737 | 738 | * able to combine mbx, fads, rpxlite, bseip, and classic into a single |
include/configs/at91rm9200dk.h
... | ... | @@ -114,7 +114,7 @@ |
114 | 114 | #define CONFIG_NET_RETRY_COUNT 20 |
115 | 115 | |
116 | 116 | #define CONFIG_HAS_DATAFLASH 1 |
117 | -#define CFG_SPI_WRITE_TOUT CFG_HZ | |
117 | +#define CFG_SPI_WRITE_TOUT (5*CFG_HZ) | |
118 | 118 | #define CFG_MAX_DATAFLASH_BANKS 2 |
119 | 119 | #define CFG_MAX_DATAFLASH_PAGES 16384 |
120 | 120 | #define CFG_DATAFLASH_LOGIC_ADDR_CS0 0xC0000000 /* Logical adress for CS0 */ |
121 | 121 | |
... | ... | @@ -127,9 +127,20 @@ |
127 | 127 | #define CFG_MAX_FLASH_SECT 40 |
128 | 128 | #define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */ |
129 | 129 | #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ |
130 | + | |
131 | +#undef CFG_ENV_IS_IN_DATAFLASH | |
132 | + | |
133 | +#ifdef CFG_ENV_IS_IN_DATAFLASH | |
134 | +#define CFG_ENV_OFFSET 0x20000 | |
135 | +#define CFG_ENV_ADDR (CFG_DATAFLASH_LOGIC_ADDR_CS0 + CFG_ENV_OFFSET) | |
136 | +#define CFG_ENV_SIZE 0x2000 /* 0x8000 */ | |
137 | +#else | |
130 | 138 | #define CFG_ENV_IS_IN_FLASH 1 |
131 | 139 | #define CFG_ENV_ADDR (PHYS_FLASH_1 + 0xe000) /* 0x10000 */ |
132 | 140 | #define CFG_ENV_SIZE 0x2000 /* 0x8000 */ |
141 | +#endif | |
142 | + | |
143 | + | |
133 | 144 | #define CFG_LOAD_ADDR 0x21000000 /* default load address */ |
134 | 145 | |
135 | 146 | #define CFG_BOOT_SIZE 0x6000 /* 24 KBytes */ |
include/configs/omap1510inn.h
... | ... | @@ -50,6 +50,7 @@ |
50 | 50 | |
51 | 51 | #define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ |
52 | 52 | #define CONFIG_SETUP_MEMORY_TAGS 1 |
53 | +#define CONFIG_INITRD_TAG 1 | |
53 | 54 | |
54 | 55 | /* |
55 | 56 | * Size of malloc() pool |
... | ... | @@ -99,12 +100,9 @@ |
99 | 100 | #include <configs/omap1510.h> |
100 | 101 | |
101 | 102 | #define CONFIG_BOOTDELAY 3 |
102 | -#define CONFIG_BOOTARGS "mem=32M console=ttyS0,115200n8 noinitrd root=/dev/nfs rw nfsroot=157.87.82.48:/home/a0875451/mwd/myfs/target ip=dhcp" | |
103 | -/*#define CONFIG_ETHADDR 00:0B:36:00:05:25 */ | |
104 | -#define CONFIG_NETMASK 255.255.254.0 /* talk on MY local net */ | |
105 | -#define CONFIG_IPADDR 156.117.97.156 /* static IP I currently own */ | |
106 | -#define CONFIG_SERVERIP 156.117.97.139 /* current IP of my dev pc */ | |
107 | -#define CONFIG_BOOTFILE "/tftpboot/uImage" /* file to load */ | |
103 | +#define CONFIG_BOOTARGS "console=ttyS0,115200n8 noinitrd root=/dev/nfs ip=bootp" | |
104 | +#define CONFIG_BOOTCOMMAND "bootp;tftp;bootm" | |
105 | +#define CFG_AUTOLOAD "n" /* No autoload */ | |
108 | 106 | |
109 | 107 | #if (CONFIG_COMMANDS & CFG_CMD_KGDB) |
110 | 108 | #define CONFIG_KGDB_BAUDRATE 115200 /* speed to run kgdb serial port */ |
include/dataflash.h
... | ... | @@ -37,17 +37,16 @@ |
37 | 37 | #include <asm/arch/hardware.h> |
38 | 38 | #include "config.h" |
39 | 39 | |
40 | +/*number of protected area*/ | |
41 | +#define NB_DATAFLASH_AREA 4 | |
40 | 42 | |
43 | +/*define the area structure*/ | |
41 | 44 | typedef struct { |
42 | - unsigned long base; /* logical base address for a bank */ | |
43 | - unsigned long size; /* total bank size */ | |
44 | - unsigned long page_count; | |
45 | - unsigned long page_size; | |
46 | - unsigned long id; /* device id */ | |
47 | - unsigned char protect[CFG_MAX_DATAFLASH_PAGES]; /* page protection status */ | |
48 | -} dataflash_info_t; | |
45 | + unsigned long start; | |
46 | + unsigned long end; | |
47 | + unsigned char protected; | |
48 | +} dataflash_protect_t; | |
49 | 49 | |
50 | - | |
51 | 50 | typedef unsigned int AT91S_DataFlashStatus; |
52 | 51 | |
53 | 52 | /*----------------------------------------------------------------------*/ |
... | ... | @@ -80,6 +79,7 @@ |
80 | 79 | int page_offset; /* page offset in command */ |
81 | 80 | int byte_mask; /* byte mask in command */ |
82 | 81 | int cs; |
82 | + dataflash_protect_t area_list[NB_DATAFLASH_AREA]; /* area protection status */ | |
83 | 83 | } AT91S_DataflashFeatures, *AT91PS_DataflashFeatures; |
84 | 84 | |
85 | 85 | /*---------------------------------------------*/ |
86 | 86 | |
... | ... | @@ -91,13 +91,13 @@ |
91 | 91 | } AT91S_DataFlash, *AT91PS_DataFlash; |
92 | 92 | |
93 | 93 | |
94 | + | |
94 | 95 | typedef struct _AT91S_DATAFLASH_INFO { |
95 | 96 | |
96 | 97 | AT91S_DataflashDesc Desc; |
97 | 98 | AT91S_DataflashFeatures Device; /* Pointer on a dataflash features array */ |
98 | 99 | unsigned long logical_address; |
99 | 100 | unsigned int id; /* device id */ |
100 | - unsigned char protect[CFG_MAX_DATAFLASH_PAGES]; /* page protection status */ | |
101 | 101 | } AT91S_DATAFLASH_INFO, *AT91PS_DATAFLASH_INFO; |
102 | 102 | |
103 | 103 | |
... | ... | @@ -106,6 +106,7 @@ |
106 | 106 | #define AT45DB161 0x2c |
107 | 107 | #define AT45DB321 0x34 |
108 | 108 | #define AT45DB642 0x3c |
109 | +#define AT45DB128 0x10 | |
109 | 110 | |
110 | 111 | #define AT91C_DATAFLASH_TIMEOUT 10000 /* For AT91F_DataFlashWaitReady */ |
111 | 112 | |
... | ... | @@ -166,6 +167,9 @@ |
166 | 167 | |
167 | 168 | /*-------------------------------------------------------------------------------------------------*/ |
168 | 169 | |
170 | +extern int size_dataflash (AT91PS_DataFlash pdataFlash, unsigned long addr, unsigned long size); | |
171 | +extern int prot_dataflash (AT91PS_DataFlash pdataFlash, unsigned long addr); | |
172 | +extern int dataflash_real_protect (int flag, unsigned long start_addr, unsigned long end_addr); | |
169 | 173 | extern int addr_dataflash (unsigned long addr); |
170 | 174 | extern int read_dataflash (unsigned long addr, unsigned long size, char *result); |
171 | 175 | extern int write_dataflash (unsigned long addr, unsigned long dest, unsigned long size); |
lib_arm/armlinux.c
... | ... | @@ -41,20 +41,24 @@ |
41 | 41 | defined (CONFIG_CMDLINE_TAG) || \ |
42 | 42 | defined (CONFIG_INITRD_TAG) || \ |
43 | 43 | defined (CONFIG_VFD) |
44 | -static void setup_start_tag(bd_t *bd); | |
44 | +static void setup_start_tag (bd_t *bd); | |
45 | + | |
45 | 46 | # ifdef CONFIG_SETUP_MEMORY_TAGS |
46 | -static void setup_memory_tags(bd_t *bd); | |
47 | +static void setup_memory_tags (bd_t *bd); | |
47 | 48 | # endif |
48 | -static void setup_commandline_tag(bd_t *bd, char *commandline); | |
49 | +static void setup_commandline_tag (bd_t *bd, char *commandline); | |
50 | + | |
49 | 51 | #if 0 |
50 | -static void setup_ramdisk_tag(bd_t *bd); | |
52 | +static void setup_ramdisk_tag (bd_t *bd); | |
51 | 53 | #endif |
52 | 54 | # ifdef CONFIG_INITRD_TAG |
53 | -static void setup_initrd_tag(bd_t *bd, ulong initrd_start, ulong initrd_end); | |
55 | +static void setup_initrd_tag (bd_t *bd, ulong initrd_start, | |
56 | + ulong initrd_end); | |
54 | 57 | # endif |
55 | -static void setup_end_tag(bd_t *bd); | |
58 | +static void setup_end_tag (bd_t *bd); | |
59 | + | |
56 | 60 | # if defined (CONFIG_VFD) |
57 | -static void setup_videolfb_tag(gd_t *gd); | |
61 | +static void setup_videolfb_tag (gd_t *gd); | |
58 | 62 | # endif |
59 | 63 | |
60 | 64 | |
61 | 65 | |
62 | 66 | |
63 | 67 | |
64 | 68 | |
65 | 69 | |
66 | 70 | |
67 | 71 | |
68 | 72 | |
69 | 73 | |
70 | 74 | |
71 | 75 | |
72 | 76 | |
73 | 77 | |
74 | 78 | |
75 | 79 | |
76 | 80 | |
77 | 81 | |
78 | 82 | |
79 | 83 | |
80 | 84 | |
81 | 85 | |
82 | 86 | |
83 | 87 | |
84 | 88 | |
85 | 89 | |
86 | 90 | |
87 | 91 | |
88 | 92 | |
89 | 93 | |
90 | 94 | |
91 | 95 | |
92 | 96 | |
93 | 97 | |
94 | 98 | |
95 | 99 | |
96 | 100 | |
97 | 101 | |
98 | 102 | |
99 | 103 | |
100 | 104 | |
101 | 105 | |
102 | 106 | |
... | ... | @@ -68,180 +72,179 @@ |
68 | 72 | # define SHOW_BOOT_PROGRESS(arg) |
69 | 73 | #endif |
70 | 74 | |
71 | -extern image_header_t header; /* from cmd_bootm.c */ | |
75 | +extern image_header_t header; /* from cmd_bootm.c */ | |
72 | 76 | |
73 | 77 | |
74 | -void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], | |
75 | - ulong addr, ulong *len_ptr, int verify) | |
78 | +void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], | |
79 | + ulong addr, ulong *len_ptr, int verify) | |
76 | 80 | { |
77 | 81 | DECLARE_GLOBAL_DATA_PTR; |
78 | 82 | |
79 | - ulong len = 0, checksum; | |
80 | - ulong initrd_start, initrd_end; | |
81 | - ulong data; | |
82 | - void (*theKernel)(int zero, int arch); | |
83 | - image_header_t *hdr = &header; | |
84 | - bd_t *bd = gd->bd; | |
83 | + ulong len = 0, checksum; | |
84 | + ulong initrd_start, initrd_end; | |
85 | + ulong data; | |
86 | + void (*theKernel) (int zero, int arch); | |
87 | + image_header_t *hdr = &header; | |
88 | + bd_t *bd = gd->bd; | |
89 | + | |
85 | 90 | #ifdef CONFIG_CMDLINE_TAG |
86 | - char *commandline = getenv("bootargs"); | |
91 | + char *commandline = getenv ("bootargs"); | |
87 | 92 | #endif |
88 | 93 | |
89 | - theKernel = (void (*)(int, int))ntohl(hdr->ih_ep); | |
94 | + theKernel = (void (*)(int, int)) ntohl (hdr->ih_ep); | |
90 | 95 | |
91 | - /* | |
92 | - * Check if there is an initrd image | |
93 | - */ | |
94 | - if (argc >= 3) { | |
95 | - SHOW_BOOT_PROGRESS (9); | |
96 | + /* | |
97 | + * Check if there is an initrd image | |
98 | + */ | |
99 | + if (argc >= 3) { | |
100 | + SHOW_BOOT_PROGRESS (9); | |
96 | 101 | |
97 | - addr = simple_strtoul(argv[2], NULL, 16); | |
102 | + addr = simple_strtoul (argv[2], NULL, 16); | |
98 | 103 | |
99 | - printf ("## Loading Ramdisk Image at %08lx ...\n", addr); | |
104 | + printf ("## Loading Ramdisk Image at %08lx ...\n", addr); | |
100 | 105 | |
101 | - /* Copy header so we can blank CRC field for re-calculation */ | |
106 | + /* Copy header so we can blank CRC field for re-calculation */ | |
102 | 107 | #ifdef CONFIG_HAS_DATAFLASH |
103 | - if (addr_dataflash(addr)){ | |
104 | - read_dataflash(addr, sizeof(image_header_t), (char *)&header); | |
105 | - } else | |
108 | + if (addr_dataflash (addr)) { | |
109 | + read_dataflash (addr, sizeof (image_header_t), | |
110 | + (char *) &header); | |
111 | + } else | |
106 | 112 | #endif |
107 | - memcpy (&header, (char *)addr, sizeof(image_header_t)); | |
113 | + memcpy (&header, (char *) addr, | |
114 | + sizeof (image_header_t)); | |
108 | 115 | |
109 | - if (ntohl(hdr->ih_magic) != IH_MAGIC) { | |
110 | - printf ("Bad Magic Number\n"); | |
111 | - SHOW_BOOT_PROGRESS (-10); | |
112 | - do_reset (cmdtp, flag, argc, argv); | |
113 | - } | |
116 | + if (ntohl (hdr->ih_magic) != IH_MAGIC) { | |
117 | + printf ("Bad Magic Number\n"); | |
118 | + SHOW_BOOT_PROGRESS (-10); | |
119 | + do_reset (cmdtp, flag, argc, argv); | |
120 | + } | |
114 | 121 | |
115 | - data = (ulong)&header; | |
116 | - len = sizeof(image_header_t); | |
122 | + data = (ulong) & header; | |
123 | + len = sizeof (image_header_t); | |
117 | 124 | |
118 | - checksum = ntohl(hdr->ih_hcrc); | |
119 | - hdr->ih_hcrc = 0; | |
125 | + checksum = ntohl (hdr->ih_hcrc); | |
126 | + hdr->ih_hcrc = 0; | |
120 | 127 | |
121 | - if (crc32 (0, (char *)data, len) != checksum) { | |
122 | - printf ("Bad Header Checksum\n"); | |
123 | - SHOW_BOOT_PROGRESS (-11); | |
124 | - do_reset (cmdtp, flag, argc, argv); | |
125 | - } | |
128 | + if (crc32 (0, (char *) data, len) != checksum) { | |
129 | + printf ("Bad Header Checksum\n"); | |
130 | + SHOW_BOOT_PROGRESS (-11); | |
131 | + do_reset (cmdtp, flag, argc, argv); | |
132 | + } | |
126 | 133 | |
127 | - SHOW_BOOT_PROGRESS (10); | |
134 | + SHOW_BOOT_PROGRESS (10); | |
128 | 135 | |
129 | - print_image_hdr (hdr); | |
136 | + print_image_hdr (hdr); | |
130 | 137 | |
131 | - data = addr + sizeof(image_header_t); | |
132 | - len = ntohl(hdr->ih_size); | |
138 | + data = addr + sizeof (image_header_t); | |
139 | + len = ntohl (hdr->ih_size); | |
133 | 140 | |
134 | 141 | #ifdef CONFIG_HAS_DATAFLASH |
135 | - if (addr_dataflash(addr)){ | |
136 | - read_dataflash(data, len, (char *)CFG_LOAD_ADDR); | |
137 | - data = CFG_LOAD_ADDR; | |
138 | - } | |
142 | + if (addr_dataflash (addr)) { | |
143 | + read_dataflash (data, len, (char *) CFG_LOAD_ADDR); | |
144 | + data = CFG_LOAD_ADDR; | |
145 | + } | |
139 | 146 | #endif |
140 | 147 | |
141 | - if (verify) { | |
142 | - ulong csum = 0; | |
148 | + if (verify) { | |
149 | + ulong csum = 0; | |
143 | 150 | |
144 | - printf (" Verifying Checksum ... "); | |
145 | - csum = crc32 (0, (char *)data, len); | |
146 | - if (csum != ntohl(hdr->ih_dcrc)) { | |
147 | - printf ("Bad Data CRC\n"); | |
148 | - SHOW_BOOT_PROGRESS (-12); | |
149 | - do_reset (cmdtp, flag, argc, argv); | |
150 | - } | |
151 | - printf ("OK\n"); | |
152 | - } | |
151 | + printf (" Verifying Checksum ... "); | |
152 | + csum = crc32 (0, (char *) data, len); | |
153 | + if (csum != ntohl (hdr->ih_dcrc)) { | |
154 | + printf ("Bad Data CRC\n"); | |
155 | + SHOW_BOOT_PROGRESS (-12); | |
156 | + do_reset (cmdtp, flag, argc, argv); | |
157 | + } | |
158 | + printf ("OK\n"); | |
159 | + } | |
153 | 160 | |
154 | - SHOW_BOOT_PROGRESS (11); | |
161 | + SHOW_BOOT_PROGRESS (11); | |
155 | 162 | |
156 | - if ((hdr->ih_os != IH_OS_LINUX) || | |
157 | - (hdr->ih_arch != IH_CPU_ARM) || | |
158 | - (hdr->ih_type != IH_TYPE_RAMDISK) ) { | |
159 | - printf ("No Linux ARM Ramdisk Image\n"); | |
160 | - SHOW_BOOT_PROGRESS (-13); | |
161 | - do_reset (cmdtp, flag, argc, argv); | |
162 | - } | |
163 | + if ((hdr->ih_os != IH_OS_LINUX) || | |
164 | + (hdr->ih_arch != IH_CPU_ARM) || | |
165 | + (hdr->ih_type != IH_TYPE_RAMDISK)) { | |
166 | + printf ("No Linux ARM Ramdisk Image\n"); | |
167 | + SHOW_BOOT_PROGRESS (-13); | |
168 | + do_reset (cmdtp, flag, argc, argv); | |
169 | + } | |
163 | 170 | |
164 | - /* | |
165 | - * Now check if we have a multifile image | |
166 | - */ | |
167 | - } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1])) { | |
168 | - ulong tail = ntohl(len_ptr[0]) % 4; | |
169 | - int i; | |
171 | + /* | |
172 | + * Now check if we have a multifile image | |
173 | + */ | |
174 | + } else if ((hdr->ih_type == IH_TYPE_MULTI) && (len_ptr[1])) { | |
175 | + ulong tail = ntohl (len_ptr[0]) % 4; | |
176 | + int i; | |
170 | 177 | |
171 | - SHOW_BOOT_PROGRESS (13); | |
178 | + SHOW_BOOT_PROGRESS (13); | |
172 | 179 | |
173 | - /* skip kernel length and terminator */ | |
174 | - data = (ulong)(&len_ptr[2]); | |
175 | - /* skip any additional image length fields */ | |
176 | - for (i=1; len_ptr[i]; ++i) | |
177 | - data += 4; | |
178 | - /* add kernel length, and align */ | |
179 | - data += ntohl(len_ptr[0]); | |
180 | - if (tail) { | |
181 | - data += 4 - tail; | |
182 | - } | |
180 | + /* skip kernel length and terminator */ | |
181 | + data = (ulong) (&len_ptr[2]); | |
182 | + /* skip any additional image length fields */ | |
183 | + for (i = 1; len_ptr[i]; ++i) | |
184 | + data += 4; | |
185 | + /* add kernel length, and align */ | |
186 | + data += ntohl (len_ptr[0]); | |
187 | + if (tail) { | |
188 | + data += 4 - tail; | |
189 | + } | |
183 | 190 | |
184 | - len = ntohl(len_ptr[1]); | |
191 | + len = ntohl (len_ptr[1]); | |
185 | 192 | |
186 | - } else { | |
187 | - /* | |
188 | - * no initrd image | |
189 | - */ | |
190 | - SHOW_BOOT_PROGRESS (14); | |
193 | + } else { | |
194 | + /* | |
195 | + * no initrd image | |
196 | + */ | |
197 | + SHOW_BOOT_PROGRESS (14); | |
191 | 198 | |
192 | - data = 0; | |
193 | - } | |
199 | + len = data = 0; | |
200 | + } | |
194 | 201 | |
195 | 202 | #ifdef DEBUG |
196 | - if (!data) { | |
197 | - printf ("No initrd\n"); | |
198 | - } | |
203 | + if (!data) { | |
204 | + printf ("No initrd\n"); | |
205 | + } | |
199 | 206 | #endif |
200 | 207 | |
201 | - if (data) { | |
202 | - initrd_start = data; | |
203 | - initrd_end = initrd_start + len; | |
204 | - } else { | |
205 | - initrd_start = 0; | |
206 | - initrd_end = 0; | |
207 | - } | |
208 | + if (data) { | |
209 | + initrd_start = data; | |
210 | + initrd_end = initrd_start + len; | |
211 | + } else { | |
212 | + initrd_start = 0; | |
213 | + initrd_end = 0; | |
214 | + } | |
208 | 215 | |
209 | - SHOW_BOOT_PROGRESS (15); | |
216 | + SHOW_BOOT_PROGRESS (15); | |
210 | 217 | |
211 | -#ifdef DEBUG | |
212 | - printf ("## Transferring control to Linux (at address %08lx) ...\n", | |
213 | - (ulong)theKernel); | |
214 | -#endif | |
218 | + debug ("## Transferring control to Linux (at address %08lx) ...\n", | |
219 | + (ulong) theKernel); | |
215 | 220 | |
216 | 221 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ |
217 | 222 | defined (CONFIG_CMDLINE_TAG) || \ |
218 | 223 | defined (CONFIG_INITRD_TAG) || \ |
219 | 224 | defined (CONFIG_VFD) |
220 | - setup_start_tag(bd); | |
225 | + setup_start_tag (bd); | |
221 | 226 | #ifdef CONFIG_SETUP_MEMORY_TAGS |
222 | - setup_memory_tags(bd); | |
227 | + setup_memory_tags (bd); | |
223 | 228 | #endif |
224 | 229 | #ifdef CONFIG_CMDLINE_TAG |
225 | - setup_commandline_tag(bd, commandline); | |
230 | + setup_commandline_tag (bd, commandline); | |
226 | 231 | #endif |
227 | 232 | #ifdef CONFIG_INITRD_TAG |
228 | - setup_initrd_tag(bd, initrd_start, initrd_end); | |
233 | + if (initrd_start && initrd_end) | |
234 | + setup_initrd_tag (bd, initrd_start, initrd_end); | |
229 | 235 | #endif |
230 | -#if 0 | |
231 | - setup_ramdisk_tag(bd); | |
232 | -#endif | |
233 | 236 | #if defined (CONFIG_VFD) |
234 | - setup_videolfb_tag((gd_t *)gd); | |
237 | + setup_videolfb_tag ((gd_t *) gd); | |
235 | 238 | #endif |
236 | - setup_end_tag(bd); | |
239 | + setup_end_tag (bd); | |
237 | 240 | #endif |
238 | 241 | |
239 | - /* we assume that the kernel is in place */ | |
240 | - printf("\nStarting kernel ...\n\n"); | |
242 | + /* we assume that the kernel is in place */ | |
243 | + printf ("\nStarting kernel ...\n\n"); | |
241 | 244 | |
242 | - cleanup_before_linux(); | |
245 | + cleanup_before_linux (); | |
243 | 246 | |
244 | - theKernel(0, bd->bi_arch_number); | |
247 | + theKernel (0, bd->bi_arch_number); | |
245 | 248 | } |
246 | 249 | |
247 | 250 | |
248 | 251 | |
249 | 252 | |
250 | 253 | |
251 | 254 | |
252 | 255 | |
253 | 256 | |
254 | 257 | |
255 | 258 | |
256 | 259 | |
257 | 260 | |
258 | 261 | |
259 | 262 | |
260 | 263 | |
261 | 264 | |
262 | 265 | |
263 | 266 | |
264 | 267 | |
... | ... | @@ -249,59 +252,59 @@ |
249 | 252 | defined (CONFIG_CMDLINE_TAG) || \ |
250 | 253 | defined (CONFIG_INITRD_TAG) || \ |
251 | 254 | defined (CONFIG_VFD) |
252 | -static void setup_start_tag(bd_t *bd) | |
255 | +static void setup_start_tag (bd_t *bd) | |
253 | 256 | { |
254 | - params = (struct tag *)bd->bi_boot_params; | |
257 | + params = (struct tag *) bd->bi_boot_params; | |
255 | 258 | |
256 | - params->hdr.tag = ATAG_CORE; | |
257 | - params->hdr.size = tag_size(tag_core); | |
259 | + params->hdr.tag = ATAG_CORE; | |
260 | + params->hdr.size = tag_size (tag_core); | |
258 | 261 | |
259 | - params->u.core.flags = 0; | |
260 | - params->u.core.pagesize = 0; | |
261 | - params->u.core.rootdev = 0; | |
262 | + params->u.core.flags = 0; | |
263 | + params->u.core.pagesize = 0; | |
264 | + params->u.core.rootdev = 0; | |
262 | 265 | |
263 | - params = tag_next(params); | |
266 | + params = tag_next (params); | |
264 | 267 | } |
265 | 268 | |
266 | 269 | |
267 | 270 | #ifdef CONFIG_SETUP_MEMORY_TAGS |
268 | -static void setup_memory_tags(bd_t *bd) | |
271 | +static void setup_memory_tags (bd_t *bd) | |
269 | 272 | { |
270 | - int i; | |
273 | + int i; | |
271 | 274 | |
272 | - for(i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { | |
273 | - params->hdr.tag = ATAG_MEM; | |
274 | - params->hdr.size = tag_size(tag_mem32); | |
275 | + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { | |
276 | + params->hdr.tag = ATAG_MEM; | |
277 | + params->hdr.size = tag_size (tag_mem32); | |
275 | 278 | |
276 | - params->u.mem.start = bd->bi_dram[i].start; | |
277 | - params->u.mem.size = bd->bi_dram[i].size; | |
279 | + params->u.mem.start = bd->bi_dram[i].start; | |
280 | + params->u.mem.size = bd->bi_dram[i].size; | |
278 | 281 | |
279 | - params = tag_next(params); | |
280 | - } | |
282 | + params = tag_next (params); | |
283 | + } | |
281 | 284 | } |
282 | -#endif /* CONFIG_SETUP_MEMORY_TAGS */ | |
285 | +#endif /* CONFIG_SETUP_MEMORY_TAGS */ | |
283 | 286 | |
284 | 287 | |
285 | -static void setup_commandline_tag(bd_t *bd, char *commandline) | |
288 | +static void setup_commandline_tag (bd_t *bd, char *commandline) | |
286 | 289 | { |
287 | - char *p; | |
290 | + char *p; | |
288 | 291 | |
289 | - /* eat leading white space */ | |
290 | - for(p = commandline; *p == ' '; p++) | |
291 | - ; | |
292 | + /* eat leading white space */ | |
293 | + for (p = commandline; *p == ' '; p++); | |
292 | 294 | |
293 | - /* skip non-existent command lines so the kernel will still | |
294 | - * use its default command line. | |
295 | - */ | |
296 | - if(*p == '\0') | |
297 | - return; | |
295 | + /* skip non-existent command lines so the kernel will still | |
296 | + * use its default command line. | |
297 | + */ | |
298 | + if (*p == '\0') | |
299 | + return; | |
298 | 300 | |
299 | - params->hdr.tag = ATAG_CMDLINE; | |
300 | - params->hdr.size = (sizeof(struct tag_header) + strlen(p) + 1 + 4) >> 2; | |
301 | + params->hdr.tag = ATAG_CMDLINE; | |
302 | + params->hdr.size = | |
303 | + (sizeof (struct tag_header) + strlen (p) + 1 + 4) >> 2; | |
301 | 304 | |
302 | - strcpy(params->u.cmdline.cmdline, p); | |
305 | + strcpy (params->u.cmdline.cmdline, p); | |
303 | 306 | |
304 | - params = tag_next(params); | |
307 | + params = tag_next (params); | |
305 | 308 | } |
306 | 309 | |
307 | 310 | |
308 | 311 | |
309 | 312 | |
310 | 313 | |
311 | 314 | |
312 | 315 | |
313 | 316 | |
314 | 317 | |
315 | 318 | |
316 | 319 | |
317 | 320 | |
318 | 321 | |
... | ... | @@ -310,64 +313,47 @@ |
310 | 313 | #endif |
311 | 314 | |
312 | 315 | #ifdef CONFIG_INITRD_TAG |
313 | -static void setup_initrd_tag(bd_t *bd, ulong initrd_start, ulong initrd_end) | |
316 | +static void setup_initrd_tag (bd_t *bd, ulong initrd_start, ulong initrd_end) | |
314 | 317 | { |
315 | - /* an ATAG_INITRD node tells the kernel where the compressed | |
316 | - * ramdisk can be found. ATAG_RDIMG is a better name, actually. | |
317 | - */ | |
318 | - params->hdr.tag = ATAG_INITRD2; | |
319 | - params->hdr.size = tag_size(tag_initrd); | |
318 | + /* an ATAG_INITRD node tells the kernel where the compressed | |
319 | + * ramdisk can be found. ATAG_RDIMG is a better name, actually. | |
320 | + */ | |
321 | + params->hdr.tag = ATAG_INITRD2; | |
322 | + params->hdr.size = tag_size (tag_initrd); | |
320 | 323 | |
321 | - params->u.initrd.start = initrd_start; | |
322 | - params->u.initrd.size = initrd_end - initrd_start; | |
324 | + params->u.initrd.start = initrd_start; | |
325 | + params->u.initrd.size = initrd_end - initrd_start; | |
323 | 326 | |
324 | - params = tag_next(params); | |
327 | + params = tag_next (params); | |
325 | 328 | } |
326 | -#endif /* CONFIG_INITRD_TAG */ | |
329 | +#endif /* CONFIG_INITRD_TAG */ | |
327 | 330 | |
328 | 331 | |
329 | -#if 0 | |
330 | -static void setup_ramdisk_tag(bd_t *bd) | |
331 | -{ | |
332 | - /* an ATAG_RAMDISK node tells the kernel how large the | |
333 | - * decompressed ramdisk will become. | |
334 | - */ | |
335 | - params->hdr.tag = ATAG_RAMDISK; | |
336 | - params->hdr.size = tag_size(tag_ramdisk); | |
337 | - | |
338 | - params->u.ramdisk.start = 0; | |
339 | - /*params->u.ramdisk.size = RAMDISK_SIZE; */ | |
340 | - params->u.ramdisk.flags = 1; /* automatically load ramdisk */ | |
341 | - | |
342 | - params = tag_next(params); | |
343 | -} | |
344 | -#endif /* 0 */ | |
345 | - | |
346 | 332 | #if defined (CONFIG_VFD) |
347 | -static void setup_videolfb_tag(gd_t *gd) | |
333 | +static void setup_videolfb_tag (gd_t *gd) | |
348 | 334 | { |
349 | - /* An ATAG_VIDEOLFB node tells the kernel where and how large | |
350 | - * the framebuffer for video was allocated (among other things). | |
351 | - * Note that a _physical_ address is passed ! | |
352 | - * | |
353 | - * We only use it to pass the address and size, the other entries | |
354 | - * in the tag_videolfb are not of interest. | |
355 | - */ | |
356 | - params->hdr.tag = ATAG_VIDEOLFB; | |
357 | - params->hdr.size = tag_size(tag_videolfb); | |
335 | + /* An ATAG_VIDEOLFB node tells the kernel where and how large | |
336 | + * the framebuffer for video was allocated (among other things). | |
337 | + * Note that a _physical_ address is passed ! | |
338 | + * | |
339 | + * We only use it to pass the address and size, the other entries | |
340 | + * in the tag_videolfb are not of interest. | |
341 | + */ | |
342 | + params->hdr.tag = ATAG_VIDEOLFB; | |
343 | + params->hdr.size = tag_size (tag_videolfb); | |
358 | 344 | |
359 | - params->u.videolfb.lfb_base = (u32)gd->fb_base; | |
360 | - /* 7168 = 256*4*56/8 - actually 2 pages (8192 bytes) are allocated */ | |
361 | - params->u.videolfb.lfb_size = 7168; | |
345 | + params->u.videolfb.lfb_base = (u32) gd->fb_base; | |
346 | + /* 7168 = 256*4*56/8 - actually 2 pages (8192 bytes) are allocated */ | |
347 | + params->u.videolfb.lfb_size = 7168; | |
362 | 348 | |
363 | - params = tag_next(params); | |
349 | + params = tag_next (params); | |
364 | 350 | } |
365 | 351 | #endif |
366 | 352 | |
367 | -static void setup_end_tag(bd_t *bd) | |
353 | +static void setup_end_tag (bd_t *bd) | |
368 | 354 | { |
369 | - params->hdr.tag = ATAG_NONE; | |
370 | - params->hdr.size = 0; | |
355 | + params->hdr.tag = ATAG_NONE; | |
356 | + params->hdr.size = 0; | |
371 | 357 | } |
372 | 358 | |
373 | 359 | #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */ |