From: Kever Yang <kever.yang@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [PATCH 07/10] usb: musb-new: Migrate to use ofnode API
Date: Wed, 19 Feb 2020 09:54:44 +0800 [thread overview]
Message-ID: <20200219015447.19392-8-kever.yang@rock-chips.com> (raw)
In-Reply-To: <20200219015447.19392-1-kever.yang@rock-chips.com>
Use ofnode_ instead of fdt_ APIs so that the driver can support live DT.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
drivers/usb/musb-new/ti-musb.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 20ca2731b4..28172c9c99 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -284,28 +284,26 @@ U_BOOT_DRIVER(ti_musb_peripheral) = {
#if CONFIG_IS_ENABLED(OF_CONTROL)
static int ti_musb_wrapper_bind(struct udevice *parent)
{
- const void *fdt = gd->fdt_blob;
- int node;
+ ofnode node;
int ret;
- for (node = fdt_first_subnode(fdt, dev_of_offset(parent)); node > 0;
- node = fdt_next_subnode(fdt, node)) {
+ ofnode_for_each_subnode(node, parent->node) {
struct udevice *dev;
- const char *name = fdt_get_name(fdt, node, NULL);
+ const char *name = ofnode_get_name(node);
enum usb_dr_mode dr_mode;
struct driver *drv;
if (strncmp(name, "usb@", 4))
continue;
- dr_mode = usb_get_dr_mode(node);
+ dr_mode = usb_get_dr_mode(ofnode_to_offset(node));
switch (dr_mode) {
case USB_DR_MODE_PERIPHERAL:
/* Bind MUSB device */
ret = device_bind_driver_to_node(parent,
"ti-musb-peripheral",
name,
- offset_to_ofnode(node),
+ node,
&dev);
if (ret)
pr_err("musb - not able to bind usb peripheral node\n");
@@ -315,7 +313,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
ret = device_bind_driver_to_node(parent,
"ti-musb-host",
name,
- offset_to_ofnode(node),
+ node,
&dev);
if (ret)
pr_err("musb - not able to bind usb host node\n");
--
2.17.1
next prev parent reply other threads:[~2020-02-19 1:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 1:54 [PATCH 00/10] usb: Covert to support Live DT Kever Yang
2020-02-19 1:54 ` [PATCH 01/10] usb: dwc3-of-simple: Drop redundant inclding header file Kever Yang
2020-02-19 1:54 ` [PATCH 02/10] usb: ehci-msm: Use dev interface to get device address Kever Yang
2020-02-19 18:31 ` Ramon Fried
2020-02-19 1:54 ` [PATCH 03/10] usb: cdns3: Migrate to use ofnode API for bind function Kever Yang
2020-02-19 1:54 ` [PATCH 04/10] usb: dwc3-generic: " Kever Yang
2020-02-19 1:54 ` [PATCH 05/10] usb: dwc3-generic: Use dev_read_addr() instead of devfdt_get_addr() Kever Yang
2020-02-19 17:07 ` Marek Vasut
2020-02-20 1:51 ` Kever Yang
2020-02-20 2:23 ` Simon Glass
2020-02-27 7:33 ` [PATCH 05/10] usb: dwc3-generic: Use dev_read_addr() instead of devfdt_get_addr()【请注意,邮件由sjg@google.com代发】 Kever Yang
2020-02-19 1:54 ` [PATCH 06/10] usb: host: dwc3-sti-glue: Migrate to use ofnode API Kever Yang
2020-02-20 8:53 ` Patrice CHOTARD
2020-02-27 7:26 ` Kever Yang
2020-02-19 1:54 ` Kever Yang [this message]
2020-02-19 1:54 ` [PATCH 08/10] usb: dwc3: core: reorder the header file including sequence Kever Yang
2020-02-19 17:07 ` Marek Vasut
2020-02-19 1:54 ` [PATCH 09/10] usb: Use ofnode as usb_get_dr_mode() parameter Kever Yang
2020-02-19 7:49 ` Neil Armstrong
2020-02-19 1:54 ` [PATCH 10/10] usb: Use ofnode as usb_get_maximum_speed() parameter Kever Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200219015447.19392-8-kever.yang@rock-chips.com \
--to=kever.yang@rock-chips.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox