提交 b983e51a 编写于 作者: M Michael Grzeschik 提交者: Greg Kroah-Hartman

usb: chipidea: udc: add the define TD_PAGE_COUNT and fix all users

A static count of transfer descriptors was used everywhere in the driver
with the fixed number 5. This patch adds a define, named TD_PAGE_COUNT,
and replaces all users of this value. This way its possible to have only
one parameter to change and limit the amount of buffer pointers per TD.
Signed-off-by: NMichael Grzeschik <m.grzeschik@pengutronix.de>
Reviewed-by: NPeter Chen <peter.chen@freescale.com>
Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 dd064e9d
......@@ -21,6 +21,7 @@
/******************************************************************************
* DEFINE
*****************************************************************************/
#define TD_PAGE_COUNT 5
#define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */
#define ENDPT_MAX 32
......
......@@ -429,7 +429,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
mReq->ptr->token |= cpu_to_le32(TD_IOC);
}
mReq->ptr->page[0] = cpu_to_le32(mReq->req.dma);
for (i = 1; i < 5; i++) {
for (i = 1; i < TD_PAGE_COUNT; i++) {
u32 page = mReq->req.dma + i * CI13XXX_PAGE_SIZE;
page &= ~TD_RESERVED_MASK;
mReq->ptr->page[i] = cpu_to_le32(page);
......@@ -676,7 +676,7 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
return -EBUSY;
}
if (req->length > 4 * CI13XXX_PAGE_SIZE) {
if (req->length > (TD_PAGE_COUNT - 1) * CI13XXX_PAGE_SIZE) {
dev_err(mEp->ci->dev, "request bigger than one td\n");
return -EMSGSIZE;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册