drivers: udc_dwc2: Allow not-multiple-of-4 mps in DMA mode

Remove the early max packet size check on endpoint activation, because
there are valid use cases where the max packet size is not multiple of 4
and the stack won't perform multi-transaction transfers. Example use
case is UAC2 explicit feedback endpoint that has Max Packet Size equal
3 when device is operating at Full-Speed.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
This commit is contained in:
Tomasz Moń 2024-08-19 10:41:24 +02:00 committed by Carles Cufí
commit debc744665

View file

@ -1491,23 +1491,6 @@ static int udc_dwc2_ep_activate(const struct device *dev,
dxepctl_reg = (mem_addr_t)&base->in_ep[ep_idx].diepctl;
}
if (priv->bufferdma && (udc_mps_ep_size(cfg) % 4)) {
/* TODO: In Buffer DMA mode, DMA will insert padding bytes in
* between packets if endpoint Max Packet Size is not multiple
* of 4 (DWORD) and single transfer spans across multiple
* packets.
*
* In order to support such Max Packet Sizes, the driver would
* have to remove the padding in between the packets. Besides
* just driver shuffling the data, the buffers would have to be
* large enough to temporarily hold the paddings.
*
* For the time being just error out early.
*/
LOG_ERR("Driver requires MPS to be multiple of 4");
return -EINVAL;
}
dxepctl = sys_read32(dxepctl_reg);
/* Set max packet size */
dxepctl &= ~USB_DWC2_DEPCTL_MPS_MASK;