Commit 7688f490 authored by Aurelien Jarno's avatar Aurelien Jarno Committed by Anas Nashif
Browse files

drivers: usb_dc_stm32: change all endpoints to bidirectional



The various STM32 reference manuals sometimes define the USB endpoints
as IN or OUT only and sometimes as bidirectional, even in the same
manual. This is likely because the OTG implementation has one set of
registers for the IN endpoints and one other set for OUT endpoints.
However at the end a given endpoint address can both transmit and
receive data.

This causes some confusion how to declare the endpoints in the device
tree, and depending on the SoC, they are either the same number of IN
and OUT endpoints declared, or they are declared as bidirectional. At
the end it doesn't really matter given how the driver uses those values:

    #define NUM_IN_EP (CONFIG_USB_NUM_BIDIR_ENDPOINTS + \
                       CONFIG_USB_NUM_IN_ENDPOINTS)

    #define NUM_OUT_EP (CONFIG_USB_NUM_BIDIR_ENDPOINTS + \
                        CONFIG_USB_NUM_OUT_ENDPOINTS)

    #define NUM_BIDIR_EP NUM_OUT_EP

This patch therefore cleanup the driver, the DTS, and the DTS fixups to
only define the number of bidirectional endpoints.

In addition to the cleanup, that fixes a regression introduced by commit
52eacf16 ("driver: usb: add check for endpoint capabilities"), which
introduced a wrong check for SoC only defining the number of
bidirectional endpoints.

Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
parent c601f3be
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -54,8 +54,6 @@
#define CONFIG_USB_IRQ				ST_STM32_USB_40005C00_IRQ_USB
#define CONFIG_USB_IRQ_PRI			ST_STM32_USB_40005C00_IRQ_USB_PRIORITY
#define CONFIG_USB_NUM_BIDIR_ENDPOINTS		ST_STM32_USB_40005C00_NUM_BIDIR_ENDPOINTS
#define CONFIG_USB_NUM_IN_ENDPOINTS		ST_STM32_USB_40005C00_NUM_IN_ENDPOINTS
#define CONFIG_USB_NUM_OUT_ENDPOINTS		ST_STM32_USB_40005C00_NUM_OUT_ENDPOINTS
#define CONFIG_USB_RAM_SIZE			ST_STM32_USB_40005C00_RAM_SIZE

#define CONFIG_PWM_STM32_1_DEV_NAME             ST_STM32_PWM_40012C00_PWM_LABEL
+0 −2
Original line number Diff line number Diff line
@@ -57,8 +57,6 @@
#define CONFIG_USB_IRQ				ST_STM32_USB_40005C00_IRQ_USB
#define CONFIG_USB_IRQ_PRI			ST_STM32_USB_40005C00_IRQ_USB_PRIORITY
#define CONFIG_USB_NUM_BIDIR_ENDPOINTS		ST_STM32_USB_40005C00_NUM_BIDIR_ENDPOINTS
#define CONFIG_USB_NUM_IN_ENDPOINTS		ST_STM32_USB_40005C00_NUM_IN_ENDPOINTS
#define CONFIG_USB_NUM_OUT_ENDPOINTS		ST_STM32_USB_40005C00_NUM_OUT_ENDPOINTS
#define CONFIG_USB_RAM_SIZE			ST_STM32_USB_40005C00_RAM_SIZE

#define CONFIG_PWM_STM32_1_DEV_NAME             ST_STM32_PWM_40012C00_PWM_LABEL
+0 −2
Original line number Diff line number Diff line
@@ -87,8 +87,6 @@
#define CONFIG_USB_IRQ				ST_STM32_OTGFS_50000000_IRQ_OTGFS
#define CONFIG_USB_IRQ_PRI			ST_STM32_OTGFS_50000000_IRQ_OTGFS_PRIORITY
#define CONFIG_USB_NUM_BIDIR_ENDPOINTS		ST_STM32_OTGFS_50000000_NUM_BIDIR_ENDPOINTS
#define CONFIG_USB_NUM_IN_ENDPOINTS		ST_STM32_OTGFS_50000000_NUM_IN_ENDPOINTS
#define CONFIG_USB_NUM_OUT_ENDPOINTS		ST_STM32_OTGFS_50000000_NUM_OUT_ENDPOINTS
#define CONFIG_USB_RAM_SIZE			ST_STM32_OTGFS_50000000_RAM_SIZE

#define CONFIG_PWM_STM32_1_DEV_NAME             ST_STM32_PWM_40010000_PWM_LABEL
+0 −2
Original line number Diff line number Diff line
@@ -52,8 +52,6 @@
#define CONFIG_USB_IRQ				ST_STM32_USB_40005C00_IRQ_USB
#define CONFIG_USB_IRQ_PRI			ST_STM32_USB_40005C00_IRQ_USB_PRIORITY
#define CONFIG_USB_NUM_BIDIR_ENDPOINTS		ST_STM32_USB_40005C00_NUM_BIDIR_ENDPOINTS
#define CONFIG_USB_NUM_IN_ENDPOINTS		ST_STM32_USB_40005C00_NUM_IN_ENDPOINTS
#define CONFIG_USB_NUM_OUT_ENDPOINTS		ST_STM32_USB_40005C00_NUM_OUT_ENDPOINTS
#define CONFIG_USB_RAM_SIZE			ST_STM32_USB_40005C00_RAM_SIZE

/* End of SoC Level DTS fixup file */
+0 −2
Original line number Diff line number Diff line
@@ -93,8 +93,6 @@
#define CONFIG_USB_IRQ				ST_STM32_OTGFS_50000000_IRQ_OTGFS
#define CONFIG_USB_IRQ_PRI			ST_STM32_OTGFS_50000000_IRQ_OTGFS_PRIORITY
#define CONFIG_USB_NUM_BIDIR_ENDPOINTS		ST_STM32_OTGFS_50000000_NUM_BIDIR_ENDPOINTS
#define CONFIG_USB_NUM_IN_ENDPOINTS		ST_STM32_OTGFS_50000000_NUM_IN_ENDPOINTS
#define CONFIG_USB_NUM_OUT_ENDPOINTS		ST_STM32_OTGFS_50000000_NUM_OUT_ENDPOINTS
#define CONFIG_USB_RAM_SIZE			ST_STM32_OTGFS_50000000_RAM_SIZE
#endif

Loading