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
diff --git a/firmware/ice40-riscv/icE1usb/usb_desc_app.c b/firmware/ice40-riscv/icE1usb/usb_desc_app.c
index 544ac23..886181c 100644
--- a/firmware/ice40-riscv/icE1usb/usb_desc_app.c
+++ b/firmware/ice40-riscv/icE1usb/usb_desc_app.c
@@ -24,13 +24,10 @@
struct {
/* Two altsettings are required, as isochronous
* interfaces must have a setting where they don't
- * transceive any data. wMaxPacketSize is 0 for
- * all endpoints in the 'off' altsetting */
+ * transceive any data. We just remove the isochronous
+ * endpoints in the 'off' altsetting */
struct {
struct usb_intf_desc intf;
- struct usb_ep_desc ep_data_in;
- struct usb_ep_desc ep_data_out;
- struct usb_ep_desc ep_fb;
struct usb_ep_desc ep_interrupt;
} __attribute__ ((packed)) off;
struct {
@@ -83,36 +80,12 @@
.bDescriptorType = USB_DT_INTF,
.bInterfaceNumber = 0,
.bAlternateSetting = 0,
- .bNumEndpoints = 4,
+ .bNumEndpoints = 1,
.bInterfaceClass = 0xff,
.bInterfaceSubClass = 0xe1,
.bInterfaceProtocol = 0x00,
.iInterface = 5,
},
- .ep_data_in = {
- .bLength = sizeof(struct usb_ep_desc),
- .bDescriptorType = USB_DT_EP,
- .bEndpointAddress = 0x82,
- .bmAttributes = 0x05,
- .wMaxPacketSize = 0,
- .bInterval = 1,
- },
- .ep_data_out = {
- .bLength = sizeof(struct usb_ep_desc),
- .bDescriptorType = USB_DT_EP,
- .bEndpointAddress = 0x01,
- .bmAttributes = 0x05,
- .wMaxPacketSize = 0,
- .bInterval = 1,
- },
- .ep_fb = {
- .bLength = sizeof(struct usb_ep_desc),
- .bDescriptorType = USB_DT_EP,
- .bEndpointAddress = 0x81,
- .bmAttributes = 0x11,
- .wMaxPacketSize = 0,
- .bInterval = 3,
- },
.ep_interrupt = {
.bLength = sizeof(struct usb_ep_desc),
.bDescriptorType = USB_DT_EP,