1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

37 Commits

Author SHA1 Message Date
MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
chrysn
756a384442 makefiles, treewide: Remove MCU variable 2024-02-18 20:46:09 +01:00
Gunar Schorcht
b34f48c233 drivers/usdev_synopsys_dwc2: enable EFM32GG11B support 2023-09-18 12:40:33 +02:00
Gunar Schorcht
34ba3a22c8 drivers/usbdev_synopsys_dwc2: set V_DDUSB for U5 2023-07-05 09:39:13 +02:00
Gunar Schorcht
b69165cde8 drivers/usbdev_synopsys_dwc2: fix disabling of V_BUS sensing 2023-07-05 09:33:53 +02:00
Gunar Schorcht
db52e5fa62 drivers/usbdev_synopsys_dwc2: comments improved 2023-07-05 09:29:48 +02:00
Gunar Schorcht
26d435a101 drivers/usbdev_synopsys_dwc2: add GD32V support 2023-04-16 23:24:23 +02:00
Gunar Schorcht
ee83893496 drivers/periph_usbdev: TXFE not used any longer
After changing IN EPs also to use XFRC (Transfer Complete) interrupts in non-DMA mode, the TXFE (TX FIFO Empty) interrupt is no longer needed to signal the completion of an IN transfer.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
ea776c92b6 drivers/usbdev_synopsys_dwc2: handle RXFLVL interruprs in ISR
Since RXFLVL (RX FIFO Level) interrupt doen't complete transfers anymore, they are handled now directly in the ISR.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
d15f0f3a7b drivers/usbdev_synopsys_dwc2: use XFRC for OUT EPs in non-DMA mode
XFRC (Transfer Complete) interrupts are now also used for OUT EPs in non-DMA mode. RXFLVL (RX FIFO Level) interrupts are no longer used to signal completed transfers, but only to copy data from FIFO to memory and to set a flag indicating that a SETUP stage is in progress. STUP (SETUP phase done) interrupts are then used to signal a completed SETUP stage and to reset the flags that indicates the SETUP stage. The flag that indicates the SETUP stage in progress is used to ignore additional XFRC interrupts for EP0 during the SETUP stage.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
1ccafe1621 drivers/usbdev_synopsys_dwc2: use XFRC for IN EPs in non-DMA mode
XFRC (Transfer Complete) interrupts are now also used for IN EPs in non-DMA mode. TXFE (TX FIFO Empty) interrupts are not necessarily needed but are still enabled.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
1a37d3b9e0 drivers/usbdev_synopsys_dwc2: several cleanups 2023-04-16 22:59:11 +02:00
Gunar Schorcht
e3fb4e7cfb drivers/usbdev_synopsys_dwc2: add OTG interrupt handling 2023-04-16 22:59:11 +02:00
Gunar Schorcht
1d7224602d drivers/usbdev_synopsys_dwc2: print CID/HW debug info 2023-04-16 22:59:11 +02:00
Gunar Schorcht
ff9e9e3a7c drivers/usbdev_synopsys_dwc2: fix power modes for STM32 2023-04-16 22:59:11 +02:00
Gunar Schorcht
d35fa914c8 drivers/usbdev_synopsys_dwc2: fix a typo 2023-04-16 22:59:11 +02:00
Gunar Schorcht
98b6d75c14 drivers/usbdev_synopsys_dwc2: improve FIFO allocation doc 2023-04-16 22:59:11 +02:00
Gunar Schorcht
9e8ef51283 drivers/usbdev_synopsys_dwc2: add thread context switch at ISR exit
The USB device driver ISR sets a thread flag of the waiting USBUS thread to indicate that it has to handle a USB device driver event. However, setting a thread flag only sets `sched_context_switch_request` to indicate that a thread context switch would be required, but it is not executed. Therefore, for STM32 MCUs, `cortexm_isr_end` was called to execute the context switch. Since the driver is also used by other platforms, this call is replaced by a direct call of `thread_yield_higher` if required. NOTE: For ESP32x SoC, such a thread context switch is implicitly executed at the end of each ISR if necessary.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
8999a5083f drivers/usbdev_synopsys_dwc2: remove USB OTG HS definition dependencies
If the MCU/board has only an USB OTG FS peripheral or only an USB OTG HS peripheral, it should only need to specify the USB OTG FS definitions such as the number of EPs or the FIFO sizes or only the USB OTG HS definitions. This commit cleans up the code so that it is translatable without the respective definitions.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
eff6c93cec drivers/usbus_synopsys_dwc2: fix interrupt handling in DMA mode 2023-04-07 12:43:02 +02:00
aa67c98a4a
synopsys_dwc2: implement USBOPT_ENUMERATED_SPEED 2023-03-31 16:43:44 +02:00
bors[bot]
50cd32fbbf
Merge #19397 #19416 #19418 #19419
19397: drivers/usbdev_synopsys_dwc2: fix and reenable DMA mode r=benpicco a=gschorcht

