epcs.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. /*
  2. * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
  3. * Scott McNutt <smcnutt@psyent.com>
  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. #include <common.h>
  24. #if defined(CFG_NIOS_EPCSBASE)
  25. #include <command.h>
  26. #include <asm/io.h>
  27. #include <nios2-io.h>
  28. #include <nios2-epcs.h>
  29. /*-----------------------------------------------------------------------*/
  30. #define SHORT_HELP\
  31. "epcs - read/write Cyclone EPCS configuration device.\n"
  32. #define LONG_HELP\
  33. "\n"\
  34. "epcs erase start [end]\n"\
  35. " - erase sector start or sectors start through end.\n"\
  36. "epcs info\n"\
  37. " - display EPCS device information.\n"\
  38. "epcs protect on | off\n"\
  39. " - turn device protection on or off.\n"\
  40. "epcs read addr offset count\n"\
  41. " - read count bytes from offset to addr.\n"\
  42. "epcs write addr offset count\n"\
  43. " - write count bytes to offset from addr.\n"\
  44. "epcs verify addr offset count\n"\
  45. " - verify count bytes at offset from addr.\n"
  46. /*-----------------------------------------------------------------------*/
  47. /* Operation codes for serial configuration devices
  48. */
  49. #define EPCS_WRITE_ENA 0x06 /* Write enable */
  50. #define EPCS_WRITE_DIS 0x04 /* Write disable */
  51. #define EPCS_READ_STAT 0x05 /* Read status */
  52. #define EPCS_READ_BYTES 0x03 /* Read bytes */
  53. #define EPCS_READ_ID 0xab /* Read silicon id */
  54. #define EPCS_WRITE_STAT 0x01 /* Write status */
  55. #define EPCS_WRITE_BYTES 0x02 /* Write bytes */
  56. #define EPCS_ERASE_BULK 0xc7 /* Erase entire device */
  57. #define EPCS_ERASE_SECT 0xd8 /* Erase sector */
  58. /* Device status register bits
  59. */
  60. #define EPCS_STATUS_WIP (1<<0) /* Write in progress */
  61. #define EPCS_STATUS_WEL (1<<1) /* Write enable latch */
  62. /* Misc
  63. */
  64. #define EPCS_TIMEOUT 100 /* 100 msec timeout */
  65. static nios_spi_t *epcs = (nios_spi_t *)CFG_NIOS_EPCSBASE;
  66. /***********************************************************************
  67. * Device access
  68. ***********************************************************************/
  69. static int epcs_cs (int assert)
  70. {
  71. ulong start;
  72. unsigned tmp;
  73. if (assert) {
  74. tmp = readl (&epcs->control);
  75. writel (&epcs->control, tmp | NIOS_SPI_SSO);
  76. } else {
  77. /* Let all bits shift out */
  78. start = get_timer (0);
  79. while ((readl (&epcs->status) & NIOS_SPI_TMT) == 0)
  80. if (get_timer (start) > EPCS_TIMEOUT)
  81. return (-1);
  82. tmp = readl (&epcs->control);
  83. writel (&epcs->control, tmp & ~NIOS_SPI_SSO);
  84. }
  85. return (0);
  86. }
  87. static int epcs_tx (unsigned char c)
  88. {
  89. ulong start;
  90. start = get_timer (0);
  91. while ((readl (&epcs->status) & NIOS_SPI_TRDY) == 0)
  92. if (get_timer (start) > EPCS_TIMEOUT)
  93. return (-1);
  94. writel (&epcs->txdata, c);
  95. return (0);
  96. }
  97. static int epcs_rx (void)
  98. {
  99. ulong start;
  100. start = get_timer (0);
  101. while ((readl (&epcs->status) & NIOS_SPI_RRDY) == 0)
  102. if (get_timer (start) > EPCS_TIMEOUT)
  103. return (-1);
  104. return (readl (&epcs->rxdata));
  105. }
  106. static unsigned char bitrev[] = {
  107. 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e,
  108. 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
  109. };
  110. static unsigned char epcs_bitrev (unsigned char c)
  111. {
  112. unsigned char val;
  113. val = bitrev[c>>4];
  114. val |= bitrev[c & 0x0f]<<4;
  115. return (val);
  116. }
  117. static void epcs_rcv (unsigned char *dst, int len)
  118. {
  119. while (len--) {
  120. epcs_tx (0);
  121. *dst++ = epcs_rx ();
  122. }
  123. }
  124. static void epcs_rrcv (unsigned char *dst, int len)
  125. {
  126. while (len--) {
  127. epcs_tx (0);
  128. *dst++ = epcs_bitrev (epcs_rx ());
  129. }
  130. }
  131. static void epcs_snd (unsigned char *src, int len)
  132. {
  133. while (len--) {
  134. epcs_tx (*src++);
  135. epcs_rx ();
  136. }
  137. }
  138. static void epcs_rsnd (unsigned char *src, int len)
  139. {
  140. while (len--) {
  141. epcs_tx (epcs_bitrev (*src++));
  142. epcs_rx ();
  143. }
  144. }
  145. static void epcs_wr_enable (void)
  146. {
  147. epcs_cs (1);
  148. epcs_tx (EPCS_WRITE_ENA);
  149. epcs_rx ();
  150. epcs_cs (0);
  151. }
  152. static unsigned char epcs_status_rd (void)
  153. {
  154. unsigned char status;
  155. epcs_cs (1);
  156. epcs_tx (EPCS_READ_STAT);
  157. epcs_rx ();
  158. epcs_tx (0);
  159. status = epcs_rx ();
  160. epcs_cs (0);
  161. return (status);
  162. }
  163. static void epcs_status_wr (unsigned char status)
  164. {
  165. epcs_wr_enable ();
  166. epcs_cs (1);
  167. epcs_tx (EPCS_WRITE_STAT);
  168. epcs_rx ();
  169. epcs_tx (status);
  170. epcs_rx ();
  171. epcs_cs (0);
  172. return;
  173. }
  174. /***********************************************************************
  175. * Device information
  176. ***********************************************************************/
  177. static struct epcs_devinfo_t devinfo[] = {
  178. { "EPCS1 ", 0x10, 17, 4, 15, 8, 0x0c },
  179. { "EPCS4 ", 0x12, 19, 8, 16, 8, 0x1c },
  180. { 0, 0, 0, 0, 0, 0 }
  181. };
  182. int epcs_reset (void)
  183. {
  184. /* When booting from an epcs controller, the epcs bootrom
  185. * code may leave the slave select in an asserted state.
  186. * This causes two problems: (1) The initial epcs access
  187. * will fail -- not a big deal, and (2) a software reset
  188. * will cause the bootrom code to hang since it does not
  189. * ensure the select is negated prior to first access -- a
  190. * big deal. Here we just negate chip select and everything
  191. * gets better :-)
  192. */
  193. epcs_cs (0); /* Negate chip select */
  194. return (0);
  195. }
  196. epcs_devinfo_t *epcs_dev_find (void)
  197. {
  198. unsigned char buf[4];
  199. unsigned char id;
  200. int i;
  201. struct epcs_devinfo_t *dev = NULL;
  202. /* Read silicon id requires 3 "dummy bytes" before it's put
  203. * on the wire.
  204. */
  205. buf[0] = EPCS_READ_ID;
  206. buf[1] = 0;
  207. buf[2] = 0;
  208. buf[3] = 0;
  209. epcs_cs (1);
  210. epcs_snd (buf,4);
  211. epcs_rcv (buf,1);
  212. if (epcs_cs (0) == -1)
  213. return (NULL);
  214. id = buf[0];
  215. /* Find the info struct */
  216. i = 0;
  217. while (devinfo[i].name) {
  218. if (id == devinfo[i].id) {
  219. dev = &devinfo[i];
  220. break;
  221. }
  222. i++;
  223. }
  224. return (dev);
  225. }
  226. /***********************************************************************
  227. * Misc Utilities
  228. ***********************************************************************/
  229. int epcs_cfgsz (void)
  230. {
  231. int sz = 0;
  232. unsigned char buf[128];
  233. unsigned char *p;
  234. struct epcs_devinfo_t *dev = epcs_dev_find ();
  235. if (!dev)
  236. return (-1);
  237. /* Read in the first 128 bytes of the device */
  238. buf[0] = EPCS_READ_BYTES;
  239. buf[1] = 0;
  240. buf[2] = 0;
  241. buf[3] = 0;
  242. epcs_cs (1);
  243. epcs_snd (buf,4);
  244. epcs_rrcv (buf, sizeof(buf));
  245. epcs_cs (0);
  246. /* Search for the starting 0x6a which is followed by the
  247. * 4-byte 'register' and 4-byte bit-count.
  248. */
  249. p = buf;
  250. while (p < buf + sizeof(buf)-8) {
  251. if ( *p == 0x6a ) {
  252. /* Point to bit count and extract */
  253. p += 5;
  254. sz = *p++;
  255. sz |= *p++ << 8;
  256. sz |= *p++ << 16;
  257. sz |= *p++ << 24;
  258. /* Convert to byte count */
  259. sz += 7;
  260. sz >>= 3;
  261. } else if (*p == 0xff) {
  262. /* 0xff is ok ... just skip */
  263. p++;
  264. continue;
  265. } else {
  266. /* Not 0xff or 0x6a ... something's not
  267. * right ... report 'unknown' (sz=0).
  268. */
  269. break;
  270. }
  271. }
  272. return (sz);
  273. }
  274. int epcs_erase (unsigned start, unsigned end)
  275. {
  276. unsigned off, sectsz;
  277. unsigned char buf[4];
  278. struct epcs_devinfo_t *dev = epcs_dev_find ();
  279. if (!dev || (start>end))
  280. return (-1);
  281. /* Erase the requested sectors. An address is required
  282. * that lies within the requested sector -- we'll just
  283. * use the first address in the sector.
  284. */
  285. printf ("epcs erasing sector %d ", start);
  286. if (start != end)
  287. printf ("to %d ", end);
  288. sectsz = (1 << dev->sz_sect);
  289. while (start <= end) {
  290. off = start * sectsz;
  291. start++;
  292. buf[0] = EPCS_ERASE_SECT;
  293. buf[1] = off >> 16;
  294. buf[2] = off >> 8;
  295. buf[3] = off;
  296. epcs_wr_enable ();
  297. epcs_cs (1);
  298. epcs_snd (buf,4);
  299. epcs_cs (0);
  300. printf ("."); /* Some user feedback */
  301. /* Wait for erase to complete */
  302. while (epcs_status_rd() & EPCS_STATUS_WIP)
  303. ;
  304. }
  305. printf (" done.\n");
  306. return (0);
  307. }
  308. int epcs_read (ulong addr, ulong off, ulong cnt)
  309. {
  310. unsigned char buf[4];
  311. struct epcs_devinfo_t *dev = epcs_dev_find ();
  312. if (!dev)
  313. return (-1);
  314. buf[0] = EPCS_READ_BYTES;
  315. buf[1] = off >> 16;
  316. buf[2] = off >> 8;
  317. buf[3] = off;
  318. epcs_cs (1);
  319. epcs_snd (buf,4);
  320. epcs_rrcv ((unsigned char *)addr, cnt);
  321. epcs_cs (0);
  322. return (0);
  323. }
  324. int epcs_write (ulong addr, ulong off, ulong cnt)
  325. {
  326. ulong wrcnt;
  327. unsigned pgsz;
  328. unsigned char buf[4];
  329. struct epcs_devinfo_t *dev = epcs_dev_find ();
  330. if (!dev)
  331. return (-1);
  332. pgsz = (1<<dev->sz_page);
  333. while (cnt) {
  334. if (off % pgsz)
  335. wrcnt = pgsz - (off % pgsz);
  336. else
  337. wrcnt = pgsz;
  338. wrcnt = (wrcnt > cnt) ? cnt : wrcnt;
  339. buf[0] = EPCS_WRITE_BYTES;
  340. buf[1] = off >> 16;
  341. buf[2] = off >> 8;
  342. buf[3] = off;
  343. epcs_wr_enable ();
  344. epcs_cs (1);
  345. epcs_snd (buf,4);
  346. epcs_rsnd ((unsigned char *)addr, wrcnt);
  347. epcs_cs (0);
  348. /* Wait for write to complete */
  349. while (epcs_status_rd() & EPCS_STATUS_WIP)
  350. ;
  351. cnt -= wrcnt;
  352. off += wrcnt;
  353. addr += wrcnt;
  354. }
  355. return (0);
  356. }
  357. int epcs_verify (ulong addr, ulong off, ulong cnt, ulong *err)
  358. {
  359. ulong rdcnt;
  360. unsigned char buf[256];
  361. unsigned char *start,*end;
  362. int i;
  363. start = end = (unsigned char *)addr;
  364. while (cnt) {
  365. rdcnt = (cnt>sizeof(buf)) ? sizeof(buf) : cnt;
  366. epcs_read ((ulong)buf, off, rdcnt);
  367. for (i=0; i<rdcnt; i++) {
  368. if (*end != buf[i]) {
  369. *err = end - start;
  370. return(-1);
  371. }
  372. end++;
  373. }
  374. cnt -= rdcnt;
  375. off += rdcnt;
  376. }
  377. return (0);
  378. }
  379. static int epcs_sect_erased (int sect, unsigned *offset,
  380. struct epcs_devinfo_t *dev)
  381. {
  382. unsigned char buf[128];
  383. unsigned off, end;
  384. unsigned sectsz;
  385. int i;
  386. sectsz = (1 << dev->sz_sect);
  387. off = sectsz * sect;
  388. end = off + sectsz;
  389. while (off < end) {
  390. epcs_read ((ulong)buf, off, sizeof(buf));
  391. for (i=0; i < sizeof(buf); i++) {
  392. if (buf[i] != 0xff) {
  393. *offset = off + i;
  394. return (0);
  395. }
  396. }
  397. off += sizeof(buf);
  398. }
  399. return (1);
  400. }
  401. /***********************************************************************
  402. * Commands
  403. ***********************************************************************/
  404. static
  405. void do_epcs_info (struct epcs_devinfo_t *dev, int argc, char *argv[])
  406. {
  407. int i;
  408. unsigned char stat;
  409. unsigned tmp;
  410. int erased;
  411. /* Basic device info */
  412. printf ("%s: %d kbytes (%d sectors x %d kbytes,"
  413. " %d bytes/page)\n",
  414. dev->name, 1 << (dev->size-10),
  415. dev->num_sects, 1 << (dev->sz_sect-10),
  416. 1 << dev->sz_page );
  417. /* Status -- for now protection is all-or-nothing */
  418. stat = epcs_status_rd();
  419. printf ("status: 0x%02x (WIP:%d, WEL:%d, PROT:%s)\n",
  420. stat,
  421. (stat & EPCS_STATUS_WIP) ? 1 : 0,
  422. (stat & EPCS_STATUS_WEL) ? 1 : 0,
  423. (stat & dev->prot_mask) ? "on" : "off" );
  424. /* Configuration */
  425. tmp = epcs_cfgsz ();
  426. if (tmp) {
  427. printf ("config: 0x%06x (%d) bytes\n", tmp, tmp );
  428. } else {
  429. printf ("config: unknown\n" );
  430. }
  431. /* Sector info */
  432. for (i=0; i<dev->num_sects; i++) {
  433. erased = epcs_sect_erased (i, &tmp, dev);
  434. printf (" %d: %06x ",
  435. i, i*(1<<dev->sz_sect) );
  436. if (erased)
  437. printf ("erased\n");
  438. else
  439. printf ("data @ 0x%06x\n", tmp);
  440. }
  441. return;
  442. }
  443. static
  444. void do_epcs_erase (struct epcs_devinfo_t *dev, int argc, char *argv[])
  445. {
  446. unsigned start,end;
  447. if ((argc < 3) || (argc > 4)) {
  448. printf ("USAGE: epcs erase sect [end]\n");
  449. return;
  450. }
  451. if ((epcs_status_rd() & dev->prot_mask) != 0) {
  452. printf ( "epcs: device protected.\n");
  453. return;
  454. }
  455. start = simple_strtoul (argv[2], NULL, 10);
  456. if (argc > 3)
  457. end = simple_strtoul (argv[3], NULL, 10);
  458. else
  459. end = start;
  460. if ((start >= dev->num_sects) || (start > end)) {
  461. printf ("epcs: invalid sector range: [%d:%d]\n",
  462. start, end );
  463. return;
  464. }
  465. epcs_erase (start, end);
  466. return;
  467. }
  468. static
  469. void do_epcs_protect (struct epcs_devinfo_t *dev, int argc, char *argv[])
  470. {
  471. unsigned char stat;
  472. /* For now protection is all-or-nothing to keep things
  473. * simple. The protection bits don't map in a linear
  474. * fashion ... and we would rather protect the bottom
  475. * of the device since it contains the config data and
  476. * leave the top unprotected for app use. But unfortunately
  477. * protection works from top-to-bottom so it does
  478. * really help very much from a software app point-of-view.
  479. */
  480. if (argc < 3) {
  481. printf ("USAGE: epcs protect on | off\n");
  482. return;
  483. }
  484. if (!dev)
  485. return;
  486. /* Protection on/off is just a matter of setting/clearing
  487. * all protection bits in the status register.
  488. */
  489. stat = epcs_status_rd ();
  490. if (strcmp ("on", argv[2]) == 0) {
  491. stat |= dev->prot_mask;
  492. } else if (strcmp ("off", argv[2]) == 0 ) {
  493. stat &= ~dev->prot_mask;
  494. } else {
  495. printf ("epcs: unknown protection: %s\n", argv[2]);
  496. return;
  497. }
  498. epcs_status_wr (stat);
  499. return;
  500. }
  501. static
  502. void do_epcs_read (struct epcs_devinfo_t *dev, int argc, char *argv[])
  503. {
  504. ulong addr,off,cnt;
  505. ulong sz;
  506. if (argc < 5) {
  507. printf ("USAGE: epcs read addr offset count\n");
  508. return;
  509. }
  510. sz = 1 << dev->size;
  511. addr = simple_strtoul (argv[2], NULL, 16);
  512. off = simple_strtoul (argv[3], NULL, 16);
  513. cnt = simple_strtoul (argv[4], NULL, 16);
  514. if (off > sz) {
  515. printf ("offset is greater than device size"
  516. "... aborting.\n");
  517. return;
  518. }
  519. if ((off + cnt) > sz) {
  520. printf ("request exceeds device size"
  521. "... truncating.\n");
  522. cnt = sz - off;
  523. }
  524. printf ("epcs: read %08lx <- %06lx (0x%lx bytes)\n",
  525. addr, off, cnt);
  526. epcs_read (addr, off, cnt);
  527. return;
  528. }
  529. static
  530. void do_epcs_write (struct epcs_devinfo_t *dev, int argc, char *argv[])
  531. {
  532. ulong addr,off,cnt;
  533. ulong sz;
  534. ulong err;
  535. if (argc < 5) {
  536. printf ("USAGE: epcs write addr offset count\n");
  537. return;
  538. }
  539. if ((epcs_status_rd() & dev->prot_mask) != 0) {
  540. printf ( "epcs: device protected.\n");
  541. return;
  542. }
  543. sz = 1 << dev->size;
  544. addr = simple_strtoul (argv[2], NULL, 16);
  545. off = simple_strtoul (argv[3], NULL, 16);
  546. cnt = simple_strtoul (argv[4], NULL, 16);
  547. if (off > sz) {
  548. printf ("offset is greater than device size"
  549. "... aborting.\n");
  550. return;
  551. }
  552. if ((off + cnt) > sz) {
  553. printf ("request exceeds device size"
  554. "... truncating.\n");
  555. cnt = sz - off;
  556. }
  557. printf ("epcs: write %08lx -> %06lx (0x%lx bytes)\n",
  558. addr, off, cnt);
  559. epcs_write (addr, off, cnt);
  560. if (epcs_verify (addr, off, cnt, &err) != 0)
  561. printf ("epcs: write error at offset %06lx\n", err);
  562. return;
  563. }
  564. static
  565. void do_epcs_verify (struct epcs_devinfo_t *dev, int argc, char *argv[])
  566. {
  567. ulong addr,off,cnt;
  568. ulong sz;
  569. ulong err;
  570. if (argc < 5) {
  571. printf ("USAGE: epcs verify addr offset count\n");
  572. return;
  573. }
  574. sz = 1 << dev->size;
  575. addr = simple_strtoul (argv[2], NULL, 16);
  576. off = simple_strtoul (argv[3], NULL, 16);
  577. cnt = simple_strtoul (argv[4], NULL, 16);
  578. if (off > sz) {
  579. printf ("offset is greater than device size"
  580. "... aborting.\n");
  581. return;
  582. }
  583. if ((off + cnt) > sz) {
  584. printf ("request exceeds device size"
  585. "... truncating.\n");
  586. cnt = sz - off;
  587. }
  588. printf ("epcs: verify %08lx -> %06lx (0x%lx bytes)\n",
  589. addr, off, cnt);
  590. if (epcs_verify (addr, off, cnt, &err) != 0)
  591. printf ("epcs: verify error at offset %06lx\n", err);
  592. return;
  593. }
  594. /*-----------------------------------------------------------------------*/
  595. int do_epcs (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  596. {
  597. int len;
  598. struct epcs_devinfo_t *dev = epcs_dev_find ();
  599. if (!dev) {
  600. printf ("epcs: device not found.\n");
  601. return (-1);
  602. }
  603. if (argc < 2) {
  604. do_epcs_info (dev, argc, argv);
  605. return (0);
  606. }
  607. len = strlen (argv[1]);
  608. if (strncmp ("info", argv[1], len) == 0) {
  609. do_epcs_info (dev, argc, argv);
  610. } else if (strncmp ("erase", argv[1], len) == 0) {
  611. do_epcs_erase (dev, argc, argv);
  612. } else if (strncmp ("protect", argv[1], len) == 0) {
  613. do_epcs_protect (dev, argc, argv);
  614. } else if (strncmp ("read", argv[1], len) == 0) {
  615. do_epcs_read (dev, argc, argv);
  616. } else if (strncmp ("write", argv[1], len) == 0) {
  617. do_epcs_write (dev, argc, argv);
  618. } else if (strncmp ("verify", argv[1], len) == 0) {
  619. do_epcs_verify (dev, argc, argv);
  620. } else {
  621. printf ("epcs: unknown operation: %s\n", argv[1]);
  622. }
  623. return (0);
  624. }
  625. /*-----------------------------------------------------------------------*/
  626. U_BOOT_CMD( epcs, 5, 0, do_epcs, SHORT_HELP, LONG_HELP );
  627. #endif /* CONFIG_NIOS_EPCS */