update.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * (C) Copyright 2007
  3. * Stefan Roese, DENX Software Engineering, sr@denx.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. #include <config.h>
  24. #include <common.h>
  25. #include <command.h>
  26. #include <asm/processor.h>
  27. #include <i2c.h>
  28. #if defined(CONFIG_TAISHAN)
  29. const uchar bootstrap_buf[16] = {
  30. 0x86,
  31. 0x78,
  32. 0xc1,
  33. 0xa6,
  34. 0x09,
  35. 0x67,
  36. 0x04,
  37. 0x63,
  38. 0x00,
  39. 0x00,
  40. 0x00,
  41. 0x00,
  42. 0x00,
  43. 0x00,
  44. 0x00,
  45. 0x00
  46. };
  47. static int update_boot_eeprom(void)
  48. {
  49. ulong len = 0x10;
  50. uchar chip = CONFIG_SYS_BOOTSTRAP_IIC_ADDR;
  51. uchar *pbuf = (uchar *)bootstrap_buf;
  52. int ii, jj;
  53. for (ii = 0; ii < len; ii++) {
  54. if (i2c_write(chip, ii, 1, &pbuf[ii], 1) != 0) {
  55. printf("i2c_write failed\n");
  56. return -1;
  57. }
  58. /* wait 10ms */
  59. for (jj = 0; jj < 10; jj++)
  60. udelay(1000);
  61. }
  62. return 0;
  63. }
  64. int do_update_boot_eeprom(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  65. {
  66. return update_boot_eeprom();
  67. }
  68. U_BOOT_CMD(update_boot_eeprom, 1, 1, do_update_boot_eeprom,
  69. "update bootstrap eeprom content", "");
  70. #endif