Skip to content

Commit b0c9351

Browse files
dlechProject516
authored andcommitted
usb: musb: da8xx: Add special endpoint config for ev3dev
The lms2012 software expects USB to be able to handle 1024 byte packets on USB ep1. There is no existing configuration for this in the kernel, so we have to add our own. The maxpacket values come from the official LEGO firmware source code: https://github.com/mindboards/ev3sources/blob/master/extra/linux-03.20.00.13/drivers/usb/musb/musb_core.c#L1065 Issue: ev3dev/lms2012-compat#49
1 parent bb44377 commit b0c9351

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/usb/musb/da8xx.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,20 @@ static const struct platform_device_info da8xx_dev_info = {
498498
.dma_mask = DMA_BIT_MASK(32),
499499
};
500500

501+
/* special config to match official LEGO firmware */
502+
static struct musb_fifo_cfg ev3dev_cfg[] = {
503+
{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 1024, },
504+
{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 1024, },
505+
{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64 , },
506+
{ .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 64 , },
507+
{ .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 1024, },
508+
/* TODO: what about ep3 FIFO_RX? */
509+
{ .hw_ep_num = 4, .style = FIFO_RXTX, .maxpacket = 128, },
510+
};
511+
501512
static const struct musb_hdrc_config da8xx_config = {
513+
.fifo_cfg = ev3dev_cfg,
514+
.fifo_cfg_size = ARRAY_SIZE(ev3dev_cfg),
502515
.ram_bits = 10,
503516
.num_eps = 5,
504517
.multipoint = 1,

0 commit comments

Comments
 (0)