2 * (C) Copyright 2002-2004
3 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
5 * SPDX-License-Identifier: GPL-2.0+
14 #include <asm/4xx_pci.h>
15 #include <asm/processor.h>
19 #if defined(CONFIG_CMD_BSP)
22 * Command loadpci: wait for signal from host and boot image.
24 int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
26 unsigned int *ptr = 0;
39 puts("\nWaiting for image from pci host -");
42 * Wait for host to write the start address
44 while (*ptr == 0xffffffff) {
48 putc(0x08); /* backspace */
49 putc(str[count2 % 4]);
52 /* Abort if ctrl-c was pressed */
61 if (*ptr == PCI_RECONFIG_MAGIC) {
63 * Save own pci configuration in PRAM
65 memset((char *)PCI_REGS_ADDR, 0, PCI_REGS_LEN);
66 ptr = (unsigned int *)PCI_REGS_ADDR + 1;
67 for (i=0; i<0x40; i+=4) {
68 pci_read_config_dword(PCIDEVID_405GP, i, ptr++);
70 ptr = (unsigned int *)PCI_REGS_ADDR;
71 *ptr = crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
73 printf("\nStoring PCI Configuration Regs...\n");
75 sprintf(addr, "%08x", *ptr);
78 * Boot image via bootm
80 printf("\nBooting Image at addr 0x%s ...\n", addr);
81 setenv("loadaddr", addr);
83 local_args[0] = argv[0];
85 do_bootm (cmdtp, 0, 1, local_args);
91 loadpci, 1, 1, do_loadpci,
92 "Wait for pci-image and boot it",