mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-29 06:31:28 +01:00
usb: dwc2: use dev_read_bool() instead of fdt_getprop()
Use dev_read_bool() instead of fdt_getprop() to get the property from DTS. And add a comment for "hnp-srp-disable" property to fully describe its effect. Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
This commit is contained in:
parent
6424de9303
commit
dd22bace7a
@ -43,6 +43,10 @@ struct dwc2_priv {
|
|||||||
struct dwc2_core_regs *regs;
|
struct dwc2_core_regs *regs;
|
||||||
int root_hub_devnum;
|
int root_hub_devnum;
|
||||||
bool ext_vbus;
|
bool ext_vbus;
|
||||||
|
/*
|
||||||
|
* The hnp/srp capability must be disabled if the platform
|
||||||
|
* does't support hnp/srp. Otherwise the force mode can't work.
|
||||||
|
*/
|
||||||
bool hnp_srp_disable;
|
bool hnp_srp_disable;
|
||||||
bool oc_disable;
|
bool oc_disable;
|
||||||
};
|
};
|
||||||
@ -1239,7 +1243,6 @@ static int dwc2_submit_int_msg(struct udevice *dev, struct usb_device *udev,
|
|||||||
static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
|
static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct dwc2_priv *priv = dev_get_priv(dev);
|
struct dwc2_priv *priv = dev_get_priv(dev);
|
||||||
const void *prop;
|
|
||||||
fdt_addr_t addr;
|
fdt_addr_t addr;
|
||||||
|
|
||||||
addr = devfdt_get_addr(dev);
|
addr = devfdt_get_addr(dev);
|
||||||
@ -1247,15 +1250,8 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
priv->regs = (struct dwc2_core_regs *)addr;
|
priv->regs = (struct dwc2_core_regs *)addr;
|
||||||
|
|
||||||
prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
|
priv->oc_disable = dev_read_bool(dev, "disable-over-current");
|
||||||
"disable-over-current", NULL);
|
priv->hnp_srp_disable = dev_read_bool(dev, "hnp-srp-disable");
|
||||||
if (prop)
|
|
||||||
priv->oc_disable = true;
|
|
||||||
|
|
||||||
prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
|
|
||||||
"hnp-srp-disable", NULL);
|
|
||||||
if (prop)
|
|
||||||
priv->hnp_srp_disable = true;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user