John Otken | d4024bb | 2007-07-26 17:49:11 +0200 | [diff] [blame] | 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 | |
| 21 | #include <config.h> |
| 22 | #include <common.h> |
| 23 | #include <command.h> |
| 24 | #include <asm/processor.h> |
| 25 | #include <i2c.h> |
| 26 | |
| 27 | #define PCI_M66EN 0x10 |
| 28 | |
| 29 | static uchar buf_33[] = |
| 30 | { |
| 31 | 0xb5, /* 0x00:hce =1, bss = 0, pae=1, ppdv= 0b10,spe = 1,ebw=0b01*/ |
| 32 | 0x80, /* 0x01~0x03:ptm1ms =0x80000001 */ |
| 33 | 0x00, |
| 34 | 0x00, |
| 35 | 0x00, /* 0x04~0x06:ptm1la = 0x00000000 */ |
| 36 | 0x00, |
| 37 | 0x00, |
| 38 | 0x00, /* 0x07~0x09:ptm2ma = 0x00000000 */ |
| 39 | 0x00, |
| 40 | 0x00, |
| 41 | 0x00, /* 0x0a~0x0c:ptm2la = 0x00000000 */ |
| 42 | 0x00, |
| 43 | 0x00, |
| 44 | 0x10, /* 0x0d~0x0e:vendor id 0x1014*/ |
| 45 | 0x14, |
| 46 | 0x00, /* 0x0f~0x10:device id 0x0000*/ |
| 47 | 0x00, |
| 48 | 0x00, /* 0x11:revision 0x00 */ |
| 49 | 0x00, /* 0x12~0x14:class 0x000000 */ |
| 50 | 0x00, |
| 51 | 0x00, |
| 52 | 0x10, /* 0x15~0x16:subsystem vendor id */ |
| 53 | 0xe8, |
| 54 | 0x00, /* 0x17~0x18:subsystem device id */ |
| 55 | 0x00, |
| 56 | 0x61, /* 0x19: opdv=0b01,cbdv=0b10,ccdv=0b00,ptm2ms_ena=0, ptm1ms_ena=1 */ |
| 57 | 0x68, /* 0x1a: rpci=1,fbmul=0b1010,epdv=0b00 */ |
| 58 | 0x2d, /* 0x1b: fwdvb=0b101,fwdva=0b101 */ |
| 59 | 0x82, /* 0x1c: pllr=1,sscs=0,mpdv=0b00,tun[22-23]=0b10 */ |
| 60 | 0xbe, /* 0x1d: tun[24-31]=0xbe */ |
| 61 | 0x00, |
| 62 | 0x00 |
| 63 | }; |
| 64 | |
| 65 | static uchar buf_66[] = |
| 66 | { |
| 67 | 0xb5, /* 0x00:hce =1, bss = 0, pae=1, ppdv= 0b10,spe = 1,ebw=0b01*/ |
| 68 | 0x80, /* 0x01~0x03:ptm1ms =0x80000001 */ |
| 69 | 0x00, |
| 70 | 0x00, |
| 71 | 0x00, /* 0x04~0x06:ptm1la = 0x00000000 */ |
| 72 | 0x00, |
| 73 | 0x00, |
| 74 | 0x00, /* 0x07~0x09:ptm2ma = 0x00000000 */ |
| 75 | 0x00, |
| 76 | 0x00, |
| 77 | 0x00, /* 0x0a~0x0c:ptm2la = 0x00000000 */ |
| 78 | 0x00, |
| 79 | 0x00, |
| 80 | 0x10, /* 0x0d~0x0e:vendor id 0x1014*/ |
| 81 | 0x14, |
| 82 | 0x00, /* 0x0f~0x10:device id 0x0000*/ |
| 83 | 0x00, |
| 84 | 0x00, /* 0x11:revision 0x00 */ |
| 85 | 0x00, /* 0x12~0x14:class 0x000000 */ |
| 86 | 0x00, |
| 87 | 0x00, |
| 88 | 0x10, /* 0x15~0x16:subsystem vendor id */ |
| 89 | 0xe8, |
| 90 | 0x00, /* 0x17~0x18:subsystem device id */ |
| 91 | 0x00, |
| 92 | 0x61, /* 0x19: opdv=0b01,cbdv=0b10,ccdv=0b00,ptm2ms_ena=0, ptm1ms_ena=1 */ |
| 93 | 0x68, /* 0x1a: rpci=1,fbmul=0b1010,epdv=0b00 */ |
| 94 | 0x2d, /* 0x1b: fwdvb=0b101,fwdva=0b101 */ |
| 95 | 0x82, /* 0x1c: pllr=1,sscs=0,mpdv=0b00,tun[22-23]=0b10 */ |
| 96 | 0xbe, /* 0x1d: tun[24-31]=0xbe */ |
| 97 | 0x00, |
| 98 | 0x00 |
| 99 | }; |
| 100 | |
| 101 | static int update_boot_eeprom(cmd_tbl_t* cmdtp, int flag, int argc, char *argv[]) |
| 102 | { |
| 103 | ulong len = 0x20; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 104 | uchar chip = CONFIG_SYS_I2C_EEPROM_ADDR; |
John Otken | d4024bb | 2007-07-26 17:49:11 +0200 | [diff] [blame] | 105 | uchar *pbuf; |
| 106 | uchar base; |
| 107 | int i; |
| 108 | |
| 109 | if ((*(volatile char*)CPLD_REG0_ADDR & PCI_M66EN) != PCI_M66EN) { |
| 110 | pbuf = buf_33; |
| 111 | base = 0x00; |
| 112 | } else { |
| 113 | pbuf = buf_66; |
| 114 | base = 0x40; |
| 115 | } |
| 116 | |
| 117 | for (i = 0; i< len; i++, base++) { |
| 118 | if (i2c_write(chip, base, 1, &pbuf[i],1)!= 0) { |
| 119 | printf("i2c_write fail\n"); |
| 120 | return 1; |
| 121 | } |
| 122 | udelay(11000); |
| 123 | } |
| 124 | |
| 125 | return 0; |
| 126 | } |
| 127 | |
| 128 | U_BOOT_CMD ( |
| 129 | update_boot_eeprom, 1, 1, update_boot_eeprom, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 130 | "update boot eeprom content", |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 131 | "" |
| 132 | ); |