mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
usb: Migrate to support live DT for some driver
Use ofnode_ instead of fdt_ APIs so that the drivers can support live DT. This patch updates usb_get_dr_mode() and usb_get_maximum_speed() to use ofnode as parameter instead of fdt offset. And all the drivers who use these APIs update to use live dt APIs at the same time. Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
parent
2be1130a93
commit
ac28e59a57
11 changed files with 42 additions and 57 deletions
|
@ -108,7 +108,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
|
|||
enum usb_dr_mode dr_mode;
|
||||
int ret = 0;
|
||||
|
||||
dr_mode = usb_get_dr_mode(dev_of_offset(dev));
|
||||
dr_mode = usb_get_dr_mode(dev->node);
|
||||
cdns->role = USB_ROLE_NONE;
|
||||
|
||||
/*
|
||||
|
@ -384,22 +384,20 @@ static const struct udevice_id cdns3_ids[] = {
|
|||
|
||||
int cdns3_bind(struct udevice *parent)
|
||||
{
|
||||
int from = dev_of_offset(parent);
|
||||
const void *fdt = gd->fdt_blob;
|
||||
enum usb_dr_mode dr_mode;
|
||||
struct udevice *dev;
|
||||
const char *driver;
|
||||
const char *name;
|
||||
int node;
|
||||
ofnode node;
|
||||
int ret;
|
||||
|
||||
node = fdt_node_offset_by_compatible(fdt, from, "cdns,usb3");
|
||||
if (node < 0) {
|
||||
node = ofnode_by_compatible(parent->node, "cdns,usb3");
|
||||
if (!ofnode_valid(node)) {
|
||||
ret = -ENODEV;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
name = fdt_get_name(fdt, node, NULL);
|
||||
name = ofnode_get_name(node);
|
||||
dr_mode = usb_get_dr_mode(node);
|
||||
|
||||
switch (dr_mode) {
|
||||
|
@ -422,8 +420,7 @@ int cdns3_bind(struct udevice *parent)
|
|||
goto fail;
|
||||
};
|
||||
|
||||
ret = device_bind_driver_to_node(parent, driver, name,
|
||||
offset_to_ofnode(node), &dev);
|
||||
ret = device_bind_driver_to_node(parent, driver, name, node, &dev);
|
||||
if (ret) {
|
||||
printf("%s: not able to bind usb device mode\n",
|
||||
__func__);
|
||||
|
|
|
@ -2579,7 +2579,7 @@ static int cdns3_gadget_start(struct cdns3 *cdns)
|
|||
if (!priv_dev->onchip_buffers)
|
||||
priv_dev->onchip_buffers = 256;
|
||||
|
||||
max_speed = usb_get_maximum_speed(dev_of_offset(cdns->dev));
|
||||
max_speed = usb_get_maximum_speed(dev_ofnode(cdns->dev));
|
||||
|
||||
/* Check the maximum_speed parameter */
|
||||
switch (max_speed) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue