tizen: add ramdisk bootmode with ramdisk config option
[profile/mobile/platform/kernel/u-boot-tm1.git] / include / normal_mode.h
1 #ifndef NORMAL_MODE_H
2 #define NORMAL_MODE_H
3
4 #include <config.h>
5 #include <common.h>
6 #include <linux/types.h>
7 #include <asm/arch/bits.h>
8 #include <linux/string.h>
9 #include <android_bootimg.h>
10 #include <linux/mtd/mtd.h>
11 #include <linux/mtd/ubi.h>
12 #include <linux/crc32b.h>
13 #include <linux/mtd/nand.h>
14 #include <nand.h>
15 #include <android_boot.h>
16 #include <environment.h>
17 #include <jffs2/jffs2.h>
18 #include <boot_mode.h>
19 #include <malloc.h>
20 #include <asm/arch/secure_boot.h>
21 #include <ubi_uboot.h>
22 #ifdef CONFIG_MTD_PARTITIONS
23 #include <linux/mtd/partitions.h>
24 #endif
25
26 extern unsigned spl_data_buf[0x2000] __attribute__((align(4)));
27 extern unsigned harsh_data_buf[8]__attribute__((align(4)));
28 extern void *spl_data;
29 extern void *harsh_data;
30 extern unsigned char raw_header[8192];
31 #define DEBUG 1
32
33 #ifdef DEBUG
34 #define debugf(fmt, args...) do { printf("%s(): ", __func__); printf(fmt, ##args); } while (0)
35 #else
36 #define debugf(fmt, args...)
37 #endif
38
39
40 #define SPL_PART "spl"
41 #define LOGO_PART "logo"
42 #define SIMLOCK_SIZE   1024
43 #define PRODUCTINFO_FILE_PATITION  "miscdata"
44
45
46 #if defined (CONFIG_SP8835EB) || defined(CONFIG_FPGA) ||defined(CONFIG_SP8830EB)||defined(CONFIG_SP8830EC)||defined(CONFIG_SP8830GEA)||defined(CONFIG_SC9620OPENPHONE)  //for TD CP1
47 #define SIMLOCK_ADR      (0x891FE800+0x4)   //0x4 just for data header
48 #elif defined (CONFIG_SP7735EC) || defined(CONFIG_SP7730EC)  //for W CP0
49 #define SIMLOCK_ADR      (0x920FE800+0x4)   //0x4(32bit) just for data header
50 #endif
51
52 #define KERNEL_ADR      0x80008000
53 #define VLX_TAG_ADDR    0x82000100
54 #define DT_ADR          0x85400000
55 #define RAMDISK_ADR     0x85500000
56 #define RAMDISK_SIZE_MB 8
57
58 #if defined (CONFIG_SPX30G)
59 #define COOPERATE_PROCESSOR_RESET_ADDR    0x402b00b0
60 #define COOPERATE_PMU_CTRL0_ADDR         0x402b0044
61 #define COOPERATE_PMU_CTRL2_ADDR         0x402b0068
62 #define CORE_CP0                          BIT_0
63 #define CORE_CP2                          BIT_2
64 #endif
65
66 /////////////////////////////////////////////////////////
67 /* log_switch function */
68 #if 0
69 GSM_Download_Param include the following :
70
71 system_param_version  short
72 fcch_det_struct         12 * short
73 freq_est_struct         6 * short
74 freq_track_algo_struct  4 * short
75 AGC_algo_cal_struct             12 * short
76 time_track_algo_struct  4 * short
77 rx_equalizer_struct             3 * short
78 rx_deinterlever_struct  1 * short
79 power_scan_struct               ----------------->  power_scan_saturation_thresh                1 * short
80                                                power_exp_lev                                    3 * short
81                                                power_underflow_thresh                   3 * short
82 tone_para_struct                1 * short
83 action_tables_struct            0x120 * short
84 audio_filter_coef               ----------------->  HPF_coef                                    36 * short
85                                                LPF_coef                                 15 * short
86 dsp_uart_struct         1 * short
87 deep_sleep_struct               5 * short
88 log_switch_struct               -----------------> DSP_log_switch                             1 * short
89 #endif
90
91 struct power_scan_saturation_thresh_tag {
92         unsigned short  power_scan_saturation_thresh;
93 };
94
95 struct power_exp_lev_tag {
96         unsigned short  power_exp_lev[3];
97 };
98
99 struct power_underflow_thresh_tag {
100         unsigned short  power_underflow_thresh[3];
101 };
102
103 struct HPF_coef_tag {
104         unsigned short  HPF_coef[36];
105 };
106
107 struct LPF_coef_tag {
108         unsigned short  LPF_coef[15];
109 };
110
111 struct power_scan_struct_tag {
112         struct power_scan_saturation_thresh_tag power_scan_saturation_thresh;
113         struct power_exp_lev_tag power_exp_lev;
114         struct power_underflow_thresh_tag power_underflow_thresh;
115 };
116
117 struct audio_filter_coef_tag {
118         struct HPF_coef_tag HPF_coef;
119         struct LPF_coef_tag LPF_coef;
120 };
121
122 struct DSP_log_switch_tag {
123         unsigned short DSP_log_switch_value;
124 };
125
126 struct log_switch_struct_tag {
127         struct DSP_log_switch_tag DSP_log_switch;
128 };
129
130 struct GSM_Download_Param_Tag {
131         unsigned short system_param_version;
132         unsigned short fcch_det_struct[12];
133         unsigned short freq_est_struct[6];
134         unsigned short freq_track_algo_struct[4];
135         unsigned short AGC_algo_cal_struct[12];
136         unsigned short time_track_algo_struct[4];
137         unsigned short rx_equalizer_struct[3];
138         unsigned short rx_deinterlever_struct;
139         struct power_scan_struct_tag power_scan_struct;
140         unsigned short tone_para_struct;
141         unsigned short action_tables_struct[0x120];
142         struct audio_filter_coef_tag audio_filter_coef;
143         unsigned short dsp_uart_struct;
144         unsigned short deep_sleep_struct[5];
145         struct log_switch_struct_tag log_switch_struct;
146 };
147 /////////////////////////////////////////////////////////
148
149 #define MAX_SN_LEN                      (24)
150 #define SP09_MAX_SN_LEN                 MAX_SN_LEN
151 #define SP09_MAX_STATION_NUM            (15)
152 #define SP09_MAX_STATION_NAME_LEN       (10)
153 #define SP09_SPPH_MAGIC_NUMBER          (0X53503039)    // "SP09"
154 #define SP09_MAX_LAST_DESCRIPTION_LEN   (32)
155
156 typedef struct _tagSP09_PHASE_CHECK
157 {
158         unsigned long   Magic;                  // "SP09"
159         char            SN1[SP09_MAX_SN_LEN];   // SN , SN_LEN=24
160         char            SN2[SP09_MAX_SN_LEN];    // add for Mobile
161         int             StationNum;                     // the test station number of the testing
162         char            StationName[SP09_MAX_STATION_NUM][SP09_MAX_STATION_NAME_LEN];
163         unsigned char   Reserved[13];                   //
164         unsigned char   SignFlag;
165         char            szLastFailDescription[SP09_MAX_LAST_DESCRIPTION_LEN];
166         unsigned short  iTestSign;                              // Bit0~Bit14 ---> station0~station 14
167                                                                   //if tested. 0: tested, 1: not tested
168         unsigned short  iItem;    // part1: Bit0~ Bit_14 indicate test Station,1 : Pass,
169
170 }SP09_PHASE_CHECK_T, *LPSP09_PHASE_CHECK_T;
171
172 typedef enum{
173         IMG_RAW,
174         IMG_UBIFS,
175         IMG_YAFFS,
176         IMG_MAX
177 }img_fs_type;
178
179 typedef struct vol_image_required
180 {
181         char* vol;  //volume name
182         char* bak_vol;  //if no backup vol, set NULL
183         unsigned long size;  //partition size to be read
184         unsigned long mem_addr;  //target memory addr
185         img_fs_type fs_type;
186 }vol_image_required_t;
187
188 typedef struct boot_image_required
189 {
190         wchar_t* partition;  //partition name record on disk
191         wchar_t* bak_partition;  //if no backup partition, set NULL
192         unsigned long size;  //partition size to be read
193         unsigned long mem_addr;  //target memory addr
194 }boot_image_required_t;
195
196 extern const int SP09_MAX_PHASE_BUFF_SIZE;
197
198 #define NV_HEAD_MAGIC   (0x00004e56)
199 #define NV_VERSION              (101)
200 #define NV_UPDATED      0x1234abcd
201 #define NV_HEAD_LEN     (512)
202 typedef struct  _NV_HEADER {
203         unsigned long int magic;
204         unsigned long int len;
205         unsigned long int checksum;
206         unsigned long int version;
207         unsigned int updated;
208 }nv_header_t;
209
210 void set_vibrator(int on);
211 void vibrator_hw_init(void);
212 void MMU_InvalideICACHEALL(void);
213 int read_spldata();
214 void lcd_display_logo(int backlight_set,ulong bmp_image,size_t size);
215 int creat_cmdline(char * cmdline,boot_img_hdr *hdr);
216 void vlx_entry();
217 extern char* get_product_sn(void);
218 extern char *calibration_cmd_buf;
219
220
221
222 #endif /* NORMAL_MODE_H */