update.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * See file CREDITS for list of people who contributed to this
  3. * project.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. */
  20. #include <config.h>
  21. #include <common.h>
  22. #include <command.h>
  23. #include <asm/processor.h>
  24. #include <i2c.h>
  25. #define PCI_M66EN 0x10
  26. static uchar buf_33[] =
  27. {
  28. 0xb5, /* 0x00:hce =1, bss = 0, pae=1, ppdv= 0b10,spe = 1,ebw=0b01*/
  29. 0x80, /* 0x01~0x03:ptm1ms =0x80000001 */
  30. 0x00,
  31. 0x00,
  32. 0x00, /* 0x04~0x06:ptm1la = 0x00000000 */
  33. 0x00,
  34. 0x00,
  35. 0x00, /* 0x07~0x09:ptm2ma = 0x00000000 */
  36. 0x00,
  37. 0x00,
  38. 0x00, /* 0x0a~0x0c:ptm2la = 0x00000000 */
  39. 0x00,
  40. 0x00,
  41. 0x10, /* 0x0d~0x0e:vendor id 0x1014*/
  42. 0x14,
  43. 0x00, /* 0x0f~0x10:device id 0x0000*/
  44. 0x00,
  45. 0x00, /* 0x11:revision 0x00 */
  46. 0x00, /* 0x12~0x14:class 0x000000 */
  47. 0x00,
  48. 0x00,
  49. 0x10, /* 0x15~0x16:subsystem vendor id */
  50. 0xe8,
  51. 0x00, /* 0x17~0x18:subsystem device id */
  52. 0x00,
  53. 0x61, /* 0x19: opdv=0b01,cbdv=0b10,ccdv=0b00,ptm2ms_ena=0, ptm1ms_ena=1 */
  54. 0x68, /* 0x1a: rpci=1,fbmul=0b1010,epdv=0b00 */
  55. 0x2d, /* 0x1b: fwdvb=0b101,fwdva=0b101 */
  56. 0x82, /* 0x1c: pllr=1,sscs=0,mpdv=0b00,tun[22-23]=0b10 */
  57. 0xbe, /* 0x1d: tun[24-31]=0xbe */
  58. 0x00,
  59. 0x00
  60. };
  61. static uchar buf_66[] =
  62. {
  63. 0xb5, /* 0x00:hce =1, bss = 0, pae=1, ppdv= 0b10,spe = 1,ebw=0b01*/
  64. 0x80, /* 0x01~0x03:ptm1ms =0x80000001 */
  65. 0x00,
  66. 0x00,
  67. 0x00, /* 0x04~0x06:ptm1la = 0x00000000 */
  68. 0x00,
  69. 0x00,
  70. 0x00, /* 0x07~0x09:ptm2ma = 0x00000000 */
  71. 0x00,
  72. 0x00,
  73. 0x00, /* 0x0a~0x0c:ptm2la = 0x00000000 */
  74. 0x00,
  75. 0x00,
  76. 0x10, /* 0x0d~0x0e:vendor id 0x1014*/
  77. 0x14,
  78. 0x00, /* 0x0f~0x10:device id 0x0000*/
  79. 0x00,
  80. 0x00, /* 0x11:revision 0x00 */
  81. 0x00, /* 0x12~0x14:class 0x000000 */
  82. 0x00,
  83. 0x00,
  84. 0x10, /* 0x15~0x16:subsystem vendor id */
  85. 0xe8,
  86. 0x00, /* 0x17~0x18:subsystem device id */
  87. 0x00,
  88. 0x61, /* 0x19: opdv=0b01,cbdv=0b10,ccdv=0b00,ptm2ms_ena=0, ptm1ms_ena=1 */
  89. 0x68, /* 0x1a: rpci=1,fbmul=0b1010,epdv=0b00 */
  90. 0x2d, /* 0x1b: fwdvb=0b101,fwdva=0b101 */
  91. 0x82, /* 0x1c: pllr=1,sscs=0,mpdv=0b00,tun[22-23]=0b10 */
  92. 0xbe, /* 0x1d: tun[24-31]=0xbe */
  93. 0x00,
  94. 0x00
  95. };
  96. static int update_boot_eeprom(cmd_tbl_t* cmdtp, int flag, int argc, char *argv[])
  97. {
  98. ulong len = 0x20;
  99. uchar chip = CONFIG_SYS_I2C_EEPROM_ADDR;
  100. uchar *pbuf;
  101. uchar base;
  102. int i;
  103. if ((*(volatile char*)CPLD_REG0_ADDR & PCI_M66EN) != PCI_M66EN) {
  104. pbuf = buf_33;
  105. base = 0x00;
  106. } else {
  107. pbuf = buf_66;
  108. base = 0x40;
  109. }
  110. for (i = 0; i< len; i++, base++) {
  111. if (i2c_write(chip, base, 1, &pbuf[i],1)!= 0) {
  112. printf("i2c_write fail\n");
  113. return 1;
  114. }
  115. udelay(11000);
  116. }
  117. return 0;
  118. }
  119. U_BOOT_CMD (
  120. update_boot_eeprom, 1, 1, update_boot_eeprom,
  121. "update boot eeprom content",
  122. ""
  123. );