Commit graph

582 commits

Author SHA1 Message Date
Manuel Aebischer 5b9a0e5456 drivers: usb_dc_rpi_pico: handling of data toggle after endpoint setup
The previous behaviour led to an issue where we already expected data1
on the first transfer instead of data0. The DesignWare USB DC actually
implements the same behaviour. Also, the next_pid flag has to be reset
on setting up the endpoint.
Fixes #66283.

Signed-off-by: Manuel Aebischer <manuel.aebischer@netmodule.com>
2023-12-19 12:45:52 +01:00
Johann Fischer cc2fdf2053 drivers: udc: add initial support for DWC2 controller
The driver currently supports only dedicated FIFO mode (with
dynfifosizing if enabled). Control, bulk and interrupt transfers are
supported, isochronous transfers are not yet supported. The driver
accesses controller registers using sys_io.h, but for debugging purposes
one can get a register map from the driver's config, similar to the
usb_dc_dw.c driver.

Initial support also has vendor quirks for the STM32F4 SoC family.
Tested on NUCLEO-F413HG.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-18 09:48:58 +01:00
Johann Fischer ffbe257c76 drivers: usb: use common usb_dwc2_hw.h header
Use new common header and remove usb_dw_registers.h.
No functional changes, only renaming of registers and field identifiers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-18 09:48:58 +01:00
Johann Fischer ef124718aa drivers: usb: add common DWC2 register header
This header is based on drivers/usb/device/usb_dw_registers.h and
describes registers of the DWC2 controllers IP and is intended for use
in both device controller drivers and a host controller driver. The
difference to usb_dw_registers.h is that this header does not confuse
offsets with bit positions, contains all the definitions required for
device mode, has register and bit field names identical to the databook
and no annoying underscores.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-18 09:48:58 +01:00
Daniel DeGrasse c9404e0174 drivers: usb: usb_dc_kinetis: fix k_heap_alloc wait duration
Change k_heap_alloc wait duration to K_NO_WAIT in kinetis USB driver,
since the usb_dc_ep_configure function may be called from an ISR
context, where only K_NO_WAIT would be allowed as a duration for this
function.

Fixes #66507

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-12-15 11:41:56 +00:00
Marc Desvaux c758f1cc14 drivers: usb: device: usb_dc_stm32 issue USB drivers
Isochronous endpoint issue with USB drivers on STM32G491
we setup an isochronous endpoint and are having an issue
where every other frame sends the desired data sandwiched
between garbage data.

For isochronous the parameter ep_kind into the fonction :
HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr,
uint16_t ep_kind, uint32_t pmaadress) must be PCD_DBL_BUF.

The parameter pmaadress (EP address in The PMA) is like that:
EP address in The PMA: In case of single buffer endpoint
this parameter is 16-bit value providing the address
in PMA allocated to endpoint.
In case of double buffer endpoint this parameter
is a 32-bit value providing the endpoint buffer 0 address
in the LSB part of 32-bit value and endpoint buffer 1 address
in the MSB part of 32-bit value.


Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-12-13 10:40:23 +01:00
Johann Fischer aad6a81a3b drivers: udc_nrf: submit resume event after RWUP is initiated
Submit resume event after remote wakeup (resume) signalling is
initiated. Handle it same way as in the usb_dc_nrfx driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-12 15:34:11 +01:00
Marc Desvaux 1204aa25c8 drivers: usb: device: fix Rx FIFO min size
the FIFO Rx need to have a Minimum memory to works
distributed the rest of the ram_size memory between
the different TX FIFOs except the first which is
a control endtype with max data payload of 64 bytes

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-11-30 10:01:11 +01:00
Marek Pieta 8d8e2b0f42 drivers: usb: nrf_usbd_common: Remove unneeded assertion
Code uses local RAM buffer to properly handle the case where provided
USB transfer TX data is not in RAM.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2023-11-29 10:22:25 +01:00
Declan Snyder 345f079e49 dts: bindings: Fix NXP USB bindings
NXP USB bindings were combined into one binding and using
a property corresponding to HAL enums which is improper use
of devicetree.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-09 15:34:39 +01:00
Ting Shen c5d3fc10c1 drivers: usb_dc_it82xx2: fix uninitialized variable warning
ep_ctrl and ep_trans_type is not used inside it82xx2_usb_dc_isr, this
triggers a compile warning. Move these variables to a smaller scope.

