cmd_stk52xx.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  1. /*
  2. * (C) Copyright 2005
  3. * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.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. /*
  24. * STK52XX specific functions
  25. */
  26. /*#define DEBUG*/
  27. #include <common.h>
  28. #include <command.h>
  29. #if defined(CONFIG_CMD_BSP)
  30. #if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
  31. #define DEFAULT_VOL 45
  32. #define DEFAULT_FREQ 500
  33. #define DEFAULT_DURATION 200
  34. #define LEFT 1
  35. #define RIGHT 2
  36. #define LEFT_RIGHT 3
  37. #define BL_OFF 0
  38. #define BL_ON 1
  39. #define SM501_GPIO_CTRL_LOW 0x00000008UL
  40. #define SM501_GPIO_CTRL_HIGH 0x0000000CUL
  41. #define SM501_POWER_MODE0_GATE 0x00000040UL
  42. #define SM501_POWER_MODE1_GATE 0x00000048UL
  43. #define POWER_MODE_GATE_GPIO_PWM_I2C 0x00000040UL
  44. #define SM501_GPIO_DATA_LOW 0x00010000UL
  45. #define SM501_GPIO_DATA_HIGH 0x00010004UL
  46. #define SM501_GPIO_DATA_DIR_LOW 0x00010008UL
  47. #define SM501_GPIO_DATA_DIR_HIGH 0x0001000CUL
  48. #define SM501_PANEL_DISPLAY_CONTROL 0x00080000UL
  49. static int i2s_squarewave(unsigned long duration, unsigned int freq,
  50. unsigned int channel);
  51. static int i2s_sawtooth(unsigned long duration, unsigned int freq,
  52. unsigned int channel);
  53. static void spi_init(void);
  54. static int spi_transmit(unsigned char data);
  55. static void pcm1772_write_reg(unsigned char addr, unsigned char data);
  56. static void set_attenuation(unsigned char attenuation);
  57. static void spi_init(void)
  58. {
  59. struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
  60. struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
  61. /* PSC3 as SPI and GPIOs */
  62. gpio->port_config &= 0xFFFFF0FF;
  63. gpio->port_config |= 0x00000800;
  64. /*
  65. * Its important to use the correct order when initializing the
  66. * registers
  67. */
  68. spi->ddr = 0x0F; /* set all SPI pins as output */
  69. spi->pdr = 0x08; /* set SS high */
  70. spi->cr1 = 0x50; /* SPI is master, SS is general purpose output */
  71. spi->cr2 = 0x00; /* normal operation */
  72. spi->brr = 0xFF; /* baud rate: IPB clock / 2048 */
  73. }
  74. static int spi_transmit(unsigned char data)
  75. {
  76. struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
  77. spi->dr = data;
  78. /* wait for SPI transmission completed */
  79. while (!(spi->sr & 0x80)) {
  80. if (spi->sr & 0x40) { /* if write collision occured */
  81. int dummy;
  82. /* do dummy read to clear status register */
  83. dummy = spi->dr;
  84. printf("SPI write collision: dr=0x%x\n", dummy);
  85. return -1;
  86. }
  87. }
  88. return (spi->dr);
  89. }
  90. static void pcm1772_write_reg(unsigned char addr, unsigned char data)
  91. {
  92. struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
  93. spi->pdr = 0x00; /* Set SS low */
  94. spi_transmit(addr);
  95. spi_transmit(data);
  96. /* wait some time to meet MS# hold time of PCM1772 */
  97. udelay (1);
  98. spi->pdr = 0x08; /* set SS high */
  99. }
  100. static void set_attenuation(unsigned char attenuation)
  101. {
  102. pcm1772_write_reg(0x01, attenuation); /* left channel */
  103. debug ("PCM1772 attenuation left set to %d.\n", attenuation);
  104. pcm1772_write_reg(0x02, attenuation); /* right channel */
  105. debug ("PCM1772 attenuation right set to %d.\n", attenuation);
  106. }
  107. void amplifier_init(void)
  108. {
  109. static int init_done = 0;
  110. int i;
  111. struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
  112. /* Do this only once, because of the long time delay */
  113. if (!init_done) {
  114. /* configure PCM1772 audio format as I2S */
  115. pcm1772_write_reg(0x03, 0x01);
  116. /* enable audio amplifier */
  117. gpio->sint_gpioe |= 0x02; /* PSC3_5 as GPIO */
  118. gpio->sint_ode &= ~0x02; /* PSC3_5 is not open Drain */
  119. gpio->sint_dvo &= ~0x02; /* PSC3_5 is LOW */
  120. gpio->sint_ddr |= 0x02; /* PSC3_5 as output */
  121. /*
  122. * wait some time to allow amplifier to recover from shutdown
  123. * mode.
  124. */
  125. for(i = 0; i < 350; i++)
  126. udelay(1000);
  127. /*
  128. * The used amplifier (LM4867) has a so called "pop and click"
  129. * elmination filter. The input signal of the amplifier must
  130. * exceed a certain level once after power up to activate the
  131. * generation of the output signal. This is achieved by
  132. * sending a low frequent (nearly inaudible) sawtooth with a
  133. * sufficient signal level.
  134. */
  135. set_attenuation(50);
  136. i2s_sawtooth (200, 5, LEFT_RIGHT);
  137. init_done = 1;
  138. }
  139. }
  140. static void i2s_init(void)
  141. {
  142. unsigned long i;
  143. struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;;
  144. struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
  145. gpio->port_config |= 0x00000070; /* PSC2 ports as Codec with MCLK */
  146. psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
  147. psc->sicr = 0x22E00000; /* 16 bit data; I2S */
  148. *(vu_long *)(CONFIG_SYS_MBAR + 0x22C) = 0x805d; /* PSC2 CDM MCLK config; MCLK
  149. * 5.617 MHz */
  150. *(vu_long *)(CONFIG_SYS_MBAR + 0x214) |= 0x00000040; /* CDM clock enable
  151. * register */
  152. psc->ccr = 0x1F03; /* 16 bit data width; 5.617MHz MCLK */
  153. psc->ctur = 0x0F; /* 16 bit frame width */
  154. for (i = 0; i < 128; i++)
  155. psc->psc_buffer_32 = 0; /* clear tx fifo */
  156. }
  157. static int i2s_play_wave(unsigned long addr, unsigned long len)
  158. {
  159. unsigned long i;
  160. unsigned char *wave_file = (uchar *)addr + 44; /* quick'n dirty: skip
  161. * wav header*/
  162. struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
  163. /*
  164. * play wave file in memory; bytes/words are be swapped
  165. */
  166. psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
  167. for(i = 0;i < (len / 4); i++) {
  168. unsigned char swapped[4];
  169. unsigned long *p = (unsigned long*)swapped;
  170. swapped[3] = *wave_file++;
  171. swapped[2] = *wave_file++;
  172. swapped[1] = *wave_file++;
  173. swapped[0] = *wave_file++;
  174. psc->psc_buffer_32 = *p;
  175. while (psc->tfnum > 400) {
  176. if(ctrlc())
  177. return 0;
  178. }
  179. }
  180. while (psc->tfnum > 0); /* wait for fifo empty */
  181. udelay (100);
  182. psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
  183. return 0;
  184. }
  185. static int i2s_sawtooth(unsigned long duration, unsigned int freq,
  186. unsigned int channel)
  187. {
  188. long i,j;
  189. unsigned long data;
  190. struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
  191. psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
  192. /*
  193. * Generate sawtooth. Start with middle level up to highest level. Then
  194. * go to lowest level and back to middle level.
  195. */
  196. for(j = 0; j < ((duration * freq) / 1000); j++) {
  197. for(i = 0; i <= 0x7FFF; i += (0x7FFF/(44100/(freq*4)))) {
  198. data = (i & 0xFFFF);
  199. /* data format: right data left data) */
  200. if (channel == LEFT_RIGHT)
  201. data |= (data<<16);
  202. if (channel == RIGHT)
  203. data = (data<<16);
  204. psc->psc_buffer_32 = data;
  205. while (psc->tfnum > 400);
  206. }
  207. for(i = 0x7FFF; i >= -0x7FFF; i -= (0xFFFF/(44100/(freq*2)))) {
  208. data = (i & 0xFFFF);
  209. /* data format: right data left data) */
  210. if (channel == LEFT_RIGHT)
  211. data |= (data<<16);
  212. if (channel == RIGHT)
  213. data = (data<<16);
  214. psc->psc_buffer_32 = data;
  215. while (psc->tfnum > 400);
  216. }
  217. for(i = -0x7FFF; i <= 0; i += (0x7FFF/(44100/(freq*4)))) {
  218. data = (i & 0xFFFF);
  219. /* data format: right data left data) */
  220. if (channel == LEFT_RIGHT)
  221. data |= (data<<16);
  222. if (channel == RIGHT)
  223. data = (data<<16);
  224. psc->psc_buffer_32 = data;
  225. while (psc->tfnum > 400);
  226. }
  227. }
  228. while (psc->tfnum > 0); /* wait for fifo empty */
  229. udelay (100);
  230. psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
  231. return 0;
  232. }
  233. static int i2s_squarewave(unsigned long duration, unsigned int freq,
  234. unsigned int channel)
  235. {
  236. long i,j;
  237. unsigned long data;
  238. struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
  239. psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE);
  240. /*
  241. * Generate sqarewave. Start with high level, duty cycle 1:1.
  242. */
  243. for(j = 0; j < ((duration * freq) / 1000); j++) {
  244. for(i = 0; i < (44100/(freq*2)); i ++) {
  245. data = 0x7FFF;
  246. /* data format: right data left data) */
  247. if (channel == LEFT_RIGHT)
  248. data |= (data<<16);
  249. if (channel == RIGHT)
  250. data = (data<<16);
  251. psc->psc_buffer_32 = data;
  252. while (psc->tfnum > 400);
  253. }
  254. for(i = 0; i < (44100/(freq*2)); i ++) {
  255. data = 0x8000;
  256. /* data format: right data left data) */
  257. if (channel == LEFT_RIGHT)
  258. data |= (data<<16);
  259. if (channel == RIGHT)
  260. data = (data<<16);
  261. psc->psc_buffer_32 = data;
  262. while (psc->tfnum > 400);
  263. }
  264. }
  265. while (psc->tfnum > 0); /* wait for fifo empty */
  266. udelay (100);
  267. psc->command = (PSC_RX_DISABLE | PSC_TX_DISABLE);
  268. return 0;
  269. }
  270. static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  271. {
  272. unsigned long reg, val, duration;
  273. char *tmp;
  274. unsigned int freq, channel;
  275. unsigned char volume;
  276. int rcode = 1;
  277. #ifdef CONFIG_STK52XX_REV100
  278. printf ("Revision 100 of STK52XX not supported!\n");
  279. return 1;
  280. #endif
  281. spi_init();
  282. i2s_init();
  283. amplifier_init();
  284. if ((tmp = getenv ("volume")) != NULL) {
  285. volume = simple_strtoul (tmp, NULL, 10);
  286. } else {
  287. volume = DEFAULT_VOL;
  288. }
  289. set_attenuation(volume);
  290. switch (argc) {
  291. case 0:
  292. case 1:
  293. return cmd_usage(cmdtp);
  294. case 2:
  295. if (strncmp(argv[1],"saw",3) == 0) {
  296. printf ("Play sawtooth\n");
  297. rcode = i2s_sawtooth (DEFAULT_DURATION, DEFAULT_FREQ,
  298. LEFT_RIGHT);
  299. return rcode;
  300. } else if (strncmp(argv[1],"squ",3) == 0) {
  301. printf ("Play squarewave\n");
  302. rcode = i2s_squarewave (DEFAULT_DURATION, DEFAULT_FREQ,
  303. LEFT_RIGHT);
  304. return rcode;
  305. }
  306. return cmd_usage(cmdtp);
  307. case 3:
  308. if (strncmp(argv[1],"saw",3) == 0) {
  309. duration = simple_strtoul(argv[2], NULL, 10);
  310. printf ("Play sawtooth\n");
  311. rcode = i2s_sawtooth (duration, DEFAULT_FREQ,
  312. LEFT_RIGHT);
  313. return rcode;
  314. } else if (strncmp(argv[1],"squ",3) == 0) {
  315. duration = simple_strtoul(argv[2], NULL, 10);
  316. printf ("Play squarewave\n");
  317. rcode = i2s_squarewave (duration, DEFAULT_FREQ,
  318. LEFT_RIGHT);
  319. return rcode;
  320. }
  321. return cmd_usage(cmdtp);
  322. case 4:
  323. if (strncmp(argv[1],"saw",3) == 0) {
  324. duration = simple_strtoul(argv[2], NULL, 10);
  325. freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
  326. printf ("Play sawtooth\n");
  327. rcode = i2s_sawtooth (duration, freq,
  328. LEFT_RIGHT);
  329. return rcode;
  330. } else if (strncmp(argv[1],"squ",3) == 0) {
  331. duration = simple_strtoul(argv[2], NULL, 10);
  332. freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
  333. printf ("Play squarewave\n");
  334. rcode = i2s_squarewave (duration, freq,
  335. LEFT_RIGHT);
  336. return rcode;
  337. } else if (strcmp(argv[1],"pcm1772") == 0) {
  338. reg = simple_strtoul(argv[2], NULL, 10);
  339. val = simple_strtoul(argv[3], NULL, 10);
  340. printf("Set PCM1772 %lu. %lu\n", reg, val);
  341. pcm1772_write_reg((uchar)reg, (uchar)val);
  342. return 0;
  343. }
  344. return cmd_usage(cmdtp);
  345. case 5:
  346. if (strncmp(argv[1],"saw",3) == 0) {
  347. duration = simple_strtoul(argv[2], NULL, 10);
  348. freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
  349. if (strncmp(argv[4],"l",1) == 0)
  350. channel = LEFT;
  351. else if (strncmp(argv[4],"r",1) == 0)
  352. channel = RIGHT;
  353. else
  354. channel = LEFT_RIGHT;
  355. printf ("Play squarewave\n");
  356. rcode = i2s_sawtooth (duration, freq,
  357. channel);
  358. return rcode;
  359. } else if (strncmp(argv[1],"squ",3) == 0) {
  360. duration = simple_strtoul(argv[2], NULL, 10);
  361. freq = (unsigned int)simple_strtoul(argv[3], NULL, 10);
  362. if (strncmp(argv[4],"l",1) == 0)
  363. channel = LEFT;
  364. else if (strncmp(argv[4],"r",1) == 0)
  365. channel = RIGHT;
  366. else
  367. channel = LEFT_RIGHT;
  368. printf ("Play squarewave\n");
  369. rcode = i2s_squarewave (duration, freq,
  370. channel);
  371. return rcode;
  372. }
  373. return cmd_usage(cmdtp);
  374. }
  375. printf ("Usage:\nsound cmd [arg1] [arg2] ...\n");
  376. return 1;
  377. }
  378. static int cmd_wav(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  379. {
  380. unsigned long length, addr;
  381. unsigned char volume;
  382. int rcode = 1;
  383. char *tmp;
  384. #ifdef CONFIG_STK52XX_REV100
  385. printf ("Revision 100 of STK52XX not supported!\n");
  386. return 1;
  387. #endif
  388. spi_init();
  389. i2s_init();
  390. amplifier_init();
  391. switch (argc) {
  392. case 3:
  393. length = simple_strtoul(argv[2], NULL, 16);
  394. addr = simple_strtoul(argv[1], NULL, 16);
  395. break;
  396. case 2:
  397. if ((tmp = getenv ("filesize")) != NULL) {
  398. length = simple_strtoul (tmp, NULL, 16);
  399. } else {
  400. puts ("No filesize provided\n");
  401. return 1;
  402. }
  403. addr = simple_strtoul(argv[1], NULL, 16);
  404. case 1:
  405. if ((tmp = getenv ("filesize")) != NULL) {
  406. length = simple_strtoul (tmp, NULL, 16);
  407. } else {
  408. puts ("No filesize provided\n");
  409. return 1;
  410. }
  411. if ((tmp = getenv ("loadaddr")) != NULL) {
  412. addr = simple_strtoul (tmp, NULL, 16);
  413. } else {
  414. puts ("No loadaddr provided\n");
  415. return 1;
  416. }
  417. break;
  418. default:
  419. printf("Usage:\nwav <addr> <length[s]\n");
  420. return 1;
  421. break;
  422. }
  423. if ((tmp = getenv ("volume")) != NULL) {
  424. volume = simple_strtoul (tmp, NULL, 10);
  425. } else {
  426. volume = DEFAULT_VOL;
  427. }
  428. set_attenuation(volume);
  429. printf("Play wave file at %lX with length %lX\n", addr, length);
  430. rcode = i2s_play_wave(addr, length);
  431. return rcode;
  432. }
  433. static int cmd_beep(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  434. {
  435. unsigned char volume;
  436. unsigned int channel;
  437. int rcode;
  438. char *tmp;
  439. #ifdef CONFIG_STK52XX_REV100
  440. printf ("Revision 100 of STK52XX not supported!\n");
  441. return 1;
  442. #endif
  443. spi_init();
  444. i2s_init();
  445. amplifier_init();
  446. switch (argc) {
  447. case 0:
  448. case 1:
  449. channel = LEFT_RIGHT;
  450. break;
  451. case 2:
  452. if (strncmp(argv[1],"l",1) == 0)
  453. channel = LEFT;
  454. else if (strncmp(argv[1],"r",1) == 0)
  455. channel = RIGHT;
  456. else
  457. channel = LEFT_RIGHT;
  458. break;
  459. default:
  460. return cmd_usage(cmdtp);
  461. }
  462. if ((tmp = getenv ("volume")) != NULL) {
  463. volume = simple_strtoul (tmp, NULL, 10);
  464. } else {
  465. volume = DEFAULT_VOL;
  466. }
  467. set_attenuation(volume);
  468. printf("Beep on ");
  469. if (channel == LEFT)
  470. printf ("left ");
  471. else if (channel == RIGHT)
  472. printf ("right ");
  473. else
  474. printf ("left and right ");
  475. printf ("channel\n");
  476. rcode = i2s_squarewave (DEFAULT_DURATION, DEFAULT_FREQ, channel);
  477. return rcode;
  478. }
  479. #endif
  480. #if defined(CONFIG_STK52XX)
  481. void led_init(void)
  482. {
  483. struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
  484. struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
  485. /* configure PSC3 for SPI and GPIO */
  486. gpio->port_config &= ~(0x00000F00);
  487. gpio->port_config |= 0x00000800;
  488. gpio->simple_gpioe &= ~(0x00000F00);
  489. gpio->simple_gpioe |= 0x00000F00;
  490. gpio->simple_ddr &= ~(0x00000F00);
  491. gpio->simple_ddr |= 0x00000F00;
  492. /* configure timer 4-7 for simple GPIO output */
  493. gpt->gpt4.emsr |= 0x00000024;
  494. gpt->gpt5.emsr |= 0x00000024;
  495. gpt->gpt6.emsr |= 0x00000024;
  496. gpt->gpt7.emsr |= 0x00000024;
  497. #ifndef CONFIG_TQM5200S
  498. /* enable SM501 GPIO control (in both power modes) */
  499. *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
  500. POWER_MODE_GATE_GPIO_PWM_I2C;
  501. *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
  502. POWER_MODE_GATE_GPIO_PWM_I2C;
  503. /* configure SM501 gpio pins 24-27 as output */
  504. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_CTRL_LOW) &= ~(0xF << 24);
  505. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_LOW) |= (0xF << 24);
  506. /* configure SM501 gpio pins 48-51 as output */
  507. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |= (0xF << 16);
  508. #endif /* !CONFIG_TQM5200S */
  509. }
  510. /*
  511. * return 1 if led number unknown
  512. * return 0 else
  513. */
  514. int do_led(char * const argv[])
  515. {
  516. struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
  517. struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
  518. switch (simple_strtoul(argv[2], NULL, 10)) {
  519. case 0:
  520. if (strcmp (argv[3], "on") == 0) {
  521. gpio->simple_dvo |= (1 << 8);
  522. } else {
  523. gpio->simple_dvo &= ~(1 << 8);
  524. }
  525. break;
  526. case 1:
  527. if (strcmp (argv[3], "on") == 0) {
  528. gpio->simple_dvo |= (1 << 9);
  529. } else {
  530. gpio->simple_dvo &= ~(1 << 9);
  531. }
  532. break;
  533. case 2:
  534. if (strcmp (argv[3], "on") == 0) {
  535. gpio->simple_dvo |= (1 << 10);
  536. } else {
  537. gpio->simple_dvo &= ~(1 << 10);
  538. }
  539. break;
  540. case 3:
  541. if (strcmp (argv[3], "on") == 0) {
  542. gpio->simple_dvo |= (1 << 11);
  543. } else {
  544. gpio->simple_dvo &= ~(1 << 11);
  545. }
  546. break;
  547. case 4:
  548. if (strcmp (argv[3], "on") == 0) {
  549. gpt->gpt4.emsr |= (1 << 4);
  550. } else {
  551. gpt->gpt4.emsr &= ~(1 << 4);
  552. }
  553. break;
  554. case 5:
  555. if (strcmp (argv[3], "on") == 0) {
  556. gpt->gpt5.emsr |= (1 << 4);
  557. } else {
  558. gpt->gpt5.emsr &= ~(1 << 4);
  559. }
  560. break;
  561. case 6:
  562. if (strcmp (argv[3], "on") == 0) {
  563. gpt->gpt6.emsr |= (1 << 4);
  564. } else {
  565. gpt->gpt6.emsr &= ~(1 << 4);
  566. }
  567. break;
  568. case 7:
  569. if (strcmp (argv[3], "on") == 0) {
  570. gpt->gpt7.emsr |= (1 << 4);
  571. } else {
  572. gpt->gpt7.emsr &= ~(1 << 4);
  573. }
  574. break;
  575. #ifndef CONFIG_TQM5200S
  576. case 24:
  577. if (strcmp (argv[3], "on") == 0) {
  578. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
  579. (0x1 << 24);
  580. } else {
  581. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
  582. ~(0x1 << 24);
  583. }
  584. break;
  585. case 25:
  586. if (strcmp (argv[3], "on") == 0) {
  587. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
  588. (0x1 << 25);
  589. } else {
  590. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
  591. ~(0x1 << 25);
  592. }
  593. break;
  594. case 26:
  595. if (strcmp (argv[3], "on") == 0) {
  596. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
  597. (0x1 << 26);
  598. } else {
  599. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
  600. ~(0x1 << 26);
  601. }
  602. break;
  603. case 27:
  604. if (strcmp (argv[3], "on") == 0) {
  605. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) |=
  606. (0x1 << 27);
  607. } else {
  608. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_LOW) &=
  609. ~(0x1 << 27);
  610. }
  611. break;
  612. case 48:
  613. if (strcmp (argv[3], "on") == 0) {
  614. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
  615. (0x1 << 16);
  616. } else {
  617. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
  618. ~(0x1 << 16);
  619. }
  620. break;
  621. case 49:
  622. if (strcmp (argv[3], "on") == 0) {
  623. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
  624. (0x1 << 17);
  625. } else {
  626. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
  627. ~(0x1 << 17);
  628. }
  629. break;
  630. case 50:
  631. if (strcmp (argv[3], "on") == 0) {
  632. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
  633. (0x1 << 18);
  634. } else {
  635. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
  636. ~(0x1 << 18);
  637. }
  638. break;
  639. case 51:
  640. if (strcmp (argv[3], "on") == 0) {
  641. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
  642. (0x1 << 19);
  643. } else {
  644. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
  645. ~(0x1 << 19);
  646. }
  647. break;
  648. #endif /* !CONFIG_TQM5200S */
  649. default:
  650. printf ("%s: invalid led number %s\n", __FUNCTION__, argv[2]);
  651. return 1;
  652. }
  653. return 0;
  654. }
  655. #endif
  656. #if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
  657. /*
  658. * return 1 on CAN initialization failure
  659. * return 0 if no failure
  660. */
  661. int can_init(void)
  662. {
  663. static int init_done = 0;
  664. int i;
  665. struct mpc5xxx_mscan *can1 =
  666. (struct mpc5xxx_mscan *)(CONFIG_SYS_MBAR + 0x0900);
  667. struct mpc5xxx_mscan *can2 =
  668. (struct mpc5xxx_mscan *)(CONFIG_SYS_MBAR + 0x0980);
  669. /* GPIO configuration of the CAN pins is done in TQM5200.h */
  670. if (!init_done) {
  671. /* init CAN 1 */
  672. can1->canctl1 |= 0x80; /* CAN enable */
  673. udelay(100);
  674. i = 0;
  675. can1->canctl0 |= 0x02; /* sleep mode */
  676. /* wait until sleep mode reached */
  677. while (!(can1->canctl1 & 0x02)) {
  678. udelay(10);
  679. i++;
  680. if (i == 10) {
  681. printf ("%s: CAN1 initialize error, "
  682. "can not enter sleep mode!\n",
  683. __FUNCTION__);
  684. return 1;
  685. }
  686. }
  687. i = 0;
  688. can1->canctl0 = 0x01; /* enter init mode */
  689. /* wait until init mode reached */
  690. while (!(can1->canctl1 & 0x01)) {
  691. udelay(10);
  692. i++;
  693. if (i == 10) {
  694. printf ("%s: CAN1 initialize error, "
  695. "can not enter init mode!\n",
  696. __FUNCTION__);
  697. return 1;
  698. }
  699. }
  700. can1->canctl1 = 0x80;
  701. can1->canctl1 |= 0x40;
  702. can1->canbtr0 = 0x0F;
  703. can1->canbtr1 = 0x7F;
  704. can1->canidac &= ~(0x30);
  705. can1->canidar1 = 0x00;
  706. can1->canidar3 = 0x00;
  707. can1->canidar5 = 0x00;
  708. can1->canidar7 = 0x00;
  709. can1->canidmr0 = 0xFF;
  710. can1->canidmr1 = 0xFF;
  711. can1->canidmr2 = 0xFF;
  712. can1->canidmr3 = 0xFF;
  713. can1->canidmr4 = 0xFF;
  714. can1->canidmr5 = 0xFF;
  715. can1->canidmr6 = 0xFF;
  716. can1->canidmr7 = 0xFF;
  717. i = 0;
  718. can1->canctl0 &= ~(0x01); /* leave init mode */
  719. can1->canctl0 &= ~(0x02);
  720. /* wait until init and sleep mode left */
  721. while ((can1->canctl1 & 0x01) || (can1->canctl1 & 0x02)) {
  722. udelay(10);
  723. i++;
  724. if (i == 10) {
  725. printf ("%s: CAN1 initialize error, "
  726. "can not leave init/sleep mode!\n",
  727. __FUNCTION__);
  728. return 1;
  729. }
  730. }
  731. /* init CAN 2 */
  732. can2->canctl1 |= 0x80; /* CAN enable */
  733. udelay(100);
  734. i = 0;
  735. can2->canctl0 |= 0x02; /* sleep mode */
  736. /* wait until sleep mode reached */
  737. while (!(can2->canctl1 & 0x02)) {
  738. udelay(10);
  739. i++;
  740. if (i == 10) {
  741. printf ("%s: CAN2 initialize error, "
  742. "can not enter sleep mode!\n",
  743. __FUNCTION__);
  744. return 1;
  745. }
  746. }
  747. i = 0;
  748. can2->canctl0 = 0x01; /* enter init mode */
  749. /* wait until init mode reached */
  750. while (!(can2->canctl1 & 0x01)) {
  751. udelay(10);
  752. i++;
  753. if (i == 10) {
  754. printf ("%s: CAN2 initialize error, "
  755. "can not enter init mode!\n",
  756. __FUNCTION__);
  757. return 1;
  758. }
  759. }
  760. can2->canctl1 = 0x80;
  761. can2->canctl1 |= 0x40;
  762. can2->canbtr0 = 0x0F;
  763. can2->canbtr1 = 0x7F;
  764. can2->canidac &= ~(0x30);
  765. can2->canidar1 = 0x00;
  766. can2->canidar3 = 0x00;
  767. can2->canidar5 = 0x00;
  768. can2->canidar7 = 0x00;
  769. can2->canidmr0 = 0xFF;
  770. can2->canidmr1 = 0xFF;
  771. can2->canidmr2 = 0xFF;
  772. can2->canidmr3 = 0xFF;
  773. can2->canidmr4 = 0xFF;
  774. can2->canidmr5 = 0xFF;
  775. can2->canidmr6 = 0xFF;
  776. can2->canidmr7 = 0xFF;
  777. can2->canctl0 &= ~(0x01); /* leave init mode */
  778. can2->canctl0 &= ~(0x02);
  779. i = 0;
  780. /* wait until init mode left */
  781. while ((can2->canctl1 & 0x01) || (can2->canctl1 & 0x02)) {
  782. udelay(10);
  783. i++;
  784. if (i == 10) {
  785. printf ("%s: CAN2 initialize error, "
  786. "can not leave init/sleep mode!\n",
  787. __FUNCTION__);
  788. return 1;
  789. }
  790. }
  791. init_done = 1;
  792. }
  793. return 0;
  794. }
  795. /*
  796. * return 1 on CAN failure
  797. * return 0 if no failure
  798. */
  799. int do_can(char * const argv[])
  800. {
  801. int i;
  802. struct mpc5xxx_mscan *can1 =
  803. (struct mpc5xxx_mscan *)(CONFIG_SYS_MBAR + 0x0900);
  804. struct mpc5xxx_mscan *can2 =
  805. (struct mpc5xxx_mscan *)(CONFIG_SYS_MBAR + 0x0980);
  806. /* send a message on CAN1 */
  807. can1->cantbsel = 0x01;
  808. can1->cantxfg.idr[0] = 0x55;
  809. can1->cantxfg.idr[1] = 0x00;
  810. can1->cantxfg.idr[1] &= ~0x8;
  811. can1->cantxfg.idr[1] &= ~0x10;
  812. can1->cantxfg.dsr[0] = 0xCC;
  813. can1->cantxfg.dlr = 1;
  814. can1->cantxfg.tbpr = 0;
  815. can1->cantflg = 0x01;
  816. i = 0;
  817. while ((can1->cantflg & 0x01) == 0) {
  818. i++;
  819. if (i == 10) {
  820. printf ("%s: CAN1 send timeout, "
  821. "can not send message!\n",
  822. __FUNCTION__);
  823. return 1;
  824. }
  825. udelay(1000);
  826. }
  827. udelay(1000);
  828. i = 0;
  829. while (!(can2->canrflg & 0x01)) {
  830. i++;
  831. if (i == 10) {
  832. printf ("%s: CAN2 receive timeout, "
  833. "no message received!\n",
  834. __FUNCTION__);
  835. return 1;
  836. }
  837. udelay(1000);
  838. }
  839. if (can2->canrxfg.dsr[0] != 0xCC) {
  840. printf ("%s: CAN2 receive error, "
  841. "data mismatch!\n",
  842. __FUNCTION__);
  843. return 1;
  844. }
  845. /* send a message on CAN2 */
  846. can2->cantbsel = 0x01;
  847. can2->cantxfg.idr[0] = 0x55;
  848. can2->cantxfg.idr[1] = 0x00;
  849. can2->cantxfg.idr[1] &= ~0x8;
  850. can2->cantxfg.idr[1] &= ~0x10;
  851. can2->cantxfg.dsr[0] = 0xCC;
  852. can2->cantxfg.dlr = 1;
  853. can2->cantxfg.tbpr = 0;
  854. can2->cantflg = 0x01;
  855. i = 0;
  856. while ((can2->cantflg & 0x01) == 0) {
  857. i++;
  858. if (i == 10) {
  859. printf ("%s: CAN2 send error, "
  860. "can not send message!\n",
  861. __FUNCTION__);
  862. return 1;
  863. }
  864. udelay(1000);
  865. }
  866. udelay(1000);
  867. i = 0;
  868. while (!(can1->canrflg & 0x01)) {
  869. i++;
  870. if (i == 10) {
  871. printf ("%s: CAN1 receive timeout, "
  872. "no message received!\n",
  873. __FUNCTION__);
  874. return 1;
  875. }
  876. udelay(1000);
  877. }
  878. if (can1->canrxfg.dsr[0] != 0xCC) {
  879. printf ("%s: CAN1 receive error 0x%02x\n",
  880. __FUNCTION__, (can1->canrxfg.dsr[0]));
  881. return 1;
  882. }
  883. return 0;
  884. }
  885. /*
  886. * return 1 if rs232 port unknown
  887. * return 2 on txd/rxd failure (only rs232 2)
  888. * return 3 on rts/cts failure
  889. * return 0 if no failure
  890. */
  891. int do_rs232(char * const argv[])
  892. {
  893. int error_status = 0;
  894. struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
  895. struct mpc5xxx_psc *psc1 = (struct mpc5xxx_psc *)MPC5XXX_PSC1;
  896. switch (simple_strtoul(argv[2], NULL, 10)) {
  897. case 1:
  898. /* check RTS <-> CTS loop */
  899. /* set rts to 0 */
  900. psc1->op1 |= 0x01;
  901. /* wait some time before requesting status */
  902. udelay(10);
  903. /* check status at cts */
  904. if ((psc1->ip & 0x01) != 0) {
  905. error_status = 3;
  906. printf ("%s: failure at rs232_1, cts status is %d "
  907. "(should be 0)\n",
  908. __FUNCTION__, (psc1->ip & 0x01));
  909. }
  910. /* set rts to 1 */
  911. psc1->op0 |= 0x01;
  912. /* wait some time before requesting status */
  913. udelay(10);
  914. /* check status at cts */
  915. if ((psc1->ip & 0x01) != 1) {
  916. error_status = 3;
  917. printf ("%s: failure at rs232_1, cts status is %d "
  918. "(should be 1)\n",
  919. __FUNCTION__, (psc1->ip & 0x01));
  920. }
  921. break;
  922. case 2:
  923. /* set PSC3_0, PSC3_2 as output and PSC3_1, PSC3_3 as input */
  924. gpio->simple_ddr &= ~(0x00000F00);
  925. gpio->simple_ddr |= 0x00000500;
  926. /* check TXD <-> RXD loop */
  927. /* set TXD to 1 */
  928. gpio->simple_dvo |= (1 << 8);
  929. /* wait some time before requesting status */
  930. udelay(10);
  931. if ((gpio->simple_ival & 0x00000200) != 0x00000200) {
  932. error_status = 2;
  933. printf ("%s: failure at rs232_2, rxd status is %d "
  934. "(should be 1)\n",
  935. __FUNCTION__,
  936. (gpio->simple_ival & 0x00000200) >> 9);
  937. }
  938. /* set TXD to 0 */
  939. gpio->simple_dvo &= ~(1 << 8);
  940. /* wait some time before requesting status */
  941. udelay(10);
  942. if ((gpio->simple_ival & 0x00000200) != 0x00000000) {
  943. error_status = 2;
  944. printf ("%s: failure at rs232_2, rxd status is %d "
  945. "(should be 0)\n",
  946. __FUNCTION__,
  947. (gpio->simple_ival & 0x00000200) >> 9);
  948. }
  949. /* check RTS <-> CTS loop */
  950. /* set RTS to 1 */
  951. gpio->simple_dvo |= (1 << 10);
  952. /* wait some time before requesting status */
  953. udelay(10);
  954. if ((gpio->simple_ival & 0x00000800) != 0x00000800) {
  955. error_status = 3;
  956. printf ("%s: failure at rs232_2, cts status is %d "
  957. "(should be 1)\n",
  958. __FUNCTION__,
  959. (gpio->simple_ival & 0x00000800) >> 11);
  960. }
  961. /* set RTS to 0 */
  962. gpio->simple_dvo &= ~(1 << 10);
  963. /* wait some time before requesting status */
  964. udelay(10);
  965. if ((gpio->simple_ival & 0x00000800) != 0x00000000) {
  966. error_status = 3;
  967. printf ("%s: failure at rs232_2, cts status is %d "
  968. "(should be 0)\n",
  969. __FUNCTION__,
  970. (gpio->simple_ival & 0x00000800) >> 11);
  971. }
  972. /* set PSC3_0, PSC3_1, PSC3_2 and PSC3_3 as output */
  973. gpio->simple_ddr &= ~(0x00000F00);
  974. gpio->simple_ddr |= 0x00000F00;
  975. break;
  976. default:
  977. printf ("%s: invalid rs232 number %s\n", __FUNCTION__, argv[2]);
  978. error_status = 1;
  979. break;
  980. }
  981. return error_status;
  982. }
  983. #if !defined(CONFIG_FO300) && !defined(CONFIG_TQM5200S)
  984. static void sm501_backlight (unsigned int state)
  985. {
  986. if (state == BL_ON) {
  987. *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) |=
  988. (1 << 26) | (1 << 27);
  989. } else if (state == BL_OFF)
  990. *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) &=
  991. ~((1 << 26) | (1 << 27));
  992. }
  993. #endif /* !CONFIG_FO300 & !CONFIG_TQM5200S */
  994. int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  995. {
  996. int rcode;
  997. #ifdef CONFIG_STK52XX_REV100
  998. printf ("Revision 100 of STK52XX not supported!\n");
  999. return 1;
  1000. #endif
  1001. #if defined(CONFIG_STK52XX)
  1002. led_init();
  1003. #endif
  1004. can_init();
  1005. switch (argc) {
  1006. case 0:
  1007. case 1:
  1008. break;
  1009. case 2:
  1010. if (strncmp (argv[1], "can", 3) == 0) {
  1011. rcode = do_can (argv);
  1012. if (rcode == 0)
  1013. printf ("OK\n");
  1014. else
  1015. printf ("Error\n");
  1016. return rcode;
  1017. }
  1018. break;
  1019. case 3:
  1020. if (strncmp (argv[1], "rs232", 3) == 0) {
  1021. rcode = do_rs232 (argv);
  1022. if (rcode == 0)
  1023. printf ("OK\n");
  1024. else
  1025. printf ("Error\n");
  1026. return rcode;
  1027. #if !defined(CONFIG_FO300) && !defined(CONFIG_TQM5200S)
  1028. } else if (strncmp (argv[1], "backlight", 4) == 0) {
  1029. if (strncmp (argv[2], "on", 2) == 0) {
  1030. sm501_backlight (BL_ON);
  1031. return 0;
  1032. }
  1033. else if (strncmp (argv[2], "off", 3) == 0) {
  1034. sm501_backlight (BL_OFF);
  1035. return 0;
  1036. }
  1037. #endif /* !CONFIG_FO300 & !CONFIG_TQM5200S */
  1038. }
  1039. break;
  1040. #if defined(CONFIG_STK52XX)
  1041. case 4:
  1042. if (strcmp (argv[1], "led") == 0) {
  1043. return (do_led (argv));
  1044. }
  1045. break;
  1046. #endif
  1047. default:
  1048. break;
  1049. }
  1050. printf ("Usage:\nfkt cmd [arg1] [arg2] ...\n");
  1051. return 1;
  1052. }
  1053. U_BOOT_CMD(
  1054. sound , 5, 1, cmd_sound,
  1055. "Sound sub-system",
  1056. "saw [duration] [freq] [channel]\n"
  1057. " - generate sawtooth for 'duration' ms with frequency 'freq'\n"
  1058. " on left \"l\" or right \"r\" channel\n"
  1059. "sound square [duration] [freq] [channel]\n"
  1060. " - generate squarewave for 'duration' ms with frequency 'freq'\n"
  1061. " on left \"l\" or right \"r\" channel\n"
  1062. "pcm1772 reg val"
  1063. );
  1064. U_BOOT_CMD(
  1065. wav , 3, 1, cmd_wav,
  1066. "play wav file",
  1067. "[addr] [bytes]\n"
  1068. " - play wav file at address 'addr' with length 'bytes'"
  1069. );
  1070. U_BOOT_CMD(
  1071. beep , 2, 1, cmd_beep,
  1072. "play short beep",
  1073. "[channel]\n"
  1074. " - play short beep on \"l\"eft or \"r\"ight channel"
  1075. );
  1076. #endif /* CONFIG_STK52XX || CONFIG_FO300 */
  1077. #if defined(CONFIG_STK52XX)
  1078. U_BOOT_CMD(
  1079. fkt , 4, 1, cmd_fkt,
  1080. "Function test routines",
  1081. "led number on/off\n"
  1082. " - 'number's like printed on STK52XX board\n"
  1083. "fkt can\n"
  1084. " - loopback plug for X83 required\n"
  1085. "fkt rs232 number\n"
  1086. " - loopback plug(s) for X2 required"
  1087. #ifndef CONFIG_TQM5200S
  1088. "\n"
  1089. "fkt backlight on/off\n"
  1090. " - switch backlight on or off"
  1091. #endif /* !CONFIG_TQM5200S */
  1092. );
  1093. #elif defined(CONFIG_FO300)
  1094. U_BOOT_CMD(
  1095. fkt , 3, 1, cmd_fkt,
  1096. "Function test routines",
  1097. "fkt can\n"
  1098. " - loopback plug for X16/X29 required\n"
  1099. "fkt rs232 number\n"
  1100. " - loopback plug(s) for X21/X22 required"
  1101. );
  1102. #endif
  1103. #endif