drivers: udc_dwc2: Disable control IN endpoint on timeout
DWC2 core sets DIEPCTL0 SNAK when SETUP packet is received. The CNAK bit results in device sending NAK in response to IN token sent to EP0, but it does not modify the TxFIFO in any way. The stale data in TxFIFO can then lead to "FIFO space is too low" error. Solve the issue by disabling and flushing IN endpoint 0 if previous control transfer did not finish. Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
This commit is contained in:
parent
b6cfb4533e
commit
243f7c44d3
1 changed files with 6 additions and 1 deletions
|
@ -140,6 +140,9 @@ struct udc_dwc2_data {
|
|||
uint8_t setup[8];
|
||||
};
|
||||
|
||||
static void udc_dwc2_ep_disable(const struct device *dev,
|
||||
struct udc_ep_config *const cfg, bool stall);
|
||||
|
||||
#if defined(CONFIG_PINCTRL)
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
|
||||
|
@ -829,6 +832,7 @@ static int dwc2_handle_evt_setup(const struct device *dev)
|
|||
|
||||
buf = udc_buf_get_all(cfg_in);
|
||||
if (buf) {
|
||||
udc_dwc2_ep_disable(dev, cfg_in, false);
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
|
||||
|
@ -1557,7 +1561,8 @@ static void udc_dwc2_ep_disable(const struct device *dev,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!is_iso && (dxepctl & USB_DWC2_DEPCTL_NAKSTS)) {
|
||||
if (!is_iso && (dxepctl & USB_DWC2_DEPCTL_NAKSTS) &&
|
||||
!(dxepctl & USB_DWC2_DEPCTL_EPENA)) {
|
||||
/* Endpoint already sends forced NAKs. STALL if necessary. */
|
||||
if (stall) {
|
||||
dxepctl |= USB_DWC2_DEPCTL_STALL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue