cmd_stk52xx.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247
  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 - Sound sub-system\n",
  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\n"
  1072. );
  1073. U_BOOT_CMD(
  1074. wav , 3, 1, cmd_wav,
  1075. "wav - play wav file\n",
  1076. "[addr] [bytes]\n"
  1077. " - play wav file at address 'addr' with length 'bytes'\n"
  1078. );
  1079. U_BOOT_CMD(
  1080. beep , 2, 1, cmd_beep,
  1081. "beep - play short beep\n",
  1082. "[channel]\n"
  1083. " - play short beep on \"l\"eft or \"r\"ight channel\n"
  1084. );
  1085. #endif /* CONFIG_STK52XX || CONFIG_FO300 */
  1086. #if defined(CONFIG_STK52XX)
  1087. U_BOOT_CMD(
  1088. fkt , 4, 1, cmd_fkt,
  1089. "fkt - Function test routines\n",
  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\n"
  1096. #ifndef CONFIG_TQM5200S
  1097. "fkt backlight on/off\n"
  1098. " - switch backlight on or off\n"
  1099. #endif /* !CONFIG_TQM5200S */
  1100. );
  1101. #elif defined(CONFIG_FO300)
  1102. U_BOOT_CMD(
  1103. fkt , 3, 1, cmd_fkt,
  1104. "fkt - Function test routines\n",
  1105. "fkt can\n"
  1106. " - loopback plug for X16/X29 required\n"
  1107. "fkt rs232 number\n"
  1108. " - loopback plug(s) for X21/X22 required\n"
  1109. );
  1110. #endif
  1111. #endif