Signed-off-by: Ting Shen <phoenixshen@google.com>
2023-11-09 15:34:18 +01:00
Tomasz Moń f2c804b46e nrf_usbd_common: Do not use USBD HAL
Use MDK directly instead of via USBD HAL to not mix direct register
accesses with USBD HAL. In my opinion this change is not really
necessary but reviewers are strict about consistency.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń f533ec16e6 nrf_usbd_common: Remove dynamic feeders/consumers
There is no point in setting the feeder or consumer at runtime. The time
saved due to not checking conditions on each transaction is smaller than
the additional cost of calling function via pointer.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń 3e6b86ff73 nrf_usbd_common: Keep interrupt configuration constant
Do not enable nor disable endpoint done interrupts at runtime because it
is not necessary. Simply keep all relevant interrupts enabled when USBD
is active and disable all interrupts when USBD is disabled.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń 3d523a9cb4 nrf_usbd_common: Refactor interrupt handling code
Ensure strict order within interrupt processing to eliminate workaround
in IN transfer acknowledged handler. EPDATASTATUS and DMA done events
are processed in a way that eliminates the possibility for race condions
between interrupt handler and host IN tokens.

Store last started DMA endpoint and use it in common handler for all DMA
finished events. Unify use of ep dma waiting variable because atomics
only make sense if all accesses are through atomic functions - here the
accesses are guarded with critical section.

Do not disable SETUP interrupt when DMA transfers data on endpoint 0 but
simply postpone handling if currently active DMA is on endpoint 0.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń fc59ed701b nrf_usbd_common: Disable started interrupt handling
There is no point in calling an empty function on every single DMA
transfer start. While the empty function is just BX LR the fact that is
is called on every DMA transfer makes its impact visible. This change
improves CDC ACM echo throughput by approximately 2%.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń 0efdff96df nrf_usbd_common: Remove early DMA process handling
Early DMA process handling actually decreases performance in real world
scenarios because real world scenarios tend to be CPU bound. Moreover
the actual optimization is questionable because DMA semaphore can only
be released after the respective endpoint end event is handled. Remove
early DMA processing altogether and only check pending DMA at the end of
interrupt handler.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń a0a80f6299 nrf_usbd_common: Guard DMA with semaphore
Rely on semaphore to serialize access to DMA instead of busy looping
after triggering DMA. With this change Ozone Code Profile generated with
J-Trace Pro on nrf52840dk_nrf52840 board running headphones microphone
sample shows following Load changes (trace data was reset once playback
and recording started and percentages were taken when memcpy reached
200 000 Run Count):
  * usbd_dmareq_process() from 17.16% to 2.24%
  * memcpy() from 9.37% to 8.36%
  * nrf_usbd_common_irq_handler() from 8.89% to 10.88%

Mark nrf_usbd_common_stop() as static because the caller must acquire
DMA semaphore before calling this function and the only place where it
is used is already acquiring the semaphore.

Disable EP0 SETUP interrupt when there is active DMA on EP0 to eliminate
the need for aborting DMA on EP0. This code path should not really
happen in real life though because hosts must not issue new SETUP before
a relatively long timeout (at least 50 ms).

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń 8db6919695 nrfx_usbd: Rename to nrf_usbd_common
Rename local usbd copy from nrfx_usbd to nrf_usbd_common and use it in
both USB stacks. Renaming header to nrf_usbd_common.h allows breaking
changes in exposed interface. Mark all doxygen comments as internal
because local usbd copy should not be treated as public interface
because we are under refactoring process that aims to arrive at native
driver and therefore drop nrf_usbd_common in the future.

Use Zephyr constructs directly instead of nrfx glue macros.

No functional changes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Anas Nashif a08bfeb49c syscall: rename Z_OOPS -> K_OOPS
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 1a9de05767 syscall: rename Z_SYSCALL_DRIVER_ -> K_SYSCALL_DRIVER_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 684b8fcdd0 syscall: Z_SYSCALL_VERIFY_MSG -> K_SYSCALL_VERIFY_MSG
Rename macros and do not use Z_ for internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 4e396174ce kernel: move syscall_handler.h to internal include directory
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Benedikt Schmidt a03f1010b8 drivers: fix thread function signatures
Fix thread function signatures to avoid stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Peter Mitsis 52f343c5c7 drivers: usb: Replace k_mem_block usage
The k_mem_block structure has been obsolete for some years with
a few loose ends still remaining. As its usage in the usb_dc_mcux
codebase was confined to needing its "void *" pointer field, it
was simple to enough to hoist that field to remove another loose end.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-10-13 09:56:02 +03:00
Tomasz Moń dbb4e8aa9d drivers: usb_dc_nrfx: Isochronous endpoint cannot be bulk
Prevent use of isochronous endpoints as bulk and/or interrupt endpoint.
The issue was observed when trying to use 4 CDC ACM instances where the
4th instance would claim the isochronous IN endpoint 0x88 to be bulk.
Because the isochronous endpoints cannot respond with handshake packet
the iso endpoints cannot be used as bulk or interrupt substitue.

