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,
27 #include <405gp_pci.h>
30 #if (CONFIG_COMMANDS & CFG_CMD_BSP)
32 #define IBM_VENDOR_ID 0x1014
33 #define PPC405_DEVICE_ID 0x0156
37 * Set device number on pci board
39 int do_setdevice(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
41 int idx = 1; /* start at 1 (skip device 0) */
46 if ((bdf = pci_find_device(IBM_VENDOR_ID, PPC405_DEVICE_ID, idx++)) < 0) {
49 printf("Found device nr %d at %x!\n", idx-1, bdf);
50 pci_read_config_dword(bdf, PCI_BASE_ADDRESS_1, &addr);
52 *(u32 *)addr = (bdf & 0x0000f800) >> 11;
53 printf("Wrote %x at %x!\n", (bdf & 0x0000f800) >> 11, addr);
59 setdevice, 1, 1, do_setdevice,
60 "setdevice - Set device number on pci adapter boards\n",
66 * Get device number on pci board
68 int do_getdevice(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
74 device = 0x16 - device; /* calculate vxworks bp slot id */
75 sprintf(str, "%d", device);
77 printf("Variabel slot set to %x\n", device);
82 getdevice, 1, 1, do_getdevice,
83 "getdevice - Get device number and set slot env variable\n",