qi_lb60.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /*
  2. * Authors: Xiangfu Liu <xiangfu.z@gmail.com>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 3 of the License, or (at your option) any later version.
  8. */
  9. #ifndef __CONFIG_QI_LB60_H
  10. #define __CONFIG_QI_LB60_H
  11. #define CONFIG_MIPS32 /* MIPS32 CPU core */
  12. #define CONFIG_JZSOC /* Jz SoC */
  13. #define CONFIG_JZ4740 /* Jz4740 SoC */
  14. #define CONFIG_NAND_JZ4740
  15. #define CONFIG_SYS_CPU_SPEED 336000000 /* CPU clock: 336 MHz */
  16. #define CONFIG_SYS_EXTAL 12000000 /* EXTAL freq: 12 MHz */
  17. #define CONFIG_SYS_HZ (CONFIG_SYS_EXTAL / 256) /* incrementer freq */
  18. #define CONFIG_SYS_MIPS_TIMER_FREQ CONFIG_SYS_CPU_SPEED
  19. #define CONFIG_SYS_UART_BASE JZ4740_UART0_BASE /* Base of the UART channel */
  20. #define CONFIG_BAUDRATE 57600
  21. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
  22. #define CONFIG_SKIP_LOWLEVEL_INIT
  23. #define CONFIG_BOARD_EARLY_INIT_F
  24. #define CONFIG_SYS_NO_FLASH
  25. #define CONFIG_SYS_FLASH_BASE 0 /* init flash_base as 0 */
  26. #define CONFIG_ENV_OVERWRITE
  27. #define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAUL)
  28. #define CONFIG_BOOTDELAY 0
  29. #define CONFIG_BOOTARGS "mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait"
  30. #define CONFIG_BOOTCOMMAND "nand read 0x80600000 0x400000 0x200000;bootm"
  31. /*
  32. * Command line configuration.
  33. */
  34. #define CONFIG_CMD_BOOTD /* bootd */
  35. #define CONFIG_CMD_CONSOLE /* coninfo */
  36. #define CONFIG_CMD_ECHO /* echo arguments */
  37. #define CONFIG_CMD_LOADB /* loadb */
  38. #define CONFIG_CMD_LOADS /* loads */
  39. #define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop mtest */
  40. #define CONFIG_CMD_MISC /* Misc functions like sleep etc*/
  41. #define CONFIG_CMD_RUN /* run command in env variable */
  42. #define CONFIG_CMD_SAVEENV /* saveenv */
  43. #define CONFIG_CMD_SETGETDCR /* DCR support on 4xx */
  44. #define CONFIG_CMD_SOURCE /* "source" command support */
  45. #define CONFIG_CMD_NAND
  46. /*
  47. * Serial download configuration
  48. */
  49. #define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
  50. /*
  51. * Miscellaneous configurable options
  52. */
  53. #define CONFIG_SYS_MAXARGS 16
  54. #define CONFIG_SYS_LONGHELP
  55. #define CONFIG_SYS_PROMPT "NanoNote# "
  56. #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
  57. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
  58. #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
  59. #define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024)
  60. #define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */
  61. #define CONFIG_SYS_INIT_SP_OFFSET 0x400000
  62. #define CONFIG_SYS_LOAD_ADDR 0x80600000
  63. #define CONFIG_SYS_MEMTEST_START 0x80100000
  64. #define CONFIG_SYS_MEMTEST_END 0x80800000
  65. /*
  66. * Environment
  67. */
  68. #define CONFIG_ENV_IS_IN_NAND /* use NAND for environment vars */
  69. #define CONFIG_SYS_NAND_5_ADDR_CYCLE
  70. /*
  71. * if board nand flash is 1GB, set to 1
  72. * if board nand flash is 2GB, set to 2
  73. * for change the PAGE_SIZE and BLOCK_SIZE
  74. * will delete when there is no 1GB flash
  75. */
  76. #define NANONOTE_NAND_SIZE 2
  77. #define CONFIG_SYS_NAND_PAGE_SIZE (2048 * NANONOTE_NAND_SIZE)
  78. #define CONFIG_SYS_NAND_BLOCK_SIZE (256 * NANONOTE_NAND_SIZE << 10)
  79. /* nand bad block was marked at this page in a block, start from 0 */
  80. #define CONFIG_SYS_NAND_BADBLOCK_PAGE 127
  81. #define CONFIG_SYS_NAND_PAGE_COUNT 128
  82. #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0
  83. /* ECC offset position in oob area, default value is 6 if it isn't defined */
  84. #define CONFIG_SYS_NAND_ECC_POS (6 * NANONOTE_NAND_SIZE)
  85. #define CONFIG_SYS_NAND_ECCSIZE 512
  86. #define CONFIG_SYS_NAND_ECCBYTES 9
  87. #define CONFIG_SYS_NAND_ECCPOS \
  88. {12, 13, 14, 15, 16, 17, 18, 19,\
  89. 20, 21, 22, 23, 24, 25, 26, 27, \
  90. 28, 29, 30, 31, 32, 33, 34, 35, \
  91. 36, 37, 38, 39, 40, 41, 42, 43, \
  92. 44, 45, 46, 47, 48, 49, 50, 51, \
  93. 52, 53, 54, 55, 56, 57, 58, 59, \
  94. 60, 61, 62, 63, 64, 65, 66, 67, \
  95. 68, 69, 70, 71, 72, 73, 74, 75, \
  96. 76, 77, 78, 79, 80, 81, 82, 83}
  97. #define CONFIG_SYS_NAND_OOBSIZE 128
  98. #define CONFIG_SYS_NAND_BASE 0xB8000000
  99. #define CONFIG_SYS_ONENAND_BASE CONFIG_SYS_NAND_BASE
  100. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  101. #define CONFIG_SYS_NAND_SELECT_DEVICE 1 /* nand driver supports mutipl.*/
  102. #define CONFIG_NAND_SPL_TEXT_BASE 0x80000000
  103. /*
  104. * IPL (Initial Program Loader, integrated inside CPU)
  105. * Will load first 8k from NAND (SPL) into cache and execute it from there.
  106. *
  107. * SPL (Secondary Program Loader)
  108. * Will load special U-Boot version (NUB) from NAND and execute it. This SPL
  109. * has to fit into 8kByte. It sets up the CPU and configures the SDRAM
  110. * controller and the NAND controller so that the special U-Boot image can be
  111. * loaded from NAND to SDRAM.
  112. *
  113. * NUB (NAND U-Boot)
  114. * This NAND U-Boot (NUB) is a special U-Boot version which can be started
  115. * from RAM. Therefore it mustn't (re-)configure the SDRAM controller.
  116. *
  117. */
  118. #define CONFIG_SYS_NAND_U_BOOT_DST 0x80100000 /* Load NUB to this addr */
  119. #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST
  120. /* Start NUB from this addr*/
  121. /*
  122. * Define the partitioning of the NAND chip (only RAM U-Boot is needed here)
  123. */
  124. #define CONFIG_SYS_NAND_U_BOOT_OFFS (256 << 10) /* Offset to RAM U-Boot image */
  125. #define CONFIG_SYS_NAND_U_BOOT_SIZE (512 << 10) /* Size of RAM U-Boot image */
  126. #define CONFIG_ENV_SIZE (4 << 10)
  127. #define CONFIG_ENV_OFFSET \
  128. (CONFIG_SYS_NAND_BLOCK_SIZE + CONFIG_SYS_NAND_U_BOOT_SIZE)
  129. #define CONFIG_ENV_OFFSET_REDUND \
  130. (CONFIG_ENV_OFFSET + CONFIG_SYS_NAND_BLOCK_SIZE)
  131. #define CONFIG_SYS_TEXT_BASE 0x80100000
  132. #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
  133. /*
  134. * SDRAM Info.
  135. */
  136. #define CONFIG_NR_DRAM_BANKS 1
  137. /*
  138. * Cache Configuration
  139. */
  140. #define CONFIG_SYS_DCACHE_SIZE 16384
  141. #define CONFIG_SYS_ICACHE_SIZE 16384
  142. #define CONFIG_SYS_CACHELINE_SIZE 32
  143. /*
  144. * GPIO definition
  145. */
  146. #define GPIO_LCD_CS (2 * 32 + 21)
  147. #define GPIO_AMP_EN (3 * 32 + 4)
  148. #define GPIO_SDPW_EN (3 * 32 + 2)
  149. #define GPIO_SD_DETECT (3 * 32 + 0)
  150. #define GPIO_BUZZ_PWM (3 * 32 + 27)
  151. #define GPIO_USB_DETECT (3 * 32 + 28)
  152. #define GPIO_AUDIO_POP (1 * 32 + 29)
  153. #define GPIO_COB_TEST (1 * 32 + 30)
  154. #define GPIO_KEYOUT_BASE (2 * 32 + 10)
  155. #define GPIO_KEYIN_BASE (3 * 32 + 18)
  156. #define GPIO_KEYIN_8 (3 * 32 + 26)
  157. #define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */
  158. #define GPIO_SD_VCC_EN_N GPIO_SDPW_EN /* SD Card Power Enable */
  159. #define SPEN GPIO_LCD_CS /* LCDCS :Serial command enable */
  160. #define SPDA (2 * 32 + 22) /* LCDSCL:Serial command clock input */
  161. #define SPCK (2 * 32 + 23) /* LCDSDA:Serial command data input */
  162. /* SDRAM paramters */
  163. #define SDRAM_BW16 1 /* Data bus width: 0-32bit, 1-16bit */
  164. #define SDRAM_BANK4 1 /* Banks each chip: 0-2bank, 1-4bank */
  165. #define SDRAM_ROW 13 /* Row address: 11 to 13 */
  166. #define SDRAM_COL 9 /* Column address: 8 to 12 */
  167. #define SDRAM_CASL 2 /* CAS latency: 2 or 3 */
  168. /* SDRAM Timings, unit: ns */
  169. #define SDRAM_TRAS 45 /* RAS# Active Time */
  170. #define SDRAM_RCD 20 /* RAS# to CAS# Delay */
  171. #define SDRAM_TPC 20 /* RAS# Precharge Time */
  172. #define SDRAM_TRWL 7 /* Write Latency Time */
  173. #define SDRAM_TREF 15625 /* Refresh period: 8192 cycles/64ms */
  174. #endif