dm: usb: add hook for low level usb init
PATCH 1/1 dm: usb: add hook for low level usb init
Signed-off-by Simon-Pierre Allaire <[email protected]>
---
drivers/usb/host/usb-uclass.c | 7 ++++++- drivers/usb/musb-new/musb_uboot.c | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
drivers/usb/host/usb-uclass.c +6 -1
@@ -243,6 +243,7 @@ int usb_init(void)struct udevice *bus;struct uclass *uc;int count =0 ; +void *ctrl;int ret; asynch_allowed =1 ;
@@ -256,7 +257,11 @@ int usb_init(void) uclass_foreach_dev(bus, uc) {/* init low_level USB */ printf ("USB%d: " , count); - count++; + ret =usb_lowlevel_init (count,USB_INIT_HOST , &ctrl); +if (ret == -ENODEV )/* No such device. */ +puts ("Port not available.\n" ); +else + count++;#ifdef CONFIG_SANDBOX /*
drivers/usb/musb-new/musb_uboot.c +13 -0
@@ -303,6 +303,19 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)#endif /* !CONFIG_IS_ENABLED(DM_USB) */ #if CONFIG_IS_ENABLED (DM_USB ) + +int usb_lowlevel_init (int index,enum usb_init_type init,void **controller) +{ +int ret; + + ret =board_usb_init (index, init); +if (ret !=0 ) { +puts ("Failed to initialize board for USB\n" ); +return ret; + } +return 0 ; +} +static int musb_submit_control_msg (struct udevice *dev,struct usb_device *udev,unsigned long pipe,void *buffer,int length,struct devrequest *setup)
Signature · 1 line
2.30.2
Hi Simon-Pierre,
Quoted 4 lines · Simon-Pierre Allaire
Signed-off-by Simon-Pierre Allaire <[email protected]>---
commit message? Needs motivation and what it does.
But I think we're going to have to figure out a driver model way of doing this.
Quoted 54 lines
drivers/usb/host/usb-uclass.c | 7 ++++++- drivers/usb/musb-new/musb_uboot.c | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)drivers/usb/host/usb-uclass.c +6
-1@@ -243,6 +243,7 @@ int usb_init(void)struct udevice *bus;struct uclass *uc;int count =0 ; +void *ctrl;int ret; asynch_allowed =1 ;@@ -256,7 +257,11 @@ int usb_init(void) uclass_foreach_dev(bus, uc) {/* init low_level USB */ printf ("USB%d: " , count); - count++; + ret =usb_lowlevel_init (count,USB_INIT_HOST , &ctrl); +if (ret == -ENODEV )/* No such device. */ +puts ("Port not available.\n" ); +else + count++;#ifdef CONFIG_SANDBOX /* drivers/usb/musb-new/musb_uboot.c +13
-1@@ -303,6 +303,19 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)#endif /* !CONFIG_IS_ENABLED(DM_USB) */ #if CONFIG_IS_ENABLED (DM_USB ) + +int usb_lowlevel_init (int index,enum usb_init_type init,void **controller) +{ +int ret; + + ret =board_usb_init (index, init); +if (ret !=0 ) { +puts ("Failed to initialize board for USB\n" ); +return ret; + } +return 0 ; +} +static int musb_submit_control_msg (struct udevice *dev,struct usb_device *udev,unsigned long pipe,void *buffer,int length,struct devrequest *setup) --
Quoted 2 lines
2.30.2
Regards,
Simon