km82xx.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. /*
  2. * (C) Copyright 2007-2011
  3. * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __CONFIG_H
  8. #define __CONFIG_H
  9. /*
  10. * High Level Configuration Options
  11. * (easy to change)
  12. */
  13. #define CONFIG_MPC8247
  14. /* MGCOGE */
  15. #if defined(CONFIG_MGCOGE)
  16. #define CONFIG_HOSTNAME mgcoge
  17. #define CONFIG_KM_BOARD_EXTRA_ENV ""
  18. /* MGCOGE3NE */
  19. #elif defined(CONFIG_MGCOGE3NE)
  20. #define CONFIG_HOSTNAME mgcoge3ne
  21. #define CONFIG_KM_82XX
  22. #define CONFIG_KM_BOARD_EXTRA_ENV "bobcatreset=true\0"
  23. #else
  24. #error ("Board unsupported")
  25. #endif
  26. #define CONFIG_SYS_TEXT_BASE 0xFE000000
  27. #define CONFIG_MISC_INIT_R
  28. /* include common defines/options for all Keymile boards */
  29. #include "km/keymile-common.h"
  30. #include "km/km-powerpc.h"
  31. #define CONFIG_SYS_SDRAM_BASE 0x00000000
  32. #define CONFIG_SYS_FLASH_BASE 0xFE000000
  33. #define CONFIG_SYS_FLASH_SIZE 32
  34. #define CONFIG_SYS_FLASH_CFI
  35. #define CONFIG_FLASH_CFI_DRIVER
  36. /* MGCOGE */
  37. #if defined(CONFIG_MGCOGE)
  38. #define CONFIG_SYS_MAX_FLASH_BANKS 3
  39. /* max num of sects on one chip */
  40. #define CONFIG_SYS_MAX_FLASH_SECT 512
  41. #define CONFIG_SYS_FLASH_BASE_1 0x50000000
  42. #define CONFIG_SYS_FLASH_SIZE_1 32
  43. #define CONFIG_SYS_FLASH_BASE_2 0x52000000
  44. #define CONFIG_SYS_FLASH_SIZE_2 32
  45. #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \
  46. CONFIG_SYS_FLASH_BASE_1, \
  47. CONFIG_SYS_FLASH_BASE_2 }
  48. #define MTDIDS_DEFAULT "nor3=app"
  49. /*
  50. * Bank 1 - 60x bus SDRAM
  51. */
  52. #define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */
  53. #define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */
  54. /* SDRAM initialization values
  55. */
  56. #define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \
  57. ORxS_SDAM_MSK) |\
  58. ORxS_BPD_8 |\
  59. ORxS_ROWST_PBI0_A7 |\
  60. ORxS_NUMR_13)
  61. #define CONFIG_SYS_PSDMR ( \
  62. PSDMR_SDAM_A14_IS_A5 |\
  63. PSDMR_BSMA_A14_A16 |\
  64. PSDMR_SDA10_PBI0_A9 |\
  65. PSDMR_RFRC_5_CLK |\
  66. PSDMR_PRETOACT_2W |\
  67. PSDMR_ACTTORW_2W |\
  68. PSDMR_LDOTOPRE_1C |\
  69. PSDMR_WRC_1C |\
  70. PSDMR_CL_2)
  71. /* MGCOGE3NE */
  72. #elif defined(CONFIG_MGCOGE3NE)
  73. #define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max num of flash banks */
  74. #define CONFIG_SYS_MAX_FLASH_SECT 1024 /*
  75. * max num of sects on one
  76. * chip
  77. */
  78. #define CONFIG_SYS_FLASH_BASE_1 0x50000000
  79. #define CONFIG_SYS_FLASH_SIZE_1 128
  80. #define CONFIG_SYS_FLASH_SIZE_2 0 /* dummy value to calc SYS_OR5 */
  81. #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \
  82. CONFIG_SYS_FLASH_BASE_1 }
  83. #define MTDIDS_DEFAULT "nor2=app"
  84. /*
  85. * Bank 1 - 60x bus SDRAM
  86. * mgcoge3ne has 256MB
  87. * mgcoge2ne has 128MB
  88. */
  89. #define SDRAM_MAX_SIZE 0x10000000 /* max. 256 MB */
  90. #define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (512 << 20) /* less than 512 MB */
  91. #define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \
  92. ORxS_SDAM_MSK) |\
  93. ORxS_BPD_4 |\
  94. ORxS_NUMR_13 |\
  95. ORxS_IBID)
  96. #define CONFIG_SYS_PSDMR ( \
  97. PSDMR_PBI |\
  98. PSDMR_RFEN |\
  99. PSDMR_BSMA_A13_A15 |\
  100. PSDMR_RFRC_5_CLK |\
  101. PSDMR_PRETOACT_2W |\
  102. PSDMR_ACTTORW_2W |\
  103. PSDMR_LDOTOPRE_1C |\
  104. PSDMR_WRC_1C |\
  105. PSDMR_CL_2)
  106. #define CONFIG_SYS_SDRAM_LIST { \
  107. { .size = 256 << 20, \
  108. .or1 = ORxS_ROWST_PBI1_A4, \
  109. .psdmr = PSDMR_SDAM_A17_IS_A5 | PSDMR_SDA10_PBI1_A6, \
  110. }, \
  111. { .size = 128 << 20, \
  112. .or1 = ORxS_ROWST_PBI1_A5, \
  113. .psdmr = PSDMR_SDAM_A16_IS_A5 | PSDMR_SDA10_PBI1_A7, \
  114. }, \
  115. }
  116. #endif /* defined(CONFIG_MGCOGE3NE) */
  117. /* include further common stuff for all keymile 82xx boards */
  118. /*
  119. * Select serial console configuration
  120. *
  121. * If either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
  122. * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
  123. * for SCC).
  124. */
  125. #define CONFIG_CONS_ON_SMC /* Console is on SMC */
  126. #undef CONFIG_CONS_ON_SCC /* It's not on SCC */
  127. #undef CONFIG_CONS_NONE /* It's not on external UART */
  128. #define CONFIG_CONS_INDEX 2 /* SMC2 is used for console */
  129. #define CONFIG_SYS_SMC_RXBUFLEN 128
  130. #define CONFIG_SYS_MAXIDLE 10
  131. /*
  132. * Select ethernet configuration
  133. *
  134. * If either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected,
  135. * then CONFIG_ETHER_INDEX must be set to the channel number (1-4 for
  136. * SCC, 1-3 for FCC)
  137. *
  138. * If CONFIG_ETHER_NONE is defined, then either the ethernet routines
  139. * must be defined elsewhere (as for the console), or CONFIG_CMD_NET
  140. * must be unset.
  141. */
  142. #define CONFIG_ETHER_ON_SCC /* Ethernet is on SCC */
  143. #undef CONFIG_ETHER_ON_FCC /* Ethernet is not on FCC */
  144. #undef CONFIG_ETHER_NONE /* No external Ethernet */
  145. #define CONFIG_ETHER_INDEX 4
  146. #define CONFIG_HAS_ETH0
  147. #define CONFIG_SYS_SCC_TOUT_LOOP 10000000
  148. #define CONFIG_SYS_CMXSCR_VALUE (CMXSCR_RS4CS_CLK7 | CMXSCR_TS4CS_CLK8)
  149. #ifndef CONFIG_8260_CLKIN
  150. #define CONFIG_8260_CLKIN 66000000 /* in Hz */
  151. #endif
  152. #define BOOTFLASH_START 0xFE000000
  153. #define CONFIG_KM_CONSOLE_TTY "ttyCPM0"
  154. #define MTDPARTS_DEFAULT "mtdparts=" \
  155. "app:" \
  156. "768k(u-boot)," \
  157. "128k(env)," \
  158. "128k(envred)," \
  159. "3072k(free)," \
  160. "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ")"
  161. /*
  162. * Default environment settings
  163. */
  164. #define CONFIG_EXTRA_ENV_SETTINGS \
  165. CONFIG_KM_BOARD_EXTRA_ENV \
  166. CONFIG_KM_DEF_ENV \
  167. "unlock=yes\0" \
  168. "newenv=" \
  169. "prot off 0xFE0C0000 +0x40000 && " \
  170. "era 0xFE0C0000 +0x40000\0" \
  171. "arch=ppc_82xx\0" \
  172. ""
  173. #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
  174. #define CONFIG_SYS_MONITOR_LEN (768 << 10)
  175. #define CONFIG_ENV_IS_IN_FLASH
  176. #ifdef CONFIG_ENV_IS_IN_FLASH
  177. #define CONFIG_ENV_SECT_SIZE 0x20000
  178. #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + \
  179. CONFIG_SYS_MONITOR_LEN)
  180. #define CONFIG_ENV_OFFSET CONFIG_SYS_MONITOR_LEN
  181. /* Address and size of Redundant Environment Sector */
  182. #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
  183. CONFIG_ENV_SECT_SIZE)
  184. #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
  185. #endif /* CONFIG_ENV_IS_IN_FLASH */
  186. /* enable I2C and select the hardware/software driver */
  187. #define CONFIG_SYS_I2C
  188. #define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */
  189. #define CONFIG_SYS_I2C_INIT_BOARD
  190. #define CONFIG_SYS_NUM_I2C_BUSES 3
  191. #define CONFIG_SYS_I2C_MAX_HOPS 1
  192. #define CONFIG_SYS_I2C_SOFT_SPEED 50000
  193. #define CONFIG_SYS_I2C_SPEED CONFIG_SYS_I2C_SOFT_SPEED
  194. #define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F
  195. #define CONFIG_SYS_I2C_BUSES {{0, {I2C_NULL_HOP} }, \
  196. {0, {{I2C_MUX_PCA9542, 0x70, 0} } }, \
  197. {0, {{I2C_MUX_PCA9542, 0x70, 1} } } }
  198. #define CONFIG_KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/
  199. #define CONFIG_KM_I2C_ABORT
  200. /*
  201. * Software (bit-bang) I2C driver configuration
  202. */
  203. #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */
  204. #define I2C_ACTIVE (iop->pdir |= 0x00010000)
  205. #define I2C_TRISTATE (iop->pdir &= ~0x00010000)
  206. #define I2C_READ ((iop->pdat & 0x00010000) != 0)
  207. #define I2C_SDA(bit) do { \
  208. if (bit) \
  209. iop->pdat |= 0x00010000; \
  210. else \
  211. iop->pdat &= ~0x00010000; \
  212. } while (0)
  213. #define I2C_SCL(bit) do { \
  214. if (bit) \
  215. iop->pdat |= 0x00020000; \
  216. else \
  217. iop->pdat &= ~0x00020000; \
  218. } while (0)
  219. #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */
  220. #ifndef __ASSEMBLY__
  221. void set_sda(int state);
  222. void set_scl(int state);
  223. int get_sda(void);
  224. int get_scl(void);
  225. #endif
  226. /* I2C SYSMON (LM75, AD7414 is almost compatible) */
  227. #define CONFIG_DTT_LM75 /* ON Semi's LM75 */
  228. #define CONFIG_DTT_SENSORS {0} /* Sensor addresses */
  229. #define CONFIG_SYS_DTT_MAX_TEMP 70
  230. #define CONFIG_SYS_DTT_HYSTERESIS 3
  231. #define CONFIG_SYS_DTT_BUS_NUM 2
  232. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
  233. #define CONFIG_SYS_IMMR 0xF0000000
  234. #define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_IMMR
  235. #define CONFIG_SYS_INIT_RAM_SIZE 0x2000 /* used size in DPRAM */
  236. #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \
  237. GENERATED_GBL_DATA_SIZE)
  238. #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
  239. /* Hard reset configuration word */
  240. #define CONFIG_SYS_HRCW_MASTER 0x0604b211
  241. /* No slaves */
  242. #define CONFIG_SYS_HRCW_SLAVE1 0
  243. #define CONFIG_SYS_HRCW_SLAVE2 0
  244. #define CONFIG_SYS_HRCW_SLAVE3 0
  245. #define CONFIG_SYS_HRCW_SLAVE4 0
  246. #define CONFIG_SYS_HRCW_SLAVE5 0
  247. #define CONFIG_SYS_HRCW_SLAVE6 0
  248. #define CONFIG_SYS_HRCW_SLAVE7 0
  249. /* Initial Memory map for Linux */
  250. #define CONFIG_SYS_BOOTMAPSZ (8 << 20)
  251. #define CONFIG_SYS_CACHELINE_SIZE 32 /* For MPC8260 CPUs */
  252. #if defined(CONFIG_CMD_KGDB)
  253. # define CONFIG_SYS_CACHELINE_SHIFT 5 /* log base 2 of the above value */
  254. #endif
  255. #define CONFIG_SYS_HID0_INIT 0
  256. #define CONFIG_SYS_HID0_FINAL (HID0_ICE | HID0_IFEM | HID0_ABE)
  257. #define CONFIG_SYS_HID2 0
  258. #define CONFIG_SYS_SIUMCR 0x4020c200
  259. #define CONFIG_SYS_SYPCR 0xFFFFFF83
  260. #define CONFIG_SYS_BCR 0x10000000
  261. #define CONFIG_SYS_SCCR (SCCR_PCI_MODE | SCCR_PCI_MODCK)
  262. /*
  263. *-----------------------------------------------------------------------
  264. * RMR - Reset Mode Register 5-5
  265. *-----------------------------------------------------------------------
  266. * turn on Checkstop Reset Enable
  267. */
  268. #define CONFIG_SYS_RMR 0
  269. /*
  270. *-----------------------------------------------------------------------
  271. * TMCNTSC - Time Counter Status and Control 4-40
  272. *-----------------------------------------------------------------------
  273. * Clear once per Second and Alarm Interrupt Status, Set 32KHz timersclk,
  274. * and enable Time Counter
  275. */
  276. #define CONFIG_SYS_TMCNTSC (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
  277. /*
  278. *-----------------------------------------------------------------------
  279. * PISCR - Periodic Interrupt Status and Control 4-42
  280. *-----------------------------------------------------------------------
  281. * Clear Periodic Interrupt Status, Set 32KHz timersclk, and enable
  282. * Periodic timer
  283. */
  284. #define CONFIG_SYS_PISCR (PISCR_PS|PISCR_PTF|PISCR_PTE)
  285. /*
  286. *-----------------------------------------------------------------------
  287. * RCCR - RISC Controller Configuration 13-7
  288. *-----------------------------------------------------------------------
  289. */
  290. #define CONFIG_SYS_RCCR 0
  291. /*
  292. * Init Memory Controller:
  293. *
  294. * Bank Bus Machine PortSz Device
  295. * ---- --- ------- ------ ------
  296. * 0 60x GPCM 8 bit FLASH
  297. * 1 60x SDRAM 32 bit SDRAM
  298. * 3 60x GPCM 8 bit GPIO/PIGGY
  299. * 5 60x GPCM 16 bit CFG-Flash
  300. *
  301. */
  302. /* Bank 0 - FLASH
  303. */
  304. #define CONFIG_SYS_BR0_PRELIM ((CONFIG_SYS_FLASH_BASE & BRx_BA_MSK) |\
  305. BRx_PS_8 |\
  306. BRx_MS_GPCM_P |\
  307. BRx_V)
  308. #define CONFIG_SYS_OR0_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE) |\
  309. ORxG_CSNT |\
  310. ORxG_ACS_DIV2 |\
  311. ORxG_SCY_5_CLK |\
  312. ORxG_TRLX)
  313. #define CONFIG_SYS_MPTPR 0x1800
  314. /*
  315. *-----------------------------------------------------------------------------
  316. * Address for Mode Register Set (MRS) command
  317. *-----------------------------------------------------------------------------
  318. */
  319. #define CONFIG_SYS_MRS_OFFS 0x00000110
  320. #define CONFIG_SYS_PSRT 0x0e
  321. #define CONFIG_SYS_BR1_PRELIM ((CONFIG_SYS_SDRAM_BASE & BRx_BA_MSK) |\
  322. BRx_PS_64 |\
  323. BRx_MS_SDRAM_P |\
  324. BRx_V)
  325. #define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_OR1
  326. /*
  327. * UPIO FPGA (GPIO/PIGGY) on CS3 initialization values
  328. */
  329. #define CONFIG_SYS_KMBEC_FPGA_BASE 0x30000000
  330. #define CONFIG_SYS_KMBEC_FPGA_SIZE 128
  331. #define CONFIG_SYS_BR3_PRELIM ((CONFIG_SYS_KMBEC_FPGA_BASE & BRx_BA_MSK) |\
  332. BRx_PS_8 | BRx_MS_GPCM_P | BRx_V)
  333. #define CONFIG_SYS_OR3_PRELIM (MEG_TO_AM(CONFIG_SYS_KMBEC_FPGA_SIZE) |\
  334. ORxG_CSNT | ORxG_ACS_DIV2 |\
  335. ORxG_SCY_3_CLK | ORxG_TRLX)
  336. /*
  337. * BFTICU board FPGA on CS4 initialization values
  338. */
  339. #define CONFIG_SYS_FPGA_BASE 0x40000000
  340. #define CONFIG_SYS_FPGA_SIZE 1 /*1KB*/
  341. #define CONFIG_SYS_BR4_PRELIM ((CONFIG_SYS_FPGA_BASE & BRx_BA_MSK) |\
  342. BRx_PS_8 | BRx_MS_GPCM_P | BRx_V)
  343. #define CONFIG_SYS_OR4_PRELIM (P2SZ_TO_AM(CONFIG_SYS_FPGA_SIZE << 10) |\
  344. ORxG_CSNT | ORxG_ACS_DIV2 |\
  345. ORxG_SCY_3_CLK | ORxG_TRLX)
  346. /*
  347. * CFG-Flash on CS5 initialization values
  348. */
  349. #define CONFIG_SYS_BR5_PRELIM ((CONFIG_SYS_FLASH_BASE_1 & BRx_BA_MSK) |\
  350. BRx_PS_16 | BRx_MS_GPCM_P | BRx_V)
  351. #define CONFIG_SYS_OR5_PRELIM (MEG_TO_AM(CONFIG_SYS_FLASH_SIZE_1 + \
  352. CONFIG_SYS_FLASH_SIZE_2) |\
  353. ORxG_CSNT | ORxG_ACS_DIV2 |\
  354. ORxG_SCY_5_CLK | ORxG_TRLX)
  355. #define CONFIG_SYS_RESET_ADDRESS 0xFDFFFFFC /* "bad" address */
  356. #define OF_TBCLK (bd->bi_busfreq / 4)
  357. #define OF_STDOUT_PATH "/soc/cpm/serial@11a90"
  358. #endif /* __CONFIG_H */