mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
arm: mvebu: theadorable: Add 'pcie' test command
This board specific command tests for the presence of a specified PCIe device (via vendor-ID and device-ID). If the device is not detected, this will get printed. If the device is detected, the board will get resetted so that an easy loop test can be done. The board will reboot until the PCIe device is not detected. Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
1304f4bb8e
commit
1ec2a80b10
1 changed files with 41 additions and 0 deletions
|
@ -294,3 +294,44 @@ int board_late_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_PCI)
|
||||||
|
int do_pcie_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
|
{
|
||||||
|
pci_dev_t bdf;
|
||||||
|
u16 ven_id, dev_id;
|
||||||
|
|
||||||
|
if (argc != 3)
|
||||||
|
return cmd_usage(cmdtp);
|
||||||
|
|
||||||
|
ven_id = simple_strtoul(argv[1], NULL, 16);
|
||||||
|
dev_id = simple_strtoul(argv[2], NULL, 16);
|
||||||
|
|
||||||
|
printf("Checking for PCIe device: VendorID 0x%04x, DeviceId 0x%04x\n",
|
||||||
|
ven_id, dev_id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the PCIe device is detected (somtimes its not available
|
||||||
|
* on the PCIe bus)
|
||||||
|
*/
|
||||||
|
bdf = pci_find_device(ven_id, dev_id, 0);
|
||||||
|
if (bdf == -1) {
|
||||||
|
/* PCIe device not found! */
|
||||||
|
printf("Failed to find PCIe device\n");
|
||||||
|
} else {
|
||||||
|
/* PCIe device found! */
|
||||||
|
printf("PCIe device found, resetting board...\n");
|
||||||
|
|
||||||
|
/* default handling: SOFT reset */
|
||||||
|
do_reset(NULL, 0, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
U_BOOT_CMD(
|
||||||
|
pcie, 3, 0, do_pcie_test,
|
||||||
|
"Test for presence of a PCIe device",
|
||||||
|
"<VendorID> <DeviceID>"
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue