]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/devs/eth/arm/netarm/v2_0/doc/netarm_hal.patch
Initial revision
[karo-tx-redboot.git] / packages / devs / eth / arm / netarm / v2_0 / doc / netarm_hal.patch
1 diff -Naur orig/hal/arm/netarm/current/cdl/hal_arm_netarm.cdl new/hal/arm/netarm/current/cdl/hal_arm_netarm.cdl
2 --- orig/hal/arm/netarm/current/cdl/hal_arm_netarm.cdl  2004-11-29 17:35:46.000000000 +0100
3 +++ new/hal/arm/netarm/current/cdl/hal_arm_netarm.cdl   2005-03-10 14:54:13.903367200 +0100
4 @@ -18,6 +18,26 @@
5                 puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_arm_netarm.h>"
6         }
7  
8 +       cdl_option CYGSEM_HAL_INSTRUCTION_CACHE_SETS {
9 +           display "Sets for Instruction Cache"
10 +           parent CYGPKG_HAL_CACHE_CONTROL
11 +           active_if CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP
12 +               flavor data
13 +               legal_values 0 to 15
14 +               default_value 0xc
15 +           description "MSB: SET1 | SET2 | SET3 | SET4"
16 +       }
17 +       
18 +       cdl_option CYGSEM_HAL_DATA_CACHE_SETS {
19 +           display "Sets for Data Cache"
20 +           parent CYGPKG_HAL_CACHE_CONTROL
21 +           active_if CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP
22 +               flavor data
23 +               legal_values 0 to 15
24 +               default_value 0x3
25 +           description "MSB: SET1 | SET2 | SET3 | SET4"
26 +       }
27 +
28         cdl_component CYG_HAL_STARTUP {
29         display "Startup type" 
30                 flavor data 
31 diff -Naur orig/hal/arm/netarm/current/include/hal_cache.h new/hal/arm/netarm/current/include/hal_cache.h
32 --- orig/hal/arm/netarm/current/include/hal_cache.h     2004-11-29 17:35:46.000000000 +0100
33 +++ new/hal/arm/netarm/current/include/hal_cache.h      2005-03-10 14:41:51.032173600 +0100
34 @@ -19,25 +19,57 @@
35  #define HAL_ICACHE_WAYS                 4        // Associativity of the cache
36  #define HAL_ICACHE_LINE_SIZE            4       // Size of a cache line
37  
38 -#define HAL_ICACHE_BASE                                        0x08000000
39 -#define HAL_ICACHE_MASK                                        0xfe000000
40 +#if defined(CYG_HAL_STARTUP_ROMRAM) || defined(CYG_HAL_STARTUP_RAM)
41 +       #define HAL_ICACHE_BASE                                 0x04000000
42 +       #define HAL_DCACHE_BASE                                 0x08000000
43 +#else
44 +       #define HAL_ICACHE_BASE                                 0x02000000
45 +       #define HAL_DCACHE_BASE                                 0x04000000
46 +#endif
47 +
48 +#define HAL_ICACHE_MASK                                        0xff000000
49 +#define HAL_DCACHE_MASK                                        0xff000000
50 +
51 +
52 +#ifdef CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP
53 +       #define HAL_ICACHE_ENABLE()                                             \
54 +       {                                                                                               \
55 +               *(CCR0)=(HAL_ICACHE_BASE) |                                     \
56 +                               (HAL_ICACHE_MASK >> 8) |                        \
57 +                               (CCR_ENABLE) |                                          \
58 +                               (1 << 11)       |                                               \
59 +                               (CYGSEM_HAL_INSTRUCTION_CACHE_SETS);    \
60 +       }
61 +#else
62 +       #define HAL_ICACHE_ENABLE() (*(CCR0)=0)
63 +#endif
64  
65 -#define HAL_ICACHE_ENABLE()                     \
66 +#ifdef CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP
67 +       #define HAL_DCACHE_ENABLE()                                             \
68 +       {                                                                                               \
69 +               *(CCR1)=(HAL_DCACHE_BASE) |                                     \
70 +                               (HAL_DCACHE_MASK >> 8) |                        \
71 +                               (CCR_ENABLE) |                                          \
72 +                               (1 << 11)       |                                               \
73 +                               (CYGSEM_HAL_DATA_CACHE_SETS);   \
74 +       }
75 +#else
76 +       #define HAL_DCACHE_ENABLE() (*(CCR1)=0)
77 +#endif
78 +
79 +#define HAL_CACHE_ENABLE()                      \
80  {                                                                                              \
81         unsigned int *p;                                                        \
82         int i;                                                                      \
83                                                                                                 \
84         *(SYSCON)|=SYSCON_CINIT|SYSCON_CACHE;           \
85         p=(unsigned int *)0xfff00000;                           \
86 -       for(i=0;i<(0x2000/4);i++,p++)                           \
87 +       for(i=0;i<(0x4000/4);i++,p++)                           \
88                 *p=0;                                                                   \
89                                                                                                 \
90 -       *(SYSCON)&=~(SYSCON_CINIT);                                     \
91 -       *(CCR0)=(HAL_ICACHE_BASE) |                                     \
92 -                       (HAL_ICACHE_MASK >> 8) |                        \
93 -                       (CCR_ENABLE) |                                          \
94 -                       (CCR_SET1 | CCR_SET2 | CCR_SET3 | CCR_SET4);            \
95 -       *(CCR1)=0;                                                                      \
96 +       HAL_ICACHE_ENABLE();                                            \
97 +       HAL_DCACHE_ENABLE();                                            \
98 +                                                                                               \
99         *(SYSCON)|=SYSCON_CACHE;                                        \
100         *(SYSCON)&=~SYSCON_WB;                                          \
101  }
102 @@ -45,17 +77,25 @@
103  #define HAL_ICACHE_DISABLE()                    \
104  {                                                                                              \
105         *(CCR0)=0;                                                                      \
106 -       *(SYSCON)&=~SYSCON_CACHE;                                                       \
107 +       if (HAL_DCACHE_IS_ENABLED == 0)                         \
108 +               *(SYSCON)&=~SYSCON_CACHE;                               \
109  }
110  
111 -#define HAL_ICACHE_IS_ENABLED(_state_) _state_ = ((*(CCR0) & CCR_ENABLE) >> 15)
112 +#define HAL_DCACHE_DISABLE()                    \
113 +{                                                                                              \
114 +       *(CCR1)=0;                                                                      \
115 +       if (HAL_ICACHE_IS_ENABLED == 0)                         \
116 +               *(SYSCON)&=~SYSCON_CACHE;                               \
117 +}
118 +
119 +#define HAL_ICACHE_IS_ENABLED ((*(CCR0) & CCR_ENABLE) >> 15)
120  
121 -#define HAL_ICACHE_INVALIDATE_ALL()                            \
122 +#define HAL_CACHE_INVALIDATE_ALL()                             \
123  {                                                                                              \
124         unsigned *p;                                                            \
125         *(SYSCON)|=SYSCON_CINIT;                                                        \
126         for(p=(unsigned int*)0xfff00000;                        \
127 -               (unsigned int)p<0xfff02000;                             \
128 +               (unsigned int)p<0xfff04000;                             \
129                 p++)                                                                    \
130                 *p=0;                                                                   \
131                                                                                                 \
132 @@ -64,25 +104,13 @@
133  
134  #define HAL_ICACHE_SYNC()
135  
136 -#define HAL_ICACHE_PURGE_ALL()  HAL_ICACHE_INVALIDATE_ALL()
137 -
138 -#define HAL_DCACHE_LINE_SIZE 0
139 -#define HAL_DCACHE_WAYS 0
140 -#define HAL_DCACHE_SETS 0
141 -
142 -#define HAL_DCACHE_ENABLE()
143 +#define HAL_CACHE_PURGE_ALL()  HAL_ICACHE_INVALIDATE_ALL()
144  
145 -#define HAL_DCACHE_DISABLE()
146 -
147 -#define HAL_DCACHE_INVALIDATE_ALL()
148 +#define HAL_DCACHE_LINE_SIZE 4
149 +#define HAL_DCACHE_WAYS 4
150  
151  #define HAL_DCACHE_SYNC()
152  
153 -#define HAL_DCACHE_IS_ENABLED(_state_) 0
154 -
155 -#define HAL_DCACHE_FLUSH( _base_ , _size_ )
156 -
157 -#define HAL_DCACHE_STORE( _base_ , _size_ )
158 +#define HAL_DCACHE_IS_ENABLED ((*(CCR1) & CCR_ENABLE) >> 15)
159  
160  #endif
161 -
162 diff -Naur orig/hal/arm/netarm/current/include/hal_platform_setup.h new/hal/arm/netarm/current/include/hal_platform_setup.h
163 --- orig/hal/arm/netarm/current/include/hal_platform_setup.h    2004-11-29 17:35:46.000000000 +0100
164 +++ new/hal/arm/netarm/current/include/hal_platform_setup.h     2005-03-14 17:10:01.542675500 +0100
165 @@ -19,7 +19,7 @@
166  // Usage:       #include <cyg/hal/hal_platform_setup.h>
167  //
168  //####DESCRIPTIONEND####
169 -// 
170 +//
171  //===========================================================================*/
172  
173  #include <pkgconf/system.h>           // System-wide configuration info
174 @@ -34,15 +34,31 @@
175                                                         bic     r0,r0, #((\x & 3)<<1); \
176                                                         str r0,[r1]
177  
178 -#if defined(CYG_HAL_STARTUP_ROMRAM) 
179 +#if defined(CYG_HAL_STARTUP_ROMRAM)
180  #define HAL_FLASH_PHYS_ADDR            0x02000000
181 -#define UNMAPPED(x)                    ((x)-0x08000000)
182 +#define UNMAPPED(x)                    ((x)-0x04000000)
183  #elif  defined(CYG_HAL_STARTUP_ROM)
184  #define HAL_FLASH_PHYS_ADDR            0x02000000
185  #define UNMAPPED(x)                    ((x)-0x02000000)
186  #endif
187                 .macro  PLATFORM_SETUP1
188 -       
189 +
190 +               ldr             r1,=0xffb0000c          // software reset
191 +               ldr             r0,=0x00000123
192 +               str             r0,[r1]
193 +               ldr             r0,=0x00000321
194 +               str             r0,[r1]
195 +
196 +               mov             r0,#1000
197 +loop:
198 +               sub             r0,r0,#1
199 +               cmp             r0,#0
200 +               bne             loop
201 +
202 +               ldr             r0,=0x00000123
203 +               str             r0,[r1]
204 +               ldr             r0,=0x00000321
205 +               str             r0,[r1]
206  
207  #if defined(CYG_HAL_STARTUP_ROMRAM) || defined(CYG_HAL_STARTUP_ROM)
208                 mov             r1,#0xff000000
209 @@ -51,7 +67,11 @@
210                 ldr             r0,=0x4004a800          /* System control register */
211                 str             r0,[r1]
212  
213 +#ifdef CYG_HAL_STARTUP_ROM
214                 mov             r0,#0                           /* PLL config */
215 +#else
216 +               ldr             r0,=0x09000e1e
217 +#endif
218                 str             r0,[r1,#8]
219  
220                 ldr             r0,=0xfff00000          /* PORT A mode & dir */
221 @@ -64,7 +84,7 @@
222                 str             r0,[r1,#0x28]
223  
224                 add             r1,r1,#0x100000         /* Setup MEM Module base addr */
225 -               
226 +
227                 ldr             r0,=0x148C0000          /* Memory Module Config register */
228                 str             r0,[r1]
229  
230 @@ -79,7 +99,7 @@
231                 ldr             r0,=0xf3f00304          /* CS0 Option register */
232                 str             r0,[r1,#0x14]
233  
234 -               ldr             r0,=0x02000001          /* CS0 Base Address register */ 
235 +               ldr             r0,=0x02000001          /* CS0 Base Address register */
236                 str             r0,[r1,#0x10]
237  
238                 mov             pc,r2                           /* Jump to new flash base */
239 @@ -92,7 +112,7 @@
240  
241                 /* Configure SDRAM */
242  
243 -               ldr             r0,=0xf38000b0          /* CS1 Option register, BLEN=11 */
244 +               ldr             r0,=0xf3000070          /* CS1 Option register, BLEN=11 (0xf38000b0)*/
245                 str             r0,[r1,#0x24]
246  
247                 ldr             r0,=0x0000022d          /* CS1 Base Address register */
248 @@ -110,7 +130,7 @@
249  #if defined(CYG_HAL_STARTUP_ROMRAM)
250                 mov             r1,#0
251                 mov             r2,#HAL_FLASH_PHYS_ADDR
252 -               ldr             r3,=(__heap1 - 0x04000000 + HAL_FLASH_PHYS_ADDR)
253 +               ldr             r3,=(__heap1 - 0x08000000 + HAL_FLASH_PHYS_ADDR)
254  
255                 mov             r4,#0
256                 mov             r6,#0
257 @@ -129,11 +149,11 @@
258                 nop
259                 nop
260                 nop
261 -30:    
262 +30:
263  #endif
264  
265  #endif
266                 .endm
267 -                       
268 +
269  #endif
270  
271 diff -Naur orig/hal/arm/netarm/current/include/pkgconf/mlt_arm_netarm_ram.ldi new/hal/arm/netarm/current/include/pkgconf/mlt_arm_netarm_ram.ldi
272 --- orig/hal/arm/netarm/current/include/pkgconf/mlt_arm_netarm_ram.ldi  2004-11-29 17:35:46.000000000 +0100
273 +++ new/hal/arm/netarm/current/include/pkgconf/mlt_arm_netarm_ram.ldi   2005-03-10 14:56:07.137708600 +0100
274 @@ -3,34 +3,32 @@
275  MEMORY
276  {
277      noncacheram : ORIGIN = 0, LENGTH = 16*1024*1024
278 -    dataram : ORIGIN = 0x4000000, LENGTH = 16*1024*1024
279 -    codecacheram : ORIGIN = 0x8000000, LENGTH = 16*1024*1024
280 +    codecacheram : ORIGIN = 0x4000000, LENGTH = 16*1024*1024
281 +    datacacheram : ORIGIN = 0x8000000, LENGTH = 16*1024*1024
282  }
283  
284  SECTIONS
285  {
286      SECTIONS_BEGIN
287 -       _dataram = 0x4000000;
288 +       _dataram = 0x8000000;
289      SECTION_rom_vectors (nocacheram, 0x0, LMA_EQ_VMA)
290      SECTION_fixed_vectors (nocacheram, ALIGN (0x4), LMA_EQ_VMA)
291 -       code_start = . + 0x8000000; 
292 -    SECTION_text (codecacheram, code_start, AT (code_start - 0x8000000))
293 +       code_start = . + 0x4000000; 
294 +    SECTION_text (codecacheram, code_start, AT (code_start - 0x4000000))
295         fini = .;
296 -    SECTION_fini (codecacheram, ALIGN (0x4), AT (fini - 0x8000000))
297 +    SECTION_fini (codecacheram, ALIGN (0x4), AT (fini - 0x4000000))
298         rodata = .;
299 -    SECTION_rodata (codecacheram, ALIGN (0x4), AT (rodata - 0x8000000))
300 +    SECTION_rodata (codecacheram, ALIGN (0x4), AT (rodata - 0x4000000))
301         rodata1 = .;
302 -    SECTION_rodata1 (codecacheram, ALIGN (0x4), AT (rodata1 - 0x8000000))
303 +    SECTION_rodata1 (codecacheram, ALIGN (0x4), AT (rodata1 - 0x4000000))
304         fixup = .;
305 -    SECTION_fixup (codecacheram, ALIGN (0x4), AT (fixup - 0x8000000))
306 +    SECTION_fixup (codecacheram, ALIGN (0x4), AT (fixup - 0x4000000))
307         gcc_except_table =.;
308 -    SECTION_gcc_except_table (codecacheram, ALIGN (0x4), AT (gcc_except_table - 0x8000000))
309 -       data_start = ALIGN(0x4) - 0x4000000; 
310 -    SECTION_data (dataram, data_start, AT (data_start - 0x4000000))
311 +    SECTION_gcc_except_table (codecacheram, ALIGN (0x4), AT (gcc_except_table - 0x4000000))
312 +       data_start = ALIGN(0x4) + 0x4000000; 
313 +    SECTION_data (datacacheram, data_start, AT (data_start - 0x8000000))
314         bss = .;
315 -    SECTION_bss (dataram, ALIGN (0x4), AT (bss - 0x4000000))
316 +    SECTION_bss (datacacheram, ALIGN (0x4), AT (bss - 0x8000000))
317      CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
318      SECTIONS_END
319  }
320 -
321 -
322 diff -Naur orig/hal/arm/netarm/current/include/pkgconf/mlt_arm_netarm_romram.ldi new/hal/arm/netarm/current/include/pkgconf/mlt_arm_netarm_romram.ldi
323 --- orig/hal/arm/netarm/current/include/pkgconf/mlt_arm_netarm_romram.ldi       2004-11-29 17:35:46.000000000 +0100
324 +++ new/hal/arm/netarm/current/include/pkgconf/mlt_arm_netarm_romram.ldi        2005-03-10 14:56:18.184583600 +0100
325 @@ -3,34 +3,32 @@
326  MEMORY
327  {
328      noncacheram : ORIGIN = 0, LENGTH = 16*1024*1024
329 -    dataram : ORIGIN = 0x4000000, LENGTH = 16*1024*1024
330 -    codecacheram : ORIGIN = 0x8000000, LENGTH = 16*1024*1024
331 +    codecacheram : ORIGIN = 0x4000000, LENGTH = 16*1024*1024
332 +    datacacheram : ORIGIN = 0x8000000, LENGTH = 16*1024*1024
333  }
334  
335  SECTIONS
336  {
337      SECTIONS_BEGIN
338 -       _dataram = 0x4000000;
339 +       _dataram = 0x8000000;
340      SECTION_rom_vectors (nocacheram, 0x0, LMA_EQ_VMA)
341      SECTION_fixed_vectors (nocacheram, ALIGN (0x4), LMA_EQ_VMA)
342 -       code_start = . + 0x8000000; 
343 -    SECTION_text (codecacheram, code_start, AT (code_start -  0x8000000))
344 +       code_start = . + 0x4000000; 
345 +    SECTION_text (codecacheram, code_start, AT (code_start - 0x4000000))
346         fini = .;
347 -    SECTION_fini (codecacheram, ALIGN (0x4), AT (fini -  0x8000000))
348 +    SECTION_fini (codecacheram, ALIGN (0x4), AT (fini - 0x4000000))
349         rodata = .;
350 -    SECTION_rodata (codecacheram, ALIGN (0x4), AT (rodata -  0x8000000))
351 +    SECTION_rodata (codecacheram, ALIGN (0x4), AT (rodata - 0x4000000))
352         rodata1 = .;
353 -    SECTION_rodata1 (codecacheram, ALIGN (0x4), AT (rodata1 -  0x8000000))
354 +    SECTION_rodata1 (codecacheram, ALIGN (0x4), AT (rodata1 - 0x4000000))
355         fixup = .;
356 -    SECTION_fixup (codecacheram, ALIGN (0x4), AT (fixup -  0x8000000))
357 -       gcc_except_table = .;
358 -    SECTION_gcc_except_table (codecacheram, ALIGN (0x4), AT (gcc_except_table -  0x8000000))
359 -       data_start = . - 0x4000000; 
360 -    SECTION_data (dataram, data_start, AT (data_start -  0x4000000))
361 +    SECTION_fixup (codecacheram, ALIGN (0x4), AT (fixup - 0x4000000))
362 +       gcc_except_table =.;
363 +    SECTION_gcc_except_table (codecacheram, ALIGN (0x4), AT (gcc_except_table - 0x4000000))
364 +       data_start = ALIGN(0x4) + 0x4000000; 
365 +    SECTION_data (datacacheram, data_start, AT (data_start - 0x8000000))
366         bss = .;
367 -    SECTION_bss (dataram, ALIGN (0x4), AT (bss -  0x4000000))
368 +    SECTION_bss (datacacheram, ALIGN (0x4), AT (bss - 0x8000000))
369      CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
370      SECTIONS_END
371  }
372 -
373 -
374 diff -Naur orig/hal/arm/netarm/current/src/netarm_misc.c new/hal/arm/netarm/current/src/netarm_misc.c
375 --- orig/hal/arm/netarm/current/src/netarm_misc.c       2004-11-29 17:35:48.000000000 +0100
376 +++ new/hal/arm/netarm/current/src/netarm_misc.c        2005-02-22 11:57:58.296703200 +0100
377 @@ -7,15 +7,15 @@
378  //==========================================================================
379  //==========================================================================
380  //#####DESCRIPTIONBEGIN####
381 -// 
382 +//
383  // Author(s):    Peter De Schrijver (p2@mind.be)
384  // Contributors: Peter De Schrijver (p2@mind.be)
385  // Date:         2002-10-25
386  // Purpose:      HAL board support
387  // Description:  Implementations of HAL board interfaces
388 -// 
389 +//
390  //####DESCRIPTIONEND####
391 -// 
392 +//
393  //========================================================================*/
394  
395  #include <pkgconf/hal.h>
396 @@ -29,7 +29,7 @@
397  #include <cyg/hal/hal_io.h>             // IO macros
398  #include <cyg/hal/hal_arch.h>           // Register state info
399  #include <cyg/hal/hal_diag.h>
400 -#include <cyg/hal/hal_intr.h>           // Interrupt names 
401 +#include <cyg/hal/hal_intr.h>           // Interrupt names
402  #include <cyg/hal/hal_cache.h>
403  #include <cyg/hal/hal_netarm.h>         // Hardware definitions
404  #include <cyg/hal/hal_if.h>             // calling interface API
405 @@ -74,9 +74,9 @@
406  void hal_clock_read(cyg_uint32 *pvalue) {
407  
408         static cyg_uint32 clock_val;
409 -       
410 -       clock_val=*TIMERSTAT1 & 0x1ff; 
411 -       *pvalue = (cyg_uint32)(_period - clock_val); 
412 +
413 +       clock_val=*TIMERSTAT1 & 0x1ff;
414 +       *pvalue = (cyg_uint32)(_period - clock_val);
415  
416  }
417  
418 @@ -97,24 +97,19 @@
419  
420  void hal_hardware_init(void) {
421  
422 +#if defined (CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP) ||   \
423 +       defined (CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP)
424  
425 -#ifdef ENABLECACHE
426 -       /* CS1 BSIZE = 4 */
427 -       *OR1&=~(3 << 4);
428 -       *OR1|=1 << 4;
429 -       
430 -       HAL_ICACHE_ENABLE();
431 -#endif /* ENABLECACHE */
432 +       HAL_CACHE_ENABLE();
433  
434 +#endif /* ENABLECACHE */
435  
436         *INTENABLE_CLR=0xffffffff;
437 -                       
438 +
439         hal_clock_initialize(CYGNUM_HAL_RTC_PERIOD);
440  
441         hal_if_init();
442  
443 -//     HAL_ICACHE_DISABLE();
444 -
445  }
446  
447  int hal_spurious_ints;
448 @@ -125,8 +120,8 @@
449         int i;
450  
451         stat=*INTSTATUS;
452 -       
453 -       for(i=0;i<CYGNUM_HAL_ISR_MAX;i++) 
454 +
455 +       for(i=0;i<CYGNUM_HAL_ISR_MAX;i++)
456                 if(stat & (1<<i))
457                         return i+1;
458  
459 @@ -154,7 +149,7 @@
460  
461         if((vector>=CYGNUM_HAL_INTERRUPT_C0) && (vector<=CYGNUM_HAL_INTERRUPT_C3)) {
462                 *PORTC|=1<< (vector+23);
463 -       if(up) 
464 +       if(up)
465                         *PORTC|=1<< (vector+15);
466                 else
467                         *PORTC&=~(1<< (vector+15));