未验证 提交 40252dd7 编写于 作者: P Peter Chen

usb: cdns3: gadget: calculate TD_SIZE based on TD

The TRB entry TD_SIZE is the packet number for the TD (request) but not the
each TRB, so it only needs to be assigned for the first TRB during the TD,
and the value of it is for TD too.

Fixes: 7733f6c3 ("usb: cdns3: Add Cadence USB3 DRD Driver")
Signed-off-by: NPeter Chen <peter.chen@nxp.com>
上级 78e91588
...@@ -1193,10 +1193,20 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep, ...@@ -1193,10 +1193,20 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
/* set incorrect Cycle Bit for first trb*/ /* set incorrect Cycle Bit for first trb*/
control = priv_ep->pcs ? 0 : TRB_CYCLE; control = priv_ep->pcs ? 0 : TRB_CYCLE;
trb->length = 0;
if (priv_dev->dev_ver >= DEV_VER_V2) {
u16 td_size;
td_size = DIV_ROUND_UP(request->length,
priv_ep->endpoint.maxpacket);
if (priv_dev->gadget.speed == USB_SPEED_SUPER)
trb->length = TRB_TDL_SS_SIZE(td_size);
else
control |= TRB_TDL_HS_SIZE(td_size);
}
do { do {
u32 length; u32 length;
u16 td_size = 0;
/* fill TRB */ /* fill TRB */
control |= TRB_TYPE(TRB_NORMAL); control |= TRB_TYPE(TRB_NORMAL);
...@@ -1208,20 +1218,12 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep, ...@@ -1208,20 +1218,12 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
length = request->length; length = request->length;
} }
if (likely(priv_dev->dev_ver >= DEV_VER_V2)) if (priv_ep->flags & EP_TDLCHK_EN)
td_size = DIV_ROUND_UP(length,
priv_ep->endpoint.maxpacket);
else if (priv_ep->flags & EP_TDLCHK_EN)
total_tdl += DIV_ROUND_UP(length, total_tdl += DIV_ROUND_UP(length,
priv_ep->endpoint.maxpacket); priv_ep->endpoint.maxpacket);
trb->length = cpu_to_le32(TRB_BURST_LEN(priv_ep->trb_burst_size) | trb->length |= cpu_to_le32(TRB_BURST_LEN(priv_ep->trb_burst_size) |
TRB_LEN(length)); TRB_LEN(length));
if (priv_dev->gadget.speed == USB_SPEED_SUPER)
trb->length |= cpu_to_le32(TRB_TDL_SS_SIZE(td_size));
else
control |= TRB_TDL_HS_SIZE(td_size);
pcs = priv_ep->pcs ? TRB_CYCLE : 0; pcs = priv_ep->pcs ? TRB_CYCLE : 0;
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册