### Contribution description

This PR fixes the DMA mode for all STM32 USB OTG HS cores (including that for STM32F4xx CID 1.xxx) and reenables it. It fixes remaining problems in issue #19359.

This PR includes also includes some changes that are needed to use the DMA mode:
- EP number is used as defined in CMSIS (if defined) for STM32
- `periph_usbdev_hs` feature is added in Kconfig
- `periph_usbdev_hs` feature is added in board definition of `stm32f429i-disc1`
- largest number of available EPs is used for STM32 instead of the smallest number (to be able to use all EPs of HS peripheral)
- `stm32f429i-disco` is removed from blacklist in `tests/usbus_cdc_ecm` since it uses the HS peripheral

### Testing procedure

The following tests should work
```python
USEMODULE=stdio_cdc_acm BOARD=stm32f429i-disc1 make -j8 -C tests/usbus_cdc_ecm flash
```
<details>
<summary>Test results</summary>

```python
[526755.875691] usb 1-2.2: new full-speed USB device number 106 using xhci_hcd
[526755.977853] usb 1-2.2: config 1 interface 3 altsetting 1 endpoint 0x84 has invalid maxpacket 512, setting to 64
[526755.977856] usb 1-2.2: config 1 interface 3 altsetting 1 endpoint 0x2 has invalid maxpacket 512, setting to 64
[526755.978762] usb 1-2.2: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00
[526755.978764] usb 1-2.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[526755.978766] usb 1-2.2: Product: stm32f429i-disc1
[526755.978768] usb 1-2.2: Manufacturer: RIOT-os.org
[526755.978769] usb 1-2.2: SerialNumber: 7C156425A950A8EB
[526755.991190] cdc_acm 1-2.2:1.0: ttyACM1: USB ACM device
[526755.998131] cdc_ether 1-2.2:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-2.2, CDC Ethernet Device, a6:f6:4a:85:1d:c9
[526756.044150] cdc_ether 1-2.2:1.2 enp0s20f0u2u2i2: renamed from usb0
```

</details>

```python
USEMODULE='stdio_cdc_acm periph_usbdev_hs_utmi' BOARD=stm32f723e-disco make -j8 -C tests/usbus_cdc_ecm flash
```
<details>
<summary>Test results</summary>

```python
[528733.480207] usb 1-4.3.4: reset high-speed USB device number 32 using xhci_hcd
[528733.707800] usb 1-4.4: new high-speed USB device number 111 using xhci_hcd
[528733.808257] usb 1-4.4: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 255, changing to 11
[528733.808260] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64
[528733.808263] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 64
[528733.808642] usb 1-4.4: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00
[528733.808645] usb 1-4.4: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[528733.808647] usb 1-4.4: Product: stm32f723e-disco
[528733.808649] usb 1-4.4: Manufacturer: RIOT-os.org
[528733.808651] usb 1-4.4: SerialNumber: A6BAC4E1B1E0806B
[528733.811988] cdc_acm 1-4.4:1.0: ttyACM1: USB ACM device
[528733.814456] cdc_ether 1-4.4:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-4.4, CDC Ethernet Device, e6:75:97:3a:74:ba
[528733.854371] cdc_ether 1-4.4:1.2 enp0s20f0u4u4i2: renamed from usb0
```

</details>

