km82xx-common.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. /*
  2. * (C) Copyright 2007-2010
  3. * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef __KM82XX_COMMON
  24. #define __KM82XX_COMMON
  25. /*
  26. * Select serial console configuration
  27. *
  28. * If either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
  29. * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
  30. * for SCC).
  31. */
  32. #define CONFIG_CONS_ON_SMC /* Console is on SMC */
  33. #undef CONFIG_CONS_ON_SCC /* It's not on SCC */
  34. #undef CONFIG_CONS_NONE /* It's not on external UART */
  35. #define CONFIG_CONS_INDEX 2 /* SMC2 is used for console */
  36. #define CONFIG_SYS_SMC_RXBUFLEN 128
  37. #define CONFIG_SYS_MAXIDLE 10
  38. /*
  39. * Select ethernet configuration
  40. *
  41. * If either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected,
  42. * then CONFIG_ETHER_INDEX must be set to the channel number (1-4 for
  43. * SCC, 1-3 for FCC)
  44. *
  45. * If CONFIG_ETHER_NONE is defined, then either the ethernet routines
  46. * must be defined elsewhere (as for the console), or CONFIG_CMD_NET
  47. * must be unset.
  48. */
  49. #define CONFIG_ETHER_ON_SCC /* Ethernet is on SCC */
  50. #undef CONFIG_ETHER_ON_FCC /* Ethernet is not on FCC */
  51. #undef CONFIG_ETHER_NONE /* No external Ethernet */
  52. #define CONFIG_NET_MULTI
  53. #define CONFIG_ETHER_INDEX 4
  54. #define CONFIG_HAS_ETH0
  55. #define CONFIG_SYS_SCC_TOUT_LOOP 10000000
  56. #define CONFIG_SYS_CMXSCR_VALUE (CMXSCR_RS4CS_CLK7 | CMXSCR_TS4CS_CLK8)
  57. #ifndef CONFIG_8260_CLKIN
  58. #define CONFIG_8260_CLKIN 66000000 /* in Hz */
  59. #endif
  60. #define BOOTFLASH_START 0xFE000000
  61. #define CONFIG_KM_CONSOLE_TTY "ttyCPM0"
  62. #define MTDPARTS_DEFAULT "mtdparts=" \
  63. "app:" \
  64. "768k(u-boot)," \
  65. "128k(env)," \
  66. "128k(envred)," \
  67. "3072k(free)," \
  68. "-(" CONFIG_KM_UBI_PARTITION_NAME ")"
  69. /*
  70. * Default environment settings
  71. */
  72. #define CONFIG_EXTRA_ENV_SETTINGS \
  73. CONFIG_KM_DEF_ENV \
  74. "EEprom_ivm=pca9544a:70:4 \0" \
  75. "unlock=yes\0" \
  76. "newenv=" \
  77. "prot off 0xFE0C0000 +0x40000 && " \
  78. "era 0xFE0C0000 +0x40000\0" \
  79. "rootpath=/opt/eldk/ppc_82xx\0" \
  80. ""
  81. #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
  82. #if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE)
  83. #define CONFIG_SYS_RAMBOOT
  84. #endif
  85. #define CONFIG_SYS_MONITOR_LEN (768 << 10)
  86. #define CONFIG_ENV_IS_IN_FLASH
  87. #ifdef CONFIG_ENV_IS_IN_FLASH
  88. #define CONFIG_ENV_SECT_SIZE 0x20000
  89. #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + \
  90. CONFIG_SYS_MONITOR_LEN)
  91. #define CONFIG_ENV_OFFSET CONFIG_SYS_MONITOR_LEN
  92. /* Address and size of Redundant Environment Sector */
  93. #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
  94. CONFIG_ENV_SECT_SIZE)
  95. #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
  96. #endif /* CONFIG_ENV_IS_IN_FLASH */
  97. /* enable I2C and select the hardware/software driver */
  98. #undef CONFIG_HARD_I2C /* I2C with hardware support */
  99. #define CONFIG_SOFT_I2C /* I2C bit-banged */
  100. #define CONFIG_SYS_I2C_SPEED 50000 /* I2C speed */
  101. #define CONFIG_SYS_I2C_SLAVE 0x7F /* I2C slave address */
  102. /*
  103. * Software (bit-bang) I2C driver configuration
  104. */
  105. #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */
  106. #define I2C_ACTIVE (iop->pdir |= 0x00010000)
  107. #define I2C_TRISTATE (iop->pdir &= ~0x00010000)
  108. #define I2C_READ ((iop->pdat & 0x00010000) != 0)
  109. #define I2C_SDA(bit) do { \
  110. if (bit) \
  111. iop->pdat |= 0x00010000; \
  112. else \
  113. iop->pdat &= ~0x00010000; \
  114. } while (0)
  115. #define I2C_SCL(bit) do { \
  116. if (bit) \
  117. iop->pdat |= 0x00020000; \
  118. else \
  119. iop->pdat &= ~0x00020000; \
  120. } while (0)
  121. #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */
  122. /* I2C SYSMON (LM75, AD7414 is almost compatible) */
  123. #define CONFIG_DTT_LM75 /* ON Semi's LM75 */
  124. #define CONFIG_DTT_SENSORS {0} /* Sensor addresses */
  125. #define CONFIG_SYS_DTT_MAX_TEMP 70
  126. #define CONFIG_SYS_DTT_LOW_TEMP -30
  127. #define CONFIG_SYS_DTT_HYSTERESIS 3
  128. #define CONFIG_SYS_DTT_BUS_NUM (CONFIG_SYS_MAX_I2C_BUS)
  129. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
  130. #define CONFIG_SYS_IMMR 0xF0000000
  131. #define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_IMMR
  132. #define CONFIG_SYS_INIT_RAM_SIZE 0x2000 /* used size in DPRAM */
  133. #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \
  134. GENERATED_GBL_DATA_SIZE)
  135. #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
  136. /* Hard reset configuration word */
  137. #define CONFIG_SYS_HRCW_MASTER 0x0604b211
  138. /* No slaves */
  139. #define CONFIG_SYS_HRCW_SLAVE1 0
  140. #define CONFIG_SYS_HRCW_SLAVE2 0
  141. #define CONFIG_SYS_HRCW_SLAVE3 0
  142. #define CONFIG_SYS_HRCW_SLAVE4 0
  143. #define CONFIG_SYS_HRCW_SLAVE5 0
  144. #define CONFIG_SYS_HRCW_SLAVE6 0
  145. #define CONFIG_SYS_HRCW_SLAVE7 0
  146. /* Initial Memory map for Linux */
  147. #define CONFIG_SYS_BOOTMAPSZ (8 << 20)
  148. #define CONFIG_SYS_CACHELINE_SIZE 32 /* For MPC8260 CPUs */
  149. #if defined(CONFIG_CMD_KGDB)
  150. # define CONFIG_SYS_CACHELINE_SHIFT 5 /* log base 2 of the above value */
  151. #endif
  152. #define CONFIG_SYS_HID0_INIT 0
  153. #define CONFIG_SYS_HID0_FINAL (HID0_ICE | HID0_IFEM | HID0_ABE)
  154. #define CONFIG_SYS_HID2 0
  155. #define CONFIG_SYS_SIUMCR 0x4020c200
  156. #define CONFIG_SYS_SYPCR 0xFFFFFFC3
  157. #define CONFIG_SYS_BCR 0x10000000
  158. #define CONFIG_SYS_SCCR (SCCR_PCI_MODE | SCCR_PCI_MODCK)
  159. /*
  160. *-----------------------------------------------------------------------
  161. * RMR - Reset Mode Register 5-5
  162. *-----------------------------------------------------------------------
  163. * turn on Checkstop Reset Enable
  164. */
  165. #define CONFIG_SYS_RMR 0
  166. /*
  167. *-----------------------------------------------------------------------
  168. * TMCNTSC - Time Counter Status and Control 4-40
  169. *-----------------------------------------------------------------------
  170. * Clear once per Second and Alarm Interrupt Status, Set 32KHz timersclk,
  171. * and enable Time Counter
  172. */
  173. #define CONFIG_SYS_TMCNTSC (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
  174. /*
  175. *-----------------------------------------------------------------------
  176. * PISCR - Periodic Interrupt Status and Control 4-42
  177. *-----------------------------------------------------------------------
  178. * Clear Periodic Interrupt Status, Set 32KHz timersclk, and enable
  179. * Periodic timer
  180. */
  181. #define CONFIG_SYS_PISCR (PISCR_PS|PISCR_PTF|PISCR_PTE)
  182. /*
  183. *-----------------------------------------------------------------------
  184. * RCCR - RISC Controller Configuration 13-7
  185. *-----------------------------------------------------------------------
  186. */
  187. #define CONFIG_SYS_RCCR 0
  188. /*
  189. * Init Memory Controller:
  190. *
  191. * Bank Bus Machine PortSz Device
  192. * ---- --- ------- ------ ------
  193. * 0 60x GPCM 8 bit FLASH
  194. * 1 60x SDRAM 32 bit SDRAM
  195. * 3 60x GPCM 8 bit GPIO/PIGGY
  196. * 5 60x GPCM 16 bit CFG-Flash
  197. *
  198. */
  199. /* Bank 0 - FLASH
  200. */
  201. #define CONFIG_SYS_BR0_PRELIM ((CONFIG_SYS_FLASH_BASE & BRx_BA_MSK) |\
  202. BRx_PS_8 |\
  203. BRx_MS_GPCM_P |\
  204. BRx_V)
  205. #define CONFIG_SYS_OR0_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) |\
  206. ORxG_CSNT |\
  207. ORxG_ACS_DIV2 |\
  208. ORxG_SCY_5_CLK |\
  209. ORxG_TRLX)
  210. /*
  211. * Bank 1 - 60x bus SDRAM
  212. */
  213. #define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */
  214. #define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */
  215. #define CONFIG_SYS_MPTPR 0x1800
  216. /*
  217. *-----------------------------------------------------------------------------
  218. * Address for Mode Register Set (MRS) command
  219. *-----------------------------------------------------------------------------
  220. */
  221. #define CONFIG_SYS_MRS_OFFS 0x00000110
  222. #define CONFIG_SYS_PSRT 0x0e
  223. #define CONFIG_SYS_BR1_PRELIM ((CONFIG_SYS_SDRAM_BASE & BRx_BA_MSK) |\
  224. BRx_PS_64 |\
  225. BRx_MS_SDRAM_P |\
  226. BRx_V)
  227. #define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_OR1
  228. /*
  229. * SDRAM initialization values
  230. */
  231. #define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & ORxS_SDAM_MSK) |\
  232. ORxS_BPD_8 |\
  233. ORxS_ROWST_PBI0_A7 |\
  234. ORxS_NUMR_13)
  235. #define CONFIG_SYS_PSDMR (PSDMR_SDAM_A14_IS_A5 |\
  236. PSDMR_BSMA_A14_A16 |\
  237. PSDMR_SDA10_PBI0_A9 |\
  238. PSDMR_RFRC_5_CLK |\
  239. PSDMR_PRETOACT_2W |\
  240. PSDMR_ACTTORW_2W |\
  241. PSDMR_LDOTOPRE_1C |\
  242. PSDMR_WRC_1C |\
  243. PSDMR_CL_2)
  244. /*
  245. * GPIO/PIGGY on CS3 initialization values
  246. */
  247. #define CONFIG_SYS_PIGGY_BASE 0x30000000
  248. #define CONFIG_SYS_PIGGY_SIZE 128
  249. #define CONFIG_SYS_BR3_PRELIM ((CONFIG_SYS_PIGGY_BASE & BRx_BA_MSK) |\
  250. BRx_PS_8 | BRx_MS_GPCM_P | BRx_V)
  251. #define CONFIG_SYS_OR3_PRELIM (MEG_TO_AM(CONFIG_SYS_PIGGY_SIZE) |\
  252. ORxG_CSNT | ORxG_ACS_DIV2 |\
  253. ORxG_SCY_3_CLK | ORxG_TRLX)
  254. /*
  255. * Board FPGA on CS4 initialization values
  256. */
  257. #define CONFIG_SYS_FPGA_BASE 0x40000000
  258. #define CONFIG_SYS_FPGA_SIZE 1 /*1KB*/
  259. #define CONFIG_SYS_BR4_PRELIM ((CONFIG_SYS_FPGA_BASE & BRx_BA_MSK) |\
  260. BRx_PS_8 | BRx_MS_GPCM_P | BRx_V)
  261. #define CONFIG_SYS_OR4_PRELIM (P2SZ_TO_AM(CONFIG_SYS_FPGA_SIZE << 10) |\
  262. ORxG_CSNT | ORxG_ACS_DIV2 |\
  263. ORxG_SCY_3_CLK | ORxG_TRLX)
  264. /*
  265. * CFG-Flash on CS5 initialization values
  266. */
  267. #define CONFIG_SYS_BR5_PRELIM ((CONFIG_SYS_FLASH_BASE_1 & BRx_BA_MSK) |\
  268. BRx_PS_16 | BRx_MS_GPCM_P | BRx_V)
  269. #define CONFIG_SYS_OR5_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE_1 + \
  270. CONFIG_SYS_FLASH_SIZE_2) |\
  271. ORxG_CSNT | ORxG_ACS_DIV2 |\
  272. ORxG_SCY_5_CLK | ORxG_TRLX)
  273. #define CONFIG_SYS_RESET_ADDRESS 0xFDFFFFFC /* "bad" address */
  274. /* pass open firmware flat tree */
  275. #define CONFIG_FIT 1
  276. #define CONFIG_OF_LIBFDT 1
  277. #define CONFIG_OF_BOARD_SETUP 1
  278. #define OF_TBCLK (bd->bi_busfreq / 4)
  279. #define OF_STDOUT_PATH "/soc/cpm/serial@11a90"
  280. #endif /* __KM82XX_COMMON */