VoVPN-GW.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. /*
  2. * (C) Copyright 2004
  3. * Elmeg Communications Systems GmbH, Juergen Selent (j.selent@elmeg.de)
  4. *
  5. * Support for the Elmeg VoVPN Gateway Module
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #ifndef __CONFIG_H
  23. #define __CONFIG_H
  24. /* define cpu used */
  25. #define CONFIG_MPC8272 1
  26. /* define busmode: 8260 */
  27. #undef CONFIG_BUSMODE_60x
  28. /* system clock rate (CLKIN) - equal to the 60x and local bus speed */
  29. #ifdef CONFIG_CLKIN_66MHz
  30. #define CONFIG_8260_CLKIN 66666666 /* in Hz */
  31. #else
  32. #define CONFIG_8260_CLKIN 100000000 /* in Hz */
  33. #endif
  34. /* call board_early_init_f */
  35. #define CONFIG_BOARD_EARLY_INIT_F 1
  36. /* have misc_init_r() function */
  37. #define CONFIG_MISC_INIT_R 1
  38. /* have reset_phy_r() function */
  39. #define CONFIG_RESET_PHY_R 1
  40. /* have special reset function */
  41. #define CONFIG_HAVE_OWN_RESET 1
  42. /* allow serial and ethaddr to be overwritten */
  43. #define CONFIG_ENV_OVERWRITE
  44. /* watchdog disabled */
  45. #undef CONFIG_WATCHDOG
  46. /* include support for bzip2 compressed images */
  47. #undef CONFIG_BZIP2
  48. /* status led */
  49. #undef CONFIG_STATUS_LED /* XXX jse */
  50. /* vendor parameter protection */
  51. #define CONFIG_ENV_OVERWRITE
  52. /*
  53. * select serial console configuration
  54. *
  55. * if either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
  56. * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
  57. * for SCC).
  58. */
  59. #define CONFIG_CONS_ON_SMC
  60. #undef CONFIG_CONS_ON_SCC
  61. #undef CONFIG_CONS_NONE
  62. #define CONFIG_CONS_INDEX 1
  63. /* serial port default baudrate */
  64. #define CONFIG_BAUDRATE 115200
  65. /* echo on for serial download */
  66. #define CONFIG_LOADS_ECHO 1
  67. /* don't allow baudrate change */
  68. #undef CFG_LOADS_BAUD_CHANGE
  69. /* supported baudrates */
  70. #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
  71. /*
  72. * select ethernet configuration
  73. *
  74. * if either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected, then
  75. * CONFIG_ETHER_INDEX must be set to the channel number (1-4 for SCC, 1-3
  76. * for FCC)
  77. *
  78. * if CONFIG_ETHER_NONE is defined, then either the ethernet routines must be
  79. * defined elsewhere (as for the console), or CFG_CMD_NET must be removed
  80. * from CONFIG_COMMANDS to remove support for networking.
  81. */
  82. #undef CONFIG_ETHER_ON_SCC
  83. #define CONFIG_ETHER_ON_FCC
  84. #undef CONFIG_ETHER_NONE
  85. #ifdef CONFIG_ETHER_ON_FCC
  86. /* which SCC/FCC channel for ethernet */
  87. #define CONFIG_ETHER_INDEX 1
  88. /* Marvell Switch SMI base addr */
  89. #define CFG_PHY_ADDR 0x10
  90. /* FCC1 RMII REFCLK is CLK10 */
  91. #define CFG_CMXFCR_VALUE CMXFCR_TF1CS_CLK10
  92. #define CFG_CMXFCR_MASK (CMXFCR_FC1|CMXFCR_TF1CS_MSK)
  93. /* BDs and buffers on 60x bus */
  94. #define CFG_CPMFCR_RAMTYPE 0
  95. /* Local Protect, Full duplex, Flowcontrol, RMII */
  96. #define CFG_FCC_PSMR (FCC_PSMR_LPB|FCC_PSMR_FDE|\
  97. FCC_PSMR_FCE|FCC_PSMR_RMII)
  98. /* bit-bang MII PHY management */
  99. #define CONFIG_BITBANGMII
  100. #define MDIO_PORT 1 /* Port B */
  101. #define CFG_MDIO_PIN 0x00002000 /* PB18 */
  102. #define CFG_MDC_PIN 0x00001000 /* PB19 */
  103. #define MDIO_ACTIVE (iop->pdir |= CFG_MDIO_PIN)
  104. #define MDIO_TRISTATE (iop->pdir &= ~CFG_MDIO_PIN)
  105. #define MDIO_READ ((iop->pdat & CFG_MDIO_PIN) != 0)
  106. #define MDIO(bit) if(bit) iop->pdat |= CFG_MDIO_PIN; \
  107. else iop->pdat &= ~CFG_MDIO_PIN
  108. #define MDC(bit) if(bit) iop->pdat |= CFG_MDC_PIN; \
  109. else iop->pdat &= ~CFG_MDC_PIN
  110. #define MIIDELAY udelay(1)
  111. #endif
  112. /* configure commands */
  113. #define CONFIG_COMMANDS ( CFG_CMD_AUTOSCRIPT | \
  114. CFG_CMD_BDI | \
  115. CFG_CMD_CONSOLE | \
  116. CFG_CMD_ECHO | \
  117. CFG_CMD_ENV | \
  118. CFG_CMD_FLASH | \
  119. CFG_CMD_IMI | \
  120. CFG_CMD_IMLS | \
  121. CFG_CMD_LOADB | \
  122. CFG_CMD_MEMORY | \
  123. CFG_CMD_MISC | \
  124. CFG_CMD_NET | \
  125. CFG_CMD_PING | \
  126. CFG_CMD_RUN )
  127. /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
  128. #include <cmd_confdefs.h>
  129. /*
  130. * boot options & environment
  131. */
  132. #define CONFIG_BOOTDELAY 3
  133. #define CONFIG_BOOTCOMMAND "run flash_self"
  134. #undef CONFIG_BOOTARGS
  135. #define CONFIG_EXTRA_ENV_SETTINGS \
  136. "clean_nv=erase fff20000 ffffffff\0" \
  137. "update_boss=tftp 100000 PPC/logic157.bin; protect off fff00000 ffffffff; erase fff00000 ffffffff; cp.b 100000 fff00000 $(filesize); tftp 100000 PPC/bootmon157.bin; cp.b 100000 fff20000 $(filesize)\0" \
  138. "update_lx=tftp 100000 $(kernel); erase $(kernel_addr) ffefffff; cp.b 100000 $(kernel_addr) $(filesize)\0" \
  139. "update_fs=tftp 100000 $(fs).$(fstype); erase ff840000 ffdfffff; cp.b 100000 ff840000 $(filesize)\0" \
  140. "update_ub=tftp 100000 $(uboot); protect off fff00000 fff1ffff; erase fff00000 fff1ffff; cp.b 100000 fff00000 $(filesize); protect off ff820000 ff83ffff; erase ff820000 ff83ffff\0" \
  141. "flashargs=setenv bootargs root=$(rootdev) rw rootfstype=$(fstype)\0" \
  142. "nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath)\0" \
  143. "addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):$(netdev):off\0" \
  144. "addmisc=setenv bootargs $(bootargs) console=$(console),$(baudrate) ethaddr=$(ethaddr) panic=1\0" \
  145. "net_nfs=tftpboot 400000 $(kernel); run nfsargs addip addmisc; bootm\0" \
  146. "net_self=tftpboot 400000 $(kernel); run flashargs addmisc; bootm\0" \
  147. "flash_self=run flashargs addmisc; bootm $(kernel_addr)\0" \
  148. "flash_nfs=run nfsargs addip addmisc; bootm $(kernel_addr)\0" \
  149. "fstype=cramfs\0" \
  150. "rootpath=/root_fs\0" \
  151. "uboot=PPC/u-boot.bin\0" \
  152. "kernel=PPC/uImage\0" \
  153. "kernel_addr=ffe00000\0" \
  154. "fs=PPC/root_fs\0" \
  155. "console=ttyS0\0" \
  156. "netdev=eth0\0" \
  157. "rootdev=31:3\0" \
  158. "ethaddr=00:09:4f:01:02:03\0" \
  159. "ipaddr=10.0.0.201\0" \
  160. "netmask=255.255.255.0\0" \
  161. "serverip=10.0.0.136\0" \
  162. "gatewayip=10.0.0.10\0" \
  163. "hostname=bastard\0" \
  164. ""
  165. /*
  166. * miscellaneous configurable options
  167. */
  168. /* undef to save memory */
  169. #define CFG_LONGHELP
  170. /* monitor command prompt */
  171. #define CFG_PROMPT "=> "
  172. /* console i/o buffer size */
  173. #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
  174. #define CFG_CBSIZE 1024
  175. #else
  176. #define CFG_CBSIZE 256
  177. #endif
  178. /* print buffer size */
  179. #define CFG_PBSIZE (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
  180. /* max number of command args */
  181. #define CFG_MAXARGS 16
  182. /* boot argument buffer size */
  183. #define CFG_BARGSIZE CFG_CBSIZE
  184. /* memtest works on */
  185. #define CFG_MEMTEST_START 0x00100000
  186. /* 1 ... 15 MB in DRAM */
  187. #define CFG_MEMTEST_END 0x00f00000
  188. /* full featured memtest */
  189. #define CFG_ALT_MEMTEST
  190. /* default load address */
  191. #define CFG_LOAD_ADDR 0x00100000
  192. /* decrementer freq: 1 ms ticks */
  193. #define CFG_HZ 1000
  194. /* configure flash */
  195. #define CFG_FLASH_BASE 0xff800000
  196. #define CFG_MAX_FLASH_BANKS 1
  197. #define CFG_MAX_FLASH_SECT 64
  198. #define CFG_FLASH_SIZE 8
  199. #undef CFG_FLASH_16BIT
  200. #define CFG_FLASH_ERASE_TOUT 240000
  201. #define CFG_FLASH_WRITE_TOUT 500
  202. #define CFG_FLASH_LOCK_TOUT 500
  203. #define CFG_FLASH_UNLOCK_TOUT 10000
  204. #define CFG_FLASH_PROTECTION
  205. /* monitor in flash */
  206. #define CFG_MONITOR_OFFSET 0x00700000
  207. /* environment in flash */
  208. #define CFG_ENV_IS_IN_FLASH 1
  209. #define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x00020000)
  210. #define CFG_ENV_SIZE 0x00020000
  211. #define CFG_ENV_SECT_SIZE 0x00020000
  212. /*
  213. * Initial memory map for linux
  214. * For booting Linux, the board info and command line data
  215. * have to be in the first 8 MB of memory, since this is
  216. * the maximum mapped by the Linux kernel during initialization.
  217. */
  218. #define CFG_BOOTMAPSZ (8 << 20)
  219. /* hard reset configuration words */
  220. #ifdef CONFIG_CLKIN_66MHz
  221. #define CFG_HRCW_MASTER 0x04643050
  222. #else
  223. #error NO HRCW FOR 100MHZ SPECIFIED !!!
  224. #endif
  225. #define CFG_HRCW_SLAVE1 0x00000000
  226. #define CFG_HRCW_SLAVE2 0x00000000
  227. #define CFG_HRCW_SLAVE3 0x00000000
  228. #define CFG_HRCW_SLAVE4 0x00000000
  229. #define CFG_HRCW_SLAVE5 0x00000000
  230. #define CFG_HRCW_SLAVE6 0x00000000
  231. #define CFG_HRCW_SLAVE7 0x00000000
  232. /* internal memory mapped register */
  233. #define CFG_IMMR 0xF0000000
  234. /* definitions for initial stack pointer and data area (in DPRAM) */
  235. #define CFG_INIT_RAM_ADDR CFG_IMMR
  236. #define CFG_INIT_RAM_END 0x2000
  237. #define CFG_GBL_DATA_SIZE 128
  238. #define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
  239. #define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
  240. /*
  241. * Start addresses for the final memory configuration
  242. * (Set up by the startup code)
  243. * Please note that CFG_SDRAM_BASE _must_ start at 0
  244. */
  245. #define CFG_SDRAM_BASE 0x00000000
  246. #define CFG_SDRAM_SIZE (32*1024*1024)
  247. #define CFG_MONITOR_BASE TEXT_BASE
  248. #define CFG_MONITOR_FLASH (CFG_FLASH_BASE + CFG_MONITOR_OFFSET)
  249. #define CFG_MONITOR_LEN 0x00020000
  250. #define CFG_MALLOC_LEN 0x00020000
  251. /* boot flags */
  252. #define BOOTFLAG_COLD 0x01 /* normal power-on */
  253. #define BOOTFLAG_WARM 0x02 /* software reboot */
  254. /* cache configuration */
  255. #define CFG_CACHELINE_SIZE 32 /* for MPC8260 */
  256. #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
  257. #define CFG_CACHELINE_SHIFT 5 /* log base 2 of above */
  258. #endif
  259. /*
  260. * HIDx - Hardware Implementation-dependent Registers
  261. *-----------------------------------------------------------------------
  262. * HID0 also contains cache control - initially enable both caches and
  263. * invalidate contents, then the final state leaves only the instruction
  264. * cache enabled. Note that Power-On and Hard reset invalidate the caches,
  265. * but Soft reset does not.
  266. *
  267. * HID1 has only read-only information - nothing to set.
  268. */
  269. #define CFG_HID0_INIT (HID0_ICE|HID0_DCE|\
  270. HID0_ICFI|HID0_DCI|HID0_IFEM|HID0_ABE)
  271. #define CFG_HID0_FINAL (HID0_IFEM|HID0_ABE)
  272. #define CFG_HID2 0
  273. /* RMR - reset mode register - turn on checkstop reset enable */
  274. #define CFG_RMR RMR_CSRE
  275. /* BCR - bus configuration */
  276. #define CFG_BCR 0x00000000
  277. /* SIUMCR - siu module configuration */
  278. #define CFG_SIUMCR 0x4905c000
  279. /* SYPCR - system protection control */
  280. #if defined(CONFIG_WATCHDOG)
  281. #define CFG_SYPCR 0xffffff87
  282. #else
  283. #define CFG_SYPCR 0xffffff83
  284. #endif
  285. /* TMCNTSC - time counter status and control */
  286. /* clear interrupts XXX jse */
  287. //#define CFG_TMCNTSC (TMCNTSC_SEC|TMCNTSC_ALR)
  288. #define CFG_TMCNTSC (TMCNTSC_SEC|TMCNTSC_ALR|\
  289. TMCNTSC_TCF|TMCNTSC_TCE)
  290. /* PISCR - periodic interrupt status and control */
  291. /* clear interrupts XXX jse */
  292. //#define CFG_PISCR (PISCR_PS)
  293. #define CFG_PISCR (PISCR_PS|PISCR_PTF|PISCR_PTE)
  294. /* SCCR - system clock control */
  295. #define CFG_SCCR 0x000001a9
  296. /* RCCR - risc controller configuration */
  297. #define CFG_RCCR 0
  298. /*
  299. * MEMORY MAP
  300. * ----------
  301. * CS0 - FLASH 8MB/8Bit base=0xff800000 (boot: 0xfe000000, 8x mirrored)
  302. * CS1 - SDRAM 32MB/64Bit base=0x00000000
  303. * CS2 - DSP/SL1 1MB/16Bit base=0xf0100000
  304. * CS3 - DSP/SL2 1MB/16Bit base=0xf0200000
  305. * CS4 - DSP/SL3 1MB/16Bit base=0xf0300000
  306. * CS5 - DSP/SL4 1MB/16Bit base=0xf0400000
  307. * CS7 - DPRAM 1KB/8Bit base=0xf0500000, size=32KB (32x mirrored)
  308. * x - IMMR 384KB base=0xf0000000
  309. */
  310. /* XXX jse 100MHz TODO */
  311. #define CFG_BR0_PRELIM 0xff800801
  312. #define CFG_OR0_PRELIM 0xff801e44
  313. #define CFG_BR1_PRELIM 0x00000041
  314. #define CFG_OR1_PRELIM 0xfe002ec0
  315. #if 1
  316. #define CFG_BR2_PRELIM 0xf0101001
  317. #define CFG_OR2_PRELIM 0xfff00ef4
  318. #define CFG_BR3_PRELIM 0xf0201001
  319. #define CFG_OR3_PRELIM 0xfff00ef4
  320. #define CFG_BR4_PRELIM 0xf0301001
  321. #define CFG_OR4_PRELIM 0xfff00ef4
  322. #define CFG_BR5_PRELIM 0xf0401001
  323. #define CFG_OR5_PRELIM 0xfff00ef4
  324. #else
  325. #define CFG_BR2_PRELIM 0xf0101081
  326. #define CFG_OR2_PRELIM 0xfff00104
  327. #define CFG_BR3_PRELIM 0xf0201081
  328. #define CFG_OR3_PRELIM 0xfff00104
  329. #define CFG_BR4_PRELIM 0xf0301081
  330. #define CFG_OR4_PRELIM 0xfff00104
  331. #define CFG_BR5_PRELIM 0xf0401081
  332. #define CFG_OR5_PRELIM 0xfff00104
  333. #endif
  334. #define CFG_BR7_PRELIM 0xf0500881
  335. #define CFG_OR7_PRELIM 0xffff8104
  336. #define CFG_MPTPR 0x2700
  337. #define CFG_PSDMR 0x822a2452 /* optimal */
  338. //#define CFG_PSDMR 0x822a48a3 /* relaxed */
  339. #define CFG_PSRT 0x1a
  340. /* "bad" address */
  341. #define CFG_RESET_ADDRESS 0x40000000
  342. #endif /* __CONFIG_H */