OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [xscale/] [mpc50/] [current/] [include/] [hal_platform_setup.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
/*=============================================================================
2
//
3
//      hal_platform_setup.h
4
//
5
//      Platform specific support for HAL (assembly code)
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later
16
// version.
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21
// for more details.
22
//
23
// You should have received a copy of the GNU General Public License
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26
//
27
// As a special exception, if other files instantiate templates or use
28
// macros or inline functions from this file, or you compile this file
29
// and link it with other works to produce a work based on this file,
30
// this file does not by itself cause the resulting work to be covered by
31
// the GNU General Public License. However the source code for this file
32
// must still be made available in accordance with section (3) of the GNU
33
// General Public License v2.
34
//
35
// This exception does not invalidate any other reasons why a work based
36
// on this file might be covered by the GNU General Public License.
37
// -------------------------------------------
38
// ####ECOSGPLCOPYRIGHTEND####
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):    <knud.woehler@microplex.de>
43
// Date:         2003-01-09
44
//
45
//####DESCRIPTIONEND####
46
//
47
//===========================================================================*/
48
#ifndef CYGONCE_HAL_PLATFORM_SETUP_H
49
#define CYGONCE_HAL_PLATFORM_SETUP_H
50
 
51
#include <pkgconf/system.h>             // System-wide configuration info
52
#include CYGBLD_HAL_VARIANT_H           // Variant specific configuration
53
#include CYGBLD_HAL_PLATFORM_H  // Platform specific configuration
54
#include <cyg/hal/hal_pxa2x0.h> // Platform specific hardware definitions
55
#include <cyg/hal/hal_mmu.h>            // MMU definitions
56
#include <cyg/hal/hal_mm.h>             // more MMU definitions
57
#include <cyg/hal/mpc50.h>
58
 
59
/**********************************************************************************************************************
60
* MMU/Cache
61
**********************************************************************************************************************/
62
.macro init_mmu_cache_on
63
                ldr             r0, =0x2001
64
                mcr             p15, 0, r0, c15, c1, 0
65
                mcr             p15, 0, r0, c7, c10, 4           // drain the write & fill buffers
66
                CPWAIT  r0
67
                mcr             p15, 0, r0, c7, c7, 0             // flush Icache, Dcache and BTB
68
                CPWAIT  r0
69
                mcr             p15, 0, r0, c8, c7, 0             // flush instuction and data TLBs
70
                CPWAIT  r0
71
 
72
                // Icache on
73
                mrc             p15, 0, r0, c1, c0, 0
74
                orr             r0, r0, #MMU_Control_I
75
                orr             r0, r0, #MMU_Control_BTB                // Enable the BTB
76
                mcr             p15, 0, r0, c1, c0, 0
77
                CPWAIT  r0
78
 
79
                // create stack for "C"
80
                ldr     r1,=__startup_stack
81
                ldr     r2,=PXA2X0_RAM_BANK0_BASE
82
                orr     sp,r1,r2
83
                bl              hal_mmu_init    // create MMU Tables 
84
 
85
                // Enable permission checks in all domains
86
                ldr             r0, =0x55555555
87
                mcr             p15, 0, r0, c3, c0, 0
88
 
89
                // MMU on
90
                ldr     r2,=1f
91
                mrc             p15, 0, r0, c1, c0, 0
92
                orr             r0, r0, #MMU_Control_M
93
                orr             r0, r0, #MMU_Control_R
94
                mcr             p15, 0, r0, c1, c0, 0
95
                mov             pc,r2
96
                nop
97
                nop
98
                nop
99
1:
100
 
101
                mcr             p15, 0, r0, c7, c10, 4           // drain the write & fill buffers
102
                CPWAIT  r0
103
 
104
                // Dcache on
105
                mrc             p15, 0, r0, c1, c0, 0
106
                orr             r0, r0, #MMU_Control_C
107
                mcr             p15, 0, r0, c1, c0, 0
108
                CPWAIT  r0
109
 
110
                // clean/drain/flush the main Dcache
111
                mov             r1, #0xc0000000
112
                mov             r0, #1024
113
2:
114
                mcr             p15, 0, r1, c7, c2, 5
115
                add             r1, r1, #32
116
                subs    r0, r0, #1
117
                bne             2b
118
 
119
                // clean/drain/flush the mini Dcache
120
                //ldr   r1, =(DCACHE_FLUSH_AREA+DCACHE_SIZE) // use a CACHEABLE area of
121
                mov             r0, #64                                 // number of lines in the mini Dcache
122
3:
123
                mcr             p15, 0, r1, c7, c2, 5    // allocate a Dcache line
124
                add             r1, r1, #32                             // increment the address to
125
                subs    r0, r0, #1                              // decrement the loop count
126
                bne             3b
127
 
128
                // flush Dcache
129
                mcr             p15, 0, r0, c7, c6, 0
130
                CPWAIT  r0
131
 
132
                // drain the write & fill buffers
133
                mcr             p15, 0, r0, c7, c10, 4
134
                CPWAIT  r0
135
 
136
.endm
137
 
138
 
139
 
140
.macro  init_mmu_off
141
                mov             r0, #0x78                        
142
                mcr             p15, 0, r0, c1, c0, 0     // caches off -- MMU off or ID map
143
                mcr             p15, 0, r0, c7, c7, 0     // Invalidate the I & D cache, mini- d cache, and BTB
144
                mcr             p15, 0, r0, c7, c10, 4   // Drain write buffer -- r0 ignored
145
                CPWAIT  r0
146
                nop
147
                nop
148
                nop
149
                nop
150
                mvn             r0, #0                      
151
                mcr             p15, 0, r0, c3, c0, 0
152
.endm
153
 
154
/**********************************************************************************************************************
155
* Clock
156
**********************************************************************************************************************/
157
#define CCCR_OFFS (PXA2X0_CCCR-PXA2X0_CLK_BASE)
158
.macro init_clks
159
                ldr             r1, =PXA2X0_CLK_BASE
160
                // TurboMode=400MHz/RunMode=200MHz/Memory=100MHz/SDRam=100MHz
161
//              ldr             r0, =(PXA2X0_CCCR_L27 | PXA2X0_CCCR_M2 | PXA2X0_CCCR_N20)
162
                // TurboMode=300MHz/RunMode=200MHz/Memory=100MHz/SDRam=100MHz   
163
//              ldr             r0, =(PXA2X0_CCCR_L27 | PXA2X0_CCCR_M2 | PXA2X0_CCCR_N15)       
164
                adr             r0, mpc50_static_info
165
                ldr             r0, [r0, #MPC50_VAL_OFFS_CCCR]
166
 
167
                str             r0, [r1, #CCCR_OFFS]                                    // set Core Clock
168
                mov             r0,     #3
169
                mcr             p14, 0, r0, c6, c0, 0                                     // Turbo Mode on
170
.endm
171
 
172
/**********************************************************************************************************************
173
* Interrupt controller
174
**********************************************************************************************************************/
175
#define ICLR_OFFS (PXA2X0_ICLR-PXA2X0_IC_BASE)
176
#define ICMR_OFFS (PXA2X0_ICMR-PXA2X0_IC_BASE)
177
.macro init_intc_cnt
178
                ldr             r1, =PXA2X0_IC_BASE
179
                mov             r0, #0
180
                str             r0, [r1, #ICLR_OFFS]                                                                    // clear Interrupt level Register
181
                str             r0,     [r1, #ICMR_OFFS]                                                                        // clear Interrupt mask Register
182
.endm
183
 
184
/**********************************************************************************************************************
185
* SDRAM
186
**********************************************************************************************************************/
187
 
188
//#define MDCNFG_VAL    0x094B094B      // SDRAM Config Reg (32Bit, 9 Col, 13 Row, 2 Bank, CL2)
189
//#define MDREFR_VAL    0x0005b018  // SDRAM Refresh Reg SDCLK=memory clock
190
//#define MDREFR_VAL    0x000ff018  // SDRAM Refresh Reg SDCLK=1/2 memory clock
191
#define MDMRS_VAL       0x00000000  // SDRAM Mode Reg Set Config Reg
192
#define MSC0_VAL        0x199123da      // CS1(FPGA)/CS0(Flash)
193
#define MSC1_VAL        0x7ff07ff1      // CS3(not used)/CS2(ETH)
194
 
195
#define OSCR_OFFS       (PXA2X0_OSCR-PXA2X0_OSTIMER_BASE)
196
#define MDREFR_OFFS     (PXA2X0_MDREFR-PXA2X0_MEMORY_CTL_BASE)
197
#define MDCNFG_OFFS     (PXA2X0_MDCNFG-PXA2X0_MEMORY_CTL_BASE)
198
#define MDMRS_OFFS      (PXA2X0_MDMRS-PXA2X0_MEMORY_CTL_BASE)
199
#define MSC0_OFFS       (PXA2X0_MSC0-PXA2X0_MEMORY_CTL_BASE)
200
#define MSC1_OFFS       (PXA2X0_MSC1-PXA2X0_MEMORY_CTL_BASE)
201
#define MSC2_OFFS       (PXA2X0_MSC2-PXA2X0_MEMORY_CTL_BASE)
202
.macro init_sdram_cnt
203
// Hardware Reset Operation (S. 5-83)
204
// Step 1
205
 
206
// wait 200 usec
207
                ldr             r1,     =PXA2X0_OSTIMER_BASE                                                            // set OS Timer Count
208
                mov             r0,     #0
209
                str             r0,     [r1, #OSCR_OFFS] 
210
                ldr             r2,     =0x300                                                                                          // wait 200 usec 
211
61:
212
                ldr             r0,     [r1, #OSCR_OFFS] 
213
                cmp             r2,     r0
214
                bgt             61b
215
 
216
                ldr             r1,  =PXA2X0_MEMORY_CTL_BASE
217
 
218
        ldr     r0,  =MSC0_VAL
219
                str             r0,     [r1, #MSC0_OFFS]                                                                        // FPGA/Flash
220
 
221
                ldr     r0,  =MSC1_VAL
222
                str             r0,     [r1, #MSC1_OFFS]                                                                        // ETH
223
 
224
                // Refresh Register 
225
        //ldr     r3,  =MDREFR_VAL                                                                              // load SDRAM refresh info
226
                adr             r3,  mpc50_static_info
227
                ldr             r3,  [r3, #MPC50_VAL_OFFS_MDREFR]
228
 
229
 
230
                ldr     r2,  =0xFFF                                                                                             // DRI field
231
        and     r3,  r3,  r2
232
        ldr     r4,  [r1, #MDREFR_OFFS]                                                                 // read Reset Status
233
        bic     r4,  r4,  r2
234
                bic     r4,  r4,  #(0x01000000 | 0x02000000)                                    // clear K1Free, K2Free, 
235
                bic             r4,  r4,  #0x00004000                                                                   // K0DB2
236
        orr     r4,  r4,  r3                                                                                    // add DRI field
237
        str     r4,  [r1, #MDREFR_OFFS]                                                                 // 
238
        ldr     r4,  [r1, #MDREFR_OFFS]
239
 
240
// Step 2
241
// 
242
 
243
// Step 3
244
        //ldr     r3,  =MDREFR_VAL                                                                              // load SDRAM Refresh Info 
245
                adr             r3,  mpc50_static_info
246
                ldr             r3,  [r3, #MPC50_VAL_OFFS_MDREFR]
247
 
248
 
249
                ldr     r2,  =0x000f0000
250
        and     r3,  r3,  r2
251
        orr     r4,  r4,  r3
252
        str     r4,  [r1, #MDREFR_OFFS]
253
        ldr     r4,  [r1, #MDREFR_OFFS]        
254
 
255
        bic     r4,  r4,  #0x00400000                                                                   // Self Refresh off
256
        str     r4,  [r1, #MDREFR_OFFS]
257
        ldr     r4,  [r1, #MDREFR_OFFS]
258
 
259
                orr     r4,  r4,  #0x00008000                                                                   // SDCKE1 on
260
        str     r4,  [r1, #MDREFR_OFFS]
261
        ldr     r4,  [r1, #MDREFR_OFFS]
262
 
263
                orr     r4,  r4,  #0x00800000                                                                   // K0Free on
264
        str     r4,  [r1, #MDREFR_OFFS]
265
        ldr     r4,  [r1, #MDREFR_OFFS]
266
                nop
267
        nop
268
 
269
 // Step 4       
270
                //ldr     r2,  =MDCNFG_VAL
271
                adr             r2,  mpc50_static_info
272
                ldr             r2,  [r2, #MPC50_VAL_OFFS_MDCNFG]
273
 
274
 
275
                bic     r2,  r2,  #0x0003               // DE1-0
276
        bic     r2,  r2,  #0x00030000   // DE3-2
277
        str     r2,  [r1, #MDCNFG_OFFS]
278
 
279
// Step 5
280
// wait 200 usec 
281
                ldr r1, =PXA2X0_OSTIMER_BASE
282
                mov r0, #0
283
                str r0, [r1, #OSCR_OFFS] 
284
                ldr r2, =0x300
285
71:
286
                ldr r0, [r1, #OSCR_OFFS] 
287
                cmp r2, r0
288
                bgt 71b
289
 
290
// Step 6
291
                mov    r0, #0x78
292
                mcr    p15, 0, r0, c1, c0, 0      // (caches off, MMU off, etc.)
293
 
294
// Step 7
295
            ldr     r2, =PXA2X0_RAM_BANK0_BASE
296
            str     r2, [r2]
297
            str     r2, [r2]
298
            str     r2, [r2]
299
            str     r2, [r2]
300
            str     r2, [r2]
301
            str     r2, [r2]
302
            str     r2, [r2]
303
            str     r2, [r2]
304
 
305
// Step 8
306
//
307
// Step 9
308
// SDRAM enable
309
                //ldr     r3,  =MDCNFG_VAL
310
                adr             r3,  mpc50_static_info
311
                ldr             r3,  [r3, #MPC50_VAL_OFFS_MDCNFG]
312
 
313
 
314
                ldr     r2,  =0x00030003
315
        and     r2,  r3,  r2
316
                ldr             r1,  =PXA2X0_MEMORY_CTL_BASE
317
        ldr     r3,  [r1, #MDCNFG_OFFS]
318
                orr     r3,  r3,  r2
319
                str     r3,  [r1, #MDCNFG_OFFS]
320
 
321
// Step 10
322
        ldr     r2,  =MDMRS_VAL
323
        str     r2,  [r1, #MDMRS_OFFS]
324
.endm
325
 
326
 
327
/**********************************************************************************************************************
328
* GPIOs
329
**********************************************************************************************************************/
330
 
331
// GPIO         Name                    Pin             GPDR    GAFR    GPSR
332
 
333
//      0                INT0                    L10             0                00              0
334
//      1               INT1                    L12             0                00              0
335
//      2               FLX-CLK                 L13             1               00              0
336
//      3               FLX-DAT                 K14             1               00              0
337
 
338
//      4               FLX-CONFIG              J12             1               00              1
339
//      5               FLX-STATUS              J11             0                00              0
340
//      6               FLX-CONFDONE    H14             0                00              0
341
//      7               LAN_INT                 G15             0                00              0
342
 
343
//      8               USB-H-ON                F14             1               00              1
344
//      9               USB-CL-ON               F12             0                00              0
345
//      10              MPSB-INT0               F7              0                00              0
346
//      11              -                               A7              0                00              0
347
 
348
//      12              MPSB-INT1               B6              0                00              0
349
//      13              MBGNT                   B5              1               10              0
350
//      14              MBREQ                   B4              0                01              0
351
//      15              nCS_1                   T8              1               10              1
352
 
353
#define GAFR0_L_VAL             0x80000000 //0x98000000
354
 
355
//      16              PWM0                    E12             0                00              0
356
//      17              PWM1                    D12             0                00              0
357
//      18              RDY                             C1              0                01              0
358
//      19              DREQ[1]                 N14             0                00              0
359
 
360
//      20              DREQ[0]                 N12             0                00              0
361
//      21              DVAL0                   N15             0                00              0
362
//      22              DVAL1                   M12             0                00              0
363
//      23              SSPSCLK                 F9              0                00              0
364
 
365
//      24              SSPSFRM                 E9              0                00              0
366
//      25              SSPTXD                  D9              0                00              0
367
//      26              SSPRXD                  A9              0                00              0
368
//      27              SSPEXTCLK               B9              0                00              0
369
 
370
//      28              BITCLK                  C9              0                00              0
371
//      29              SDATIN0                 E10             0                00              0
372
//      30              SDATOUT                 A10             0                00              0
373
//      31              SYNC                    E11             0                00              0
374
 
375
#define GPDR0_VAL               0x0000811c //0x0000a11c
376
#define GAFR0_U_VAL             0x00000010
377
#define GPSR0_VAL               0x00008110
378
 
379
//      32              SDATIN1                 A16             0                00              0
380
//      33              Reset-Button    T13             0                00              0
381
//      34              FFRXD                   A13             0                01              0
382
//      35              FFCTS                   A14             0                01              0
383
 
384
//      36              FFDCD                   A12             0                01              0
385
//      37              FFDSR                   B11             0                01              0
386
//      38              FFRI                    B10             0                01              0
387
//      39              FFTXD                   E13             1               10              1
388
 
389
//      40              FFDTR                   F10             1               10              1
390
//      41              FFRTS                   F8              1               10              1
391
//      42              BTRXD                   B13             0                00              0
392
//      43              BTTXD                   D13             0                00              0
393
 
394
//      44              BTCTS                   A15             0                00              0
395
//      45              BTRTS                   B14             0                00              0
396
//      46              IRRXD                   B15             0                00              0
397
//      47              IRTXD                   C15             0                00              0
398
 
399
#define GAFR1_L_VAL             0x000a9550
400
 
401
 
402
//      48              LED_DP                  P13             1               00              0
403
//      49              LED_G                   T14             1               00              0
404
//      50              LED_F                   T15             1               00              0
405
//      51              LED_E                   R15             1               00              0
406
 
407
//      52              LED_D                   P14             1               00              0
408
//      53              LED_C                   R16             1               00              0
409
//      54              LED_B                   P16             1               00              0
410
//      55              LED_A                   M13             1               00              0
411
 
412
//      56              GPIO56                  N16             0                00              0
413
//      57              GPIO57                  M16             0                00              0
414
//      58              LCDD0                   E7              0                00              0
415
//      59              LCDD1                   D7              0                00              0
416
 
417
//      60              LCDD2                   C7              0                00              0
418
//      61              LCDD3                   B7              0                00              0
419
//      62              LCDD4                   E6              0                00              0
420
//      63              LCDD5                   D6              0                00              0
421
 
422
#define GPDR1_VAL               0x00ff0380
423
#define GAFR1_U_VAL             0x00000000
424
#define GPSR1_VAL               0x00000380
425
#define GPSR_LED_VAL    0x00ff0000
426
 
427
//      64              LCDD6                   E5              0                00              0
428
//      65              LCDD7                   A6              0                00              0
429
//      66              LCDD8                   C5              0                00              0
430
//      67              LCDD9                   A5              0                00              0
431
 
432
//      68              LCDD10                  D5              0                00              0
433
//      69              LCDD11                  A4              0                00              0
434
//      70              LCDD12                  A3              0                00              0
435
//      71              LCDD13                  A2              0                00              0
436
 
437
//      72              LCDD14                  C3              0                00              0
438
//      73              LCDD15                  B3              0                00              0
439
//      74              LCDFCLK                 E8              0                00              0
440
//      75              LCDLCLK                 D8              0                00              0
441
 
442
//      76              LCDPCLK                 B8              0                00              0
443
//      77              LCDBIAS                 A8              0                00              0
444
//      78              n_CS2                   P9              1               10              1
445
//      79              LAN_RES                 T9              1               00              1
446
 
447
#define GAFR2_L_VAL             0x20000000
448
 
449
//      80              n_CS4                   R13             0                00              0
450
 
451
#define GPDR2_VAL               0x0000c000
452
#define GAFR2_U_VAL             0x00000000
453
#define GPSR2_VAL               0x0000c000
454
 
455
 
456
#define GPSR0_OFFS              (PXA2X0_GPSR0-PXA2X0_GPIO_BASE)
457
#define GPCR0_OFFS              (PXA2X0_GPCR0-PXA2X0_GPIO_BASE)
458
#define GPSR1_OFFS              (PXA2X0_GPSR1-PXA2X0_GPIO_BASE)
459
#define GPCR1_OFFS              (PXA2X0_GPCR1-PXA2X0_GPIO_BASE)
460
#define GPSR2_OFFS              (PXA2X0_GPSR2-PXA2X0_GPIO_BASE)
461
#define GPCR2_OFFS              (PXA2X0_GPCR2-PXA2X0_GPIO_BASE)
462
#define GPDR0_OFFS              (PXA2X0_GPDR0-PXA2X0_GPIO_BASE)
463
#define GPDR1_OFFS              (PXA2X0_GPDR1-PXA2X0_GPIO_BASE)
464
#define GPDR2_OFFS              (PXA2X0_GPDR2-PXA2X0_GPIO_BASE)
465
#define GAFR0_L_OFFS    (PXA2X0_GAFR0_L-PXA2X0_GPIO_BASE)
466
#define GAFR0_U_OFFS    (PXA2X0_GAFR0_U-PXA2X0_GPIO_BASE)
467
#define GAFR1_L_OFFS    (PXA2X0_GAFR1_L-PXA2X0_GPIO_BASE)
468
#define GAFR1_U_OFFS    (PXA2X0_GAFR1_U-PXA2X0_GPIO_BASE)
469
#define GAFR2_L_OFFS    (PXA2X0_GAFR2_L-PXA2X0_GPIO_BASE)
470
#define GAFR2_U_OFFS    (PXA2X0_GAFR2_U-PXA2X0_GPIO_BASE)
471
#define PSSR_OFFS               (PXA2X0_PSSR-PXA2X0_PM_BASE)
472
 
473
.macro init_mpc_gpio
474
        ldr             r1, =PXA2X0_GPIO_BASE
475
 
476
        ldr             r0, =GPSR0_VAL                  // set GPIO outputs to default
477
        str             r0, [r1, #GPSR0_OFFS]
478
                mvn             r0, r0
479
                str             r0, [r1, #GPCR0_OFFS]
480
                ldr             r0, =GPSR1_VAL                  // set GPIO outputs to default
481
        str             r0, [r1, #GPSR1_OFFS]
482
                mvn             r0, r0
483
        str             r0, [r1, #GPCR1_OFFS]
484
        ldr             r0, =GPSR2_VAL                  // set GPIO outputs to default
485
        str             r0, [r1, #GPSR2_OFFS]
486
                mvn             r0, r0
487
                str             r0, [r1, #GPCR2_OFFS]
488
 
489
                ldr             r0, =GPDR0_VAL                  // GPIO direction
490
                str             r0, [r1, #GPDR0_OFFS]
491
                ldr             r0, =GPDR1_VAL                  // GPIO direction
492
                str             r0, [r1, #GPDR1_OFFS]
493
                ldr             r0, =GPDR2_VAL                  // GPIO direction
494
                str             r0, [r1, #GPDR2_OFFS]
495
 
496
        ldr             r0, =GAFR0_L_VAL                // GPIO alternate function
497
        str             r0, [r1, #GAFR0_L_OFFS]
498
        ldr             r0, =GAFR0_U_VAL                // GPIO alternate function
499
        str             r0, [r1, #GAFR0_U_OFFS]
500
        ldr             r0, =GAFR1_L_VAL                // GPIO alternate function
501
        str             r0, [r1, #GAFR1_L_OFFS]
502
        ldr             r0, =GAFR1_U_VAL                // GPIO alternate function
503
        str             r0, [r1, #GAFR1_U_OFFS]
504
        ldr             r0, =GAFR2_L_VAL                // GPIO alternate function
505
        str             r0, [r1, #GAFR2_L_OFFS]
506
        ldr             r0, =GAFR2_U_VAL                // GPIO alternate function
507
        str             r0, [r1, #GAFR2_U_OFFS]
508
 
509
        ldr             r1, =PXA2X0_PM_BASE
510
                ldr             r0,     =0x20
511
        str             r0, [r1, #PSSR_OFFS]    // enable GPIO inputs 
512
 
513
.endm
514
 
515
/**********************************************************************************************************************
516
* LED
517
**********************************************************************************************************************/
518
//   -7-
519
// |     |
520
// 1     6
521
// |     |
522
//   -2-
523
// |     |
524
// 3     5
525
// |     |
526
//   -4-     0
527
 
528
#define CYGHWR_LED_MACRO                                \
529
        b               2f                                                      ;\
530
1:                                                                              ;\
531
        .byte 0xfb, 0x61, 0xdd, 0xf5            ;\
532
        .byte 0x67, 0xb7, 0xbf, 0xe1            ;\
533
        .byte 0xff, 0xf7, 0xef, 0x3f            ;\
534
        .byte 0x1d, 0x7d, 0x9f, 0x8f            ;\
535
2:                                                                              ;\
536
        ldr             r1, =PXA2X0_GPIO_BASE           ;\
537
        mov             r0, #0x00ff0000                         ;\
538
        str             r0, [r1, #GPSR1_OFFS]           ;\
539
        sub             r0, pc, #((3f+4)-1b)            ;\
540
3:                                                                              ;\
541
        ldrb    r0,     [r0, #\x]                               ;\
542
        mov             r0, r0, lsl #16                         ;\
543
        str             r0, [r1, #GPCR1_OFFS]           ;
544
 
545
/**********************************************************************************************************************
546
* initialize controller
547
**********************************************************************************************************************/
548
 
549
#if defined(CYG_HAL_STARTUP_ROM)
550
#define PLATFORM_SETUP1 _platform_setup1
551
#define CYGHWR_HAL_ARM_HAS_MMU
552
#else
553
#define PLATFORM_SETUP1
554
#endif
555
 
556
.macro _platform_setup1
557
        .rept 0x20/4
558
        nop
559
        .endr
560
        b               1f
561
 
562
.globl mpc50_static_info        // Space for some static information
563
mpc50_static_info:
564
        .byte 'M','P','C','5'   // Magic
565
        .rept 16
566
        .long 0
567
        .endr
568
1:
569
        init_mmu_off                    // MMU on (and Cache)
570
        init_mpc_gpio                   // GPIOs 
571
        LED(12)
572
        init_sdram_cnt                  // SDRAM 
573
        LED(11)
574
        init_intc_cnt                   // Interrupt Controller 
575
        LED(10)
576
        init_clks                               // Clocks 
577
        LED(9)
578
        init_mmu_cache_on               // MMU and Cache 
579
        LED(8)
580
.endm
581
 
582
#endif /* CYGONCE_HAL_PLATFORM_SETUP_H */
583
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.