source: svn/newcon3bcm2_21bu/rockford/bsp/bcm97552/no-os/src/sde/scramble.s

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1#ifndef __ASSEMBLER__
2#define __ASSEMBLER__
3#endif
4#include "bmips.h"
5#include "bchp.h"
6#include "bchp_common.h"
7#include "bchp_bsp_glb_control.h"
8#include "bchp_bsp_cmdbuf.h"
9
10/*
11 * The following define needs to be manually turned on/off
12 * depending on what chip the CFE is being built for.
13 *
14 * NON-ZEUS_2_0:
15 *      7231A0/7344A0/7346A0/7420A0/7425A0/7552A0 FullROM
16 *
17 * ZEUS_2_0:
18 *      7231A0/7344A0/7346A0/7420A0/7425A0/7552A0 BSECK
19 *      7231B0/7344B0/7346B0/7420B0/7425B0/7552B0 FullROM
20 */
21#if (BCHP_VER == BCHP_VER_B0)       
22#define ZEUS_2_0
23#endif
24       
25#if defined(ZEUS_2_0)
26#define CMD_INBUFFER2           (2 * 384)               /* 0x300 */
27#else
28#define CMD_INBUFFER2           (1 * 384)               /* 0x180 */
29#endif /* ZEUS_2_0 */
30#define CMD_OUTBUFFER2          (3 * 384)               /* 0x480 */
31
32#if 0
33.data
34ScramErr_msg:   .asciiz "ScramErr="
35CR_msg:         .asciiz         "\n\r"
36#endif
37
38.text
39
40/******************************************************************************
41 * Function: sdram_scramble_command
42 * Arguments:   None
43 * Returns:             None
44 * Description:
45 * Trashes:             s0, t0, t1, a0
46 *
47 *      pseudo code:
48 *     
49 ******************************************************************************/
50
51
52LEAF(sdram_scramble_command)
53
54.set noreorder
55        /* a1: parameter length
56         */
57
58        move    s0, ra
59
60start_Enable_SDRAM_Encryption: 
61
62    /* XXX */
63    li      a0, 'S'
64    bal     _writeasm
65    nop
66
67        /*li            t0,0xb030b008 */
68        li              t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_IRDY)
69
70        lw              t1,0(t0)
71
72        andi    t1,t1,0x02
73
74
75
76        bne             t1,0x02,end_Enable_SDRAM_Encryption
77
78        nop
79
80
81        /*li            t0,0xb0307980 */
82        li              t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_CMDBUF_DMEMi_ARRAY_BASE+CMD_INBUFFER2)
83
84        li              t1,0x10
85
86        sw              t1,0(t0)
87
88        li              t1,0xDE
89
90        sw              t1,4(t0)
91
92        li              t1,0xabcdef00
93
94        sw              t1,8(t0)
95
96        li              t1,0xe355aa1C 
97
98        sw              t1,12(t0) 
99
100        li              t1,0x789a0000
101
102        addu    t1, t1, a1
103       
104        sw              t1,16(t0)
105
106    /* cold boot, new keys */
107        li              t1,0x0     
108       
109        sw              t1,20(t0)
110
111        /* set ILOAD2 */
112
113        /*li            t0,0xb030b028*/
114    li          t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_ILOAD2)   
115
116        li              t1,0x01
117
118        sw              t1,0(t0)
119
120       
121
122        /* poll for OLOAD2 */
123
124wait_for_OLOAD_DE_SDENC:
125
126
127        /*li            t0,0xb030b020 */
128    li          t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_OLOAD2)   
129
130        lw              t1,0(t0)
131
132        andi    t1, t1,0x01
133
134        beq             t1,zero,wait_for_OLOAD_DE_SDENC
135
136        nop
137
138       
139
140        /* reset OLOAD2 */
141
142        /*li            t0,0xb030b010 */
143        li              t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_HOST_INTR_STATUS)
144
145        li              t1,0x00
146
147        sw              t1,0(t0)
148
149        /*li            t0,0xb030b020 */
150    li          t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_OLOAD2)   
151
152        li              t1,0x00
153
154        sw              t1,0(t0)
155
156
157
158        /* check for status */
159
160        /*li            t0,0xb0307c80*/
161    li          t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_CMDBUF_DMEMi_ARRAY_BASE+CMD_OUTBUFFER2)   
162
163        lw              v0,20(t0)
164
165#if 0
166    /* XXX */
167    la      a0, ScramErr_msg
168    bal     aegis_print_string
169    nop
170    bal     aegis_print_hex
171    nop
172        la              a0, CR_msg
173    bal     aegis_print_string
174    nop
175#endif
176
177
178        beq             v0,zero,end_Enable_SDRAM_Encryption
179
180        nop
181
182end_Enable_SDRAM_Encryption:   
183        move    ra, s0
184
185
186.set reorder
187    jr          ra
188    nop
189   
190END(sdram_scramble_command)       
191
192
193
194/******************************************************************************
195 * Function: scramble_sdram
196 * Arguments:   None
197 * Returns:             None
198 * Description:
199 * Trashes:             t8, a0, a1
200 *
201 *      pseudo code:
202 *     
203 ******************************************************************************/
204
205LEAF(scramble_sdram)
206
207.set noreorder
208        move    t8, ra
209
210        /* Send a 4 byte length sdram scrambling command. */
211        li              a1, 0x4
212
213        bal     sdram_scramble_command
214       
215        nop
216
217        nop
218               
219        move    ra, t8
220
221
222.set reorder
223    jr          ra
224    nop
225   
226END(scramble_sdram)       
Note: See TracBrowser for help on using the repository browser.