Properly fail endpoint check and therefore make 4 CDC ACM instances not
enumerate at all because the hardware has endpoints that only allows up
to 3 CDC ACM instances.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-10-06 14:50:10 +02:00
Johann Fischer 9cb777b95e drivers: uhc: rework transfer buffer handling
The current approach is a bit impractical in the upper layer.
This patch removes the two fifos that hold the transfer buffers
and replaces them with a byte array for the setup packet and
a pointer to a data buffer. The data buffer is mandatory for
all types of transfers except control without a data stage.
The waste of eight unused bytes for non-control transfers should
be insignificant, since an additional pointer would be at least
half of it, and then there would be the overhead of handling it.

This patch also clean up the transfer flags, rename owner to callback
as it reflects the upper layer use case, and add an additional member
to hold the pointer to the USB device (peripheral on the bus).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-10-01 09:26:07 +03:00
Johann Fischer 960e758e6b drivers: uhc: move transfer status to transfer structure
Aling with the changes in UDC done in the commit ad81b3b797
("drivers: udc: move transfer status to buffer info structure")
This allows us to get the result of synchronous transfer and
simplify uhc_submit_event().

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-10-01 09:26:07 +03:00
Michał Barnaś 4aac1756a9 i2c: use device instead of name for i2c dump messages
This commit changes the parameter of i2c_dump_msgs function from
string name to pointer to the device structure.
It allows for comparison of device pointers and allow to use
the printed device name in i2c shell commands.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-09-06 17:54:53 +02:00
Carles Cufi 8c748fd005 kernel: Modify the signature of k_mem_slab_free()
Modify the signature of the k_mem_slab_free() function with a new one,
replacing the old void **mem with void *mem as a parameter.

The following function:
void k_mem_slab_free(struct k_mem_slab *slab, void **mem);

has the wrong signature. mem is only used as a regular pointer, so there
is no need to use a double-pointer. The correct signature should be:
void k_mem_slab_free(struct k_mem_slab *slab, void *mem);

The issue with the current signature, although functional, is that it is
extremely confusing. I myself, a veteran Zephyr developer, was confused
by this parameter when looking at it recently.

All in-tree uses of the function have been adapted.

Fixes #61888.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-09-03 18:20:59 -04:00
Gerard Marull-Paretas 99c19425d1 drivers: usb: device: add missing init.h
Some drivers were missing init.h, required for SYS_INIT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-31 10:21:50 +02:00
Gerard Marull-Paretas 008f1c44e2 drivers: usb: device: s/device.h/init.h
Some drivers were not using any device.h API, but init.h (SYS_INIT).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-31 10:21:50 +02:00
Gerard Marull-Paretas 939e3d6149 drivers: usb: device: kinetis: s/device.h/init.h
File was not using any device.h API, but SYS_INIT from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 10:15:56 +02:00
Gerard Marull-Paretas 2202864f4f drivers: usb: udc: common: add missing init.h
File was using SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 10:15:49 +02:00
Gerard Marull-Paretas e80f71a14d drivers: usb: device: nrfx: add missing init.h
File was using SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 12:28:04 +01:00
Nick Ward 2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
Fabio Baltieri ec71be5d9d drivers,subsys: fix few missing k_work_delayable_from_work
Fix few instances of delayable work handlers using the k_work pointer
directly in a CONTAINER_OF pointing to a k_work_delayable.

This is harmless since the k_work is the first element in
k_work_delayable, but using k_work_delayable_from_work is the right way
of handling it.

Change a couple of explicit CONTAINER_OF doing the same work as the
macro in the process.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 10:12:21 +02:00
Florian La Roche 5727503489 style: move ALWAYS_INLINE to the beginning to resolve compiler warnings
With gcc from the zephyr sdk and -Wold-style-declaration is giving this
output:
zephyr/arch/arm/core/aarch32/cortex_a_r/fault.c:101:1: warning:
  'inline' is not at beginning of declaration [-Wold-style-declaration]
  101 | static void ALWAYS_INLINE
                    z_arm_fpu_caller_save(struct __fpu_sf *fpu)
      | ^~~~~~

I searched to all of the source code to find these further occurances
where inline is not at the beginning of a function declaration.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2023-08-23 14:44:23 +02:00
Daniel Leung 6c85e615c5 usb: fixes shadow variables
This fixes a shadow variables found by -Wshadow.
The variable ep_ctx is only used in certain switch cases
so declare it when it is needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Johann Fischer 41e9547ead drivers: usb: fix common misspellings in USB drivers
Fix common misspellings in USB drivers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-07-26 10:46:01 +02:00
Loic Poulain e8e2b53849 drivers: usb: udc: add STM32 UDC driver
Add UDC driver for STM32 based MCU, relying on HAL/PCD.
This has been tested with cdc_acm sample on the following boards:

- 96b_carbon (STM32F4)
- disco_l475_iot1 (STM32L4)
- nucleo_wb55rg (STM32WB)
- nucleo_h723zg (STM32H7)
- stm32f3_disco (STM32F3)

