Skip to contentSkip to conversation

spl: spl_sdp: don't call board_usb_init twice

PATCH In review Angus Ainslie 1 participant 2 messages Jan 17, 2022 – Apr 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: spl_sdp: don't call board_usb_init twice

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.

---
 common/spl/spl_sdp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/spl/spl_sdp.c +2 -1
index ae9c09883a..2a2bc8475d 100644
@@ -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);
 
Signature · 1 line
2.25.1
#1 lore raw

Hi

Quoted 15 lines · Angus Ainslie

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.

---
 common/spl/spl_sdp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/spl/spl_sdp.c +0 -0
index ae9c09883a..2a2bc8475d 100644

common/spl/spl_sdp.c static int spl_sdp_load_image(struct spl_image_info · line 24

Quoted 9 lines
common/spl/spl_sdp.c +2 -1
@@ -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