Commit Graph

7 Commits

Author SHA1 Message Date
Yann Gautier bd9cd63ba0 fix(usb): correct type in message
pdev->request.bm_request is unsigned, use %u.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Idaadb8440d0b56bcfa02abd7c94a4ab59f5e15ee
2022-02-15 18:09:51 +01:00
Madhukar Pappireddy 2e43638e95 Merge changes from topic "st_usb" into integration
* changes:
  fix(drivers/usb): add a optional ops get_other_speed_config_desc
  fix(drivers/usb): remove unnecessary cast
2021-11-09 06:03:32 +01:00
Patrick Delaunay 216c1223c2 fix(drivers/usb): add a optional ops get_other_speed_config_desc
Correctly handle USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION request
in USB driver and support a different result than
USB_DESC_TYPE_CONFIGURATION with the new optional ops
get_other_speed_config_desc().

The support of this descriptor is optionnal and is only
required when high-speed capable device which can operate at its
other possible speed.

This patch allows to remove the pbuf update in usb_core_get_desc()
and solves an issue on USB re-enumeration on STM32MP15 platform
as the result of get_config_desc() is a const array.
This issue is not see on normal use-case, as the USB enumeration
is only done in ROM code and TF-A reuse the same USB descritors.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I8edcc1e45065ab4e45d48f4bc37b49120674fdb0
2021-11-05 11:28:59 +02:00
Patrick Delaunay 025f5ef201 fix(drivers/usb): remove unnecessary cast
Remove the unnecessary cast on the result of function which
already return the correct type.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: Ie21f7e78a880d30d1f31e32b3d2c3fb09489d65b
2021-11-05 10:22:44 +01:00
Patrick Delaunay 7ca49284be fix(drivers/usb): remove deadcode when USBD_EP_NB = 1
CID 373791:  Control flow issues  (DEADCODE)
CID 373789:  Control flow issues  (DEADCODE)

Since USBD_EP_NB = 1 for DFU stack on STMP32MP15 platform (only EP0 is
required for DFU support) the value of num can't be different of 0
and the code can't be reached in usb_core_receive / usb_core_transmit.

Add a simple sub-function with this part of code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I07a56909bb1e6de19ce52da7945b6d2916be8538
2021-11-04 09:49:30 +01:00
Patrick Delaunay 0cb9870ddf fix(drivers/usb): fix Null pointer dereferences in usb_core_set_config
Correct the invalid test on NULL pointer pdev->class in
usb_core_set_config function.

This patch fix the coverity errors:

  ** CID 373790:  Null pointer dereferences  (FORWARD_NULL)
  /drivers/usb/usb_device.c: 182 in usb_core_set_config()

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I83e43261bafa2d47f800e56df0b047a6c58a1e29
2021-11-04 09:48:44 +01:00
Patrick Delaunay 859bfd8d42 feat(drivers/usb): add a USB device stack
Add a new USB framework to manage an USB device profile (USBD)
based on a peripheral controller driver (PCD).

This USB stack can be use to implement any Universal Serial Bus Device
Class in TF-A on top of a USB driver defined in the platform.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I7971ec6d952edec3511157a198e6e5359df4346b
2021-10-29 16:43:28 +02:00