This fails at runtime for the following:

- b_u585i_iot2a (STM32U5)

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-07-13 10:44:42 +02:00
Ren Chen f46453cabb drivers: usb: usb_dc_it82xx2: correct the resumed/suspended mechanism
This change corrects the it82xx2 resumed/suspended mechanism and power
policy flow. The sof package is used to judge if the device can be set as
suspended state. If there is no sof package received(suspended), the chip
power policy is set as standby(deep doze) mode. Meanwhile, the USB D+
interrupt is enabled. The interrupt is triggered at resume signal(from J
to K state). Chip sets its power state as active(doze) mode and disable
the interrupt.

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2023-07-07 10:50:34 +02:00
Alberto Escolar Piedras abf6da6318 drivers for POSIX arch: Add external libc dependencies
Quite a few of the drivers meant for the POSIX arch
interacted with the host directly, and will not
work when we use an embedded libC.

Until we fix them, let's add the appropriate
kconfig dependencies to avoid users trying to build them.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-05 07:01:19 -04:00
Mahesh Mahadevan 074fdbb4f7 drivers: mcux_usb: Fix selection of NO_CACHE
NO_CACHE cannot be selected for certain cores.
Use ARCH_HAS_NOCACHE_MEMORY_SUPPORT as the condtion
to select NO_CACHE config

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-07-04 11:07:55 +00:00
Daniel Leung 26ecaba4af drivers: syscalls: use zephyr_syscall_header
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-17 07:57:45 -04:00
Mahesh Mahadevan e94b6f901b drivers: usb_mcux: Fix disable and reset functions
1. Fix the reset function to reset correctly.
2. Ensure the controller handle is initialized before
   calling the SDK functions.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-06-09 11:45:55 -04:00
Tomasz Moń 3b14268e41 drivers: usb_dc_native_posix: Check data length before copy
Fail requests if the data does not fit inside buffer.

This commit only adds missing sanity checks but the native posix driver
remains broken at the design level. The amount of work to fix the native
posix driver in legacy USB stack is deemed too great to be worth it.

Coverity-CID: 195841, GitHub issue #58564
Coverity-CID: 240244, GitHub issue #58570

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-06-09 11:45:16 -04:00
Declan Snyder 0a6c072b77 drivers: usb_dc_mcux: Debug log needs more stack
Increase the size of the MCUX USB driver thread stack if using
the CONFIG_USB_DEVICE_LOG_LEVEL_DBG Kconfig, to avoid stack overflow
caused by many stack frames coming from the debug logs.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-02 18:46:39 -04:00
Daniel DeGrasse 19829ace7d drivers: usb: usb_dc_kinetis: reconfigure USB endpoint 0 after reset
Per Kinetis USB reference manual, when USB reset interrupt is asserted,
the driver should configure and enable the default USB control endpoint
0. Generally, when the reset interrupt is asserted, endpoint 0 is
already configured so the driver only needs to reenable it.

However, when usb_dc_detach is called and the module is reset, all endpoint
configuration will be reset. Thus, we need to manually configure USB
endpoint 0 when a USB reset interrupt is received, or the USB driver
will not function correctly after usb_dc_detach has been called.

Additionally, do not zero out all BDT entries in the usb_dc_reset
function. BDT entries are zeroed when an endpoint is configured, and
clearing BDT buffer pointers during device reset will cause a memory
leak.

Fixes #58407

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-31 10:25:36 +01:00
Mahesh Mahadevan d5775ea7ba drivers: usb_dc_mcux: Use CONFIG_USB_DC_NXP_LPCIP3511 define
Use CONFIG_USB_DC_NXP_LPCIP3511 instead of FSL_FEATURE_USB_USB_RAM
as the behaviour variation is based on the SDK driver used and not
if the SoC has a dedicated USB SRAM.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 17:53:37 -04:00
Mahesh Mahadevan f05bbd09be drivers: usb_dc_mcux: Add Pinctrl defines
Add Pinctrl code

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 17:53:37 -04:00
Mahesh Mahadevan ec5d3b7bff drivers: nxp_usb: Enable USB_DC_HAS_HS_SUPPORT conditionally
Conditionally enable the USB_DC_HAS_HS_SUPPORT as the
USB_DC_NXP_LPCIP3511 controller can have both HS and FS only.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 17:53:37 -04:00
BJ Chen 215f180296 ITE: drivers/usb/device: Add USB Device Controller Support
Add USB Device Driver (usb_dc) of ITE IT82xx2

TEST=west build -p always -b it82xx2_evb
1. zephyr/sample/subsys/usb/hid
2. zephyr/sample/subsys/usb/hid-mouse

Signed-off-by: BJ Chen <bj.chen@ite.com.tw>
2023-05-26 12:40:18 +02:00
Niek Ilmer b79d65aaca drivers: usb_device: Add USB driver for smartbond
This adds support for the USB interface for the
Renesas Smartbond DA1469x device family.

