]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/esd/pci405/cmd_pci405.c
2 * (C) Copyright 2002-2004
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,
30 #include <asm/4xx_pci.h>
31 #include <asm/processor.h>
36 #if defined(CONFIG_CMD_BSP)
38 extern int do_bootm (cmd_tbl_t
*, int, int, char *[]);
39 extern int do_bootvx (cmd_tbl_t
*, int, int, char *[]);
40 unsigned long get_dcr(unsigned short);
44 * Command loadpci: wait for signal from host and boot image.
46 int do_loadpci(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
48 unsigned int *ptr
= 0;
62 puts("\nWaiting for image from pci host -");
65 * Wait for host to write the start address
67 while (*ptr
== 0xffffffff) {
71 putc(0x08); /* backspace */
72 putc(str
[count2
% 4]);
75 /* Abort if ctrl-c was pressed */
84 if (*ptr
== PCI_RECONFIG_MAGIC
) {
86 * Save own pci configuration in PRAM
88 memset((char *)PCI_REGS_ADDR
, 0, PCI_REGS_LEN
);
89 ptr
= (unsigned int *)PCI_REGS_ADDR
+ 1;
90 for (i
=0; i
<0x40; i
+=4) {
91 pci_read_config_dword(PCIDEVID_405GP
, i
, ptr
++);
93 ptr
= (unsigned int *)PCI_REGS_ADDR
;
94 *ptr
= crc32(0, (uchar
*)PCI_REGS_ADDR
+4, PCI_REGS_LEN
-4);
96 printf("\nStoring PCI Configuration Regs...\n");
98 sprintf(addr
, "%08x", *ptr
);
104 if (*ptr
& 0x00000001) {
106 * Boot VxWorks image via bootvx
108 addr
[strlen(addr
)-1] = '0';
109 printf("\nBooting VxWorks-Image at addr 0x%s ...\n", addr
);
110 setenv("loadaddr", addr
);
112 local_args
[0] = argv
[0];
113 local_args
[1] = NULL
;
114 status
= do_bootvx (cmdtp
, 0, 1, local_args
);
117 * Boot image via bootm (normally Linux)
119 printf("\nBooting Image at addr 0x%s ...\n", addr
);
120 setenv("loadaddr", addr
);
122 local_args
[0] = argv
[0];
123 local_args
[1] = NULL
;
124 status
= do_bootm (cmdtp
, 0, 1, local_args
);
128 * Boot image via bootm
130 printf("\nBooting Image at addr 0x%s ...\n", addr
);
131 setenv("loadaddr", addr
);
133 local_args
[0] = argv
[0];
134 local_args
[1] = NULL
;
135 status
= do_bootm (cmdtp
, 0, 1, local_args
);
142 loadpci
, 1, 1, do_loadpci
,
143 "loadpci - Wait for pci-image and boot it\n",
149 #if 1 /* test-only */
150 int do_getpci(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
155 printf("\nPCI Configuration Regs for PPC405GP:");
156 for (i
=0; i
<0x64; i
+=4) {
157 pci_read_config_dword(PCIDEVID_405GP
, i
, &val
);
159 printf("\n%02x: ", i
);
161 printf("%08x ", val
);
168 getpci
, 1, 1, do_getpci
,
169 "getpci - Print own pci configuration registers\n",
173 int do_setpci(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
178 addr
= simple_strtol (argv
[1], NULL
, 16);
179 val
= simple_strtol (argv
[2], NULL
, 16);
181 printf("\nWriting %08x to PCI reg %08x.\n", val
, addr
);
182 pci_write_config_dword(PCIDEVID_405GP
, addr
, val
);
187 setpci
, 3, 1, do_setpci
,
188 "setpci - Set one pci configuration lword\n",
190 " - Write pci configuration lword <val> to <addr>.\n"
193 int do_dumpdcr(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
197 printf("\nDevice Configuration Registers (DCR's) for PPC405GP:");
198 for (i
=0; i
<=0x1e0; i
++) {
200 printf("\n%04x ", i
);
202 printf("%08lx ", get_dcr(i
));
209 dumpdcr
, 1, 1, do_dumpdcr
,
210 "dumpdcr - Dump all DCR registers\n",
215 int do_dumpspr(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
217 printf("\nSpecial Purpose Registers (SPR's) for PPC405GP:");
218 printf("\n%04x %08x ", 947, mfspr(947));
219 printf("\n%04x %08x ", 9, mfspr(9));
220 printf("\n%04x %08x ", 1014, mfspr(1014));
221 printf("\n%04x %08x ", 1015, mfspr(1015));
222 printf("\n%04x %08x ", 1010, mfspr(1010));
223 printf("\n%04x %08x ", 957, mfspr(957));
224 printf("\n%04x %08x ", 1008, mfspr(1008));
225 printf("\n%04x %08x ", 1018, mfspr(1018));
226 printf("\n%04x %08x ", 954, mfspr(954));
227 printf("\n%04x %08x ", 950, mfspr(950));
228 printf("\n%04x %08x ", 951, mfspr(951));
229 printf("\n%04x %08x ", 981, mfspr(981));
230 printf("\n%04x %08x ", 980, mfspr(980));
231 printf("\n%04x %08x ", 982, mfspr(982));
232 printf("\n%04x %08x ", 1012, mfspr(1012));
233 printf("\n%04x %08x ", 1013, mfspr(1013));
234 printf("\n%04x %08x ", 948, mfspr(948));
235 printf("\n%04x %08x ", 949, mfspr(949));
236 printf("\n%04x %08x ", 1019, mfspr(1019));
237 printf("\n%04x %08x ", 979, mfspr(979));
238 printf("\n%04x %08x ", 8, mfspr(8));
239 printf("\n%04x %08x ", 945, mfspr(945));
240 printf("\n%04x %08x ", 987, mfspr(987));
241 printf("\n%04x %08x ", 287, mfspr(287));
242 printf("\n%04x %08x ", 953, mfspr(953));
243 printf("\n%04x %08x ", 955, mfspr(955));
244 printf("\n%04x %08x ", 272, mfspr(272));
245 printf("\n%04x %08x ", 273, mfspr(273));
246 printf("\n%04x %08x ", 274, mfspr(274));
247 printf("\n%04x %08x ", 275, mfspr(275));
248 printf("\n%04x %08x ", 260, mfspr(260));
249 printf("\n%04x %08x ", 276, mfspr(276));
250 printf("\n%04x %08x ", 261, mfspr(261));
251 printf("\n%04x %08x ", 277, mfspr(277));
252 printf("\n%04x %08x ", 262, mfspr(262));
253 printf("\n%04x %08x ", 278, mfspr(278));
254 printf("\n%04x %08x ", 263, mfspr(263));
255 printf("\n%04x %08x ", 279, mfspr(279));
256 printf("\n%04x %08x ", 26, mfspr(26));
257 printf("\n%04x %08x ", 27, mfspr(27));
258 printf("\n%04x %08x ", 990, mfspr(990));
259 printf("\n%04x %08x ", 991, mfspr(991));
260 printf("\n%04x %08x ", 956, mfspr(956));
261 printf("\n%04x %08x ", 284, mfspr(284));
262 printf("\n%04x %08x ", 285, mfspr(285));
263 printf("\n%04x %08x ", 986, mfspr(986));
264 printf("\n%04x %08x ", 984, mfspr(984));
265 printf("\n%04x %08x ", 256, mfspr(256));
266 printf("\n%04x %08x ", 1, mfspr(1));
267 printf("\n%04x %08x ", 944, mfspr(944));
273 dumpspr
, 1, 1, do_dumpspr
,
274 "dumpspr - Dump all SPR registers\n",
279 #define PCI0_BRDGOPT1 0x4a
280 #define plb0_acr 0x87
282 int do_getplb(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
286 printf("PLB0_ACR=%08lx\n", get_dcr(0x87));
287 pci_read_config_word(PCIDEVID_405GP
, PCI0_BRDGOPT1
, &val
);
288 printf("PCI0_BRDGOPT1=%04x\n", val
);
289 printf("CCR0=%08x\n", mfspr(ccr0
));
294 getplb
, 1, 1, do_getplb
,
295 "getplb - Dump all plb arbiter registers\n",
299 int do_setplb(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
302 unsigned int my_brdgopt1
;
303 unsigned int my_ccr0
;
305 my_acr
= simple_strtol (argv
[1], NULL
, 16);
306 my_brdgopt1
= simple_strtol (argv
[2], NULL
, 16);
307 my_ccr0
= simple_strtol (argv
[3], NULL
, 16);
309 mtdcr(plb0_acr
, my_acr
);
310 pci_write_config_word(PCIDEVID_405GP
, PCI0_BRDGOPT1
, my_brdgopt1
);
311 mtspr(ccr0
, my_ccr0
);
316 setplb
, 4, 1, do_setplb
,
317 "setplb - Set all plb arbiter registers\n",
318 "PLB0_ACR PCI0_BRDGOPT1 CCR0\n"
319 " - Set all plb arbiter registers\n"
323 /***********************************************************************
325 * The following code is only for test purposes!!!!
326 * Please ignore this ugly stuff!!!!!!!!!!!!!!!!!!!
328 ***********************************************************************/
330 #define PCI_ADDR 0xc0000000
332 int do_writepci(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
336 unsigned int countmax
;
339 volatile unsigned long *ptr
;
340 volatile unsigned long val
;
342 int test_pci_read
= 0;
343 int test_pci_cfg_write
= 0;
345 int test_pci_pre_read
= 0;
347 addr
= simple_strtol (argv
[1], NULL
, 16);
348 size
= simple_strtol (argv
[2], NULL
, 16);
349 countmax
= simple_strtol (argv
[3], NULL
, 16);
353 do_getplb(NULL
, 0, 0, NULL
);
357 out32r(PMM0PCILA
, 0);
358 out32r(PMM0PCIHA
, 0);
360 out32r(PMM1LA
, PCI_ADDR
);
361 out32r(PMM1PCILA
, addr
& 0xff000000);
362 out32r(PMM1PCIHA
, 0x00000000);
363 out32r(PMM1MA
, 0xff000001);
366 printf("PMM1LA =%08lx\n", in32r(PMM1LA
));
367 printf("PMM1MA =%08lx\n", in32r(PMM1MA
));
368 printf("PMM1PCILA =%08lx\n", in32r(PMM1PCILA
));
369 printf("PMM1PCIHA =%08lx\n", in32r(PMM1PCIHA
));
371 addr
= PCI_ADDR
| (addr
& 0x00ffffff);
372 printf("\nWriting at addr %08x, size %08x (countmax=%x)\n", addr
, size
, countmax
);
376 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
378 val
= *(ulong
*)0x00000000;
379 if (val
& 0x00000008) {
380 test_pci_pre_read
= 1;
381 printf("Running test with pre pci-memory-read access!\n");
383 if (val
& 0x00000004) {
385 printf("Running test with sync instruction!\n");
387 if (val
& 0x00000001) {
389 printf("Running test with pci-memory-read access!\n");
391 if (val
& 0x00000002) {
392 test_pci_cfg_write
= 1;
393 printf("Running test with pci-config-write access!\n");
398 if (test_pci_pre_read
) {
400 * Read one value back
402 ptr
= (volatile unsigned long *)addr
;
407 * Write some values to host via pci busmastering
409 ptr
= (volatile unsigned long *)addr
;
410 for (i
=0; i
<max
; i
++) {
416 * Sync previous writes
423 * Read one value back
425 ptr
= (volatile unsigned long *)addr
;
429 if (test_pci_cfg_write
) {
431 * Generate IRQ to host via config regs
433 pci_write_config_byte(PCIDEVID_405GP
, 0x44, 0x00);
436 if (loopcount
++ > countmax
) {
437 /* Abort if ctrl-c was pressed */
452 writepci
, 4, 1, do_writepci
,
453 "writepci - Write some data to pcibus\n",
455 " - Write some data to pcibus.\n"
458 #define PCI_CFGADDR 0xeec00000
459 #define PCI_CFGDATA 0xeec00004
461 int ibmPciConfigWrite
463 int offset
, /* offset into the configuration space */
464 int width
, /* data width */
465 unsigned int data
/* data to be written */
469 * Write config register address to the PCI config address register
470 * bit 31 must be 1 and bits 1:0 must be 0 (note LE bit notation)
472 out32r(PCI_CFGADDR
, 0x80000000 | (offset
& 0xFFFFFFFC));
474 #if 0 /* test-only */
479 * Write value to be written to the PCI config data register
482 case 1: out32r(PCI_CFGDATA
| (offset
& 0x3), (unsigned char)(data
& 0xFF));
484 case 2: out32r(PCI_CFGDATA
| (offset
& 0x3), (unsigned short)(data
& 0xFFFF));
486 case 4: out32r(PCI_CFGDATA
| (offset
& 0x3), data
);
493 int do_writepci2(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
497 unsigned int countmax
;
499 volatile unsigned long *ptr
;
500 volatile unsigned long val
;
503 addr
= simple_strtol (argv
[1], NULL
, 16);
504 size
= simple_strtol (argv
[2], NULL
, 16);
505 countmax
= simple_strtol (argv
[3], NULL
, 16);
509 do_getplb(NULL
, 0, 0, NULL
);
513 out32r(PMM0PCILA
, 0);
514 out32r(PMM0PCIHA
, 0);
516 out32r(PMM1LA
, PCI_ADDR
);
517 out32r(PMM1PCILA
, addr
& 0xff000000);
518 out32r(PMM1PCIHA
, 0x00000000);
519 out32r(PMM1MA
, 0xff000001);
522 printf("PMM1LA =%08lx\n", in32r(PMM1LA
));
523 printf("PMM1MA =%08lx\n", in32r(PMM1MA
));
524 printf("PMM1PCILA =%08lx\n", in32r(PMM1PCILA
));
525 printf("PMM1PCIHA =%08lx\n", in32r(PMM1PCIHA
));
527 addr
= PCI_ADDR
| (addr
& 0x00ffffff);
528 printf("\nWriting at addr %08x, size %08x (countmax=%x)\n", addr
, size
, countmax
);
532 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
537 * Write one values to host via pci busmastering
539 ptr
= (volatile unsigned long *)addr
;
543 * Read one value back
545 ptr
= (volatile unsigned long *)addr
;
549 * One pci config write
551 /* pci_write_config_byte(PCIDEVID_405GP, 0x44, 0x00); */
552 /* ibmPciConfigWrite(0x44, 1, 0x00); */
553 ibmPciConfigWrite(0x2e, 2, 0x1234); /* subsystem id */
555 if (loopcount
++ > countmax
) {
556 /* Abort if ctrl-c was pressed */
571 writepci2
, 4, 1, do_writepci2
,
572 "writepci2- Write some data to pcibus\n",
574 " - Write some data to pcibus.\n"
577 int do_writepci22(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
581 unsigned int countmax
= 0;
582 volatile unsigned long *ptr
;
583 volatile unsigned long val
;
585 addr
= simple_strtol (argv
[1], NULL
, 16);
586 size
= simple_strtol (argv
[2], NULL
, 16);
588 addr
= PCI_ADDR
| (addr
& 0x00ffffff);
589 printf("\nWriting at addr %08x, size %08x (countmax=%x)\n", addr
, size
, countmax
);
590 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
595 * Write one values to host via pci busmastering
597 ptr
= (volatile unsigned long *)addr
;
601 * Read one value back
603 ptr
= (volatile unsigned long *)addr
;
607 * One pci config write
609 ibmPciConfigWrite(0x2e, 2, 0x1234); /* subsystem id */
615 writepci22
, 4, 1, do_writepci22
,
616 "writepci22- Write some data to pcibus\n",
618 " - Write some data to pcibus.\n"
621 int ibmPciConfigWrite3
623 int offset
, /* offset into the configuration space */
624 int width
, /* data width */
625 unsigned int data
/* data to be written */
629 * Write config register address to the PCI config address register
630 * bit 31 must be 1 and bits 1:0 must be 0 (note LE bit notation)
632 out32r(PCI_CFGADDR
, 0x80000000 | (offset
& 0xFFFFFFFC));
634 #if 1 /* test-only */
639 * Write value to be written to the PCI config data register
642 case 1: out32r(PCI_CFGDATA
| (offset
& 0x3), (unsigned char)(data
& 0xFF));
644 case 2: out32r(PCI_CFGDATA
| (offset
& 0x3), (unsigned short)(data
& 0xFFFF));
646 case 4: out32r(PCI_CFGDATA
| (offset
& 0x3), data
);
653 int do_writepci3(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
657 unsigned int countmax
;
659 volatile unsigned long *ptr
;
660 volatile unsigned long val
;
663 addr
= simple_strtol (argv
[1], NULL
, 16);
664 size
= simple_strtol (argv
[2], NULL
, 16);
665 countmax
= simple_strtol (argv
[3], NULL
, 16);
669 do_getplb(NULL
, 0, 0, NULL
);
673 out32r(PMM0PCILA
, 0);
674 out32r(PMM0PCIHA
, 0);
676 out32r(PMM1LA
, PCI_ADDR
);
677 out32r(PMM1PCILA
, addr
& 0xff000000);
678 out32r(PMM1PCIHA
, 0x00000000);
679 out32r(PMM1MA
, 0xff000001);
682 printf("PMM1LA =%08lx\n", in32r(PMM1LA
));
683 printf("PMM1MA =%08lx\n", in32r(PMM1MA
));
684 printf("PMM1PCILA =%08lx\n", in32r(PMM1PCILA
));
685 printf("PMM1PCIHA =%08lx\n", in32r(PMM1PCIHA
));
687 addr
= PCI_ADDR
| (addr
& 0x00ffffff);
688 printf("\nWriting at addr %08x, size %08x (countmax=%x)\n", addr
, size
, countmax
);
692 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
697 * Write one values to host via pci busmastering
699 ptr
= (volatile unsigned long *)addr
;
703 * Read one value back
705 ptr
= (volatile unsigned long *)addr
;
709 * One pci config write
711 /* pci_write_config_byte(PCIDEVID_405GP, 0x44, 0x00); */
712 /* ibmPciConfigWrite(0x44, 1, 0x00); */
713 ibmPciConfigWrite3(0x2e, 2, 0x1234); /* subsystem id */
715 if (loopcount
++ > countmax
) {
716 /* Abort if ctrl-c was pressed */
731 writepci3
, 4, 1, do_writepci3
,
732 "writepci3- Write some data to pcibus\n",
734 " - Write some data to pcibus.\n"
738 #define SECTOR_SIZE 32 /* 32 byte cache line */
739 #define SECTOR_MASK 0x1F
741 void my_flush_dcache(ulong lcl_addr
, ulong count
)
743 unsigned int lcl_target
;
745 /* promote to nearest cache sector */
746 lcl_target
= (lcl_addr
+ count
+ SECTOR_SIZE
- 1) & ~SECTOR_MASK
;
747 lcl_addr
&= ~SECTOR_MASK
;
748 while (lcl_addr
!= lcl_target
)
750 /* ppcDcbf((void *)lcl_addr);*/
751 __asm__("dcbf 0,%0": :"r" (lcl_addr
));
752 lcl_addr
+= SECTOR_SIZE
;
754 __asm__("sync"); /* Always flush prefetch queue in any case */
757 int do_writepci_cache(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
761 unsigned int countmax
;
763 volatile unsigned long *ptr
;
764 volatile unsigned long val
;
767 addr
= simple_strtol (argv
[1], NULL
, 16);
768 size
= simple_strtol (argv
[2], NULL
, 16);
769 countmax
= simple_strtol (argv
[3], NULL
, 16);
773 do_getplb(NULL
, 0, 0, NULL
);
777 out32r(PMM0PCILA
, 0);
778 out32r(PMM0PCIHA
, 0);
780 out32r(PMM1LA
, PCI_ADDR
);
781 out32r(PMM1PCILA
, addr
& 0xff000000);
782 out32r(PMM1PCIHA
, 0x00000000);
783 out32r(PMM1MA
, 0xff000001);
786 printf("PMM1LA =%08lx\n", in32r(PMM1LA
));
787 printf("PMM1MA =%08lx\n", in32r(PMM1MA
));
788 printf("PMM1PCILA =%08lx\n", in32r(PMM1PCILA
));
789 printf("PMM1PCIHA =%08lx\n", in32r(PMM1PCIHA
));
791 addr
= PCI_ADDR
| (addr
& 0x00ffffff);
792 printf("\nWriting at addr %08x, size %08x (countmax=%x)\n", addr
, size
, countmax
);
794 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
799 * Set pci region as cachable
802 __asm__
volatile (" addis 4,0,0x0000 ");
803 __asm__
volatile (" addi 4,4,0x0080 ");
804 __asm__
volatile (" mtdccr 4 ");
810 * Write one values to host via pci busmastering
812 ptr
= (volatile unsigned long *)addr
;
813 printf("A\n"); /* test-only */
822 printf("B\n"); /* test-only */
823 my_flush_dcache(addr
, 32);
824 printf("C\n"); /* test-only */
827 * Read one value back
829 ptr
= (volatile unsigned long *)addr
;
831 printf("D\n"); /* test-only */
834 * One pci config write
836 /* pci_write_config_byte(PCIDEVID_405GP, 0x44, 0x00); */
837 /* ibmPciConfigWrite(0x44, 1, 0x00); */
838 ibmPciConfigWrite3(0x2e, 2, 0x1234); /* subsystem id */
839 printf("E\n"); /* test-only */
841 if (loopcount
++ > countmax
) {
842 /* Abort if ctrl-c was pressed */
857 writepci_cache
, 4, 1, do_writepci_cache
,
858 "writepci_cache - Write some data to pcibus\n",
860 " - Write some data to pcibus.\n"
863 int do_savepci(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
869 * Save own pci configuration in PRAM
871 memset((char *)PCI_REGS_ADDR
, 0, PCI_REGS_LEN
);
872 ptr
= (unsigned int *)PCI_REGS_ADDR
+ 1;
873 for (i
=0; i
<0x40; i
+=4) {
874 pci_read_config_dword(PCIDEVID_405GP
, i
, ptr
++);
876 ptr
= (unsigned int *)PCI_REGS_ADDR
;
877 *ptr
= crc32(0, (uchar
*)PCI_REGS_ADDR
+4, PCI_REGS_LEN
-4);
879 printf("\nStoring PCI Configuration Regs...\n");
884 savepci
, 4, 1, do_savepci
,
885 "savepci - Save all pci regs\n",
887 " - Write some data to pcibus.\n"
890 int do_restorepci(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
896 * Rewrite pci config regs (only after soft-reset with magic set)
898 ptr
= (unsigned int *)PCI_REGS_ADDR
;
899 if (crc32(0, (uchar
*)PCI_REGS_ADDR
+4, PCI_REGS_LEN
-4) == *ptr
) {
900 puts("Restoring PCI Configurations Regs!\n");
901 ptr
= (unsigned int *)PCI_REGS_ADDR
+ 1;
902 for (i
=0; i
<0x40; i
+=4) {
903 pci_write_config_dword(PCIDEVID_405GP
, i
, *ptr
++);
906 mtdcr(uicsr
, 0xFFFFFFFF); /* clear all ints */
911 restorepci
, 4, 1, do_restorepci
,
912 "restorepci - Restore all pci regs\n",
914 " - Write some data to pcibus.\n"
918 extern void write_without_sync(void);
919 extern void write_with_sync(void);
920 extern void write_with_less_sync(void);
921 extern void write_with_more_sync(void);
924 * code from IBM-PPCSUPP
926 int do_writeibm1(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
928 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
930 write_without_sync();
935 writeibm1
, 4, 1, do_writeibm1
,
936 "writeibm1- Write some data to pcibus (without sync)\n",
938 " - Write some data to pcibus.\n"
941 int do_writeibm2(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
943 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
950 writeibm2
, 4, 1, do_writeibm2
,
951 "writeibm2- Write some data to pcibus (with sync)\n",
953 " - Write some data to pcibus.\n"
956 int do_writeibm22(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
958 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
960 write_with_less_sync();
965 writeibm22
, 4, 1, do_writeibm22
,
966 "writeibm22- Write some data to pcibus (with less sync)\n",
968 " - Write some data to pcibus.\n"
971 int do_writeibm3(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
973 pci_write_config_word(PCIDEVID_405GP
, 0x04, 0x0106); /* write command reg */
975 write_with_more_sync();
980 writeibm3
, 4, 1, do_writeibm3
,
981 "writeibm3- Write some data to pcibus (with more sync)\n",
983 " - Write some data to pcibus.\n"