```python
USEMODULE='stdio_cdc_acm periph_usbdev_hs_ulpi' BOARD=stm32f746g-disco make -j8 -C tests/usbus_cdc_ecm flash
```
<details>
<summary>Test results</summary>

```python
[529000.944482] usb 1-4.3.4: reset high-speed USB device number 32 using xhci_hcd
[529003.728260] usb 1-4.4: new high-speed USB device number 114 using xhci_hcd
[529003.833107] usb 1-4.4: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 255, changing to 11
[529003.833111] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64
[529003.833113] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 64
[529003.833743] usb 1-4.4: New USB device found, idVendor=1209, idProduct=7d00, bcdDevice= 1.00
[529003.833747] usb 1-4.4: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[529003.833749] usb 1-4.4: Product: stm32f746g-disco
[529003.833751] usb 1-4.4: Manufacturer: RIOT-os.org
[529003.833753] usb 1-4.4: SerialNumber: 66FE8934D1A363E0
[529003.837143] cdc_acm 1-4.4:1.0: ttyACM1: USB ACM device
[529003.839755] cdc_ether 1-4.4:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-4.4, CDC Ethernet Device, 6a:88:1f:1f:b1:f0
[529003.879025] cdc_ether 1-4.4:1.2 enp0s20f0u4u4i2: renamed from usb0```
```
</details>

### Issues/PRs references

Fixes #19359


19416: cpu/rpx0xx/cmsis: Update vendor header files r=benpicco a=maribu

### Contribution description

Generated new vendor header files from upstream SVD files using:

    ./SVDConv "$PICO_SDK_DIR"/src/rp2040/hardware_regs/rp2040.svd \
        --generate=header --fields=macro --fields=enum

Note: The missing `--fields=struct` flag resulted in the header no longer containing bit-fields to represent different fields within registers. While this would generally ease writing code, the RP2040 has the unpleasant feature of corrupting the remaining bits of the register when a write access that is not word-sized occurs in the memory mapped I/O area. This could happen e.g. when a bit field is byte-sized and byte-aligned.
### Testing procedure

No binary changes (hopefully).

### Issues/PRs references

This adds a few additional vendor defines, notably for USB. If anyone were to implement USB, this would be a requirement.

19418: cpu/gd32v: fix gpio_read in periph_gpio r=benpicco a=gschorcht

### Contribution description

This PR fixes a bug in `gpio_read` which made `gpio_read` completely unusable!

A small bug with big consequences. In `gpio_read` the combined port | pin_num parameter `pin` was used instead of the pin number `pin_num` for the call of `_pin_is_input`. This caused the problem that for example instead of accessing GPIOA->CTL0 with address 0x40010800, address 0x60018c00 was accessed. As a result, a pin was randomly detected as input or output and thus a result was arbitrarily returned. Approx. 50% of all inputs always returned LOW.

I found this error by coincidence when I tried to find out why the BOOT0 button on a Sipeed Longan Nano is not usable as a button in RIOT.

### Testing procedure

Flash `tests/periph_gpio`
```
BOARD=sipeed-longan-nano make -j8 -C tests/periph_gpio flash
```
and use commands
```
init_in 0 8
read 0 8
```
Without this PR, the pin is always LOW. With the PR, the pin should be HIGH when the BOOT button is pressed.

### Issues/PRs references

19419: boards/sipeed-longan-nano: add BOOT as user button r=benpicco a=gschorcht

### Contribution description

This PR makes the BOOT button usable as a user button.

### Testing procedure

The test requires PR #19418 to work.

Flash and test:
```
BOARD=sipeed-longan-nano make -j8 -C tests/saul flash term
```
The output
```
Dev: BOOT	Type: SENSE_BTN
Data:	              0 
```
should change to
```
Dev: BOOT	Type: SENSE_BTN
Data:	              1 
```
when the BOOT button is pressed.

### Issues/PRs references

Depends on PR #19418 


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-03-24 08:38:06 +00:00
Gunar Schorcht
d388055850 drivers/usbdev_synopsys_dwc2: add ESP32x power management 2023-03-16 12:27:56 +01:00
Gunar Schorcht
97e1cdc15e drivers/usbdev_synopsys_dwc2: fix DMA mode 2023-03-16 08:44:48 +01:00
Gunar Schorcht
93c547aaa8 drivers/usbdev_synopsys_dwc2: disable DMA mode
DMA mode is disabled for now due to several problems:
 - The STALL bit of the OUT control endpoint does not seem to be cleared automatically on the next SETUP received. At least the USB OTG HS core does not generate an interrupt on the next SETUP received. This happens, for example, when CDC ACM is used and the host sends the SET_LINE_CODING request. In this case the enumeration of further interfaces, for example CDC ECM is stopped.
- The Enumeration fails for CDC ECM interface which uses URB support.
2023-03-14 14:04:20 +01:00
Gunar Schorcht
4d19f21703 driver/usbdev_synopsys_dwc2: use correct number of EPs
This commit fixes the problem that the driver uses the wrong number of EPs when using the USB OTG HS core. The reason is that the constant `DWC2_USB_OTG_FS_NUM_EP` is used in several places even though there is a function `_max_endpoints` which takes into account the configuration used. For most MCUs this is not a problem, because they have only a USB OTG FS core anyway. But for MCUs like the STM32, which has both a USB OTG FS core and a USB OTG HS core, it matters.
2023-03-11 16:57:23 +01:00
33ba2adc68
drivers/usbdev_synopsys_dwc2: add stall functions to usbdev 2023-02-28 11:00:06 +01:00
Gunar Schorcht
6ab71b1dee drivers/usbdev_synopsys_dwc2: add EFM32 support 2022-12-07 16:34:34 +01:00
MrKevinWeiss
17cce015d4
treewide/stm32: Make CLOCK_HS* configurable 2022-11-03 11:37:28 +01:00
Gunar Schorcht
1dfe79fe7c drivers/usbdev_synopsys_dwc2: use DWC2_USB_OTG_FS_TOTAL_FIFO_SIZE
Use `DWC2_USB_OTG_FS_TOTAL_FIFO_SIZE` instead of `USB_OTG_FS_TOTAL_FIFO_SIZE` since the latter is only defined in the vendor headers for STM32 MCUs. The STM32-specific problem that `USB_OTG_FS_TOTAL_FIFO_SIZE` is not defined in the vendor headers for all STM32 families has therefore been moved from the driver to the STM32-specific USB device header.
2022-10-17 20:03:57 +02:00
0fca912e91
Merge pull request #18714 from gschorcht/drivers/usbdev_synopsys_dwc2_hs_utmi
drivers/usbdev_synopsys_dwc2: add support for internal UTMI HS PHY
2022-10-16 14:05:32 +02:00
Gunar Schorcht
41b0a3efae drivers/usbdev_synopsys_dwc2: add internal UTMI HS PHY support 2022-10-16 11:35:42 +02:00
8cecb81517
usbdev_synopsys_dwc2: Mask RX FIFO irq with DMA
When using DMA to transfer endpoint data from the RX FIFO to the
endpoint memory, the RXFLVL irq is not needed as that is already handled
by the DMA. Furthermore, servicing this irq anyway can cause the event
handling to interpret data from the FIFO as the endpoint and status
marker during the DMA transfer.

This commit masks the RXFLVL irq while DMA is used for the endpoint
transfers.
2022-10-12 10:18:15 +02:00
Gunar Schorcht
85054e3d1a drivers/usbdev_synopsys_dwc2: don't init DM/DP GPIOs if ULPI is used 2022-10-09 14:00:41 +02:00
Gunar Schorcht
41e25c53a3 drivers/usbdev_synopsys_dwc2: fix settings for STM32
The existence of the macros USB_OTG_GUSBCFG_ULPI_UTMI_SEL, USB_OTG_GUSBCFG_PHYIF and USB_OTG_GUSBCFG_DDRSEL depends on a specific STM32 line and not on STM32 itself. Therefore, the settings are made when the macros are defined.
2022-10-09 13:14:42 +02:00
Gunar Schorcht
95f74faf6b drivers/usbdev_synopsys_dwc2: add ULPI HS PHY support 2022-10-06 06:26:22 +02:00
Gunar Schorcht
7db66e49b3 drivers: add USB OTG FS/HS driver for Synopsys DWC2 IP core 2022-09-27 01:00:57 +02:00