Co-authored-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>

Signed-off-by: Niek Ilmer <niek.ilmer.aj@renesas.com>
2023-05-26 10:19:15 +02:00
Carlo Caione cb11b2e84b barriers: Move __DSB() to the new API
Remove the arch-specific ARM-centric __DSB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione 2fa807bcd1 barriers: Move __DMB() to the new API
Remove the arch-specific ARM-centric __DMB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Gerard Marull-Paretas dacb3dbfeb iterable_sections: move to specific header
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-22 10:42:30 +02:00
Johann Fischer 1a30cd8f1c drivers: udc: add USB device controller driver skeleton
Add a USB device controller driver skeleton to use as a starting point
for implementing a specific driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-17 12:26:48 +02:00
Johann Fischer 0a5b682461 drivers: udc_virtual: fix bus SUSPEND, RESUME, RESET event handling
Only UVB_EVT_REQUEST type passes the pkt argument.
This was overlooked in the last refactoring and
resulted in a zero pointer dereference.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-11 15:29:58 +02:00
Johann Fischer fce0b85eca drivers: usb_dc_dw: add support for STM32F4 SoC family
This commit is a draft to support more controller implementations
with these drivers. The goal is also to make it easier to port
this driver to the new UDC API later.
We use compatible, like st,stm24f4-fsotg to support and enable
vendor-specific quirk. The core of the driver remains generic,
and therefore described and enabled by snps,dwc2 compatible.

STM32F4 support requires PINCTRL, even though pinctrl API is
generic, not all platforms implement it, so we have to include
and compile it conditionally.

Now we also switch to use new snps,dwc2 compatible and
explicitly force the controller into device mode,
as we do not support other roles or role changes.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-10 20:07:04 +09:00
Johann Fischer 7538c551ff drivers: usb_dc_dw: add definition for GHWCFG1..4 registers
Add definition for GHWCFG1..4 registers to be able to obtain basic
information about PHY, endpoints, and Data FIFO.

Add GGPIO defines for STM32F4 SoC family USB controllers.
This implementation uses GGPIO to enable transceiver, VBUS
detection, and a few other functions.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-10 20:07:04 +09:00
Johann Fischer 4d2645a734 drivers: usb_dc_dw: cleanup and reorder register header
Align and sort defines according to the position in memory.
Remove unnecessary parentheses.

Fix USB_DW_DSTS_ENUM_SPD_MASK.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-10 20:07:04 +09:00
Johann Fischer 51f8d02294 drivers: usb_dc_dw: cleanup, move USB_DW macros to driver code
Cleanup includes, fix build and missing kernel header include.
Move copyright notice to the top.

USB_DW_* macros are a bit misplaced in register header,
which is supposed to be about registers only.

USB_DW macro is used to point to base of controller register set.
Move it to driver code and add a new variable in driver's configuration
that takes the base address of the instance. This also makes later
porting to UDC API and support multiple instances easier.

Remove redundant DW_USB_IN_EP_NUM and DW_USB_OUT_EP_NUM
macros. Do not limit number of endpoint register in
struct usb_dw_in_ep_reg as it does not reflect common
register mapping of the controller.

Fix build warnings caused by USB_DW_EP_FIFO and use base variable
to calculate data FIFO access register.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-10 20:07:04 +09:00
Keith Short d4fef500b2 emul: pi3usb9201: Add charging mode support
Add charging mode support the PI3USB9201 emulator and add a backend API
for connecting/disconnecting a portable device partner.

Signed-off-by: Keith Short <keithshort@google.com>
2023-05-08 09:57:56 +02:00
Keith Short 00733f346b bc12: Add charging mode support
Add chargingg mode support to the BC1.2 API and the PI3USB9201 driver.

Signed-off-by: Keith Short <keithshort@google.com>
2023-05-08 09:57:56 +02:00
Keith Short 86cb55943d bc12: Add charging mode role information to callback
Update the result callback routine to also provide information about the
charging mode role. This permits tests to validate plug/unplug events
detected by the BC1.2 device operating in charging mode.

Signed-off-by: Keith Short <keithshort@google.com>
2023-05-08 09:57:56 +02:00
Tomasz Moń 11b599c708 drivers: usb_dc_nrfx: Enable SOF interrupts only when needed
Do not enable SOF event interrupt when the USB device driver is going to
discard the event anyway. This prevents completely unnecessary interrupt
handler from executing 1000 times a second when device is connected.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-05-05 13:37:47 +02:00
Declan Snyder 90570c6b9d drivers: usb_dc_mcux: Fix write performance issues
The MCUX USB device driver currently suffers from
some performance related issues caused by the removal
of the intermediate buffer in commit 4e6f80d37a.
This buffer was essential in the case when some USB
descriptors or data were in a slow access memory,
for example a flash memory accessed over flexspi.
USB DMA as AHB master would try to fetch the data,
but it would be too slow and USB peripheral
could not meet deadlines on the USB bus waiting for it,
and so it would send null packets instead causing errors.

