summaryrefslogtreecommitdiff
path: root/drivers/usb/cdns3
diff options
context:
space:
mode:
authorKever Yang <kever.yang@rock-chips.com>2020-03-04 08:59:50 +0800
committerMarek Vasut <marek.vasut+renesas@gmail.com>2020-03-30 03:48:53 +0200
commitac28e59a574dd231a4787752d923f618587e3d10 (patch)
tree25af956b562bdb145d755f0130e1d6fed992cf89 /drivers/usb/cdns3
parent2be1130a93059b4ca0af037b896bb998e9907f8b (diff)
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>
Diffstat (limited to 'drivers/usb/cdns3')
-rw-r--r--drivers/usb/cdns3/core.c15
-rw-r--r--drivers/usb/cdns3/gadget.c2
2 files changed, 7 insertions, 10 deletions
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index f947e6983c..ce846488a8 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -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__);
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 8377eb458b..caed27c32f 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -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) {