mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 19:34:35 +00:00
usb: onboard-hub: Bail out if peer hub is already probed
The .bind function is implemented to bind the correct "half" of the hub that the driver wants to bind, and returning -ENODEV for the other "half". Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
09f557e106
commit
57e30b09fc
1 changed files with 21 additions and 0 deletions
|
@ -176,6 +176,26 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int usb_onboard_hub_bind(struct udevice *dev)
|
||||||
|
{
|
||||||
|
struct ofnode_phandle_args phandle;
|
||||||
|
const void *fdt = gd->fdt_blob;
|
||||||
|
int ret, off;
|
||||||
|
|
||||||
|
ret = dev_read_phandle_with_args(dev, "peer-hub", NULL, 0, 0, &phandle);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "peer-hub not specified\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
off = ofnode_to_offset(phandle.node);
|
||||||
|
ret = fdt_node_check_compatible(fdt, off, "usb424,5744");
|
||||||
|
if (!ret)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
static int usb_onboard_hub_remove(struct udevice *dev)
|
static int usb_onboard_hub_remove(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct onboard_hub *hub = dev_get_priv(dev);
|
struct onboard_hub *hub = dev_get_priv(dev);
|
||||||
|
@ -218,6 +238,7 @@ static const struct udevice_id usb_onboard_hub_ids[] = {
|
||||||
U_BOOT_DRIVER(usb_onboard_hub) = {
|
U_BOOT_DRIVER(usb_onboard_hub) = {
|
||||||
.name = "usb_onboard_hub",
|
.name = "usb_onboard_hub",
|
||||||
.id = UCLASS_USB_HUB,
|
.id = UCLASS_USB_HUB,
|
||||||
|
.bind = usb_onboard_hub_bind,
|
||||||
.probe = usb_onboard_hub_probe,
|
.probe = usb_onboard_hub_probe,
|
||||||
.remove = usb_onboard_hub_remove,
|
.remove = usb_onboard_hub_remove,
|
||||||
.of_match = usb_onboard_hub_ids,
|
.of_match = usb_onboard_hub_ids,
|
||||||
|
|
Loading…
Add table
Reference in a new issue