Commit Graph

12 Commits

Author SHA1 Message Date
Harald Welte cac342af6b icE1usb: Move GPS-DO USB control to separate USB interface
doing so significantly simplifies the development of a Linux kernel
driver, as the GPS-DO only exists once (not twice, like the per-E1-line
interface), and Linux kernel USB drivers typically are for an interface.

There is an option to write a usb_device_driver, but doing so will
exclude the per-interface drivers from still being probed in their usual
fashion.

While we introduce this new USB Interface for the GPS-DO, we also
move the related control endpoint requests from the device level to the
interface level.

Finally, some naming inconsistency between "enum
ice1usb_gpsdo_antenna_state" vs. the member name antenna_status is
resolved.

Change-Id: Icd6555a14896c38626fb147b78af44ff719f2254
2022-02-01 17:57:12 +01:00
Sylvain Munaut 70c10f05cf icE1usb fw: Expose the GPS NMEA data as a CDC ACM
Note that this is read-only. We drop all data from the host
because we can't have the host reconfigure the module ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ieb6a653ece882c5f90ab27da1bca04c94184dc5a
2022-01-13 13:21:29 +01:00
Sylvain Munaut 41c98b6b67 icE1usb fw: Add multi-port support in USB code
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I134410b542461c34339baa8d9120a5c86fc35d46
2022-01-09 19:18:08 +01:00
Sylvain Munaut 1d98709ff1 icE1usb fw: Tweak descriptors in preparation for dual port support
In dual port mode we can't have 388 bytes wMaxPacket size, that's
too much reserved bandwidth.

So we dial that back to 292 which is the minimum we can use. We need
4 bytes for header, then 256 byte of nominal transfer size then 32
more byte for potentially one more frame than nominal to compensate
differences between E1 clock and USB clock.

We obviously need to adapt the code filling up the packets to respect
that more restricted size ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I700adeb909e7955db0d15c6e2beade3d38b21e01
2022-01-09 17:21:04 +01:00
Sylvain Munaut 8a5a9d4dfb icE1usb fw: Use #define's in descriptors for interface/endpoints ID
This way they can be used in other parts of the code more easily.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I565d9a43bc26b99bc385b46522e7da6a207b2412
2022-01-09 17:21:04 +01:00
Sylvain Munaut 3c3ae79241 icE1usb fw: Set wDetachTimeout to 0 in DFU descriptor
It was pointed out that this should be 0 since we trigger
detach ourselves, we don't need a bus reset.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id7051ce00863c03e3498f4bab0a7124938e197c0
2022-01-09 17:21:04 +01:00
Sylvain Munaut 9674436e2a icE1usb fw: Cleanup USB code a bit
Some of it was written before some of the helpers were provided
by the no2usb code and was never update. So instead of manually
setting up a bunch of stuff we make proper use of some of the provided
helpers.

Side effects:

 - We recall e1_init(0,0) when enabling which happens to work
   around a bug ... proper fix coming later.

 - The 'dual BD' config for EP 0x81 and 0x83 is fixed. It didn't
   matter before since we overwrote it anyway, but now it's used
   and so needs to be correct.

 - The descriptors don't have the isoc endpoints at all in the
   "OFF" alt setting.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I33c92896acfba023abe0152d63dff3afe43b53cd
2022-01-09 17:21:04 +01:00
Sylvain Munaut b9d9363d91 fw/icE1usb: Adapt the CDC descriptors to new structure from no2usb
Those are actually disabled right now, but since the submodule got
updated and the protocol struct/defines changed, this updates them
anyway so you can uncommend/enable them without causing a build
failure

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I1895702eac9c6c392f24327b12f9ba3651e3249a
2021-05-31 14:03:44 +02:00
Harald Welte 805f2cf16e icE1usb fw: Expose error conditions from E1 driver
This will allow the USB interface code to report the errors to the
host PC.

Related: OS#4674
Change-Id: Iba3e00a2b28a2fef6dbd986bfc706c1619c3a3ed
2021-01-05 23:25:34 +01:00
Harald Welte 30fc560017 icE1usb fw: cosmetic: more comments in the code
Change-Id: I445bb2f92b6dcfe29ac20109ea2e63efb31051a1
2020-12-20 23:20:21 +00:00
Sylvain Munaut 4ea7d27764 firmware/ice40-riscv: Update no2usb core and fixup for API changes
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ia6bda410e2529858cb86827e186bb099b9b87799
2020-10-29 13:17:11 +01:00
Sylvain Munaut bc9f5c4219 fw/icE1usb: Import firmware for the icE1usb and icE1usb-proto boards
Currently only the icE1usb-proto is supported. Adaptation for the
final production hardware is yet to be done.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2020-09-14 10:56:49 +02:00