3 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
5 * See file CREDITS for list of people who contributed to this
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.
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.
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,
33 extern u_long pci9054_iobase;
36 /***************************************************************************
38 * Routines for PLX PCI9054 eeprom access
42 static unsigned int PciEepromReadLongVPD (int offs)
48 pci_write_config_dword (CONFIG_SYS_PCI9054_DEV_FN, 0x4c,
49 (offs << 16) | 0x0003);
54 pci_read_config_dword (CONFIG_SYS_PCI9054_DEV_FN, 0x4c, &ret);
55 if ((ret & 0x80000000) != 0) {
60 printf ("\nTimeout: ret=%08x - Please try again!\n", ret);
66 pci_read_config_dword (CONFIG_SYS_PCI9054_DEV_FN, 0x50, &value);
72 static int PciEepromWriteLongVPD (int offs, unsigned int value)
77 pci_write_config_dword (CONFIG_SYS_PCI9054_DEV_FN, 0x50, value);
78 pci_write_config_dword (CONFIG_SYS_PCI9054_DEV_FN, 0x4c,
79 (offs << 16) | 0x80000003);
84 pci_read_config_dword (CONFIG_SYS_PCI9054_DEV_FN, 0x4c, &ret);
85 if ((ret & 0x80000000) == 0) {
90 printf ("\nTimeout: ret=%08x - Please try again!\n", ret);
100 static void showPci9054 (void)
105 /* read 9054-values */
106 for (l = 0; l < 6; l++) {
107 printf ("%02x: ", l * 0x10);
108 for (i = 0; i < 4; i++) {
109 pci_read_config_dword (CONFIG_SYS_PCI9054_DEV_FN,
111 (unsigned int *)&val);
112 printf ("%08x ", val);
118 for (l = 0; l < 7; l++) {
119 printf ("%02x: ", l * 0x10);
120 for (i = 0; i < 4; i++)
122 PciEepromReadLongVPD ((i + l * 4) * 4));
129 static void updatePci9054 (void)
132 * Set EEPROM write-protect register to 0
134 out_be32 ((void *)(pci9054_iobase + 0x0c),
135 in_be32 ((void *)(pci9054_iobase + 0x0c)) & 0xffff00ff);
137 /* Long Serial EEPROM Load Registers... */
138 PciEepromWriteLongVPD (0x00, 0x905410b5);
139 PciEepromWriteLongVPD (0x04, 0x09800001); /* other input controller */
140 PciEepromWriteLongVPD (0x08, 0x28140100);
142 PciEepromWriteLongVPD (0x0c, 0x00000000); /* MBOX0... */
143 PciEepromWriteLongVPD (0x10, 0x00000000);
145 /* las0: fpga access (0x0000.0000 ... 0x0003.ffff) */
146 PciEepromWriteLongVPD (0x14, 0xfffc0000); /* LAS0RR... */
147 PciEepromWriteLongVPD (0x18, 0x00000001); /* LAS0BA */
149 PciEepromWriteLongVPD (0x1c, 0x00200000); /* MARBR... */
150 PciEepromWriteLongVPD (0x20, 0x00300500); /* LMISC/BIGEND */
152 PciEepromWriteLongVPD (0x24, 0x00000000); /* EROMRR... */
153 PciEepromWriteLongVPD (0x28, 0x00000000); /* EROMBA */
155 PciEepromWriteLongVPD (0x2c, 0x43030000); /* LBRD0... */
157 PciEepromWriteLongVPD (0x30, 0x00000000); /* DMRR... */
158 PciEepromWriteLongVPD (0x34, 0x00000000);
159 PciEepromWriteLongVPD (0x38, 0x00000000);
161 PciEepromWriteLongVPD (0x3c, 0x00000000); /* DMPBAM... */
162 PciEepromWriteLongVPD (0x40, 0x00000000);
164 /* Extra Long Serial EEPROM Load Registers... */
165 PciEepromWriteLongVPD (0x44, 0x010212fe); /* PCISID... */
167 /* las1: 505-sram access (0x0004.0000 ... 0x001f.ffff) */
168 /* Offset to LAS1: Group 1: 0x00040000 */
169 /* Group 2: 0x00080000 */
170 /* Group 3: 0x000c0000 */
171 PciEepromWriteLongVPD (0x48, 0xffe00000); /* LAS1RR */
172 PciEepromWriteLongVPD (0x4c, 0x00040001); /* LAS1BA */
173 PciEepromWriteLongVPD (0x50, 0x00000208); /* LBRD1 */ /* so wars bisher */
175 PciEepromWriteLongVPD (0x54, 0x00004c06); /* HotSwap... */
177 printf ("Finished writing defaults into PLX PCI9054 EEPROM!\n");
181 static void clearPci9054 (void)
184 * Set EEPROM write-protect register to 0
186 out_be32 ((void *)(pci9054_iobase + 0x0c),
187 in_be32 ((void *)(pci9054_iobase + 0x0c)) & 0xffff00ff);
189 /* Long Serial EEPROM Load Registers... */
190 PciEepromWriteLongVPD (0x00, 0xffffffff);
191 PciEepromWriteLongVPD (0x04, 0xffffffff); /* other input controller */
193 printf ("Finished clearing PLX PCI9054 EEPROM!\n");
197 /* ------------------------------------------------------------------------- */
198 int do_pci9054 (cmd_tbl_t * cmdtp, int flag, int argc,
201 if (strcmp (argv[1], "info") == 0) {
206 if (strcmp (argv[1], "update") == 0) {
211 if (strcmp (argv[1], "clear") == 0) {
216 return cmd_usage(cmdtp);
220 pci9054, 3, 1, do_pci9054,
221 "PLX PCI9054 EEPROM access",
222 "pci9054 info - print EEPROM values\n"
223 "pci9054 update - updates EEPROM with default values"
226 /* ------------------------------------------------------------------------- */