aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/usbfs.c
Commit message (Collapse)AuthorAgeFilesLines
* stm32: Fix STM32G4 USBAlex Maclean2023-12-211-1/+6
| | | | | | STM32G4 USB controller requires 8 or 16-bit access, not 32-bit Signed-off-by: Alex Maclean <monkeh@monkeh.net>
* stm32: Make sure to limit tx during usbfs startupKevin O'Connor2023-10-051-1/+2
| | | | | | | Wait for two tx packets before startup, and make sure one of those packets is acked before sending a third tx packet. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Fix usbfs spurious USB packet transmit on startupKevin O'Connor2023-10-041-6/+16
| | | | | | | | | | | Commit cd8d57c2 added USB double buffering mode on transmits. However, when enabling double buffering mode, the hardware seems to always send at least two packets. Spurious transmissions could cause the Linux gs_usb driver to get confused, which could lead to the can0 device becoming unavailable on restarts. Fix by waiting for two USB packets to be available before enabling the endpoint. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Only enable one direction on usbfs double buffered end pointsKevin O'Connor2023-10-041-2/+2
| | | | | | | The bulk out endpoint should not be enabled in tx mode, and the bulk in endpoint should not be enabled in rx mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add usbfs double buffer support for bulk tx messagesKevin O'Connor2023-10-031-8/+28
| | | | | | | | Implement the usbfs fast buffer switching mechanism on the "bulk in" endpoint. This can improve the overall USB throughput and bus utilization. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add usbfs double buffer support for bulk rx messagesKevin O'Connor2023-10-031-14/+49
| | | | | | | | Implement the usbfs fast buffer switching mechanism on the "bulk out" endpoint. This can improve the overall USB throughput and bus utilization. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Update usbfs to support setting both buffers for each endpointKevin O'Connor2023-10-031-35/+37
| | | | | | | | | The usbfs device supports two buffers for each endpoint - typically one for rx and one for tx. Add support for explicit handling of both buffers. This is in preparation for improved "double buffering" support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Improve usbfs epr register handlingKevin O'Connor2023-10-031-40/+41
| | | | | | | | Replace the set_stat_x_bits() functions with a single calc_epr_bits() function. This new function supports setting bits other than the stat field in the epr register. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Prefer "MACH_STM32F1" test over "MACH_STM32F103 || MACH_N32G45x"Kevin O'Connor2023-04-071-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add support for Nation N32G45x mcus (#6116)Alexey2023-04-071-1/+1
| | | | | N32G452/G455 are mostly compatible with STM32F103 but have M4 core and different ADC. Signed-off-by: Alexey Golyshin <stas2z@gmail.com>
* stm32: Fix usb build on stm32g0b0Kevin O'Connor2022-12-151-2/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32g4: implement build,usb,can,i2c,spi,serial,adc.Matt Baker2022-12-021-1/+1
| | | | Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
* stm32l4: add stm32l412 support with adc,i2c,spi,usbMatt Baker2022-09-151-1/+1
| | | | Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
* stm32: Add support for USB on stm32g0Kevin O'Connor2021-12-231-20/+69
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Rework USB transfer memory layout in usbfs.cKevin O'Connor2021-12-231-46/+55
| | | | | | | | | Use a fixed layout for the USB transfer memory and remove the ep_mem struct definition. This is in preparation for stm32g0 support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Fix buffer size calculation in usbfs.cKevin O'Connor2021-12-231-1/+1
| | | | | | When the buffers are over 32 bytes, a block count of 1 starts at 0. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Simplify irq declaration in usbfs.cKevin O'Connor2021-12-231-11/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Initial support for stm32f070Kevin O'Connor2019-10-231-6/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Support 16bit packet memory access on usbfs controllerKevin O'Connor2019-10-231-9/+15
| | | | | | | The stm32f0 line uses 16bit packet memory reads/writes (as opposed to the goofy 32bit accesses required on the stm32f103). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Make sure to turn on the usb clock before writing to the packet memoryKevin O'Connor2019-10-131-4/+4
| | | | | | | The USB clock needs to be enabled prior to writing to the USB packet memory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Move usb_request_bootloader() to chip specific codeKevin O'Connor2019-09-181-15/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Fix usbfs rx buffer sizingKevin O'Connor2019-09-161-2/+2
| | | | | | | | | The usbfs receive buffers must also have space for the 2 byte crc at the end of a transmission. This fixes an error that could lead to lost messages from mcu to host (resulting in bytes_invalid increasing in stats) on the stm32f103. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Use official defines for EPR bitsKevin O'Connor2019-09-161-30/+23
| | | | | | Use the standard definitions for the endpoint register bits. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Rename USB_BTABLE to EPM in usbfs.cKevin O'Connor2019-09-161-20/+20
| | | | | | | Rename the internal definition so it isn't in conflict with the USB_BTABLE register. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Update code to use armcm_boot mechanismKevin O'Connor2019-08-221-3/+3
| | | | | | | Replace the stm32 provided assembler with the src/generic/armcm_boot.c mechanism. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Move irq handler code above irq setupKevin O'Connor2019-08-221-28/+28
| | | | | | Only code movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Rename stm32f4/ directory to stm32/Kevin O'Connor2019-08-051-0/+307
Now that the code in stm32f4/ can handle both stm32f1 and stm32f4 chips, rename the directory to just "stm32". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>