cpci750.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104
  1. /*
  2. * (C) Copyright 2001
  3. * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
  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. * modifications for the DB64360 eval board based by Ingo.Assmus@keymile.com
  24. * modifications for the cpci750 by reinhard.arlt@esd-electronics.com
  25. */
  26. /*
  27. * cpci750.c - main board support/init for the esd cpci750.
  28. */
  29. #include <common.h>
  30. #include <command.h>
  31. #include <74xx_7xx.h>
  32. #include "../../Marvell/include/memory.h"
  33. #include "../../Marvell/include/pci.h"
  34. #include "../../Marvell/include/mv_gen_reg.h"
  35. #include <net.h>
  36. #include "eth.h"
  37. #include "mpsc.h"
  38. #include "i2c.h"
  39. #include "64360.h"
  40. #include "mv_regs.h"
  41. #undef DEBUG
  42. /*#define DEBUG */
  43. #ifdef CONFIG_PCI
  44. #define MAP_PCI
  45. #endif /* of CONFIG_PCI */
  46. #ifdef DEBUG
  47. #define DP(x) x
  48. #else
  49. #define DP(x)
  50. #endif
  51. static char show_config_tab[][15] = {{"PCI0DLL_2 "}, /* 31 */
  52. {"PCI0DLL_1 "}, /* 30 */
  53. {"PCI0DLL_0 "}, /* 29 */
  54. {"PCI1DLL_2 "}, /* 28 */
  55. {"PCI1DLL_1 "}, /* 27 */
  56. {"PCI1DLL_0 "}, /* 26 */
  57. {"BbEP2En "}, /* 25 */
  58. {"SDRAMRdDataDel"}, /* 24 */
  59. {"SDRAMRdDel "}, /* 23 */
  60. {"SDRAMSync "}, /* 22 */
  61. {"SDRAMPipeSel_1"}, /* 21 */
  62. {"SDRAMPipeSel_0"}, /* 20 */
  63. {"SDRAMAddDel "}, /* 19 */
  64. {"SDRAMClkSel "}, /* 18 */
  65. {"Reserved(1!) "}, /* 17 */
  66. {"PCIRty "}, /* 16 */
  67. {"BootCSWidth_1 "}, /* 15 */
  68. {"BootCSWidth_0 "}, /* 14 */
  69. {"PCI1PadsCal "}, /* 13 */
  70. {"PCI0PadsCal "}, /* 12 */
  71. {"MultiMVId_1 "}, /* 11 */
  72. {"MultiMVId_0 "}, /* 10 */
  73. {"MultiGTEn "}, /* 09 */
  74. {"Int60xArb "}, /* 08 */
  75. {"CPUBusConfig_1"}, /* 07 */
  76. {"CPUBusConfig_0"}, /* 06 */
  77. {"DefIntSpc "}, /* 05 */
  78. {0 }, /* 04 */
  79. {"SROMAdd_1 "}, /* 03 */
  80. {"SROMAdd_0 "}, /* 02 */
  81. {"DRAMPadCal "}, /* 01 */
  82. {"SInitEn "}, /* 00 */
  83. {0 }, /* 31 */
  84. {0 }, /* 30 */
  85. {0 }, /* 29 */
  86. {0 }, /* 28 */
  87. {0 }, /* 27 */
  88. {0 }, /* 26 */
  89. {0 }, /* 25 */
  90. {0 }, /* 24 */
  91. {0 }, /* 23 */
  92. {0 }, /* 22 */
  93. {"JTAGCalBy "}, /* 21 */
  94. {"GB2Sel "}, /* 20 */
  95. {"GB1Sel "}, /* 19 */
  96. {"DRAMPLL_MDiv_5"}, /* 18 */
  97. {"DRAMPLL_MDiv_4"}, /* 17 */
  98. {"DRAMPLL_MDiv_3"}, /* 16 */
  99. {"DRAMPLL_MDiv_2"}, /* 15 */
  100. {"DRAMPLL_MDiv_1"}, /* 14 */
  101. {"DRAMPLL_MDiv_0"}, /* 13 */
  102. {"GB0Sel "}, /* 12 */
  103. {"DRAMPLLPU "}, /* 11 */
  104. {"DRAMPLL_HIKVCO"}, /* 10 */
  105. {"DRAMPLLNP "}, /* 09 */
  106. {"DRAMPLL_NDiv_7"}, /* 08 */
  107. {"DRAMPLL_NDiv_6"}, /* 07 */
  108. {"CPUPadCal "}, /* 06 */
  109. {"DRAMPLL_NDiv_5"}, /* 05 */
  110. {"DRAMPLL_NDiv_4"}, /* 04 */
  111. {"DRAMPLL_NDiv_3"}, /* 03 */
  112. {"DRAMPLL_NDiv_2"}, /* 02 */
  113. {"DRAMPLL_NDiv_1"}, /* 01 */
  114. {"DRAMPLL_NDiv_0"}}; /* 00 */
  115. extern flash_info_t flash_info[];
  116. extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
  117. extern int do_bootvx (cmd_tbl_t *, int, int, char *[]);
  118. /* ------------------------------------------------------------------------- */
  119. /* this is the current GT register space location */
  120. /* it starts at CONFIG_SYS_DFL_GT_REGS but moves later to CONFIG_SYS_GT_REGS */
  121. /* Unfortunately, we cant change it while we are in flash, so we initialize it
  122. * to the "final" value. This means that any debug_led calls before
  123. * board_early_init_f wont work right (like in cpu_init_f).
  124. * See also my_remap_gt_regs below. (NTL)
  125. */
  126. void board_prebootm_init (void);
  127. unsigned int INTERNAL_REG_BASE_ADDR = CONFIG_SYS_GT_REGS;
  128. int display_mem_map (void);
  129. /*
  130. * Skip video initialization on slave variant.
  131. * This function will overwrite the weak default in cfb_console.c
  132. */
  133. int board_video_skip(void)
  134. {
  135. return CPCI750_SLAVE_TEST;
  136. }
  137. /* ------------------------------------------------------------------------- */
  138. /*
  139. * This is a version of the GT register space remapping function that
  140. * doesn't touch globals (meaning, it's ok to run from flash.)
  141. *
  142. * Unfortunately, this has the side effect that a writable
  143. * INTERNAL_REG_BASE_ADDR is impossible. Oh well.
  144. */
  145. void my_remap_gt_regs (u32 cur_loc, u32 new_loc)
  146. {
  147. u32 temp;
  148. /* check and see if it's already moved */
  149. /* original ppcboot 1.1.6 source
  150. temp = in_le32((u32 *)(new_loc + INTERNAL_SPACE_DECODE));
  151. if ((temp & 0xffff) == new_loc >> 20)
  152. return;
  153. temp = (in_le32((u32 *)(cur_loc + INTERNAL_SPACE_DECODE)) &
  154. 0xffff0000) | (new_loc >> 20);
  155. out_le32((u32 *)(cur_loc + INTERNAL_SPACE_DECODE), temp);
  156. while (GTREGREAD(INTERNAL_SPACE_DECODE) != temp);
  157. original ppcboot 1.1.6 source end */
  158. temp = in_le32 ((u32 *) (new_loc + INTERNAL_SPACE_DECODE));
  159. if ((temp & 0xffff) == new_loc >> 16)
  160. return;
  161. temp = (in_le32 ((u32 *) (cur_loc + INTERNAL_SPACE_DECODE)) &
  162. 0xffff0000) | (new_loc >> 16);
  163. out_le32 ((u32 *) (cur_loc + INTERNAL_SPACE_DECODE), temp);
  164. while (GTREGREAD (INTERNAL_SPACE_DECODE) != temp);
  165. }
  166. #ifdef CONFIG_PCI
  167. static void gt_pci_config (void)
  168. {
  169. unsigned int stat;
  170. unsigned int data;
  171. unsigned int val = 0x00fff864; /* DINK32: BusNum 23:16, DevNum 15:11, FuncNum 10:8, RegNum 7:2 */
  172. /* In PCIX mode devices provide their own bus and device numbers. We query the Discovery II's
  173. * config registers by writing ones to the bus and device.
  174. * We then update the Virtual register with the correct value for the bus and device.
  175. */
  176. if ((GTREGREAD (PCI_0_MODE) & (BIT4 | BIT5)) != 0) { /*if PCI-X */
  177. GT_REG_WRITE (PCI_0_CONFIG_ADDR, BIT31 | val);
  178. GT_REG_READ (PCI_0_CONFIG_DATA_VIRTUAL_REG, &stat);
  179. GT_REG_WRITE (PCI_0_CONFIG_ADDR, BIT31 | val);
  180. GT_REG_WRITE (PCI_0_CONFIG_DATA_VIRTUAL_REG,
  181. (stat & 0xffff0000) | CONFIG_SYS_PCI_IDSEL);
  182. }
  183. if ((GTREGREAD (PCI_1_MODE) & (BIT4 | BIT5)) != 0) { /*if PCI-X */
  184. GT_REG_WRITE (PCI_1_CONFIG_ADDR, BIT31 | val);
  185. GT_REG_READ (PCI_1_CONFIG_DATA_VIRTUAL_REG, &stat);
  186. GT_REG_WRITE (PCI_1_CONFIG_ADDR, BIT31 | val);
  187. GT_REG_WRITE (PCI_1_CONFIG_DATA_VIRTUAL_REG,
  188. (stat & 0xffff0000) | CONFIG_SYS_PCI_IDSEL);
  189. }
  190. /* Enable master */
  191. PCI_MASTER_ENABLE (0, SELF);
  192. PCI_MASTER_ENABLE (1, SELF);
  193. /* Enable PCI0/1 Mem0 and IO 0 disable all others */
  194. GT_REG_READ (BASE_ADDR_ENABLE, &stat);
  195. stat |= (1 << 11) | (1 << 12) | (1 << 13) | (1 << 16) | (1 << 17) | (1
  196. <<
  197. 18);
  198. stat &= ~((1 << 9) | (1 << 10) | (1 << 14) | (1 << 15));
  199. GT_REG_WRITE (BASE_ADDR_ENABLE, stat);
  200. /* ronen- add write to pci remap registers for 64460.
  201. in 64360 when writing to pci base go and overide remap automaticaly,
  202. in 64460 it doesn't */
  203. GT_REG_WRITE (PCI_0_IO_BASE_ADDR, CONFIG_SYS_PCI0_IO_SPACE >> 16);
  204. GT_REG_WRITE (PCI_0I_O_ADDRESS_REMAP, CONFIG_SYS_PCI0_IO_SPACE_PCI >> 16);
  205. GT_REG_WRITE (PCI_0_IO_SIZE, (CONFIG_SYS_PCI0_IO_SIZE - 1) >> 16);
  206. GT_REG_WRITE (PCI_0_MEMORY0_BASE_ADDR, CONFIG_SYS_PCI0_MEM_BASE >> 16);
  207. GT_REG_WRITE (PCI_0MEMORY0_ADDRESS_REMAP, CONFIG_SYS_PCI0_MEM_BASE >> 16);
  208. GT_REG_WRITE (PCI_0_MEMORY0_SIZE, (CONFIG_SYS_PCI0_MEM_SIZE - 1) >> 16);
  209. GT_REG_WRITE (PCI_1_IO_BASE_ADDR, CONFIG_SYS_PCI1_IO_SPACE >> 16);
  210. GT_REG_WRITE (PCI_1I_O_ADDRESS_REMAP, CONFIG_SYS_PCI1_IO_SPACE_PCI >> 16);
  211. GT_REG_WRITE (PCI_1_IO_SIZE, (CONFIG_SYS_PCI1_IO_SIZE - 1) >> 16);
  212. GT_REG_WRITE (PCI_1_MEMORY0_BASE_ADDR, CONFIG_SYS_PCI1_MEM_BASE >> 16);
  213. GT_REG_WRITE (PCI_1MEMORY0_ADDRESS_REMAP, CONFIG_SYS_PCI1_MEM_BASE >> 16);
  214. GT_REG_WRITE (PCI_1_MEMORY0_SIZE, (CONFIG_SYS_PCI1_MEM_SIZE - 1) >> 16);
  215. /* PCI interface settings */
  216. /* Timeout set to retry forever */
  217. GT_REG_WRITE (PCI_0TIMEOUT_RETRY, 0x0);
  218. GT_REG_WRITE (PCI_1TIMEOUT_RETRY, 0x0);
  219. /* ronen - enable only CS0 and Internal reg!! */
  220. GT_REG_WRITE (PCI_0BASE_ADDRESS_REGISTERS_ENABLE, 0xfffffdfe);
  221. GT_REG_WRITE (PCI_1BASE_ADDRESS_REGISTERS_ENABLE, 0xfffffdfe);
  222. /*ronen update the pci internal registers base address.*/
  223. #ifdef MAP_PCI
  224. for (stat = 0; stat <= PCI_HOST1; stat++) {
  225. data = pciReadConfigReg(stat,
  226. PCI_INTERNAL_REGISTERS_MEMORY_MAPPED_BASE_ADDRESS,
  227. SELF);
  228. data = (data & 0x0f) | CONFIG_SYS_GT_REGS;
  229. pciWriteConfigReg (stat,
  230. PCI_INTERNAL_REGISTERS_MEMORY_MAPPED_BASE_ADDRESS,
  231. SELF, data);
  232. }
  233. #endif
  234. }
  235. #endif
  236. /* Setup CPU interface paramaters */
  237. static void gt_cpu_config (void)
  238. {
  239. cpu_t cpu = get_cpu_type ();
  240. ulong tmp;
  241. /* cpu configuration register */
  242. tmp = GTREGREAD (CPU_CONFIGURATION);
  243. /* set the SINGLE_CPU bit see MV64360 P.399 */
  244. #ifndef CONFIG_SYS_GT_DUAL_CPU /* SINGLE_CPU seems to cause JTAG problems */
  245. tmp |= CPU_CONF_SINGLE_CPU;
  246. #endif
  247. tmp &= ~CPU_CONF_AACK_DELAY_2;
  248. tmp |= CPU_CONF_DP_VALID;
  249. tmp |= CPU_CONF_AP_VALID;
  250. tmp |= CPU_CONF_PIPELINE;
  251. GT_REG_WRITE (CPU_CONFIGURATION, tmp); /* Marvell (VXWorks) writes 0x20220FF */
  252. /* CPU master control register */
  253. tmp = GTREGREAD (CPU_MASTER_CONTROL);
  254. tmp |= CPU_MAST_CTL_ARB_EN;
  255. if ((cpu == CPU_7400) ||
  256. (cpu == CPU_7410) || (cpu == CPU_7455) || (cpu == CPU_7450)) {
  257. tmp |= CPU_MAST_CTL_CLEAN_BLK;
  258. tmp |= CPU_MAST_CTL_FLUSH_BLK;
  259. } else {
  260. /* cleanblock must be cleared for CPUs
  261. * that do not support this command (603e, 750)
  262. * see Res#1 */
  263. tmp &= ~CPU_MAST_CTL_CLEAN_BLK;
  264. tmp &= ~CPU_MAST_CTL_FLUSH_BLK;
  265. }
  266. GT_REG_WRITE (CPU_MASTER_CONTROL, tmp);
  267. }
  268. /*
  269. * board_early_init_f.
  270. *
  271. * set up gal. device mappings, etc.
  272. */
  273. int board_early_init_f (void)
  274. {
  275. /*
  276. * set up the GT the way the kernel wants it
  277. * the call to move the GT register space will obviously
  278. * fail if it has already been done, but we're going to assume
  279. * that if it's not at the power-on location, it's where we put
  280. * it last time. (huber)
  281. */
  282. my_remap_gt_regs (CONFIG_SYS_DFL_GT_REGS, CONFIG_SYS_GT_REGS);
  283. /* No PCI in first release of Port To_do: enable it. */
  284. #ifdef CONFIG_PCI
  285. gt_pci_config ();
  286. #endif
  287. /* mask all external interrupt sources */
  288. GT_REG_WRITE (CPU_INTERRUPT_MASK_REGISTER_LOW, 0);
  289. GT_REG_WRITE (CPU_INTERRUPT_MASK_REGISTER_HIGH, 0);
  290. /* new in MV6436x */
  291. GT_REG_WRITE (CPU_INTERRUPT_1_MASK_REGISTER_LOW, 0);
  292. GT_REG_WRITE (CPU_INTERRUPT_1_MASK_REGISTER_HIGH, 0);
  293. /* --------------------- */
  294. GT_REG_WRITE (PCI_0INTERRUPT_CAUSE_MASK_REGISTER_LOW, 0);
  295. GT_REG_WRITE (PCI_0INTERRUPT_CAUSE_MASK_REGISTER_HIGH, 0);
  296. GT_REG_WRITE (PCI_1INTERRUPT_CAUSE_MASK_REGISTER_LOW, 0);
  297. GT_REG_WRITE (PCI_1INTERRUPT_CAUSE_MASK_REGISTER_HIGH, 0);
  298. /* does not exist in MV6436x
  299. GT_REG_WRITE(CPU_INT_0_MASK, 0);
  300. GT_REG_WRITE(CPU_INT_1_MASK, 0);
  301. GT_REG_WRITE(CPU_INT_2_MASK, 0);
  302. GT_REG_WRITE(CPU_INT_3_MASK, 0);
  303. --------------------- */
  304. /* ----- DEVICE BUS SETTINGS ------ */
  305. /*
  306. * EVB
  307. * 0 - SRAM ????
  308. * 1 - RTC ????
  309. * 2 - UART ????
  310. * 3 - Flash checked 32Bit Intel Strata
  311. * boot - BootCS checked 8Bit 29LV040B
  312. *
  313. */
  314. /*
  315. * the dual 7450 module requires burst access to the boot
  316. * device, so the serial rom copies the boot device to the
  317. * on-board sram on the eval board, and updates the correct
  318. * registers to boot from the sram. (device0)
  319. */
  320. memoryMapDeviceSpace (DEVICE0, CONFIG_SYS_DEV0_SPACE, CONFIG_SYS_DEV0_SIZE);
  321. memoryMapDeviceSpace (DEVICE1, CONFIG_SYS_DEV1_SPACE, CONFIG_SYS_DEV1_SIZE);
  322. memoryMapDeviceSpace (DEVICE2, CONFIG_SYS_DEV2_SPACE, CONFIG_SYS_DEV2_SIZE);
  323. memoryMapDeviceSpace (DEVICE3, CONFIG_SYS_DEV3_SPACE, CONFIG_SYS_DEV3_SIZE);
  324. /* configure device timing */
  325. GT_REG_WRITE (DEVICE_BANK0PARAMETERS, CONFIG_SYS_DEV0_PAR);
  326. GT_REG_WRITE (DEVICE_BANK1PARAMETERS, CONFIG_SYS_DEV1_PAR);
  327. GT_REG_WRITE (DEVICE_BANK2PARAMETERS, CONFIG_SYS_DEV2_PAR);
  328. GT_REG_WRITE (DEVICE_BANK3PARAMETERS, CONFIG_SYS_DEV3_PAR);
  329. #ifdef CONFIG_SYS_32BIT_BOOT_PAR /* set port parameters for Flash device module access */
  330. /* detect if we are booting from the 32 bit flash */
  331. if (GTREGREAD (DEVICE_BOOT_BANK_PARAMETERS) & (0x3 << 20)) {
  332. /* 32 bit boot flash */
  333. GT_REG_WRITE (DEVICE_BANK3PARAMETERS, CONFIG_SYS_8BIT_BOOT_PAR);
  334. GT_REG_WRITE (DEVICE_BOOT_BANK_PARAMETERS,
  335. CONFIG_SYS_32BIT_BOOT_PAR);
  336. } else {
  337. /* 8 bit boot flash */
  338. GT_REG_WRITE (DEVICE_BANK3PARAMETERS, CONFIG_SYS_32BIT_BOOT_PAR);
  339. GT_REG_WRITE (DEVICE_BOOT_BANK_PARAMETERS, CONFIG_SYS_8BIT_BOOT_PAR);
  340. }
  341. #else
  342. /* 8 bit boot flash only */
  343. /* GT_REG_WRITE(DEVICE_BOOT_BANK_PARAMETERS, CONFIG_SYS_8BIT_BOOT_PAR);*/
  344. #endif
  345. gt_cpu_config ();
  346. /* MPP setup */
  347. GT_REG_WRITE (MPP_CONTROL0, CONFIG_SYS_MPP_CONTROL_0);
  348. GT_REG_WRITE (MPP_CONTROL1, CONFIG_SYS_MPP_CONTROL_1);
  349. GT_REG_WRITE (MPP_CONTROL2, CONFIG_SYS_MPP_CONTROL_2);
  350. GT_REG_WRITE (MPP_CONTROL3, CONFIG_SYS_MPP_CONTROL_3);
  351. GT_REG_WRITE (GPP_LEVEL_CONTROL, CONFIG_SYS_GPP_LEVEL_CONTROL);
  352. DEBUG_LED0_ON ();
  353. DEBUG_LED1_ON ();
  354. DEBUG_LED2_ON ();
  355. return 0;
  356. }
  357. /* various things to do after relocation */
  358. int misc_init_r ()
  359. {
  360. icache_enable ();
  361. #ifdef CONFIG_SYS_L2
  362. l2cache_enable ();
  363. #endif
  364. #ifdef CONFIG_MPSC
  365. mpsc_sdma_init ();
  366. mpsc_init2 ();
  367. #endif
  368. #if 0
  369. /* disable the dcache and MMU */
  370. dcache_lock ();
  371. #endif
  372. if (flash_info[3].size < CONFIG_SYS_FLASH_INCREMENT) {
  373. unsigned int flash_offset;
  374. unsigned int l;
  375. flash_offset = CONFIG_SYS_FLASH_INCREMENT - flash_info[3].size;
  376. for (l = 0; l < CONFIG_SYS_MAX_FLASH_SECT; l++) {
  377. if (flash_info[3].start[l] != 0) {
  378. flash_info[3].start[l] += flash_offset;
  379. }
  380. }
  381. flash_protect (FLAG_PROTECT_SET,
  382. CONFIG_SYS_MONITOR_BASE,
  383. CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1,
  384. &flash_info[3]);
  385. }
  386. return 0;
  387. }
  388. void after_reloc (ulong dest_addr, gd_t * gd)
  389. {
  390. memoryMapDeviceSpace (BOOT_DEVICE, CONFIG_SYS_BOOT_SPACE,
  391. CONFIG_SYS_BOOT_SIZE);
  392. display_mem_map ();
  393. GT_REG_WRITE (PCI_0BASE_ADDRESS_REGISTERS_ENABLE, 0xfffffdfe);
  394. GT_REG_WRITE (PCI_1BASE_ADDRESS_REGISTERS_ENABLE, 0xfffffdfe);
  395. /* now, jump to the main ppcboot board init code */
  396. board_init_r (gd, dest_addr);
  397. /* NOTREACHED */
  398. }
  399. /* ------------------------------------------------------------------------- */
  400. /*
  401. * Check Board Identity:
  402. *
  403. * right now, assume borad type. (there is just one...after all)
  404. */
  405. int checkboard (void)
  406. {
  407. int l_type = 0;
  408. printf ("BOARD: %s\n", CONFIG_SYS_BOARD_NAME);
  409. return (l_type);
  410. }
  411. /* utility functions */
  412. void debug_led (int led, int mode)
  413. {
  414. }
  415. int display_mem_map (void)
  416. {
  417. int i, j;
  418. unsigned int base, size, width;
  419. /* SDRAM */
  420. printf ("SD (DDR) RAM\n");
  421. for (i = 0; i <= BANK3; i++) {
  422. base = memoryGetBankBaseAddress (i);
  423. size = memoryGetBankSize (i);
  424. if (size != 0) {
  425. printf ("BANK%d: base - 0x%08x\tsize - %dM bytes\n",
  426. i, base, size >> 20);
  427. }
  428. }
  429. #ifdef CONFIG_PCI
  430. /* CPU's PCI windows */
  431. for (i = 0; i <= PCI_HOST1; i++) {
  432. printf ("\nCPU's PCI %d windows\n", i);
  433. base = pciGetSpaceBase (i, PCI_IO);
  434. size = pciGetSpaceSize (i, PCI_IO);
  435. printf (" IO: base - 0x%08x\tsize - %dM bytes\n", base,
  436. size >> 20);
  437. for (j = 0;
  438. j <=
  439. PCI_REGION0
  440. /*ronen currently only first PCI MEM is used 3 */ ;
  441. j++) {
  442. base = pciGetSpaceBase (i, j);
  443. size = pciGetSpaceSize (i, j);
  444. printf ("MEMORY %d: base - 0x%08x\tsize - %dM bytes\n", j, base, size >> 20);
  445. }
  446. }
  447. #endif /* of CONFIG_PCI */
  448. /* Devices */
  449. printf ("\nDEVICES\n");
  450. for (i = 0; i <= DEVICE3; i++) {
  451. base = memoryGetDeviceBaseAddress (i);
  452. size = memoryGetDeviceSize (i);
  453. width = memoryGetDeviceWidth (i) * 8;
  454. printf ("DEV %d: base - 0x%08x size - %dM bytes\twidth - %d bits", i, base, size >> 20, width);
  455. if (i == 0)
  456. printf ("\t- FLASH\n");
  457. else if (i == 1)
  458. printf ("\t- FLASH\n");
  459. else if (i == 2)
  460. printf ("\t- FLASH\n");
  461. else
  462. printf ("\t- RTC/REGS/CAN\n");
  463. }
  464. /* Bootrom */
  465. base = memoryGetDeviceBaseAddress (BOOT_DEVICE); /* Boot */
  466. size = memoryGetDeviceSize (BOOT_DEVICE);
  467. width = memoryGetDeviceWidth (BOOT_DEVICE) * 8;
  468. printf (" BOOT: base - 0x%08x size - %dM bytes\twidth - %d bits\t- FLASH\n",
  469. base, size >> 20, width);
  470. return (0);
  471. }
  472. /*
  473. * Command loadpci: wait for signal from host and boot image.
  474. */
  475. int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  476. {
  477. volatile unsigned int *ptr;
  478. int count = 0;
  479. int count2 = 0;
  480. int status;
  481. char addr[16];
  482. char str[] = "\\|/-";
  483. char *local_args[2];
  484. /*
  485. * Mark sync address
  486. */
  487. ptr = 0;
  488. ptr[0] = 0xffffffff;
  489. ptr[1] = 0xffffffff;
  490. puts("\nWaiting for image from pci host -");
  491. /*
  492. * Wait for host to write the start address
  493. */
  494. while (*ptr == 0xffffffff) {
  495. count++;
  496. if (!(count % 100)) {
  497. count2++;
  498. putc(0x08); /* backspace */
  499. putc(str[count2 % 4]);
  500. }
  501. /* Abort if ctrl-c was pressed */
  502. if (ctrlc()) {
  503. puts("\nAbort\n");
  504. return 0;
  505. }
  506. udelay(1000);
  507. }
  508. sprintf(addr, "%08x", *ptr);
  509. printf("\nBooting Image at addr 0x%s ...\n", addr);
  510. setenv("loadaddr", addr);
  511. switch (ptr[1] == 0) {
  512. case 0:
  513. /*
  514. * Boot image via bootm
  515. */
  516. local_args[0] = argv[0];
  517. local_args[1] = NULL;
  518. status = do_bootm (cmdtp, 0, 1, local_args);
  519. break;
  520. case 1:
  521. /*
  522. * Boot image via bootvx
  523. */
  524. local_args[0] = argv[0];
  525. local_args[1] = NULL;
  526. status = do_bootvx (cmdtp, 0, 1, local_args);
  527. break;
  528. }
  529. return 0;
  530. }
  531. U_BOOT_CMD(
  532. loadpci, 1, 1, do_loadpci,
  533. "loadpci - Wait for pci-image and boot it\n",
  534. NULL
  535. );
  536. /* DRAM check routines copied from gw8260 */
  537. #if defined (CONFIG_SYS_DRAM_TEST)
  538. /*********************************************************************/
  539. /* NAME: move64() - moves a double word (64-bit) */
  540. /* */
  541. /* DESCRIPTION: */
  542. /* this function performs a double word move from the data at */
  543. /* the source pointer to the location at the destination pointer. */
  544. /* */
  545. /* INPUTS: */
  546. /* unsigned long long *src - pointer to data to move */
  547. /* */
  548. /* OUTPUTS: */
  549. /* unsigned long long *dest - pointer to locate to move data */
  550. /* */
  551. /* RETURNS: */
  552. /* None */
  553. /* */
  554. /* RESTRICTIONS/LIMITATIONS: */
  555. /* May cloober fr0. */
  556. /* */
  557. /*********************************************************************/
  558. static void move64 (unsigned long long *src, unsigned long long *dest)
  559. {
  560. asm ("lfd 0, 0(3)\n\t" /* fpr0 = *scr */
  561. "stfd 0, 0(4)" /* *dest = fpr0 */
  562. : : : "fr0"); /* Clobbers fr0 */
  563. return;
  564. }
  565. #if defined (CONFIG_SYS_DRAM_TEST_DATA)
  566. unsigned long long pattern[] = {
  567. 0xaaaaaaaaaaaaaaaaLL,
  568. 0xccccccccccccccccLL,
  569. 0xf0f0f0f0f0f0f0f0LL,
  570. 0xff00ff00ff00ff00LL,
  571. 0xffff0000ffff0000LL,
  572. 0xffffffff00000000LL,
  573. 0x00000000ffffffffLL,
  574. 0x0000ffff0000ffffLL,
  575. 0x00ff00ff00ff00ffLL,
  576. 0x0f0f0f0f0f0f0f0fLL,
  577. 0x3333333333333333LL,
  578. 0x5555555555555555LL,
  579. };
  580. /*********************************************************************/
  581. /* NAME: mem_test_data() - test data lines for shorts and opens */
  582. /* */
  583. /* DESCRIPTION: */
  584. /* Tests data lines for shorts and opens by forcing adjacent data */
  585. /* to opposite states. Because the data lines could be routed in */
  586. /* an arbitrary manner the must ensure test patterns ensure that */
  587. /* every case is tested. By using the following series of binary */
  588. /* patterns every combination of adjacent bits is test regardless */
  589. /* of routing. */
  590. /* */
  591. /* ...101010101010101010101010 */
  592. /* ...110011001100110011001100 */
  593. /* ...111100001111000011110000 */
  594. /* ...111111110000000011111111 */
  595. /* */
  596. /* Carrying this out, gives us six hex patterns as follows: */
  597. /* */
  598. /* 0xaaaaaaaaaaaaaaaa */
  599. /* 0xcccccccccccccccc */
  600. /* 0xf0f0f0f0f0f0f0f0 */
  601. /* 0xff00ff00ff00ff00 */
  602. /* 0xffff0000ffff0000 */
  603. /* 0xffffffff00000000 */
  604. /* */
  605. /* The number test patterns will always be given by: */
  606. /* */
  607. /* log(base 2)(number data bits) = log2 (64) = 6 */
  608. /* */
  609. /* To test for short and opens to other signals on our boards. we */
  610. /* simply */
  611. /* test with the 1's complemnt of the paterns as well. */
  612. /* */
  613. /* OUTPUTS: */
  614. /* Displays failing test pattern */
  615. /* */
  616. /* RETURNS: */
  617. /* 0 - Passed test */
  618. /* 1 - Failed test */
  619. /* */
  620. /* RESTRICTIONS/LIMITATIONS: */
  621. /* Assumes only one one SDRAM bank */
  622. /* */
  623. /*********************************************************************/
  624. int mem_test_data (void)
  625. {
  626. unsigned long long *pmem = (unsigned long long *) CONFIG_SYS_MEMTEST_START;
  627. unsigned long long temp64 = 0;
  628. int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
  629. int i;
  630. unsigned int hi, lo;
  631. for (i = 0; i < num_patterns; i++) {
  632. move64 (&(pattern[i]), pmem);
  633. move64 (pmem, &temp64);
  634. /* hi = (temp64>>32) & 0xffffffff; */
  635. /* lo = temp64 & 0xffffffff; */
  636. /* printf("\ntemp64 = 0x%08x%08x", hi, lo); */
  637. hi = (pattern[i] >> 32) & 0xffffffff;
  638. lo = pattern[i] & 0xffffffff;
  639. /* printf("\npattern[%d] = 0x%08x%08x", i, hi, lo); */
  640. if (temp64 != pattern[i]) {
  641. printf ("\n Data Test Failed, pattern 0x%08x%08x",
  642. hi, lo);
  643. return 1;
  644. }
  645. }
  646. return 0;
  647. }
  648. #endif /* CONFIG_SYS_DRAM_TEST_DATA */
  649. #if defined (CONFIG_SYS_DRAM_TEST_ADDRESS)
  650. /*********************************************************************/
  651. /* NAME: mem_test_address() - test address lines */
  652. /* */
  653. /* DESCRIPTION: */
  654. /* This function performs a test to verify that each word im */
  655. /* memory is uniquly addressable. The test sequence is as follows: */
  656. /* */
  657. /* 1) write the address of each word to each word. */
  658. /* 2) verify that each location equals its address */
  659. /* */
  660. /* OUTPUTS: */
  661. /* Displays failing test pattern and address */
  662. /* */
  663. /* RETURNS: */
  664. /* 0 - Passed test */
  665. /* 1 - Failed test */
  666. /* */
  667. /* RESTRICTIONS/LIMITATIONS: */
  668. /* */
  669. /* */
  670. /*********************************************************************/
  671. int mem_test_address (void)
  672. {
  673. volatile unsigned int *pmem =
  674. (volatile unsigned int *) CONFIG_SYS_MEMTEST_START;
  675. const unsigned int size = (CONFIG_SYS_MEMTEST_END - CONFIG_SYS_MEMTEST_START) / 4;
  676. unsigned int i;
  677. /* write address to each location */
  678. for (i = 0; i < size; i++) {
  679. pmem[i] = i;
  680. }
  681. /* verify each loaction */
  682. for (i = 0; i < size; i++) {
  683. if (pmem[i] != i) {
  684. printf ("\n Address Test Failed at 0x%x", i);
  685. return 1;
  686. }
  687. }
  688. return 0;
  689. }
  690. #endif /* CONFIG_SYS_DRAM_TEST_ADDRESS */
  691. #if defined (CONFIG_SYS_DRAM_TEST_WALK)
  692. /*********************************************************************/
  693. /* NAME: mem_march() - memory march */
  694. /* */
  695. /* DESCRIPTION: */
  696. /* Marches up through memory. At each location verifies rmask if */
  697. /* read = 1. At each location write wmask if write = 1. Displays */
  698. /* failing address and pattern. */
  699. /* */
  700. /* INPUTS: */
  701. /* volatile unsigned long long * base - start address of test */
  702. /* unsigned int size - number of dwords(64-bit) to test */
  703. /* unsigned long long rmask - read verify mask */
  704. /* unsigned long long wmask - wrtie verify mask */
  705. /* short read - verifies rmask if read = 1 */
  706. /* short write - writes wmask if write = 1 */
  707. /* */
  708. /* OUTPUTS: */
  709. /* Displays failing test pattern and address */
  710. /* */
  711. /* RETURNS: */
  712. /* 0 - Passed test */
  713. /* 1 - Failed test */
  714. /* */
  715. /* RESTRICTIONS/LIMITATIONS: */
  716. /* */
  717. /* */
  718. /*********************************************************************/
  719. int mem_march (volatile unsigned long long *base,
  720. unsigned int size,
  721. unsigned long long rmask,
  722. unsigned long long wmask, short read, short write)
  723. {
  724. unsigned int i;
  725. unsigned long long temp = 0;
  726. unsigned int hitemp, lotemp, himask, lomask;
  727. for (i = 0; i < size; i++) {
  728. if (read != 0) {
  729. /* temp = base[i]; */
  730. move64 ((unsigned long long *) &(base[i]), &temp);
  731. if (rmask != temp) {
  732. hitemp = (temp >> 32) & 0xffffffff;
  733. lotemp = temp & 0xffffffff;
  734. himask = (rmask >> 32) & 0xffffffff;
  735. lomask = rmask & 0xffffffff;
  736. printf ("\n Walking one's test failed: address = 0x%08x," "\n\texpected 0x%08x%08x, found 0x%08x%08x", i << 3, himask, lomask, hitemp, lotemp);
  737. return 1;
  738. }
  739. }
  740. if (write != 0) {
  741. /* base[i] = wmask; */
  742. move64 (&wmask, (unsigned long long *) &(base[i]));
  743. }
  744. }
  745. return 0;
  746. }
  747. #endif /* CONFIG_SYS_DRAM_TEST_WALK */
  748. /*********************************************************************/
  749. /* NAME: mem_test_walk() - a simple walking ones test */
  750. /* */
  751. /* DESCRIPTION: */
  752. /* Performs a walking ones through entire physical memory. The */
  753. /* test uses as series of memory marches, mem_march(), to verify */
  754. /* and write the test patterns to memory. The test sequence is as */
  755. /* follows: */
  756. /* 1) march writing 0000...0001 */
  757. /* 2) march verifying 0000...0001 , writing 0000...0010 */
  758. /* 3) repeat step 2 shifting masks left 1 bit each time unitl */
  759. /* the write mask equals 1000...0000 */
  760. /* 4) march verifying 1000...0000 */
  761. /* The test fails if any of the memory marches return a failure. */
  762. /* */
  763. /* OUTPUTS: */
  764. /* Displays which pass on the memory test is executing */
  765. /* */
  766. /* RETURNS: */
  767. /* 0 - Passed test */
  768. /* 1 - Failed test */
  769. /* */
  770. /* RESTRICTIONS/LIMITATIONS: */
  771. /* */
  772. /* */
  773. /*********************************************************************/
  774. int mem_test_walk (void)
  775. {
  776. unsigned long long mask;
  777. volatile unsigned long long *pmem =
  778. (volatile unsigned long long *) CONFIG_SYS_MEMTEST_START;
  779. const unsigned long size = (CONFIG_SYS_MEMTEST_END - CONFIG_SYS_MEMTEST_START) / 8;
  780. unsigned int i;
  781. mask = 0x01;
  782. printf ("Initial Pass");
  783. mem_march (pmem, size, 0x0, 0x1, 0, 1);
  784. printf ("\b\b\b\b\b\b\b\b\b\b\b\b");
  785. printf (" ");
  786. printf (" ");
  787. printf ("\b\b\b\b\b\b\b\b\b\b\b\b");
  788. for (i = 0; i < 63; i++) {
  789. printf ("Pass %2d", i + 2);
  790. if (mem_march (pmem, size, mask, mask << 1, 1, 1) != 0) {
  791. /*printf("mask: 0x%x, pass: %d, ", mask, i); */
  792. return 1;
  793. }
  794. mask = mask << 1;
  795. printf ("\b\b\b\b\b\b\b");
  796. }
  797. printf ("Last Pass");
  798. if (mem_march (pmem, size, 0, mask, 0, 1) != 0) {
  799. /* printf("mask: 0x%x", mask); */
  800. return 1;
  801. }
  802. printf ("\b\b\b\b\b\b\b\b\b");
  803. printf (" ");
  804. printf ("\b\b\b\b\b\b\b\b\b");
  805. return 0;
  806. }
  807. /*********************************************************************/
  808. /* NAME: testdram() - calls any enabled memory tests */
  809. /* */
  810. /* DESCRIPTION: */
  811. /* Runs memory tests if the environment test variables are set to */
  812. /* 'y'. */
  813. /* */
  814. /* INPUTS: */
  815. /* testdramdata - If set to 'y', data test is run. */
  816. /* testdramaddress - If set to 'y', address test is run. */
  817. /* testdramwalk - If set to 'y', walking ones test is run */
  818. /* */
  819. /* OUTPUTS: */
  820. /* None */
  821. /* */
  822. /* RETURNS: */
  823. /* 0 - Passed test */
  824. /* 1 - Failed test */
  825. /* */
  826. /* RESTRICTIONS/LIMITATIONS: */
  827. /* */
  828. /* */
  829. /*********************************************************************/
  830. int testdram (void)
  831. {
  832. char *s;
  833. int rundata = 0;
  834. int runaddress = 0;
  835. int runwalk = 0;
  836. #ifdef CONFIG_SYS_DRAM_TEST_DATA
  837. s = getenv ("testdramdata");
  838. rundata = (s && (*s == 'y')) ? 1 : 0;
  839. #endif
  840. #ifdef CONFIG_SYS_DRAM_TEST_ADDRESS
  841. s = getenv ("testdramaddress");
  842. runaddress = (s && (*s == 'y')) ? 1 : 0;
  843. #endif
  844. #ifdef CONFIG_SYS_DRAM_TEST_WALK
  845. s = getenv ("testdramwalk");
  846. runwalk = (s && (*s == 'y')) ? 1 : 0;
  847. #endif
  848. if ((rundata == 1) || (runaddress == 1) || (runwalk == 1)) {
  849. printf ("Testing RAM from 0x%08x to 0x%08x ... (don't panic... that will take a moment !!!!)\n", CONFIG_SYS_MEMTEST_START, CONFIG_SYS_MEMTEST_END);
  850. }
  851. #ifdef CONFIG_SYS_DRAM_TEST_DATA
  852. if (rundata == 1) {
  853. printf ("Test DATA ... ");
  854. if (mem_test_data () == 1) {
  855. printf ("failed \n");
  856. return 1;
  857. } else
  858. printf ("ok \n");
  859. }
  860. #endif
  861. #ifdef CONFIG_SYS_DRAM_TEST_ADDRESS
  862. if (runaddress == 1) {
  863. printf ("Test ADDRESS ... ");
  864. if (mem_test_address () == 1) {
  865. printf ("failed \n");
  866. return 1;
  867. } else
  868. printf ("ok \n");
  869. }
  870. #endif
  871. #ifdef CONFIG_SYS_DRAM_TEST_WALK
  872. if (runwalk == 1) {
  873. printf ("Test WALKING ONEs ... ");
  874. if (mem_test_walk () == 1) {
  875. printf ("failed \n");
  876. return 1;
  877. } else
  878. printf ("ok \n");
  879. }
  880. #endif
  881. if ((rundata == 1) || (runaddress == 1) || (runwalk == 1)) {
  882. printf ("passed\n");
  883. }
  884. return 0;
  885. }
  886. #endif /* CONFIG_SYS_DRAM_TEST */
  887. /* ronen - the below functions are used by the bootm function */
  888. /* - we map the base register to fbe00000 (same mapping as in the LSP) */
  889. /* - we turn off the RX gig dmas - to prevent the dma from overunning */
  890. /* the kernel data areas. */
  891. /* - we diable and invalidate the icache and dcache. */
  892. void my_remap_gt_regs_bootm (u32 cur_loc, u32 new_loc)
  893. {
  894. u32 temp;
  895. temp = in_le32 ((u32 *) (new_loc + INTERNAL_SPACE_DECODE));
  896. if ((temp & 0xffff) == new_loc >> 16)
  897. return;
  898. temp = (in_le32 ((u32 *) (cur_loc + INTERNAL_SPACE_DECODE)) &
  899. 0xffff0000) | (new_loc >> 16);
  900. out_le32 ((u32 *) (cur_loc + INTERNAL_SPACE_DECODE), temp);
  901. while ((WORD_SWAP (*((volatile unsigned int *) (NONE_CACHEABLE |
  902. new_loc |
  903. (INTERNAL_SPACE_DECODE)))))
  904. != temp);
  905. }
  906. void board_prebootm_init ()
  907. {
  908. /* change window size of PCI1 IO in order tp prevent overlaping with REG BASE. */
  909. GT_REG_WRITE (PCI_1_IO_SIZE, (_64K - 1) >> 16);
  910. /* Stop GigE Rx DMA engines */
  911. GT_REG_WRITE (MV64360_ETH_RECEIVE_QUEUE_COMMAND_REG (0), 0x0000ff00);
  912. /* GT_REG_WRITE (MV64360_ETH_RECEIVE_QUEUE_COMMAND_REG (1), 0x0000ff00); */
  913. /* GV_REG_WRITE (MV64360_ETH_RECEIVE_QUEUE_COMMAND_REG (2), 0x0000ff00); */
  914. /* Relocate MV64360 internal regs */
  915. my_remap_gt_regs_bootm (CONFIG_SYS_GT_REGS, CONFIG_SYS_DFL_GT_REGS);
  916. icache_disable ();
  917. dcache_disable ();
  918. }
  919. int do_show_config(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  920. {
  921. unsigned int reset_sample_low;
  922. unsigned int reset_sample_high;
  923. unsigned int l, l1, l2;
  924. GT_REG_READ(0x3c4, &reset_sample_low);
  925. GT_REG_READ(0x3d4, &reset_sample_high);
  926. printf("Reset configuration 0x%08x 0x%08x\n", reset_sample_low, reset_sample_high);
  927. l2 = 0;
  928. for (l=0; l<63; l++) {
  929. if (show_config_tab[l][0] != 0) {
  930. printf("%14s:%1x ", show_config_tab[l],
  931. ((reset_sample_low >> (31 - (l & 0x1f)))) & 0x01);
  932. l2++;
  933. if ((l2 % 4) == 0)
  934. printf("\n");
  935. } else {
  936. l1++;
  937. }
  938. if (l == 32)
  939. reset_sample_low = reset_sample_high;
  940. }
  941. printf("\n");
  942. return(0);
  943. }
  944. U_BOOT_CMD(
  945. show_config, 1, 1, do_show_config,
  946. "Show Marvell strapping register",
  947. "Show Marvell strapping register (ResetSampleLow ResetSampleHigh)"
  948. );
  949. int do_pldver(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  950. {
  951. printf("PLD version:0x%02x\n", in_8((void *)CONFIG_SYS_PLD_VER));
  952. return 0;
  953. }
  954. U_BOOT_CMD(
  955. pldver, 1, 1, do_pldver,
  956. "Show PLD version",
  957. "Show PLD version)");