Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/usbdev_synopsys_dwc2: add USB OTG HS peripheral support for external ULPI HS PHYs #18679

Merged
merged 6 commits into from
Oct 6, 2022

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Oct 2, 2022

Contribution description

This PR adds the support for external ULPI HS PHYs.

Boards whose USB OTG HS peripherals use an external HS-PHY via the ULPI interface, such as the board stm32f746g-disco, can be used with this PR in USB HS mode. For this purpose, the USB OTG configuration structure has been extended by the ULPI interface configuration. ULPI HS PHY support is enabled by the periph_usbdev_hs_ulpi module, which requires the periph_usbdev_hs_ulpi feature.

Boards whose USB OTG HS peripherals use an external HS-PHY via the ULPI interface must define the ULPI interface configuration and provide the periph_usbdev_hs_ulpi feature. The application can then enable the USB OTG HS port by enabling the periph_usbdev_hs_ulpi module.

Testing procedure

The best way to test the PR is to use a board with two USB OTG ports (one FS port and one HS port connected to a ULPI PHY, such as the board "stm32f746g-disco") connected to the host with two USB cables.

  1. Compile and flash application tests/usbus_hid
    BOARD=stm32f746g-disco make -C tests/usbus_hid flash term
    
    The FS port should still work.
    Oct  2 14:12:52 gunny8 kernel: [1906145.745440] usb 1-4.4: new full-speed USB device number 91 using xhci_hcd
    Oct  2 14:12:52 gunny8 kernel: [1906145.851446] usb 1-4.4: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00
    Oct  2 14:12:52 gunny8 kernel: [1906145.851449] usb 1-4.4: New USB device strings: Mfr=3, Product=2, SerialNumber=4
    Oct  2 14:12:52 gunny8 kernel: [1906145.851451] usb 1-4.4: Product: stm32f746g-disco
    Oct  2 14:12:52 gunny8 kernel: [1906145.851452] usb 1-4.4: Manufacturer: RIOT-os.org
    Oct  2 14:12:52 gunny8 kernel: [1906145.851453] usb 1-4.4: SerialNumber: BF52913CA9DB6BE8
    Oct  2 14:12:52 gunny8 kernel: [1906145.858630] hid-generic 0003:1209:7D01.013C: hiddev2,hidraw5: USB HID v1.10 Device [RIOT-os.org stm32f
  2. Compile and flash application tests/usbus_hid with module periph_usbdev_hs_ulpi
    USEMODULE=periph_usbdev_hs_ulpi BOARD=stm32f746g-disco make -C tests/usbus_hid flash term
    
    In that case, the HS port should work and recognized as HS device.
    Oct  2 14:14:40 gunny8 kernel: [1906254.288780] usb 1-4.4: new high-speed USB device number 96 using xhci_hcd
    Oct  2 14:14:40 gunny8 kernel: [1906254.390195] usb 1-4.4: New USB device found, idVendor=1209, idProduct=7d01,  bcdDevice= 1.00
    Oct  2 14:14:40 gunny8 kernel: [1906254.390199] usb 1-4.4: New USB device strings: Mfr=3, Product=2, SerialNumber=4
    Oct  2 14:14:40 gunny8 kernel: [1906254.390201] usb 1-4.4: Product: stm32f746g-disco
    Oct  2 14:14:40 gunny8 kernel: [1906254.390202] usb 1-4.4: Manufacturer: RIOT-os.org
    Oct  2 14:14:40 gunny8 kernel: [1906254.390204] usb 1-4.4: SerialNumber: BF52913CA9DB6BE8
    Oct  2 14:14:40 gunny8 kernel: [1906254.392899] hid-generic 0003:1209:7D01.013D: hiddev2,hidraw5: USB HID v1.10 Device [RIOT-os.org stm32f746g-disco] on usb-0000:00:14.0-4.4/input0
  3. A board with USB OTG HS peripheral that uses the on-chip FS PHY, such as stm32f429i-disc1 should still work.
    BOARD=stm32f429i-disco make -C tests/usbus_hid flash term
    
  4. A board with only USB OTG FS peripheral should still work.
    BOARD=nucleo-f767zi make -C tests/usbus_hid flash term
    

Issues/PRs references

@github-actions github-actions bot added Area: boards Area: Board ports Area: build system Area: Build system Area: doc Area: Documentation Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration labels Oct 2, 2022
@gschorcht gschorcht added Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 2, 2022
@gschorcht gschorcht force-pushed the drivers/usbdev_synopsys_dwc2_hs branch from e142db4 to 3723e7f Compare October 2, 2022 12:35
@riot-ci
Copy link

riot-ci commented Oct 2, 2022

Murdock results

✔️ PASSED

4384403 boards/common/esp32{s2,s3}: update USB OTG configuration

Success Failures Total Runtime
1978 0 1979 06m:22s

Artifacts

This only reflects a subset of all builds from https://ci-prod.riot-os.org. Please refer to https://ci.riot-os.org for a complete build for now.

@gschorcht gschorcht force-pushed the drivers/usbdev_synopsys_dwc2_hs branch 2 times, most recently from bc6fb55 to 409e9b5 Compare October 3, 2022 08:00
@benpicco benpicco requested review from bergzand and dylad October 3, 2022 20:06
@benpicco
Copy link
Contributor

benpicco commented Oct 5, 2022

Looks pretty straightforward - nice addition!
But a rebase is needed.

The `fs` in the file name means that on-chip FS PHY is configured for USB OTG HS. The file is renamed to `cfg_usb_otg_hs_phy_fs.h`
- to clarify that USB OTG HS is just configured with PHY FS and not HS and FS,
- to allow a configuration of USB OTG FS and HS in one file called `cfg_usb_otg_hs_fs.h` or whatever, and
- to allow a configuration of USB OTG HS with ULPI PHY in a file called `cfg_usb_otg_hs_phy_ulpi.h`.
f
@gschorcht gschorcht force-pushed the drivers/usbdev_synopsys_dwc2_hs branch from 409e9b5 to 4384403 Compare October 6, 2022 04:27
@benpicco benpicco merged commit d6d8f8d into RIOT-OS:master Oct 6, 2022
@maribu maribu added this to the Release 2022.10 milestone Oct 14, 2022
@gschorcht gschorcht deleted the drivers/usbdev_synopsys_dwc2_hs branch October 18, 2022 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: build system Area: Build system Area: doc Area: Documentation Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants