[PATCH 09/10] usb: Use ofnode as usb_get_dr_mode() parameter
Neil Armstrong
narmstrong at baylibre.com
Wed Feb 19 08:49:25 CET 2020
On 19/02/2020 02:54, Kever Yang wrote:
> ofnode is more common and no need to convert to offset after we migrate
> other API to use ofnode.
>
> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
> ---
>
> drivers/usb/cdns3/core.c | 2 +-
> drivers/usb/common/common.c | 7 +++----
> drivers/usb/dwc3/dwc3-generic.c | 6 +++---
> drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +-
> drivers/usb/gadget/dwc2_udc_otg.c | 5 ++---
> drivers/usb/host/dwc3-sti-glue.c | 2 +-
> drivers/usb/host/ehci-mx6.c | 2 +-
> drivers/usb/host/xhci-dwc3.c | 3 +--
> drivers/usb/musb-new/ti-musb.c | 2 +-
> include/linux/usb/otg.h | 4 ++--
> 10 files changed, 16 insertions(+), 19 deletions(-)
>
[...]
> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> index a55def5aba..4300f711a9 100644
> --- a/drivers/usb/common/common.c
> +++ b/drivers/usb/common/common.c
> @@ -7,7 +7,7 @@
> */
>
> #include <common.h>
> -#include <linux/libfdt.h>
> +#include <dm.h>
> #include <linux/usb/otg.h>
> #include <linux/usb/ch9.h>
>
> @@ -20,13 +20,12 @@ static const char *const usb_dr_modes[] = {
> [USB_DR_MODE_OTG] = "otg",
> };
>
> -enum usb_dr_mode usb_get_dr_mode(int node)
> +enum usb_dr_mode usb_get_dr_mode(ofnode node)
> {
> - const void *fdt = gd->fdt_blob;
> const char *dr_mode;
> int i;
>
> - dr_mode = fdt_getprop(fdt, node, "dr_mode", NULL);
> + dr_mode = ofnode_read_string(node, "dr_mode");
> if (!dr_mode) {
> pr_err("usb dr_mode not found\n");
> return USB_DR_MODE_UNKNOWN;
> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
> index ced0f53bfd..7178f12b47 100644
[..]
> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> index 832bcd70ff..d4453f8784 100644
> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
> @@ -393,7 +393,7 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
> }
> #endif
>
> - priv->otg_mode = usb_get_dr_mode(dev_of_offset(dev));
> + priv->otg_mode = usb_get_dr_mode(dev->node);
>
> ret = dwc3_meson_g12a_usb_init(priv);
> if (ret)
For drivers/usb/dwc3/dwc3-meson-g12a.c:
Acked-by: Neil Armstrong <narmstrong at baylibre.com>
More information about the U-Boot
mailing list