21920945229a120774536f36b6371148eefd2e5b
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / cpu / armv7 / sc8825 / boot_mode.c
1 /******************************************************************************
2  ** File Name:      boot_mode.c                                               *
3  ** Author:         Jeff Li                                                   *
4  ** DATE:           31/08/2010                                                *
5  ** Copyright:      2002 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:    This file defines the logic interfaces called during boot,*
7  **                 including reset mode setting, initialization etc.
8  ******************************************************************************
9
10  ******************************************************************************
11  **                        Edit History                                       *
12  ** ------------------------------------------------------------------------- *
13  ** DATE           NAME             DESCRIPTION                               *
14  ** 31/08/2010     Jeff.Li          Create.                                   *
15  ******************************************************************************/
16
17 /**---------------------------------------------------------------------------*
18  **                         Dependencies                                      *
19  **---------------------------------------------------------------------------*/
20 #include "os_api.h"
21 #include "sc_reg.h"
22 #include "chip_internal.h"
23 #include "mocor_boot_mode.h"
24
25 /**---------------------------------------------------------------------------*
26  **                         Compiler Flag                                     *
27  **---------------------------------------------------------------------------*/
28 #ifdef __cplusplus
29 extern   "C"
30 {
31 #endif
32
33 /**---------------------------------------------------------------------------*
34  **                         Global variables                                  *
35  **---------------------------------------------------------------------------*/
36
37 /**---------------------------------------------------------------------------*
38  **                         Local variables                                   *
39  **---------------------------------------------------------------------------*/
40 LOCAL BOOLEAN wdg_debug_mode = SCI_FALSE;
41
42 /**---------------------------------------------------------------------------*
43  **                     Local Function Prototypes                             *
44  **---------------------------------------------------------------------------*/
45
46 /**---------------------------------------------------------------------------*
47  **                         Function Prototypes                               *
48  **---------------------------------------------------------------------------*/
49 /*****************************************************************************/
50 //  Description:    Sets the different kinds of reset modes, used in normal p-
51 //                  ower up mode, watchdog reset mode and calibration mode etc.
52 //  Author:         Jeff.Li
53 //  Note:           
54 /*****************************************************************************/
55 PUBLIC void BOOT_SetRstMode (uint32 val)
56 {
57     CHIP_PHY_SetRstMode (val);
58 }
59
60 /*****************************************************************************/
61 //  Description:    Gets the current reset mode.
62 //  Author:         Jeff.Li
63 //  Note:
64 /*****************************************************************************/
65 PUBLIC uint32 BOOT_GetRstMode (void)
66 {
67     return CHIP_PHY_GetRstMode ();
68 }
69
70 /*****************************************************************************/
71 //  Description:    After normal power on, the HW_RST flag should be reset in
72 //                  order to judge differrent reset conditions between normal
73 //                  power on reset and watchdog reset.
74 //  Author:         Jeff.Li
75 //  Note:           
76 /*****************************************************************************/
77 PUBLIC void BOOT_ResetHWFlag ()
78 {
79     CHIP_PHY_ResetHWFlag (0x1FFF);
80 }
81
82 /*****************************************************************************/
83 //  Description:    Before watchdog reset, writting HW_RST flag is uesed to j-
84 //                  udge differrent watchdog reset conditions between MCU reset
85 //                  and system-halted.
86 //  Author:         Jeff.Li
87 //  Note:           
88 /*****************************************************************************/
89 PUBLIC void BOOT_SetWDGHWFlag (WDG_HW_FLAG_T type, uint32 val)
90 {
91         CHIP_PHY_SetWDGHWFlag (type, val);
92 }
93
94 PUBLIC void BOOT_ResetHWVal(uint32 val)
95 {
96     CHIP_PHY_ResetHWFlag (val);
97 }
98
99
100 /**---------------------------------------------------------------------------*
101  **                         Compiler Flag                                     *
102  **---------------------------------------------------------------------------*/
103 #ifdef __cplusplus
104 }
105 #endif