tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / cpu / armv7 / sc9630 / 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 "asm/arch/boot_drvapi.h"
24 /**---------------------------------------------------------------------------*
25  **                         Compiler Flag                                     *
26  **---------------------------------------------------------------------------*/
27 #ifdef __cplusplus
28 extern   "C"
29 {
30 #endif
31
32 /**---------------------------------------------------------------------------*
33  **                         Global variables                                  *
34  **---------------------------------------------------------------------------*/
35
36 /**---------------------------------------------------------------------------*
37  **                         Local variables                                   *
38  **---------------------------------------------------------------------------*/
39 LOCAL BOOLEAN wdg_debug_mode = SCI_FALSE;
40
41 /**---------------------------------------------------------------------------*
42  **                     Local Function Prototypes                             *
43  **---------------------------------------------------------------------------*/
44
45 /**---------------------------------------------------------------------------*
46  **                         Function Prototypes                               *
47  **---------------------------------------------------------------------------*/
48 /*****************************************************************************/
49 //  Description:    Sets the different kinds of reset modes, used in normal p-
50 //                  ower up mode, watchdog reset mode and calibration mode etc.
51 //  Author:         Jeff.Li
52 //  Note:           
53 /*****************************************************************************/
54 PUBLIC void BOOT_SetRstMode (uint32 val)
55 {
56     CHIP_PHY_SetRstMode (val);
57 }
58
59 /*****************************************************************************/
60 //  Description:    Gets the current reset mode.
61 //  Author:         Jeff.Li
62 //  Note:
63 /*****************************************************************************/
64 PUBLIC uint32 BOOT_GetRstMode (void)
65 {
66     return CHIP_PHY_GetRstMode ();
67 }
68
69 /*****************************************************************************/
70 //  Description:    After normal power on, the HW_RST flag should be reset in
71 //                  order to judge differrent reset conditions between normal
72 //                  power on reset and watchdog reset.
73 //  Author:         Jeff.Li
74 //  Note:           
75 /*****************************************************************************/
76 PUBLIC void BOOT_ResetHWFlag ()
77 {
78     CHIP_PHY_ResetHWFlag (0x1FFF);
79 }
80
81 /*****************************************************************************/
82 //  Description:    Before watchdog reset, writting HW_RST flag is uesed to j-
83 //                  udge differrent watchdog reset conditions between MCU reset
84 //                  and system-halted.
85 //  Author:         Jeff.Li
86 //  Note:           
87 /*****************************************************************************/
88 PUBLIC void BOOT_SetWDGHWFlag (WDG_HW_FLAG_T type, uint32 val)
89 {
90         CHIP_PHY_SetWDGHWFlag (type, val);
91 }
92
93 PUBLIC void BOOT_ResetHWVal(uint32 val)
94 {
95     CHIP_PHY_ResetHWFlag (val);
96 }
97
98
99 /**---------------------------------------------------------------------------*
100  **                         Compiler Flag                                     *
101  **---------------------------------------------------------------------------*/
102 #ifdef __cplusplus
103 }
104 #endif