diff mbox series

spl: spl_sdp: don't call board_usb_init twice

Message ID 20220117141145.206012-1-angus@akkea.ca
State Deferred
Delegated to: Tom Rini
Headers show
Series spl: spl_sdp: don't call board_usb_init twice | expand

Commit Message

Angus Ainslie Jan. 17, 2022, 2:11 p.m. UTC
When CONFIG_DM_USB is not defined then usb_gadget_initialize is just a call
to board_usb_init. Calling board_usb_init twice causes the USB to fail so
make sure the second invocation is not compiled in when CONFIG_DM_USB is
not defined.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
---
 common/spl/spl_sdp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Angus Ainslie April 20, 2022, 6:27 p.m. UTC | #1
Hi

On 2022-01-17 06:11, Angus Ainslie wrote:
> When CONFIG_DM_USB is not defined then usb_gadget_initialize is just a 
> call
> to board_usb_init. Calling board_usb_init twice causes the USB to fail 
> so
> make sure the second invocation is not compiled in when CONFIG_DM_USB 
> is
> not defined.
> 
> Signed-off-by: Angus Ainslie <angus@akkea.ca>
> ---
>  common/spl/spl_sdp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
> index ae9c09883a..2a2bc8475d 100644
> --- a/common/spl/spl_sdp.c
> +++ b/common/spl/spl_sdp.c
> @@ -17,7 +17,8 @@ static int spl_sdp_load_image(struct spl_image_info
> *spl_image,
>  	int ret;
>  	const int controller_index = CONFIG_SPL_SDP_USB_DEV;
> 
> -	usb_gadget_initialize(controller_index);
> +	if (IS_ENABLED(CONFIG_DM_USB))
> +		usb_gadget_initialize(controller_index);
> 
>  	board_usb_init(0, USB_INIT_DEVICE);

Any comments on this patch ?

Thanks
Angus
diff mbox series

Patch

diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
index ae9c09883a..2a2bc8475d 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -17,7 +17,8 @@  static int spl_sdp_load_image(struct spl_image_info *spl_image,
 	int ret;
 	const int controller_index = CONFIG_SPL_SDP_USB_DEV;
 
-	usb_gadget_initialize(controller_index);
+	if (IS_ENABLED(CONFIG_DM_USB))
+		usb_gadget_initialize(controller_index);
 
 	board_usb_init(0, USB_INIT_DEVICE);