[usbdev] Fixes for I/O modes and expand their tests

The differental mode reception and conversion was being done in the iomux
and potentially not passing all information to the usb_fs_rx module. Reworked
to pass the single ended and differential data to usb_fs_rx, recover them
both and use the configured mode to forward appropriately.

This changes the usbdev_iomux to only synchronize and pinflip I/O and
pass the rx d, d+ and d- to receive logic.

As part of debug fixed verilator UNOPTFLAT complaint and added a link
state representing the link being active but never seen SOF because this
is where a flipped link gets stuck between FPGA board and Linux. (The
flipped pullup will make it look like a LS not FS link so the 1.5Mbit
chatter is enough to get rx PID erros but also keeps resetting the
link so host_lost never fires).

Update verilator top and usbdpi to manage all the I/Os. And add code
to the usbdpi to be able to simulate pinflip and differential as well
as the normal pin mode. Note that because there is no other signal it
uses the tx_mode_se signal to control use of differential mode in both
tx and rx directions (so it only works if both phy config bits are the
same). It uses the DN PULLUP being asserted to detect flip.

Update hello_usbdev.c to set the phy config from gpio pins. These
are switches on the nexysvideo and can be set using gpio-dpi in
verilator.

Update top_earlgrey_nexysvideo to be able to fake swapping of USB pins.
Uses DN pullup to cause the pins used for DP and DN to be swapped, allows
testing of both flip options with one FPGA build.

Tested with verilator that all four settings of PINFLIP and DIFFIO in
hello_usb.c get the same expected output. Added a script to run all
four simulations (setting the GPIOs to control).

Tested with FPGA that PINFLIP=0,1 both work by setting the switch.

Included changes requested in software and hardware reviews.

Fixes lowRISC/OpenTitan#2598

Signed-off-by: Mark Hayter <mark.hayter@gmail.com>
19 files changed
tree: fc3fe2eb408f53c352f60a59e340648986bdd28a
  1. .github/
  2. ci/
  3. doc/
  4. hw/
  5. site/
  6. sw/
  7. test/
  8. util/
  9. .clang-format
  10. .dockerignore
  11. .flake8
  12. .gitignore
  13. .style.yapf
  14. _index.md
  15. apt-requirements.txt
  16. azure-pipelines.yml
  17. check_tool_requirements.core
  18. CLA
  19. COMMITTERS
  20. CONTRIBUTING.md
  21. LICENSE
  22. meson.build
  23. meson_init.sh
  24. meson_options.txt
  25. python-requirements.txt
  26. README.md
  27. tool_requirements.py
  28. toolchain.txt
README.md

OpenTitan

OpenTitan logo

About the project

OpenTitan is an open source silicon Root of Trust (RoT) project. OpenTitan will make the silicon RoT design and implementation more transparent, trustworthy, and secure for enterprises, platform providers, and chip manufacturers. OpenTitan is administered by lowRISC CIC as a collaborative project to produce high quality, open IP for instantiation as a full-featured product. See the OpenTitan site and OpenTitan docs for more information about the project.

About this repository

This repository contains hardware, software and utilities written as part of the OpenTitan project. It is structured as monolithic repository, or “monorepo”, where all components live in one repository. It exists to enable collaboration across partners participating in the OpenTitan project.

Documentation

The project contains comprehensive documentation of all IPs and tools. You can access it online at docs.opentitan.org.

How to contribute

Have a look at CONTRIBUTING for guidelines on how to contribute code to this repository.

Licensing

Unless otherwise noted, everything in this repository is covered by the Apache License, Version 2.0 (see LICENSE for full text).