fdf8ad1546d5f6bd5f3e5fd510654d0b8869638a
[profile/mobile/platform/kernel/u-boot-tm1.git] / include / configs / sp8830ga.h
1 /*
2  * (C) Copyright 2009 DENX Software Engineering
3  * Author: John Rigby <jrigby@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA
19  */
20
21 #ifndef __CONFIG_H
22 #define __CONFIG_H
23 //only used in fdl2 .in uart download, the debug infors  from  serial will break the download process.
24 #define CONFIG_FDL2_PRINT        0
25 #define BOOT_NATIVE_LINUX        1
26 #define BOOT_NATIVE_LINUX_MODEM  1
27 //#define CALIBRATION_FLAG         0x897FFC00
28 //#define       CALIBRATION_FLAG_WCDMA   0x93FFEC00
29 #define CONFIG_SILENT_CONSOLE
30 #define CONFIG_GPIOLIB 1
31 //#define NAND_DEBUG  
32 //#define DEBUG
33 #define U_BOOT_SPRD_VER 1
34 /*#define SPRD_EVM_TAG_ON 1*/
35 #ifdef SPRD_EVM_TAG_ON
36 #define SPRD_EVM_ADDR_START 0x00026000
37 #define SPRD_EVM_TAG(_x) (*(((unsigned long *)SPRD_EVM_ADDR_START)+_x) = *(volatile unsigned long *)0x87003004)
38 #endif
39 #define CONFIG_L2_OFF                   1
40
41 #define BOOT_DEBUG 1
42
43 #define BOOT_PART "boot"
44 //#define BOOT_PART "kernel"
45 #define RECOVERY_PART "recovery"
46 #define UBIPAC_PART  "ubipac"
47
48 /*
49  * SPREADTRUM BIGPHONE board - SoC Configuration
50  */
51 #define CONFIG_SP8830
52 #define CONFIG_SC8830
53
54 #define CONFIG_SP8830GA
55 #define CONFIG_SP8830WCN
56
57
58 #define CONFIG_SUPPORT_TD
59 #define TDDSP_ADR       0x88020000
60 #define TDFIXNV_ADR     0x89060000
61 #define TDRUNTIMENV_ADR 0x890a0000
62 #define TDMODEM_ADR     0x88300000
63 #define CONFIG_SUPPORT_WIFI
64 #define WCNMODEM_ADR      0x94060000
65 #define WCNFIXNV_ADR      0x94000000
66 #define WCNRUNTIMENV_ADR  0x94020000
67
68 #define CONFIG_AUTODLOADER
69
70 #define CHIP_ENDIAN_LITTLE
71 #define _LITTLE_ENDIAN 1
72
73 #define CONFIG_RAM512M
74
75 /*
76 #define CONFIG_EMMC_BOOT
77 */
78
79 #ifdef  CONFIG_EMMC_BOOT
80 #define EMMC_SECTOR_SIZE 512
81 #define CONFIG_MMC
82
83 #define CONFIG_FS_EXT4
84 #define CONFIG_EXT4_WRITE
85 #define CONFIG_CMD_EXT4
86 #define CONFIG_CMD_EXT4_WRITE
87
88 //#define CONFIG_TIGER_MMC
89 #define CONFIG_UEFI_PARTITION
90 #define CONFIG_EFI_PARTITION
91 #define CONFIG_EXT4_SPARSE_DOWNLOAD
92 //#define CONFIG_EMMC_SPL
93 #define CONFIG_SYS_EMMC_U_BOOT_SECTOR_NUM ((CONFIG_SYS_NAND_U_BOOT_SIZE+EMMC_SECTOR_SIZE-1)/EMMC_SECTOR_SIZE)
94
95 #endif
96
97 /*
98  * MMC definition
99  */
100 #define CONFIG_CMD_MMC
101 #ifdef  CONFIG_CMD_MMC
102 #define CONFIG_CMD_FAT                  1
103 #define CONFIG_FAT_WRITE                1
104 #define CONFIG_MMC                      1
105 #define CONFIG_GENERIC_MMC              1
106 #define CONFIG_SDHCI                    1
107 #define CONFIG_SDHCI_CTRL_NO_HISPD     1 /* disable high speed control */
108 #define CONFIG_SYS_MMC_MAX_BLK_COUNT    0x1000
109 #define CONFIG_MMC_SDMA                 1
110 #define CONFIG_MV_SDHCI                 1
111 #define CONFIG_DOS_PARTITION            1
112 #define CONFIG_EFI_PARTITION            1
113 #define CONFIG_SYS_MMC_NUM              1
114 #define CONFIG_SYS_MMC_BASE             {0x20600000}
115 #define CONFIG_SYS_SD_BASE              0x20300000
116 #endif
117
118 #define BB_DRAM_TYPE_256MB_32BIT
119
120 #define CONFIG_SYS_HZ                   1000
121 #define CONFIG_SPRD_TIMER_CLK           1000 /*32768*/
122
123 //#define CONFIG_SYS_HUSH_PARSER
124
125 #ifdef CONFIG_SYS_HUSH_PARSER
126 #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
127 #endif
128
129 #define FIXNV_SIZE              (2*128 * 1024)
130 #define TDMODEM_SIZE            (0x600000)
131 #define TDDSP_SIZE              (0x2E0000)
132 #define WCNMODEM_SIZE           (0x100000)
133 #define VMJALUNA_SIZE           (0x64000) /* 400K */
134 #define RUNTIMENV_SIZE          (3*128 * 1024)
135 #define CONFIG_SPL_LOAD_LEN     (0x6000)
136
137
138 /*#define CMDLINE_NEED_CONV */
139
140 #define WATCHDOG_LOAD_VALUE     0x4000
141 #define CONFIG_SYS_STACK_SIZE   0x400
142 //#define CONFIG_SYS_TEXT_BASZE  0x80f00000
143
144 //#define       CONFIG_SYS_MONITOR_LEN          (256 << 10)     /* 256 kB for U-Boot */
145
146 /* NAND BOOT is the only boot method */
147 #define CONFIG_NAND_U_BOOT
148 #define DYNAMIC_CRC_TABLE
149 /* Start copying real U-boot from the second page */
150 #define CONFIG_SYS_NAND_U_BOOT_OFFS     0x40000
151 #define CONFIG_SYS_NAND_U_BOOT_SIZE     0x8A000
152 #define RAM_TYPPE_IS_SDRAM      0
153 //#define FPGA_TRACE_DOWNLOAD //for download image from trace
154
155 /* Load U-Boot to this address */
156 #define CONFIG_SYS_NAND_U_BOOT_DST      0x8f800000
157 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_NAND_U_BOOT_DST
158 #define CONFIG_SYS_SDRAM_BASE 0x80000000
159 #define CONFIG_SYS_SDRAM_END (CONFIG_SYS_SDRAM_BASE + 256*1024*1024)
160
161 #ifdef CONFIG_NAND_SPL
162 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_SDRAM_END - 0x40000)
163 #else
164
165 #define CONFIG_MMU_TABLE_ADDR (0x00020000)
166 #define CONFIG_SYS_INIT_SP_ADDR     \
167         (CONFIG_SYS_SDRAM_END - 0x10000 - GENERATED_GBL_DATA_SIZE)
168
169 #define CONFIG_SKIP_LOWLEVEL_INIT
170 #endif
171
172 #define CONFIG_HW_WATCHDOG
173 //#define CONFIG_AUTOBOOT //used for FPGA test, auto boot other image
174 //#define CONFIG_DISPLAY_CPUINFO
175
176 #define CONFIG_CMDLINE_TAG              1       /* enable passing of ATAGs */
177 #define CONFIG_SETUP_MEMORY_TAGS        1
178 #define CONFIG_INITRD_TAG               1
179
180 /*
181  * Memory Info
182  */
183 /* malloc() len */
184 #define CONFIG_SYS_MALLOC_LEN           (2 << 20)       /* 1 MiB */
185 /*
186  * Board has 2 32MB banks of DRAM but there is a bug when using
187  * both so only the first is configured
188  */
189 #define CONFIG_NR_DRAM_BANKS    1
190
191 #define PHYS_SDRAM_1            0x80000000
192 #define PHYS_SDRAM_1_SIZE       0x10000000
193 #if (CONFIG_NR_DRAM_BANKS == 2)
194 #define PHYS_SDRAM_2            0x90000000
195 #define PHYS_SDRAM_2_SIZE       0x10000000
196 #endif
197 /* 8MB DRAM test */
198 #define CONFIG_SYS_MEMTEST_START        PHYS_SDRAM_1
199 #define CONFIG_SYS_MEMTEST_END          (PHYS_SDRAM_1+0x0800000)
200 #define CONFIG_STACKSIZE        (256 * 1024)    /* regular stack */
201
202 /*
203  * Serial Info
204  */
205 #define CONFIG_SPRD_UART                1
206 #define CONFIG_SYS_SC8800X_UART1        1
207 #define CONFIG_CONS_INDEX       1       /* use UART0 for console */
208 #define CONFIG_BAUDRATE         115200  /* Default baud rate */
209 #define CONFIG_SYS_BAUDRATE_TABLE       { 9600, 19200, 38400, 57600, 115200 }
210 #define CONFIG_SPRD_SPI
211 #define CONFIG_SPRD_I2C
212 #define CONFIG_SC8830_I2C
213 /*
214  * Flash & Environment
215  */
216 /* No NOR flash present */
217 #define CONFIG_SYS_MONITOR_LEN ((CONFIG_SYS_NAND_U_BOOT_OFFS)+(CONFIG_SYS_NAND_U_BOOT_SIZE))
218 #define CONFIG_SYS_NO_FLASH     1
219 #define CONFIG_ENV_IS_NOWHERE
220 #define CONFIG_ENV_SIZE         (128 * 1024)    
221 /*
222 #define CONFIG_ENV_IS_IN_NAND
223 #define CONFIG_ENV_OFFSET       CONFIG_SYS_MONITOR_LEN
224 #define CONFIG_ENV_OFFSET_REDUND        (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
225 */
226
227 /* DDR */
228 #define DDR_CLK 464
229 //---these three macro below,only one can be open
230 //#define DDR_LPDDR1
231 #define DDR_LPDDR2
232 //#define DDR_DDR3
233
234 //#define DDR_AUTO_DETECT
235 #define DDR_TYPE DRAM_LPDDR2_1CS_4G_X32
236 //#define DDR_TYPE DRAM_LPDDR2_1CS_8G_X32
237 //#define DDR_TYPE DRAM_LPDDR2_2CS_8G_X32
238 //#define DDR_TYPE DRAM_LPDDR2_2CS_16G_X32
239 //#define DDR_TYPE DRAM_DDR3_1CS_2G_X8_4P
240 //#define DDR_TYPE DRAM_DDR3_1CS_4G_X16_2P
241
242 #define DDR3_DLL_ON TRUE
243 //#define DLL_BYPASS
244 #define DDR_APB_CLK 128
245 #define DDR_DFS_SUPPORT
246 #define DDR_DFS_VAL_BASE 0X1c00
247
248 //#define DDR_SCAN_SUPPORT
249 #define MEM_IO_DS LPDDR2_DS_40R
250
251 #define PUBL_LPDDR1_DS PUBL_LPDDR1_DS_48OHM
252 #define PUBL_LPDDR2_DS PUBL_LPDDR2_DS_40OHM
253 #define PUBL_DDR3_DS   PUBL_DDR3_DS_34OHM
254
255
256
257 /* NAND */
258 #define CONFIG_NAND_SC8830
259 #define CONFIG_SPRD_NAND_REGS_BASE      (0x20B00000)
260 #define CONFIG_SYS_MAX_NAND_DEVICE      1
261 #define CONFIG_SYS_NAND_BASE            (0x20B00000)
262 //#define CONFIG_JFFS2_NAND
263 //#define CONFIG_SPRD_NAND_HWECC
264 #define CONFIG_SYS_NAND_HW_ECC
265 #define CONFIG_SYS_NAND_LARGEPAGE
266 //#define CONFIG_SYS_NAND_5_ADDR_CYCLE
267
268 #define CONFIG_SYS_64BIT_VSPRINTF
269
270 #define CONFIG_CMD_MTDPARTS
271 #define CONFIG_MTD_PARTITIONS
272 #define CONFIG_MTD_DEVICE
273 #define CONFIG_CMD_UBI
274 #define CONFIG_RBTREE
275
276 #define CONFIG_CMD_UBIFS
277 #define CONFIG_LZO
278 #ifdef CONFIG_CMD_UBIFS
279 #define CONFIG_FS_UBIFS
280 #endif
281
282 /* U-Boot general configuration */
283 #define CONFIG_SYS_PROMPT       "=> "   /* Monitor Command Prompt */
284 #define CONFIG_SYS_CBSIZE       1024    /* Console I/O Buffer Size  */
285 /* Print buffer sz */
286 #define CONFIG_SYS_PBSIZE       (CONFIG_SYS_CBSIZE + \
287                 sizeof(CONFIG_SYS_PROMPT) + 16)
288 #define CONFIG_SYS_MAXARGS      32      /* max number of command args */
289 /* Boot Argument Buffer Size */
290 #define CONFIG_SYS_BARGSIZE     CONFIG_SYS_CBSIZE
291 #define CONFIG_CMDLINE_EDITING
292 #define CONFIG_SYS_LONGHELP
293
294 /* support OS choose */
295 #undef CONFIG_BOOTM_NETBSD 
296 #undef CONFIG_BOOTM_RTEMS
297
298 /* U-Boot commands */
299 #include <config_cmd_default.h>
300 #define CONFIG_CMD_NAND
301 #undef CONFIG_CMD_FPGA
302 #undef CONFIG_CMD_LOADS
303 #undef CONFIG_CMD_NET
304 #undef CONFIG_CMD_NFS
305 #undef CONFIG_CMD_SETGETDCR
306
307 #define CONFIG_ENV_OVERWRITE
308
309 #ifdef SPRD_EVM_TAG_ON
310 #define CONFIG_BOOTDELAY        0
311 #else
312 #define CONFIG_BOOTDELAY        0
313 #define CONFIG_ZERO_BOOTDELAY_CHECK
314 #endif
315
316 #define CONFIG_LOADADDR         (CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN - 4*1024*1024)    /* loadaddr env var */
317 #define CONFIG_SYS_LOAD_ADDR    CONFIG_LOADADDR
318
319 #define xstr(s) str(s)
320 #define str(s)  #s
321
322 #ifdef CONFIG_RAM512M
323 #define MEM_INIT_PARA "mem=512M"
324 #elif defined(CONFIG_RAM256M)
325 #define MEM_INIT_PARA "mem=256M"
326 //#elif defined(CONFIG_RAMxxxM)
327 ////#define MEM_INIT_PARA "mem=xxxM" //xxx maybe 1024 etc
328 #else
329 #error "CONFIG_RAMxxxM macro must be defined"
330 #endif
331 #define MTDIDS_DEFAULT "nand0=sprd-nand"
332 //#define MTDPARTS_DEFAULT "mtdparts=sprd-nand:256k(spl),512k(2ndbl),256k(params),512k(vmjaluna),10m(modem),3840k(fixnv),3840k(backupfixnv),5120k(dsp),3840k(runtimenv),10m(boot),10m(recovery),250m(system),180m(userdata),20m(cache),256k(misc),1m(boot_logo),1m(fastboot_logo),3840k(productinfo),512k(kpanic)"
333 #define MTDPARTS_DEFAULT "mtdparts=sprd-nand:256k(spl),768k(2ndbl),512k(kpanic),-(ubipac)"
334 #define CONFIG_BOOTARGS MEM_INIT_PARA" loglevel=1 console=ttyS1,115200n8 init=/init " MTDPARTS_DEFAULT
335
336 #define COPY_LINUX_KERNEL_SIZE  (0x600000)
337 #define LINUX_INITRD_NAME       "modem"
338
339 #define CONFIG_BOOTCOMMAND "cboot normal"
340 #define CONFIG_EXTRA_ENV_SETTINGS                               ""      
341
342 #ifdef CONFIG_CMD_NET
343 #define CONFIG_IPADDR 192.168.10.2
344 #define CONFIG_SERVERIP 192.168.10.5
345 #define CONFIG_NETMASK 255.255.255.0
346 #define CONFIG_USBNET_DEVADDR 26:03:ee:00:87:9f
347 #define CONFIG_USBNET_HOSTADDR 9a:04:c7:d6:30:d0
348
349
350 #define CONFIG_NET_MULTI
351 #define CONFIG_CMD_DNS
352 #define CONFIG_CMD_NFS
353 #define CONFIG_CMD_RARP
354 #define CONFIG_CMD_PING
355 /*#define CONFIG_CMD_SNTP */
356 #endif
357
358 #define CONFIG_USB_CORE_IP_293A
359 #define CONFIG_USB_GADGET_SC8800G
360 #define CONFIG_USB_DWC
361 #define CONFIG_USB_GADGET_DUALSPEED
362 //#define CONFIG_USB_ETHER
363 #define CONFIG_CMD_FASTBOOT
364 #define SCRATCH_ADDR    (CONFIG_SYS_SDRAM_BASE + 0x100000)
365 #define FB_DOWNLOAD_BUF_SIZE           (CONFIG_SYS_NAND_U_BOOT_DST - SCRATCH_ADDR-0x800000)
366 #define SCRATCH_ADDR_EXT1              (CONFIG_SYS_NAND_U_BOOT_DST + 32*1024*1024)
367 #define FB_DOWNLOAD_BUF_EXT1_SIZE      (224*1024*1024)
368
369 #define CONFIG_MODEM_CALIBERATE
370
371 #define CONFIG_LCD
372 #ifdef  CONFIG_LCD
373 #define CONFIG_SPLASH_SCREEN
374 #define LCD_BPP LCD_COLOR16
375 //#define CONFIG_LCD_HVGA   1
376 //#define CONFIG_LCD_QVGA   1
377 #define CONFIG_LCD_QHD 1
378 //#define CONFIG_LCD_720P 1
379 //#define CONFIG_LCD_INFO
380 //#define LCD_TEST_PATTERN
381 //#define CONFIG_LCD_LOGO
382 //#define CONFIG_FB_LCD_S6D0139
383 #define CONFIG_FB_LCD_SSD2075_MIPI
384 #define CONFIG_FB_LCD_NT35516_MIPI
385 #define CONFIG_SYS_WHITE_ON_BLACK
386 #ifdef  LCD_TEST_PATTERN
387 #define CONSOLE_COLOR_RED 0xf800 
388 #define CONSOLE_COLOR_GREEN 0x07e0
389 #define CONSOLE_COLOR_YELLOW 0x07e0
390 #define CONSOLE_COLOR_BLUE 0x001f
391 #define CONSOLE_COLOR_MAGENTA 0x001f
392 #define CONSOLE_COLOR_CYAN 0x001f
393 #endif
394 #endif // CONFIG_LCD
395
396 #define CONFIG_SPRD_SYSDUMP
397 #include <asm/sizes.h>
398
399 #ifdef CONFIG_RAM512M
400 #define SPRD_SYSDUMP_MAGIC      ((PHYS_OFFSET_ADDR & (~(SZ_512M - 1))) + SZ_512M - SZ_1M)
401 #elif defined(CONFIG_RAM256M)
402 #define SPRD_SYSDUMP_MAGIC      ((PHYS_OFFSET_ADDR & (~(SZ_256M - 1))) + SZ_256M - SZ_1M)
403 //#elif defined(CONFIG_RAMxxxM)
404 //#define SPRD_SYSDUMP_MAGIC      ((PHYS_OFFSET_ADDR & (~(SZ_xxxM - 1))) + SZ_xxxM - SZ_1M) //xxx maybe 1024 etc
405 #else
406 #error "CONFIG_RAMxxxM macro must be defined"
407 #endif
408
409 #define CALIBRATE_ENUM_MS 3000
410 #define CALIBRATE_IO_MS 2000
411
412 //#define LOW_BAT_ADC_LEVEL 782 /*phone battery adc value low than this value will not boot up*/
413 #define LOW_BAT_VOL            3500 /*phone battery voltage low than this value will not boot up*/
414 #define LOW_BAT_VOL_CHG        3200    //3.3V charger connect
415
416 #define PWR_KEY_DETECT_CNT 12 /*this should match the count of boot_pwr_check() function */
417 #define ALARM_LEAD_SET_MS 0 /* time set for alarm boot in advancd */
418
419 #define PHYS_OFFSET_ADDR                        0x80000000
420 #define TD_CP_OFFSET_ADDR                       0x8000000       /*128*/
421 #define TD_CP_SDRAM_SIZE                        0x1200000       /*18M*/
422 #define WCDMA_CP_OFFSET_ADDR            0x10000000      /*256M*/
423 #define WCDMA_CP_SDRAM_SIZE             0x2100000       /*33M*/
424 #define WCN_CP_OFFSET_ADDR              0x14000000      /*320M*/
425 #define WCN_CP_SDRAM_SIZE               0x281000//0x500000      /*5M*/
426
427 #define SIPC_APCP_RESET_ADDR_SIZE       0xC00   /*3K*/
428 #define SIPC_APCP_RESET_SIZE    0x1000  /*4K*/
429 #define SIPC_TD_APCP_START_ADDR         (PHYS_OFFSET_ADDR + TD_CP_OFFSET_ADDR + TD_CP_SDRAM_SIZE - SIPC_APCP_RESET_SIZE)        /*0x897FF000*/
430 #define SIPC_WCDMA_APCP_START_ADDR      (PHYS_OFFSET_ADDR + WCDMA_CP_OFFSET_ADDR + WCDMA_CP_SDRAM_SIZE - SIPC_APCP_RESET_SIZE) /*0x93FFF000*/
431 #define SIPC_WCN_APCP_START_ADDR                (PHYS_OFFSET_ADDR + WCN_CP_OFFSET_ADDR + WCN_CP_SDRAM_SIZE - SIPC_APCP_RESET_SIZE) /*0x94EFF000*/
432
433 #define CONFIG_RAM_CONSOLE
434
435 #ifdef CONFIG_RAM_CONSOLE
436 #define CONFIG_RAM_CONSOLE_SIZE        0x80000
437 #define CONFIG_RAM_CONSOLE_START    (CONFIG_SYS_NAND_U_BOOT_START + 0x600000)
438 #endif
439 #define CALIBRATION_FLAG         (PHYS_OFFSET_ADDR + TD_CP_OFFSET_ADDR + TD_CP_SDRAM_SIZE - 0x400) /*the last 1K of modem memory area*/
440 #define  CALIBRATION_FLAG_WCDMA  CALIBRATION_FLAG
441 //#define CALIBRATION_FLAG           0x89700000
442
443 #define CONFIG_CMD_SOUND 1
444 #define CONFIG_CMD_FOR_HTC 1
445 #define CONFIG_SOUND_CODEC_SPRD_V3 1
446 #define CONFIG_SOUND_DAI_VBC_R2P0 1
447 /* #define CONFIG_SPRD_AUDIO_DEBUG */
448
449 #define CONFIG_RAMDUMP_NO_SPLIT 1 /* Don't split sysdump file */
450 #define USB_PHY_TUNE_VALUE 0x44073e33
451
452 #endif /* __CONFIG_H */