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>
15 #include <android_boot.h>
16 #include <environment.h>
17 #include <jffs2/jffs2.h>
18 #include <boot_mode.h>
20 #include <asm/arch/secure_boot.h>
21 #include <ubi_uboot.h>
22 #ifdef CONFIG_MTD_PARTITIONS
23 #include <linux/mtd/partitions.h>
26 extern void *spl_data;
27 extern void *harsh_data;
28 extern unsigned char raw_header[8192];
32 #define debugf(fmt, args...) do { printf("%s(): ", __func__); printf(fmt, ##args); } while (0)
34 #define debugf(fmt, args...)
38 #define SPL_PART "spl"
39 #define LOGO_PART "logo"
40 #define SIMLOCK_SIZE 1024
41 #define PRODUCTINFO_FILE_PATITION "miscdata"
44 #if defined (CONFIG_SP8835EB) || defined(CONFIG_FPGA) ||defined(CONFIG_SP8830EB)||defined(CONFIG_SP8830EC)||defined(CONFIG_SP8830GEA)||defined(CONFIG_SC9620OPENPHONE) //for TD CP1
45 #define SIMLOCK_ADR (0x891FE800+0x4) //0x4 just for data header
46 #elif defined (CONFIG_SP7735EC) || defined(CONFIG_SP7730EC) //for W CP0
47 #define SIMLOCK_ADR (0x920FE800+0x4) //0x4(32bit) just for data header
50 #define KERNEL_ADR 0x80008000
51 #define VLX_TAG_ADDR 0x82000100
52 #define DT_ADR 0x85400000
53 #define RAMDISK_ADR 0x85500000
54 #define RAMDISK_SIZE_MB 8
56 #if defined (CONFIG_SPX30G)
57 #define COOPERATE_PROCESSOR_RESET_ADDR 0x402b00b0
58 #define COOPERATE_PMU_CTRL0_ADDR 0x402b0044
59 #define COOPERATE_PMU_CTRL2_ADDR 0x402b0068
60 #define CORE_CP0 BIT_0
61 #define CORE_CP2 BIT_2
64 /////////////////////////////////////////////////////////
65 /* log_switch function */
67 GSM_Download_Param include the following :
69 system_param_version short
70 fcch_det_struct 12 * short
71 freq_est_struct 6 * short
72 freq_track_algo_struct 4 * short
73 AGC_algo_cal_struct 12 * short
74 time_track_algo_struct 4 * short
75 rx_equalizer_struct 3 * short
76 rx_deinterlever_struct 1 * short
77 power_scan_struct -----------------> power_scan_saturation_thresh 1 * short
78 power_exp_lev 3 * short
79 power_underflow_thresh 3 * short
80 tone_para_struct 1 * short
81 action_tables_struct 0x120 * short
82 audio_filter_coef -----------------> HPF_coef 36 * short
84 dsp_uart_struct 1 * short
85 deep_sleep_struct 5 * short
86 log_switch_struct -----------------> DSP_log_switch 1 * short
89 struct power_scan_saturation_thresh_tag {
90 unsigned short power_scan_saturation_thresh;
93 struct power_exp_lev_tag {
94 unsigned short power_exp_lev[3];
97 struct power_underflow_thresh_tag {
98 unsigned short power_underflow_thresh[3];
101 struct HPF_coef_tag {
102 unsigned short HPF_coef[36];
105 struct LPF_coef_tag {
106 unsigned short LPF_coef[15];
109 struct power_scan_struct_tag {
110 struct power_scan_saturation_thresh_tag power_scan_saturation_thresh;
111 struct power_exp_lev_tag power_exp_lev;
112 struct power_underflow_thresh_tag power_underflow_thresh;
115 struct audio_filter_coef_tag {
116 struct HPF_coef_tag HPF_coef;
117 struct LPF_coef_tag LPF_coef;
120 struct DSP_log_switch_tag {
121 unsigned short DSP_log_switch_value;
124 struct log_switch_struct_tag {
125 struct DSP_log_switch_tag DSP_log_switch;
128 struct GSM_Download_Param_Tag {
129 unsigned short system_param_version;
130 unsigned short fcch_det_struct[12];
131 unsigned short freq_est_struct[6];
132 unsigned short freq_track_algo_struct[4];
133 unsigned short AGC_algo_cal_struct[12];
134 unsigned short time_track_algo_struct[4];
135 unsigned short rx_equalizer_struct[3];
136 unsigned short rx_deinterlever_struct;
137 struct power_scan_struct_tag power_scan_struct;
138 unsigned short tone_para_struct;
139 unsigned short action_tables_struct[0x120];
140 struct audio_filter_coef_tag audio_filter_coef;
141 unsigned short dsp_uart_struct;
142 unsigned short deep_sleep_struct[5];
143 struct log_switch_struct_tag log_switch_struct;
145 /////////////////////////////////////////////////////////
147 #define MAX_SN_LEN (24)
148 #define SP09_MAX_SN_LEN MAX_SN_LEN
149 #define SP09_MAX_STATION_NUM (15)
150 #define SP09_MAX_STATION_NAME_LEN (10)
151 #define SP09_SPPH_MAGIC_NUMBER (0X53503039) // "SP09"
152 #define SP09_MAX_LAST_DESCRIPTION_LEN (32)
154 typedef struct _tagSP09_PHASE_CHECK
156 unsigned long Magic; // "SP09"
157 char SN1[SP09_MAX_SN_LEN]; // SN , SN_LEN=24
158 char SN2[SP09_MAX_SN_LEN]; // add for Mobile
159 int StationNum; // the test station number of the testing
160 char StationName[SP09_MAX_STATION_NUM][SP09_MAX_STATION_NAME_LEN];
161 unsigned char Reserved[13]; //
162 unsigned char SignFlag;
163 char szLastFailDescription[SP09_MAX_LAST_DESCRIPTION_LEN];
164 unsigned short iTestSign; // Bit0~Bit14 ---> station0~station 14
165 //if tested. 0: tested, 1: not tested
166 unsigned short iItem; // part1: Bit0~ Bit_14 indicate test Station,1 : Pass,
168 }SP09_PHASE_CHECK_T, *LPSP09_PHASE_CHECK_T;
177 typedef struct vol_image_required
179 char* vol; //volume name
180 char* bak_vol; //if no backup vol, set NULL
181 unsigned long size; //partition size to be read
182 unsigned long mem_addr; //target memory addr
184 }vol_image_required_t;
186 typedef struct boot_image_required
188 wchar_t* partition; //partition name record on disk
189 wchar_t* bak_partition; //if no backup partition, set NULL
190 unsigned long size; //partition size to be read
191 unsigned long mem_addr; //target memory addr
192 }boot_image_required_t;
194 extern const int SP09_MAX_PHASE_BUFF_SIZE;
196 #define NV_HEAD_MAGIC (0x00004e56)
197 #define NV_VERSION (101)
198 #define NV_UPDATED 0x1234abcd
199 #define NV_HEAD_LEN (512)
200 typedef struct _NV_HEADER {
201 unsigned long int magic;
202 unsigned long int len;
203 unsigned long int checksum;
204 unsigned long int version;
205 unsigned int updated;
208 void set_vibrator(int on);
209 void vibrator_hw_init(void);
210 void MMU_InvalideICACHEALL(void);
211 int read_spldata(void);
212 void lcd_display_logo(int backlight_set,ulong bmp_image,size_t size);
213 int creat_cmdline(char * cmdline,boot_img_hdr *hdr);
214 void vlx_entry(void);
215 extern char* get_product_sn(void);
216 extern char *calibration_cmd_buf;
217 void set_recovery_mode(unsigned int recovery_mode);
221 #endif /* NORMAL_MODE_H */