]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/esd/ocrtc/cmd_ocrtc.c
3 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
5 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/4xx_pci.h>
15 #if defined(CONFIG_CMD_BSP)
18 * Set device number on pci board
20 int do_setdevice(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
22 int idx
= 1; /* start at 1 (skip device 0) */
27 if ((bdf
= pci_find_device(PCI_VENDOR_ID_IBM
, PCI_DEVICE_ID_IBM_405GP
, idx
++)) < 0) {
30 printf("Found device nr %d at %x!\n", idx
-1, bdf
);
31 pci_read_config_dword(bdf
, PCI_BASE_ADDRESS_1
, &addr
);
33 *(u32
*)addr
= (bdf
& 0x0000f800) >> 11;
34 printf("Wrote %x at %x!\n", (bdf
& 0x0000f800) >> 11, addr
);
40 setdevice
, 1, 1, do_setdevice
,
41 "Set device number on pci adapter boards",
47 * Get device number on pci board
49 int do_getdevice(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
55 device
= 0x16 - device
; /* calculate vxworks bp slot id */
56 sprintf(str
, "%d", device
);
58 printf("Variabel slot set to %x\n", device
);
63 getdevice
, 1, 1, do_getdevice
,
64 "Get device number and set slot env variable",