This problem can be fixed by re-introducing an intermediate
buffer in RAM with the data copied from the slow memory by
the core before the USB transfer begins, so that USB DMA
is not responsible for fetching it from flexspi/flash.

Changes to MCUX USB Device Driver:
- Re-add intermediate buffer for USB writes in RAM
- Buffer is not needed for reads, add runtime check
  to avoid copy overhead
- Buffer is not needed for platforms with USB RAM,
  since the USB RAM itself acts as an intermediate buffer.
  Compile with buffer code only when USB RAM is not present on
  the platform, to avoid unecessary copy overhead.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-04-25 12:43:17 -05:00
Gerard Marull-Paretas 4863c5f05b sys/util: extend usage of DIV_ROUND_UP
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 16:42:29 +02:00
Gerard Marull-Paretas a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Pieter De Gendt 6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
Keith Short 9b8c4ee847 emul: pi3usb9201: Create pi3usb9201 emulator
Create an emulator for the pi3usb9201 USB charging detector.

Signed-off-by: Keith Short <keithshort@google.com>
2023-03-30 17:34:36 -04:00
Keith Short e0dd45ba31 bc12: API and 1st driver implementation.
Add portable-device mode to the Diodes PI3USB9201 USB charging detector.

Signed-off-by: Keith Short <keithshort@google.com>
2023-03-30 17:34:36 -04:00
Henrik Brix Andersen c41dd36de2 drivers: kconfig: unify menuconfig title strings
Unify the drivers/*/Kconfig menuconfig title strings to the format
"<class> [(acronym)] [bus] drivers".

Including both the full name of the driver class and an acronym makes
menuconfig more user friendly as some of the acronyms are less well-known
than others. It also improves Kconfig search, both via menuconfig and via
the generated Kconfig documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 15:06:06 +02:00
Johann Fischer 9d91333a43 drivers: udc: simplify udc_submit_event()
Since we have a dedicated function for UDC_EVT_EP_REQUEST type
events, we can now simplify udc_submit_event() and remove
buf parameter.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Johann Fischer ad81b3b797 drivers: udc: move transfer status to buffer info structure
This allows us to get the result of synchronous transfer without
any hacks, just from the net_buf structure.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Johann Fischer 39218112ab drivers: udc_nrf: do not use UDC_EVT_EP_REQUEST without net_buf pointer
Do not use UDC_EVT_EP_REQUEST event without a valid pointer
to a request buffer. No changes needed in the upper layer because
it requires valid buffer pointer for this type of event anyway.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Johann Fischer 4a53645448 drivers: udc: add helper function to send UDC endpoint event
Add helper function to send UDC endpoint event to a higher level
that takes fewer arguments.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Gerson Fernando Budke 5522e65581 drivers: usb: sam: Update to use clock control
This update Atmel SAM usbhs driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Purdea Andrei f4e0f9004f drivers: usb_dc_rpi_pico: implement remote wakeup support
This change implements the following, necessary for remote wakeup to be
supported:

- implement usb_dc_wakeup_request() call to trigger remote wakeup
- implement interrupts to detect supsended/resumed state
- implement extra logic to simulate resumed state when the resume
  is a result of remote wakeup. In this case the rp2040 chip doesn't
  send a USB_INTR_DEV_RESUME_FROM_HOST interrupt, or any other
  interrupts when the resume condition is detected to be extended
  by the upstream port, so we need to simulate this event when we
  see activity on the bus.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-03-06 21:18:38 +01:00
Purdea Andrei 73a800f7dd drivers: usb_dc_rpi_pico: fix stability issue related to control transfers
Description of the bad behaviour before this change:

The arming of the control EP0_OUT endpoint was not kept under
control. It could happen that the EP0_OUT endpoint was left
armed, after the completion of a complete control transfer.

It is clear that the intention was to NOT keep EP0_OUT constantly
armed while idle, because usb_dc_ep_enable() doesn't arm it,
and the intention was for when usb_dc_ep_read() is called to
collect the Setup-Stage 8-byte data, that is when EP0_OUT is armed,
and before this call is performed, the host will keep getting NAKs
for the Data-Stage of the to_device control transfer.

This happens correctly on the first to_device control transfer with
wLength > 0. However, because usb_dc_ep_read_continue() indiscriminately
re-arms all OUT endpoints, in the case of to_device control transfers
with wLength > 0, on the Data-Stage, the endpoint is also re-armed,
which is wrong, because then the endpoint will be left armed after
the control transfer is over.

In this case when a new to_device control transfer starts, the
Data-Stage will be accepted on the first try. This would still
have worked without a failure if the Setup-Stage would have been
processed immediately, but because we process everything in a work
queue at a later time, when the Setup-Stage associated 8-byte data
buffer is read both the Setup-Stage and Data-Stage have arrived.
At the end of handling the Setup-Stage we try to re-arm the EP0_OUT,
which already contains data, thereby corrupting the received length
portion of the buf_ctl register. (Obviously other fields are changed
too, but the length field is the one that first causes chaos, cause
it's written to the maximum, which is 64.) The above mentioned Data-Stage
already has a message in its workqueue for it to be processed, but
it is picked up only after the length field has been corrupted.
Because of this usb_dc_ep_read() thinks there is more data in the buffer
than there really is, and everything becomes de-synchronized, with
later reads accessing uninitialized parts of the buffer.

This sounds like a fundamental failure, that should make it impossible
to operate USB, however the reason this behaviour doesn't make it
impossible to enumerate the device is that this only affects
to_device control transfers with wLength > 0, and during enumeration
there are not many of those happening.
When enumerating a HID keyboard, there is only _one_ of those
happening, and it is the initial setting of the lock light led status.
And that first one succeeds because it's the first one. (However, later
lock light setting control transfers can cause problems, which is how
this problem was encountered.)

The solution in this commit is to keep better control over when EP0_OUT
is armed. This forces the Data-Stage to arrive later (the host will keep
re-trying), and that way the corruption of the buffer control register
is avoided.

Summary of the changes:
 - Rework the logic around deciding wether to re-arm the out endpoint
   after a read. For non-0 endpoint the previous behaviour is kept,
   however for EP0 it is only re-armed if more OUT transactions are
   expected for that SETUP transfer (be it data-stage or status-stage)
 - Force un-arm the EP0_OUT endpoint in case a stall condition is observed.
 - When a setup transfer is received check if EP0_OUT is already armed.
   If armed then log a warning message, and force-disarm it.
 - When a setup req interrupt fires, don't immediately force the next
   read to get it, instead, it will be read only after a setup message
   is extracted from the message queue.
 - When a setup packet is received abort any unfinished previous control
   transfers:
    - cancel any data buffers given to the EP0_IN endpoint
    - drop any new ep0_in writes that are attempted before this newest
      setup packet's associated message is extracted from the message
      queue.
 - In the ISR, check buffer interrupts before setup req interrupts.
   This is to make sure that the final 0-length status message from the
   previous setup packet is consumed before the new setup packet.
   (this is the only case now when both interrupts could be seen as
   having fired by the time the interrupt handler routine executes.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
Co-authored-by: Johann Fischer
2023-03-02 12:58:24 +01:00
Andrei Emeltchenko 8e84d840b5 usb: Fix build for 64 bit platforms
Use proper format for size_t type eliminating warnings of type:

...
error: format '%u' expects argument of type 'unsigned int', but
argument 2 has type 'size_t' {aka 'long unsigned int'}
[-Werror=format=]
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-23 17:51:31 +01:00
Andrei Emeltchenko ddf9854bfb usb: udc_virtual: Adapt to updated API
Commit 00adb2a539 ("drivers: udc: remove no more required pending
state flag") removed state parameter from udc_buf_peek and udc_buf_get.
Adapt udc virtual driver so the code compiles.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-23 17:51:31 +01:00
Gerard Marull-Paretas 86a0f80c57 drivers: usb: udc: nrf: fix declaration after label
C language does not allow declarations after labels, only statements are
allowed. Add {} around the `NRFX_USBD_EVT_SETUP` case to fix build
issues (`error: a label can only be part of a statement and a
declaration is not a statement`)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-20 13:22:02 +01:00
Purdea Andrei 158ee9139c drivers: usb_dc_rpi_pico: cleanup incorrect comment and condition
I believe this comment and condition may have found its way into the
rp2040 driver from other drivers where it makes more sense. For
example for the stm32 driver performing a read on the EP0_IN endpoint
turns it silently into a read on the EP0_OUT endpoint. As far as I can
tell, this really was only used to consume 0-length Status-Stages of
to_host control transfer in the other drivers.

Note that usb_dc_ep_start_read() is never called in an IN endpoint
in the rp2040 driver, and furthermore, even if it would have been
called like that, the current implementation would not do the silent
change into actually performing a read on the EP0_OUT endpoint instead,
so the condition and comment is just wrong.

Note that 0-length Status-Stage of to_host control transfers is
currently consumed in this driver by usb_dc_ep_read_continue().

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-11 08:23:03 +09:00
Purdea Andrei 4fcbba2fb1 drivers: usb_dc_rpi_pico: fix toggle data1/0 on to_device control transfers
The data stage of Control transfers that are sent from Host to Device, can
be made out of multiple OUT transactions, if the amount of data to be
transmitted is larger than the endpoint size. When this happens, the DATA
pid should be toggling. The USB Device driver of the pico must correctly
prime the EP0_OUT buffer with the correct data PID, otherwise the hardware
will reject the received transaction.

Before this change the driver used to always prime EP0_OUT with a DATA1
pid.
After this change the driver only uses DATA1 pid after a setup transaction,
and then toggles the pid for each transaction.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-11 08:00:43 +09:00
Purdea Andrei 9a7f9ec0ba drivers: usb_dc_rpi_pico: avoid infinite unhandled irq retriggers
This driver enables a number of interrupts it does not attempt to handle.
This results in "unhandled IRQ: 0x...." messages being printed, and the
interrupt handler retriggers immediately again, and this happens again
and again forver, because nothing ends up clearing the interrupt.

This change implements very limited handling of these interrupts. A custom
warning is logged, and the interrupt is cleared.

This change does not imply that doing this is sufficient. More changes may
need to be implemented to more gracefully re-start transactions or
re-arm some endpoints, but this is one step in the right direction,
and at least the OS doesn't freeze up.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-06 22:07:03 +09:00
Mahesh Mahadevan 4e6f80d37a drivers: usb: mcux: Fix the write operation
1. Do not copy over the data to the local buffer,
it can be directly sent to the controller. The
cache is flushed before calling the HAL send
function. Also do not allocate a buffer from
the heap pool for the write operation.
2. Remove a length check as this is handled by
the HAL driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Mahesh Mahadevan 9bef7d07e7 drivers: usb: mcux: Remove unnecessary while loop
The while loop is changed to an if check.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Mahesh Mahadevan 17da2015bc drivers: usb: Cleanup MCUX driver
1. Remove unused ep_type structure member
2. Add more direction checks

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Johann Fischer 2f310dc424 drivers: udc: add capability for MPS of control endpoint
New capability is to be used by the stack to adjust the corresponding
field in the device descriptor.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 16:11:20 +01:00
Johann Fischer 373d660d96 drivers: udc: remove unused and unsupported udc_ep_flush()
udc_ep_flush() is not implemented by the driver and is not
used by the USB device stack. Remove it for less confusion
when porting drivers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 16:11:20 +01:00
Johann Fischer e60a4efbb0 drivers: udc: do not update MPS for isochronous endpoints
Zero data payload size for isochronous endpoints is a
is a valid setting for default interface.
Also do not update MPS of control endpoint since it is
set by the driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 00:57:22 +09:00
Mahesh Mahadevan 3b7e7575a9 drivers: usb: Enable High speed Kconfig for NXP controllers
Enable the USB_DC_HAS_HS_SUPPORT Kconfig for NXP controllers
that support High speed.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-23 19:40:44 -08:00
Erwan Gouriou 419adeaeed drivers: usb: stm32: Replace static clock check by a runtime check.
In order to clean up clock related code, replace static build time
clock configuration code by a runtime check.
Since I'm not able to guarantee this check will provide a correct
verdict in 100% of the cases (I'm thinking to ULPI or exotic configurations
like F7 OTG-HS), add a config option to disable it if needed.
It also doesn't apply on F1/F3 series. Keep the build time check for now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou 4899c104e0 drivers: usb: stm32: Configure domain clock using device tree
This change doesn't consider STM32F1 series.

There are 5 categories of STM32 regarding USB domain clock:
A] USB domain clocks directly driven by CK48 clocks
B] USB domain clocks which can select either CK48 or an alternative clock
C] USB domain clocks which can select between MSI or PLL
D] USB domain clocks relying statically on a PLL output
E] USB domain clocks which can be set on 2 different PLL ouputs

For case A], there is nothing to be done. Clk48 was already configured
in a previous change (51c7643295b02ba26ddcd0fd915484114db7101c).
For case B] and C] USB domain clocks will need to be configured in
each board.
For case D] and E] relying on existing dts configuration. Though
there is no easy build time chekc that can be done.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou cbc44075b7 drivers: usb: stm32: Store dt clock information into an array
Use STM32_DT_INST_CLOCKS() to access usb device clock information.
This will help accessing domain clock information from dt nodes.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou fccf4c95c0 drivers: usb: stm32: Remove HSI48 activation related code
Remove this code to clean up the driver.
Clock activation is done from device tree configuration in clock_control
driver.
Users are informed by warning about missing configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Johann Fischer b5bfd3b12c drivers: udc: fixup parameter endpoint description
The description was still from the early stages of development.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer 2cab3a8243 drivers: usb: udc_kinetis: fix race condition in Kinetis USBFSOTG
Periodic enqeueu of buffers can cause a attempt to start
a new transfer even though an endpoint is already busy.

Split usbfsotg_xfer_start() into two function, one to start
next transfer and another to continue the transfers, and use
busy state flags to explicitly mark an endpoint busy.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00