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 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];
34 #define debugf(fmt, args...) do { printf("%s(): ", __func__); printf(fmt, ##args); } while (0)
36 #define debugf(fmt, args...)
40 #define SPL_PART "spl"
41 #define LOGO_PART "logo"
42 #define SIMLOCK_SIZE 1024
43 #define PRODUCTINFO_FILE_PATITION "miscdata"
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
52 #define KERNEL_ADR 0x80008000
53 #define VLX_TAG_ADDR 0x82000100
54 #define DT_ADR 0x85400000
55 #define RAMDISK_ADR 0x85500000
57 #if defined (CONFIG_SPX30G)
58 #define COOPERATE_PROCESSOR_RESET_ADDR 0x402b00b0
59 #define COOPERATE_PMU_CTRL0_ADDR 0x402b0044
60 #define COOPERATE_PMU_CTRL2_ADDR 0x402b0068
61 #define CORE_CP0 BIT_0
62 #define CORE_CP2 BIT_2
65 /////////////////////////////////////////////////////////
66 /* log_switch function */
68 GSM_Download_Param include the following :
70 system_param_version short
71 fcch_det_struct 12 * short
72 freq_est_struct 6 * short
73 freq_track_algo_struct 4 * short
74 AGC_algo_cal_struct 12 * short
75 time_track_algo_struct 4 * short
76 rx_equalizer_struct 3 * short
77 rx_deinterlever_struct 1 * short
78 power_scan_struct -----------------> power_scan_saturation_thresh 1 * short
79 power_exp_lev 3 * short
80 power_underflow_thresh 3 * short
81 tone_para_struct 1 * short
82 action_tables_struct 0x120 * short
83 audio_filter_coef -----------------> HPF_coef 36 * short
85 dsp_uart_struct 1 * short
86 deep_sleep_struct 5 * short
87 log_switch_struct -----------------> DSP_log_switch 1 * short
90 struct power_scan_saturation_thresh_tag {
91 unsigned short power_scan_saturation_thresh;
94 struct power_exp_lev_tag {
95 unsigned short power_exp_lev[3];
98 struct power_underflow_thresh_tag {
99 unsigned short power_underflow_thresh[3];
102 struct HPF_coef_tag {
103 unsigned short HPF_coef[36];
106 struct LPF_coef_tag {
107 unsigned short LPF_coef[15];
110 struct power_scan_struct_tag {
111 struct power_scan_saturation_thresh_tag power_scan_saturation_thresh;
112 struct power_exp_lev_tag power_exp_lev;
113 struct power_underflow_thresh_tag power_underflow_thresh;
116 struct audio_filter_coef_tag {
117 struct HPF_coef_tag HPF_coef;
118 struct LPF_coef_tag LPF_coef;
121 struct DSP_log_switch_tag {
122 unsigned short DSP_log_switch_value;
125 struct log_switch_struct_tag {
126 struct DSP_log_switch_tag DSP_log_switch;
129 struct GSM_Download_Param_Tag {
130 unsigned short system_param_version;
131 unsigned short fcch_det_struct[12];
132 unsigned short freq_est_struct[6];
133 unsigned short freq_track_algo_struct[4];
134 unsigned short AGC_algo_cal_struct[12];
135 unsigned short time_track_algo_struct[4];
136 unsigned short rx_equalizer_struct[3];
137 unsigned short rx_deinterlever_struct;
138 struct power_scan_struct_tag power_scan_struct;
139 unsigned short tone_para_struct;
140 unsigned short action_tables_struct[0x120];
141 struct audio_filter_coef_tag audio_filter_coef;
142 unsigned short dsp_uart_struct;
143 unsigned short deep_sleep_struct[5];
144 struct log_switch_struct_tag log_switch_struct;
146 /////////////////////////////////////////////////////////
148 #define MAX_SN_LEN (24)
149 #define SP09_MAX_SN_LEN MAX_SN_LEN
150 #define SP09_MAX_STATION_NUM (15)
151 #define SP09_MAX_STATION_NAME_LEN (10)
152 #define SP09_SPPH_MAGIC_NUMBER (0X53503039) // "SP09"
153 #define SP09_MAX_LAST_DESCRIPTION_LEN (32)
155 typedef struct _tagSP09_PHASE_CHECK
157 unsigned long Magic; // "SP09"
158 char SN1[SP09_MAX_SN_LEN]; // SN , SN_LEN=24
159 char SN2[SP09_MAX_SN_LEN]; // add for Mobile
160 int StationNum; // the test station number of the testing
161 char StationName[SP09_MAX_STATION_NUM][SP09_MAX_STATION_NAME_LEN];
162 unsigned char Reserved[13]; //
163 unsigned char SignFlag;
164 char szLastFailDescription[SP09_MAX_LAST_DESCRIPTION_LEN];
165 unsigned short iTestSign; // Bit0~Bit14 ---> station0~station 14
166 //if tested. 0: tested, 1: not tested
167 unsigned short iItem; // part1: Bit0~ Bit_14 indicate test Station,1 : Pass,
169 }SP09_PHASE_CHECK_T, *LPSP09_PHASE_CHECK_T;
178 typedef struct vol_image_required
180 char* vol; //volume name
181 char* bak_vol; //if no backup vol, set NULL
182 unsigned long size; //partition size to be read
183 unsigned long mem_addr; //target memory addr
185 }vol_image_required_t;
187 typedef struct boot_image_required
189 wchar_t* partition; //partition name record on disk
190 wchar_t* bak_partition; //if no backup partition, set NULL
191 unsigned long size; //partition size to be read
192 unsigned long mem_addr; //target memory addr
193 }boot_image_required_t;
195 extern const int SP09_MAX_PHASE_BUFF_SIZE;
197 #define NV_HEAD_MAGIC (0x00004e56)
198 #define NV_VERSION (101)
199 #define NV_UPDATED 0x1234abcd
200 #define NV_HEAD_LEN (512)
201 typedef struct _NV_HEADER {
202 unsigned long int magic;
203 unsigned long int len;
204 unsigned long int checksum;
205 unsigned long int version;
206 unsigned int updated;
209 void set_vibrator(int on);
210 void vibrator_hw_init(void);
211 void MMU_InvalideICACHEALL(void);
213 void lcd_display_logo(int backlight_set,ulong bmp_image,size_t size);
214 int creat_cmdline(char * cmdline,boot_img_hdr *hdr);
216 extern char* get_product_sn(void);
217 extern char *calibration_cmd_buf;
221 #endif /* NORMAL_MODE_H */