1 |
27 |
unneback |
##==========================================================================
|
2 |
|
|
##
|
3 |
|
|
## platform.inc
|
4 |
|
|
##
|
5 |
|
|
## OpenRISC Reference Platform (ORP) board-specific defines
|
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 Red Hat, 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 version.
|
16 |
|
|
##
|
17 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
18 |
|
|
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
## for more details.
|
21 |
|
|
##
|
22 |
|
|
## You should have received a copy of the GNU General Public License along
|
23 |
|
|
## with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
25 |
|
|
##
|
26 |
|
|
## As a special exception, if other files instantiate templates or use macros
|
27 |
|
|
## or inline functions from this file, or you compile this file and link it
|
28 |
|
|
## with other works to produce a work based on this file, this file does not
|
29 |
|
|
## by itself cause the resulting work to be covered by the GNU General Public
|
30 |
|
|
## License. However the source code for this file must still be made available
|
31 |
|
|
## in accordance with section (3) of the GNU General Public License.
|
32 |
|
|
##
|
33 |
|
|
## This exception does not invalidate any other reasons why a work based on
|
34 |
|
|
## this file might be covered by the GNU General Public License.
|
35 |
|
|
##
|
36 |
|
|
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
37 |
|
|
## at http://sources.redhat.com/ecos/ecos-license/
|
38 |
|
|
## -------------------------------------------
|
39 |
|
|
#####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
##==========================================================================
|
41 |
|
|
#######DESCRIPTIONBEGIN####
|
42 |
|
|
##
|
43 |
|
|
## Author(s): sfurman
|
44 |
|
|
## Contributors:
|
45 |
|
|
## Date: 2003-01-20
|
46 |
|
|
## Purpose: ORP platform-specific init
|
47 |
|
|
## Description: This file handles the post-reset hardware initialization
|
48 |
|
|
## that is specific to the ORP platform (but not specific to
|
49 |
|
|
## the OpenRISC processor itself). So far, it only
|
50 |
|
|
## initializes the memory controller so as to map Flash and
|
51 |
|
|
## SDRAM into the memory space.
|
52 |
|
|
##
|
53 |
|
|
######DESCRIPTIONEND####
|
54 |
|
|
##
|
55 |
|
|
##==========================================================================
|
56 |
|
|
|
57 |
|
|
#ifndef _PLATFORM_INC_
|
58 |
|
|
#define _PLATFORM_INC_
|
59 |
|
|
|
60 |
|
|
#include
|
61 |
|
|
#include CYGHWR_MEMORY_LAYOUT_H
|
62 |
|
|
|
63 |
|
|
/* Memory organization */
|
64 |
|
|
#define SDRAM_BASE_ADD CYGMEM_REGION_ram
|
65 |
|
|
#define FLASH_BASE_ADD CYGMEM_REGION_rom
|
66 |
|
|
|
67 |
|
|
/* Memory Controller's base address */
|
68 |
|
|
#define MC_BASE_ADD 0x93000000
|
69 |
|
|
|
70 |
|
|
/* Memory controller initialize magic values */
|
71 |
|
|
#define MC_CSR_VAL 0x0B000300
|
72 |
|
|
#define MC_MASK_VAL 0x000003f0
|
73 |
|
|
#define FLASH_TMS_VAL 0x00000103
|
74 |
|
|
#define SDRAM_TMS_VAL 0x19220057
|
75 |
|
|
#define FLASH_CSC_VAL (((FLASH_BASE_ADD>>6) & 0x07ff0000) | 0x0025)
|
76 |
|
|
#define SDRAM_CSC_VAL (((SDRAM_BASE_ADD>>6) & 0x07ff0000) | 0x0411)
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
# Platform-specific, post-reset hardware initialization
|
80 |
|
|
.macro hal_hardware_init
|
81 |
|
|
init_mc:
|
82 |
|
|
load32i r3,MC_BASE_ADD
|
83 |
|
|
|
84 |
|
|
# Program Flash chip-select
|
85 |
|
|
load32i r5,FLASH_CSC_VAL
|
86 |
|
|
l.sw MC_CSC(0)(r3),r5
|
87 |
|
|
|
88 |
|
|
# Init flash timing
|
89 |
|
|
load32i r5,FLASH_TMS_VAL
|
90 |
|
|
l.sw MC_TMS(0)(r3),r5
|
91 |
|
|
|
92 |
|
|
# Start decoding memory addresses to generate chip-selects
|
93 |
|
|
l.addi r5,r0,MC_MASK_VAL
|
94 |
|
|
l.sw MC_BA_MASK(r3),r5
|
95 |
|
|
|
96 |
|
|
load32i r5, MC_CSR_VAL
|
97 |
|
|
l.sw MC_CSR(r3),r5
|
98 |
|
|
|
99 |
|
|
# Init DRAM timing
|
100 |
|
|
load32i r5, SDRAM_TMS_VAL
|
101 |
|
|
l.sw MC_TMS(1)(r3),r5
|
102 |
|
|
|
103 |
|
|
# Program DRAM chip-select
|
104 |
|
|
load32i r5, SDRAM_CSC_VAL
|
105 |
|
|
l.sw MC_CSC(1)(r3),r5
|
106 |
|
|
|
107 |
|
|
# Wait for SDRAM
|
108 |
|
|
l.addi r3,r0,0x1000
|
109 |
|
|
1: l.sfeqi r3,0
|
110 |
|
|
l.bnf 1b
|
111 |
|
|
l.addi r3,r3,-1
|
112 |
|
|
.endm
|
113 |
|
|
|
114 |
|
|
#endif /* ifndef _PLATFORM_INC_ */
|
115 |
|
|
|
116 |
|
|
#undef CYGIMP_FORCE_INTERRUPT_HANDLING_CODE_IN_RAM
|