cmd_stk52xx.c 29 KB

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