ap1000.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. /*
  2. * amirix.c: ppcboot platform support for AMIRIX board
  3. *
  4. * Copyright 2002 Mind NV
  5. * Copyright 2003 AMIRIX Systems Inc.
  6. *
  7. * http://www.mind.be/
  8. * http://www.amirix.com/
  9. *
  10. * Author : Peter De Schrijver (p2@mind.be)
  11. * Frank Smith (smith@amirix.com)
  12. *
  13. * Derived from : Other platform support files in this tree, ml2
  14. *
  15. * This software may be used and distributed according to the terms of
  16. * the GNU General Public License (GPL) version 2, incorporated herein by
  17. * reference. Drivers based on or derived from this code fall under the GPL
  18. * and must retain the authorship, copyright and this license notice. This
  19. * file is not a complete program and may only be used when the entire
  20. * program is licensed under the GPL.
  21. *
  22. */
  23. #include <common.h>
  24. #include <command.h>
  25. #include <netdev.h>
  26. #include <asm/processor.h>
  27. #include "powerspan.h"
  28. #include "ap1000.h"
  29. int board_pre_init (void)
  30. {
  31. return 0;
  32. }
  33. /** serial number and platform display at startup */
  34. int checkboard (void)
  35. {
  36. char *s = getenv ("serial#");
  37. char *e;
  38. /* After a loadace command, the SystemAce control register is left in a wonky state. */
  39. /* this code did not work in board_pre_init */
  40. unsigned char *p = (unsigned char *) AP1000_SYSACE_REGBASE;
  41. p[SYSACE_CTRLREG0] = 0x0;
  42. /* add platform and device to banner */
  43. switch (get_device ()) {
  44. case AP1xx_AP107_TARGET:
  45. puts (AP1xx_AP107_TARGET_STR);
  46. break;
  47. case AP1xx_AP120_TARGET:
  48. puts (AP1xx_AP120_TARGET_STR);
  49. break;
  50. case AP1xx_AP130_TARGET:
  51. puts (AP1xx_AP130_TARGET_STR);
  52. break;
  53. case AP1xx_AP1070_TARGET:
  54. puts (AP1xx_AP1070_TARGET_STR);
  55. break;
  56. case AP1xx_AP1100_TARGET:
  57. puts (AP1xx_AP1100_TARGET_STR);
  58. break;
  59. default:
  60. puts (AP1xx_UNKNOWN_STR);
  61. break;
  62. }
  63. puts (AP1xx_TARGET_STR);
  64. puts (" with ");
  65. switch (get_platform ()) {
  66. case AP100_BASELINE_PLATFORM:
  67. case AP1000_BASELINE_PLATFORM:
  68. puts (AP1xx_BASELINE_PLATFORM_STR);
  69. break;
  70. case AP1xx_QUADGE_PLATFORM:
  71. puts (AP1xx_QUADGE_PLATFORM_STR);
  72. break;
  73. case AP1xx_MGT_REF_PLATFORM:
  74. puts (AP1xx_MGT_REF_PLATFORM_STR);
  75. break;
  76. case AP1xx_STANDARD_PLATFORM:
  77. puts (AP1xx_STANDARD_PLATFORM_STR);
  78. break;
  79. case AP1xx_DUAL_PLATFORM:
  80. puts (AP1xx_DUAL_PLATFORM_STR);
  81. break;
  82. case AP1xx_BASE_SRAM_PLATFORM:
  83. puts (AP1xx_BASE_SRAM_PLATFORM_STR);
  84. break;
  85. case AP1xx_PCI_PCB_TESTPLATFORM:
  86. case AP1000_PCI_PCB_TESTPLATFORM:
  87. puts (AP1xx_PCI_PCB_TESTPLATFORM_STR);
  88. break;
  89. case AP1xx_DUAL_GE_MEZZ_TESTPLATFORM:
  90. puts (AP1xx_DUAL_GE_MEZZ_TESTPLATFORM_STR);
  91. break;
  92. case AP1xx_SFP_MEZZ_TESTPLATFORM:
  93. puts (AP1xx_SFP_MEZZ_TESTPLATFORM_STR);
  94. break;
  95. default:
  96. puts (AP1xx_UNKNOWN_STR);
  97. break;
  98. }
  99. if ((get_platform () & AP1xx_TESTPLATFORM_MASK) != 0) {
  100. puts (AP1xx_TESTPLATFORM_STR);
  101. } else {
  102. puts (AP1xx_PLATFORM_STR);
  103. }
  104. putc ('\n');
  105. puts ("Serial#: ");
  106. if (!s) {
  107. printf ("### No HW ID - assuming AMIRIX");
  108. } else {
  109. for (e = s; *e; ++e) {
  110. if (*e == ' ')
  111. break;
  112. }
  113. for (; s < e; ++s) {
  114. putc (*s);
  115. }
  116. }
  117. putc ('\n');
  118. return (0);
  119. }
  120. phys_size_t initdram (int board_type)
  121. {
  122. char *s = getenv ("dramsize");
  123. if (s != NULL) {
  124. if ((s[0] == '0') && ((s[1] == 'x') || (s[1] == 'X'))) {
  125. s += 2;
  126. }
  127. return (long int)simple_strtoul (s, NULL, 16);
  128. } else {
  129. /* give all 64 MB */
  130. return 64 * 1024 * 1024;
  131. }
  132. }
  133. unsigned int get_platform (void)
  134. {
  135. unsigned int *revision_reg_ptr = (unsigned int *) AP1xx_FPGA_REV_ADDR;
  136. return (*revision_reg_ptr & AP1xx_PLATFORM_MASK);
  137. }
  138. unsigned int get_device (void)
  139. {
  140. unsigned int *revision_reg_ptr = (unsigned int *) AP1xx_FPGA_REV_ADDR;
  141. return (*revision_reg_ptr & AP1xx_TARGET_MASK);
  142. }
  143. #if 0 /* loadace is not working; it appears to be a hardware issue with the system ace. */
  144. /*
  145. This function loads FPGA configurations from the SystemACE CompactFlash
  146. */
  147. int do_loadace (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  148. {
  149. unsigned char *p = (unsigned char *) AP1000_SYSACE_REGBASE;
  150. int cfg;
  151. if ((p[SYSACE_STATREG0] & 0x10) == 0) {
  152. p[SYSACE_CTRLREG0] = 0x80;
  153. printf ("\nNo CompactFlash Detected\n\n");
  154. p[SYSACE_CTRLREG0] = 0x00;
  155. return 1;
  156. }
  157. /* reset configuration controller: | 0x80 */
  158. /* select cpflash & ~0x40 */
  159. /* cfg start | 0x20 */
  160. /* wait for cfgstart & ~0x10 */
  161. /* force cfgmode: | 0x08 */
  162. /* do no force cfgaddr: & ~0x04 */
  163. /* clear mpulock: & ~0x02 */
  164. /* do not force lock request & ~0x01 */
  165. p[SYSACE_CTRLREG0] = 0x80 | 0x20 | 0x08;
  166. p[SYSACE_CTRLREG1] = 0x00;
  167. /* force config address if arg2 exists */
  168. if (argc == 2) {
  169. cfg = simple_strtoul (argv[1], NULL, 10);
  170. if (cfg > 7) {
  171. printf ("\nInvalid Configuration\n\n");
  172. p[SYSACE_CTRLREG0] = 0x00;
  173. return 1;
  174. }
  175. /* Set config address */
  176. p[SYSACE_CTRLREG1] = (cfg << 5);
  177. /* force cfgaddr */
  178. p[SYSACE_CTRLREG0] |= 0x04;
  179. } else {
  180. cfg = (p[SYSACE_STATREG1] & 0xE0) >> 5;
  181. }
  182. /* release configuration controller */
  183. printf ("\nLoading V2PRO with config %d...\n", cfg);
  184. p[SYSACE_CTRLREG0] &= ~0x80;
  185. while ((p[SYSACE_STATREG1] & 0x01) == 0) {
  186. if (p[SYSACE_ERRREG0] & 0x80) {
  187. /* attempting to load an invalid configuration makes the cpflash */
  188. /* appear to be removed. Reset here to avoid that problem */
  189. p[SYSACE_CTRLREG0] = 0x80;
  190. printf ("\nConfiguration %d Read Error\n\n", cfg);
  191. p[SYSACE_CTRLREG0] = 0x00;
  192. return 1;
  193. }
  194. }
  195. p[SYSACE_CTRLREG0] |= 0x20;
  196. return 0;
  197. }
  198. #endif
  199. /** Console command to display and set the software reconfigure byte
  200. * <pre>
  201. * swconfig - display the current value of the software reconfigure byte
  202. * swconfig [#] - change the software reconfigure byte to #
  203. * </pre>
  204. * @param *cmdtp [IN] as passed by run_command (ignored)
  205. * @param flag [IN] as passed by run_command (ignored)
  206. * @param argc [IN] as passed by run_command if 1, display, if 2 change
  207. * @param *argv[] [IN] contains the parameters to use
  208. * @return
  209. * <pre>
  210. * 0 if passed
  211. * -1 if failed
  212. * </pre>
  213. */
  214. int do_swconfigbyte (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  215. {
  216. unsigned char *sector_buffer = NULL;
  217. unsigned char input_char;
  218. int write_result;
  219. unsigned int input_uint;
  220. /* display value if no argument */
  221. if (argc < 2) {
  222. printf ("Software configuration byte is currently: 0x%02x\n",
  223. *((unsigned char *) (SW_BYTE_SECTOR_ADDR +
  224. SW_BYTE_SECTOR_OFFSET)));
  225. return 0;
  226. } else if (argc > 3) {
  227. printf ("Too many arguments\n");
  228. return -1;
  229. }
  230. /* if 3 arguments, 3rd argument is the address to use */
  231. if (argc == 3) {
  232. input_uint = simple_strtoul (argv[1], NULL, 16);
  233. sector_buffer = (unsigned char *) input_uint;
  234. } else {
  235. sector_buffer = (unsigned char *) DEFAULT_TEMP_ADDR;
  236. }
  237. input_char = simple_strtoul (argv[1], NULL, 0);
  238. if ((input_char & ~SW_BYTE_MASK) != 0) {
  239. printf ("Input of 0x%02x will be masked to 0x%02x\n",
  240. input_char, (input_char & SW_BYTE_MASK));
  241. input_char = input_char & SW_BYTE_MASK;
  242. }
  243. memcpy (sector_buffer, (void *) SW_BYTE_SECTOR_ADDR,
  244. SW_BYTE_SECTOR_SIZE);
  245. sector_buffer[SW_BYTE_SECTOR_OFFSET] = input_char;
  246. printf ("Erasing Flash...");
  247. if (flash_sect_erase
  248. (SW_BYTE_SECTOR_ADDR,
  249. (SW_BYTE_SECTOR_ADDR + SW_BYTE_SECTOR_OFFSET))) {
  250. return -1;
  251. }
  252. printf ("Writing to Flash... ");
  253. write_result =
  254. flash_write ((char *)sector_buffer, SW_BYTE_SECTOR_ADDR,
  255. SW_BYTE_SECTOR_SIZE);
  256. if (write_result != 0) {
  257. flash_perror (write_result);
  258. return -1;
  259. } else {
  260. printf ("done\n");
  261. printf ("Software configuration byte is now: 0x%02x\n",
  262. *((unsigned char *) (SW_BYTE_SECTOR_ADDR +
  263. SW_BYTE_SECTOR_OFFSET)));
  264. }
  265. return 0;
  266. }
  267. #define ONE_SECOND 1000000
  268. int do_pause (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  269. {
  270. int pause_time;
  271. unsigned int delay_time;
  272. int break_loop = 0;
  273. /* display value if no argument */
  274. if (argc < 2) {
  275. pause_time = 1;
  276. }
  277. else if (argc > 2) {
  278. printf ("Too many arguments\n");
  279. return -1;
  280. } else {
  281. pause_time = simple_strtoul (argv[1], NULL, 0);
  282. }
  283. printf ("Pausing with a poll time of %d, press any key to reactivate\n", pause_time);
  284. delay_time = pause_time * ONE_SECOND;
  285. while (break_loop == 0) {
  286. udelay (delay_time);
  287. if (serial_tstc () != 0) {
  288. break_loop = 1;
  289. /* eat user key presses */
  290. while (serial_tstc () != 0) {
  291. serial_getc ();
  292. }
  293. }
  294. }
  295. return 0;
  296. }
  297. int do_swreconfig (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  298. {
  299. printf ("Triggering software reconfigure (software config byte is 0x%02x)...\n",
  300. *((unsigned char *) (SW_BYTE_SECTOR_ADDR + SW_BYTE_SECTOR_OFFSET)));
  301. udelay (1000);
  302. *((unsigned char *) AP1000_CPLD_BASE) = 1;
  303. return 0;
  304. }
  305. #define GET_DECIMAL(low_byte) ((low_byte >> 5) * 125)
  306. #define TEMP_BUSY_BIT 0x80
  307. #define TEMP_LHIGH_BIT 0x40
  308. #define TEMP_LLOW_BIT 0x20
  309. #define TEMP_EHIGH_BIT 0x10
  310. #define TEMP_ELOW_BIT 0x08
  311. #define TEMP_OPEN_BIT 0x04
  312. #define TEMP_ETHERM_BIT 0x02
  313. #define TEMP_LTHERM_BIT 0x01
  314. int do_temp_sensor (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  315. {
  316. char cmd;
  317. int ret_val = 0;
  318. unsigned char temp_byte;
  319. int temp;
  320. int temp_low;
  321. int low;
  322. int low_low;
  323. int high;
  324. int high_low;
  325. int therm;
  326. unsigned char user_data[4] = { 0 };
  327. int user_data_count = 0;
  328. int ii;
  329. if (argc > 1) {
  330. cmd = argv[1][0];
  331. } else {
  332. cmd = 's'; /* default to status */
  333. }
  334. user_data_count = argc - 2;
  335. for (ii = 0; ii < user_data_count; ii++) {
  336. user_data[ii] = simple_strtoul (argv[2 + ii], NULL, 0);
  337. }
  338. switch (cmd) {
  339. case 's':
  340. if (I2CAccess
  341. (0x2, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  342. &temp_byte, I2C_READ) != 0) {
  343. goto fail;
  344. }
  345. printf ("Status : 0x%02x ", temp_byte);
  346. if (temp_byte & TEMP_BUSY_BIT)
  347. printf ("BUSY ");
  348. if (temp_byte & TEMP_LHIGH_BIT)
  349. printf ("LHIGH ");
  350. if (temp_byte & TEMP_LLOW_BIT)
  351. printf ("LLOW ");
  352. if (temp_byte & TEMP_EHIGH_BIT)
  353. printf ("EHIGH ");
  354. if (temp_byte & TEMP_ELOW_BIT)
  355. printf ("ELOW ");
  356. if (temp_byte & TEMP_OPEN_BIT)
  357. printf ("OPEN ");
  358. if (temp_byte & TEMP_ETHERM_BIT)
  359. printf ("ETHERM ");
  360. if (temp_byte & TEMP_LTHERM_BIT)
  361. printf ("LTHERM");
  362. printf ("\n");
  363. if (I2CAccess
  364. (0x3, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  365. &temp_byte, I2C_READ) != 0) {
  366. goto fail;
  367. }
  368. printf ("Config : 0x%02x ", temp_byte);
  369. if (I2CAccess
  370. (0x4, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  371. &temp_byte, I2C_READ) != 0) {
  372. printf ("\n");
  373. goto fail;
  374. }
  375. printf ("Conversion: 0x%02x\n", temp_byte);
  376. if (I2CAccess
  377. (0x22, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  378. &temp_byte, I2C_READ) != 0) {
  379. goto fail;
  380. }
  381. printf ("Cons Alert: 0x%02x ", temp_byte);
  382. if (I2CAccess
  383. (0x21, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  384. &temp_byte, I2C_READ) != 0) {
  385. printf ("\n");
  386. goto fail;
  387. }
  388. printf ("Therm Hyst: %d\n", temp_byte);
  389. if (I2CAccess
  390. (0x0, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  391. &temp_byte, I2C_READ) != 0) {
  392. goto fail;
  393. }
  394. temp = temp_byte;
  395. if (I2CAccess
  396. (0x6, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  397. &temp_byte, I2C_READ) != 0) {
  398. goto fail;
  399. }
  400. low = temp_byte;
  401. if (I2CAccess
  402. (0x5, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  403. &temp_byte, I2C_READ) != 0) {
  404. goto fail;
  405. }
  406. high = temp_byte;
  407. if (I2CAccess
  408. (0x20, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  409. &temp_byte, I2C_READ) != 0) {
  410. goto fail;
  411. }
  412. therm = temp_byte;
  413. printf ("Local Temp: %2d Low: %2d High: %2d THERM: %2d\n", temp, low, high, therm);
  414. if (I2CAccess
  415. (0x1, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  416. &temp_byte, I2C_READ) != 0) {
  417. goto fail;
  418. }
  419. temp = temp_byte;
  420. if (I2CAccess
  421. (0x10, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  422. &temp_byte, I2C_READ) != 0) {
  423. goto fail;
  424. }
  425. temp_low = temp_byte;
  426. if (I2CAccess
  427. (0x8, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  428. &temp_byte, I2C_READ) != 0) {
  429. goto fail;
  430. }
  431. low = temp_byte;
  432. if (I2CAccess
  433. (0x14, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  434. &temp_byte, I2C_READ) != 0) {
  435. goto fail;
  436. }
  437. low_low = temp_byte;
  438. if (I2CAccess
  439. (0x7, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  440. &temp_byte, I2C_READ) != 0) {
  441. goto fail;
  442. }
  443. high = temp_byte;
  444. if (I2CAccess
  445. (0x13, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  446. &temp_byte, I2C_READ) != 0) {
  447. goto fail;
  448. }
  449. high_low = temp_byte;
  450. if (I2CAccess
  451. (0x19, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  452. &temp_byte, I2C_READ) != 0) {
  453. goto fail;
  454. }
  455. therm = temp_byte;
  456. if (I2CAccess
  457. (0x11, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  458. &temp_byte, I2C_READ) != 0) {
  459. goto fail;
  460. }
  461. printf ("Ext Temp : %2d.%03d Low: %2d.%03d High: %2d.%03d THERM: %2d Offset: %2d\n", temp, GET_DECIMAL (temp_low), low, GET_DECIMAL (low_low), high, GET_DECIMAL (high_low), therm, temp_byte);
  462. break;
  463. case 'l': /* alter local limits : low, high, therm */
  464. if (argc < 3) {
  465. goto usage;
  466. }
  467. /* low */
  468. if (I2CAccess
  469. (0xC, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  470. &user_data[0], I2C_WRITE) != 0) {
  471. goto fail;
  472. }
  473. if (user_data_count > 1) {
  474. /* high */
  475. if (I2CAccess
  476. (0xB, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  477. &user_data[1], I2C_WRITE) != 0) {
  478. goto fail;
  479. }
  480. }
  481. if (user_data_count > 2) {
  482. /* therm */
  483. if (I2CAccess
  484. (0x20, I2C_SENSOR_DEV,
  485. I2C_SENSOR_CHIP_SEL, &user_data[2],
  486. I2C_WRITE) != 0) {
  487. goto fail;
  488. }
  489. }
  490. break;
  491. case 'e': /* alter external limits: low, high, therm, offset */
  492. if (argc < 3) {
  493. goto usage;
  494. }
  495. /* low */
  496. if (I2CAccess
  497. (0xE, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  498. &user_data[0], I2C_WRITE) != 0) {
  499. goto fail;
  500. }
  501. if (user_data_count > 1) {
  502. /* high */
  503. if (I2CAccess
  504. (0xD, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  505. &user_data[1], I2C_WRITE) != 0) {
  506. goto fail;
  507. }
  508. }
  509. if (user_data_count > 2) {
  510. /* therm */
  511. if (I2CAccess
  512. (0x19, I2C_SENSOR_DEV,
  513. I2C_SENSOR_CHIP_SEL, &user_data[2],
  514. I2C_WRITE) != 0) {
  515. goto fail;
  516. }
  517. }
  518. if (user_data_count > 3) {
  519. /* offset */
  520. if (I2CAccess
  521. (0x11, I2C_SENSOR_DEV,
  522. I2C_SENSOR_CHIP_SEL, &user_data[3],
  523. I2C_WRITE) != 0) {
  524. goto fail;
  525. }
  526. }
  527. break;
  528. case 'c': /* alter config settings: config, conv, cons alert, therm hyst */
  529. if (argc < 3) {
  530. goto usage;
  531. }
  532. /* config */
  533. if (I2CAccess
  534. (0x9, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  535. &user_data[0], I2C_WRITE) != 0) {
  536. goto fail;
  537. }
  538. if (user_data_count > 1) {
  539. /* conversion */
  540. if (I2CAccess
  541. (0xA, I2C_SENSOR_DEV, I2C_SENSOR_CHIP_SEL,
  542. &user_data[1], I2C_WRITE) != 0) {
  543. goto fail;
  544. }
  545. }
  546. if (user_data_count > 2) {
  547. /* cons alert */
  548. if (I2CAccess
  549. (0x22, I2C_SENSOR_DEV,
  550. I2C_SENSOR_CHIP_SEL, &user_data[2],
  551. I2C_WRITE) != 0) {
  552. goto fail;
  553. }
  554. }
  555. if (user_data_count > 3) {
  556. /* therm hyst */
  557. if (I2CAccess
  558. (0x21, I2C_SENSOR_DEV,
  559. I2C_SENSOR_CHIP_SEL, &user_data[3],
  560. I2C_WRITE) != 0) {
  561. goto fail;
  562. }
  563. }
  564. break;
  565. default:
  566. goto usage;
  567. }
  568. goto done;
  569. fail:
  570. printf ("Access to sensor failed\n");
  571. ret_val = -1;
  572. goto done;
  573. usage:
  574. printf ("Usage:\n%s\n", cmdtp->help);
  575. done:
  576. return ret_val;
  577. }
  578. U_BOOT_CMD (temp, 6, 0, do_temp_sensor,
  579. "interact with the temperature sensor",
  580. "temp [s]\n"
  581. " - Show status.\n"
  582. "temp l LOW [HIGH] [THERM]\n"
  583. " - Set local limits.\n"
  584. "temp e LOW [HIGH] [THERM] [OFFSET]\n"
  585. " - Set external limits.\n"
  586. "temp c CONFIG [CONVERSION] [CONS. ALERT] [THERM HYST]\n"
  587. " - Set config options.\n"
  588. "\n"
  589. "All values can be decimal or hex (hex preceded with 0x).\n"
  590. "Only whole numbers are supported for external limits.");
  591. #if 0
  592. U_BOOT_CMD (loadace, 2, 0, do_loadace,
  593. "load fpga configuration from System ACE compact flash",
  594. "N\n"
  595. " - Load configuration N (0-7) from System ACE compact flash\n"
  596. "loadace\n" " - loads default configuration");
  597. #endif
  598. U_BOOT_CMD (swconfig, 2, 0, do_swconfigbyte,
  599. "display or modify the software configuration byte",
  600. "N [ADDRESS]\n"
  601. " - set software configuration byte to N, optionally use ADDRESS as\n"
  602. " location of buffer for flash copy\n"
  603. "swconfig\n" " - display software configuration byte");
  604. U_BOOT_CMD (pause, 2, 0, do_pause,
  605. "sleep processor until any key is pressed with poll time of N seconds",
  606. "N\n"
  607. " - sleep processor until any key is pressed with poll time of N seconds\n"
  608. "pause\n"
  609. " - sleep processor until any key is pressed with poll time of 1 second");
  610. U_BOOT_CMD (swrecon, 1, 0, do_swreconfig,
  611. "trigger a board reconfigure to the software selected configuration",
  612. "\n"
  613. " - trigger a board reconfigure to the software selected configuration");
  614. int board_eth_init(bd_t *bis)
  615. {
  616. return pci_eth_init(bis);
  617. }