km82xx-common.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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_ETHER_INDEX 4
  53. #define CONFIG_HAS_ETH0
  54. #define CONFIG_SYS_SCC_TOUT_LOOP 10000000
  55. #define CONFIG_SYS_CMXSCR_VALUE (CMXSCR_RS4CS_CLK7 | CMXSCR_TS4CS_CLK8)
  56. #ifndef CONFIG_8260_CLKIN
  57. #define CONFIG_8260_CLKIN 66000000 /* in Hz */
  58. #endif
  59. #define BOOTFLASH_START 0xFE000000
  60. #define CONFIG_KM_CONSOLE_TTY "ttyCPM0"
  61. #define MTDPARTS_DEFAULT "mtdparts=" \
  62. "app:" \
  63. "768k(u-boot)," \
  64. "128k(env)," \
  65. "128k(envred)," \
  66. "3072k(free)," \
  67. "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ")"
  68. /*
  69. * Default environment settings
  70. */
  71. #define CONFIG_EXTRA_ENV_SETTINGS \
  72. CONFIG_KM_BOARD_EXTRA_ENV \
  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. "arch=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. #ifndef __ASSEMBLY__
  123. void set_sda(int state);
  124. void set_scl(int state);
  125. int get_sda(void);
  126. int get_scl(void);
  127. #endif
  128. /* I2C SYSMON (LM75, AD7414 is almost compatible) */
  129. #define CONFIG_DTT_LM75 /* ON Semi's LM75 */
  130. #define CONFIG_DTT_SENSORS {0} /* Sensor addresses */
  131. #define CONFIG_SYS_DTT_MAX_TEMP 70
  132. #define CONFIG_SYS_DTT_LOW_TEMP -30
  133. #define CONFIG_SYS_DTT_HYSTERESIS 3
  134. #define CONFIG_SYS_DTT_BUS_NUM (CONFIG_SYS_MAX_I2C_BUS)
  135. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
  136. #define CONFIG_SYS_IMMR 0xF0000000
  137. #define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_IMMR
  138. #define CONFIG_SYS_INIT_RAM_SIZE 0x2000 /* used size in DPRAM */
  139. #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \
  140. GENERATED_GBL_DATA_SIZE)
  141. #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
  142. /* Hard reset configuration word */
  143. #define CONFIG_SYS_HRCW_MASTER 0x0604b211
  144. /* No slaves */
  145. #define CONFIG_SYS_HRCW_SLAVE1 0
  146. #define CONFIG_SYS_HRCW_SLAVE2 0
  147. #define CONFIG_SYS_HRCW_SLAVE3 0
  148. #define CONFIG_SYS_HRCW_SLAVE4 0
  149. #define CONFIG_SYS_HRCW_SLAVE5 0
  150. #define CONFIG_SYS_HRCW_SLAVE6 0
  151. #define CONFIG_SYS_HRCW_SLAVE7 0
  152. /* Initial Memory map for Linux */
  153. #define CONFIG_SYS_BOOTMAPSZ (8 << 20)
  154. #define CONFIG_SYS_CACHELINE_SIZE 32 /* For MPC8260 CPUs */
  155. #if defined(CONFIG_CMD_KGDB)
  156. # define CONFIG_SYS_CACHELINE_SHIFT 5 /* log base 2 of the above value */
  157. #endif
  158. #define CONFIG_SYS_HID0_INIT 0
  159. #define CONFIG_SYS_HID0_FINAL (HID0_ICE | HID0_IFEM | HID0_ABE)
  160. #define CONFIG_SYS_HID2 0
  161. #define CONFIG_SYS_SIUMCR 0x4020c200
  162. #define CONFIG_SYS_SYPCR 0xFFFFFF83
  163. #define CONFIG_SYS_BCR 0x10000000
  164. #define CONFIG_SYS_SCCR (SCCR_PCI_MODE | SCCR_PCI_MODCK)
  165. /*
  166. *-----------------------------------------------------------------------
  167. * RMR - Reset Mode Register 5-5
  168. *-----------------------------------------------------------------------
  169. * turn on Checkstop Reset Enable
  170. */
  171. #define CONFIG_SYS_RMR 0
  172. /*
  173. *-----------------------------------------------------------------------
  174. * TMCNTSC - Time Counter Status and Control 4-40
  175. *-----------------------------------------------------------------------
  176. * Clear once per Second and Alarm Interrupt Status, Set 32KHz timersclk,
  177. * and enable Time Counter
  178. */
  179. #define CONFIG_SYS_TMCNTSC (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
  180. /*
  181. *-----------------------------------------------------------------------
  182. * PISCR - Periodic Interrupt Status and Control 4-42
  183. *-----------------------------------------------------------------------
  184. * Clear Periodic Interrupt Status, Set 32KHz timersclk, and enable
  185. * Periodic timer
  186. */
  187. #define CONFIG_SYS_PISCR (PISCR_PS|PISCR_PTF|PISCR_PTE)
  188. /*
  189. *-----------------------------------------------------------------------
  190. * RCCR - RISC Controller Configuration 13-7
  191. *-----------------------------------------------------------------------
  192. */
  193. #define CONFIG_SYS_RCCR 0
  194. /*
  195. * Init Memory Controller:
  196. *
  197. * Bank Bus Machine PortSz Device
  198. * ---- --- ------- ------ ------
  199. * 0 60x GPCM 8 bit FLASH
  200. * 1 60x SDRAM 32 bit SDRAM
  201. * 3 60x GPCM 8 bit GPIO/PIGGY
  202. * 5 60x GPCM 16 bit CFG-Flash
  203. *
  204. */
  205. /* Bank 0 - FLASH
  206. */
  207. #define CONFIG_SYS_BR0_PRELIM ((CONFIG_SYS_FLASH_BASE & BRx_BA_MSK) |\
  208. BRx_PS_8 |\
  209. BRx_MS_GPCM_P |\
  210. BRx_V)
  211. #define CONFIG_SYS_OR0_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) |\
  212. ORxG_CSNT |\
  213. ORxG_ACS_DIV2 |\
  214. ORxG_SCY_5_CLK |\
  215. ORxG_TRLX)
  216. #define CONFIG_SYS_MPTPR 0x1800
  217. /*
  218. *-----------------------------------------------------------------------------
  219. * Address for Mode Register Set (MRS) command
  220. *-----------------------------------------------------------------------------
  221. */
  222. #define CONFIG_SYS_MRS_OFFS 0x00000110
  223. #define CONFIG_SYS_PSRT 0x0e
  224. #define CONFIG_SYS_BR1_PRELIM ((CONFIG_SYS_SDRAM_BASE & BRx_BA_MSK) |\
  225. BRx_PS_64 |\
  226. BRx_MS_SDRAM_P |\
  227. BRx_V)
  228. #define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_OR1
  229. /*
  230. * UPIO FPGA (GPIO/PIGGY) on CS3 initialization values
  231. */
  232. #define CONFIG_SYS_KMBEC_FPGA_BASE 0x30000000
  233. #define CONFIG_SYS_KMBEC_FPGA_SIZE 128
  234. #define CONFIG_SYS_BR3_PRELIM ((CONFIG_SYS_KMBEC_FPGA_BASE & BRx_BA_MSK) |\
  235. BRx_PS_8 | BRx_MS_GPCM_P | BRx_V)
  236. #define CONFIG_SYS_OR3_PRELIM (MEG_TO_AM(CONFIG_SYS_KMBEC_FPGA_SIZE) |\
  237. ORxG_CSNT | ORxG_ACS_DIV2 |\
  238. ORxG_SCY_3_CLK | ORxG_TRLX)
  239. /*
  240. * BFTICU board FPGA on CS4 initialization values
  241. */
  242. #define CONFIG_SYS_FPGA_BASE 0x40000000
  243. #define CONFIG_SYS_FPGA_SIZE 1 /*1KB*/
  244. #define CONFIG_SYS_BR4_PRELIM ((CONFIG_SYS_FPGA_BASE & BRx_BA_MSK) |\
  245. BRx_PS_8 | BRx_MS_GPCM_P | BRx_V)
  246. #define CONFIG_SYS_OR4_PRELIM (P2SZ_TO_AM(CONFIG_SYS_FPGA_SIZE << 10) |\
  247. ORxG_CSNT | ORxG_ACS_DIV2 |\
  248. ORxG_SCY_3_CLK | ORxG_TRLX)
  249. /*
  250. * CFG-Flash on CS5 initialization values
  251. */
  252. #define CONFIG_SYS_BR5_PRELIM ((CONFIG_SYS_FLASH_BASE_1 & BRx_BA_MSK) |\
  253. BRx_PS_16 | BRx_MS_GPCM_P | BRx_V)
  254. #define CONFIG_SYS_OR5_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE_1 + \
  255. CONFIG_SYS_FLASH_SIZE_2) |\
  256. ORxG_CSNT | ORxG_ACS_DIV2 |\
  257. ORxG_SCY_5_CLK | ORxG_TRLX)
  258. #define CONFIG_SYS_RESET_ADDRESS 0xFDFFFFFC /* "bad" address */
  259. /* pass open firmware flat tree */
  260. #define CONFIG_FIT 1
  261. #define CONFIG_OF_LIBFDT 1
  262. #define CONFIG_OF_BOARD_SETUP 1
  263. #define OF_TBCLK (bd->bi_busfreq / 4)
  264. #define OF_STDOUT_PATH "/soc/cpm/serial@11a90"
  265. #endif /* __KM82XX_COMMON */