public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kever Yang <kever.yang@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [PATCH 06/10] usb: host: dwc3-sti-glue: Migrate to use ofnode API
Date: Thu, 27 Feb 2020 15:26:41 +0800	[thread overview]
Message-ID: <05abfaff-ce3a-9724-ed7c-ebc9486cd22f@rock-chips.com> (raw)
In-Reply-To: <74781e2c-a6ec-aad2-a24a-c2b26c8c3605@st.com>

Hi Patrice,

On 2020/2/20 ??4:53, Patrice CHOTARD wrote:
> Hi Kever
>
> On 2/19/20 2:54 AM, Kever Yang wrote:
>> Use ofnode_ instead of fdt_ or fdtdec_ APIs so that the driver can support
>> live DT.
>>
>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> ---
>>
>>   drivers/usb/host/dwc3-sti-glue.c | 22 ++++++++--------------
>>   1 file changed, 8 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c
>> index ad7cf6e6b5..36c7d4037c 100644
>> --- a/drivers/usb/host/dwc3-sti-glue.c
>> +++ b/drivers/usb/host/dwc3-sti-glue.c
>> @@ -10,8 +10,6 @@
>>   #include <asm/io.h>
>>   #include <dm.h>
>>   #include <errno.h>
>> -#include <fdtdec.h>
>> -#include <linux/libfdt.h>
>>   #include <dm/lists.h>
>>   #include <regmap.h>
>>   #include <reset-uclass.h>
>> @@ -109,8 +107,7 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev)
>>   	int ret;
>>   	u32 reg[4];
>>   
>> -	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
>> -				   "reg", reg, ARRAY_SIZE(reg));
>> +	ret = ofnode_read_u32_array(dev->node, "reg", reg, ARRAY_SIZE(reg));
>>   	if (ret) {
>>   		pr_err("unable to find st,stih407-dwc3 reg property(%d)\n", ret);
>>   		return ret;
>> @@ -153,24 +150,21 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev)
>>   static int sti_dwc3_glue_bind(struct udevice *dev)
>>   {
>>   	struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev);
>> -	int dwc3_node;
>> +	ofnode dwc3_node;
>>   
>> -	/* check if one subnode is present */
>> -	dwc3_node = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev));
>> -	if (dwc3_node <= 0) {
>> -		pr_err("Can't find subnode for %s\n", dev->name);
>> -		return -ENODEV;
>> +	/* Find snps,dwc3 node from subnode */
>> +	ofnode_for_each_subnode(node, dev->node) {
>> +		if (ofnode_device_is_compatible(node, "snps,dwc3"))
>> +			dwc3_node = node;
>>   	}
>>   
>> -	/* check if the subnode compatible string is the dwc3 one*/
>> -	if (fdt_node_check_compatible(gd->fdt_blob, dwc3_node,
>> -				      "snps,dwc3") != 0) {
>> +	if (!ofnode_valid(node)) {
>>   		pr_err("Can't find dwc3 subnode for %s\n", dev->name);
>>   		return -ENODEV;
>>   	}
>>   
>>   	/* retrieve the DWC3 dual role mode */
>> -	plat->mode = usb_get_dr_mode(dwc3_node);
>> +	plat->mode = usb_get_dr_mode(ofnode_to_offset(dwc3_node));
>>   	if (plat->mode == USB_DR_MODE_UNKNOWN)
>>   		/* by default set dual role mode to HOST */
>>   		plat->mode = USB_DR_MODE_HOST;
> Using stih410-b2260_defconfig, this path doesn't compile, see below:
>
> In file included from board/st/stih410-b2260/board.c:9:
> include/linux/usb/otg.h:26:34: error: unknown type name ?ofnode?
>  ?enum usb_dr_mode usb_get_dr_mode(ofnode node);


This has been fixed in the version 2.

Thanks,

- Kever

>  ????????????????????????????????? ^~~~~~
> include/linux/usb/otg.h:35:45: error: unknown type name ?ofnode?
>  ?enum usb_device_speed usb_get_maximum_speed(ofnode node);
>  ???????????????????????????????????????????? ^~~~~~
>  ? CC????? drivers/spi/spi.o
>  ? CC????? drivers/usb/common/common.o
> scripts/Makefile.build:278: recipe for target 'board/st/stih410-b2260/board.o' failed
> make[1]: *** [board/st/stih410-b2260/board.o] Error 1
>  ? CC????? drivers/serial/serial_sti_asc.o
> Makefile:1728: recipe for target 'board/st/stih410-b2260' failed
> make: *** [board/st/stih410-b2260] Error 2
> make: *** Waiting for unfinished jobs....
>  ? CC????? drivers/usb/dwc3/core.o
>  ? CC????? drivers/usb/eth/usb_ether.o
>  ? CC????? drivers/usb/eth/asix.o
>  ? CC????? common/main.o
>  ? CC????? drivers/usb/eth/mcs7830.o
>  ? CC????? drivers/usb/gadget/epautoconf.o
>  ? CC????? drivers/fastboot/fb_getvar.o
>  ? CC????? drivers/usb/eth/smsc95xx.o
>  ? LD????? drivers/spi/built-in.o
>  ? CC????? drivers/usb/dwc3/gadget.o
>  ? CC????? cmd/version.o
>  ? CC????? drivers/usb/dwc3/ep0.o
>  ? CC????? drivers/usb/gadget/config.o
>  ? LD????? drivers/usb/common/built-in.o
>  ? LD????? drivers/serial/built-in.o
>  ? LD????? common/built-in.o
> In file included from drivers/usb/dwc3/core.h:23,
>  ???????????????? from drivers/usb/dwc3/gadget.c:28:
> include/linux/usb/otg.h:26:34: error: unknown type name ?ofnode?
>  ?enum usb_dr_mode usb_get_dr_mode(ofnode node);
>  ????????????????????????????????? ^~~~~~
> In file included from drivers/usb/dwc3/core.h:23,
>  ???????????????? from drivers/usb/dwc3/ep0.c:25:
> include/linux/usb/otg.h:26:34: error: unknown type name ?ofnode?
>  ?enum usb_dr_mode usb_get_dr_mode(ofnode node);
>  ????????????????????????????????? ^~~~~~
>  ? CC????? drivers/usb/gadget/usbstring.o
> include/linux/usb/otg.h:35:45: error: unknown type name ?ofnode?
>  ?enum usb_device_speed usb_get_maximum_speed(ofnode node);
>  ???????????????????????????????????????????? ^~~~~~
> include/linux/usb/otg.h:35:45: error: unknown type name ?ofnode?
>  ?enum usb_device_speed usb_get_maximum_speed(ofnode node);
>  ???????????????????????????????????????????? ^~~~~~
>  ? CC????? drivers/usb/gadget/g_dnl.o
> scripts/Makefile.build:278: recipe for target 'drivers/usb/dwc3/ep0.o' failed
> make[1]: *** [drivers/usb/dwc3/ep0.o] Error 1
> make[1]: *** Waiting for unfinished jobs....
>
> Thanks
>
> Patrice

  reply	other threads:[~2020-02-27  7:26 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 [this message]
2020-02-19  1:54 ` [PATCH 07/10] usb: musb-new: " Kever Yang
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=05abfaff-ce3a-9724-ed7c-ebc9486cd22f@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