diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 68577d1f1c0d23979b752a8d66878251b6d41030..b0a6bce064ca9a4f6ed7e4b19657165c48821686 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -21,6 +21,7 @@ /****************************************************************************** * DEFINE *****************************************************************************/ +#define TD_PAGE_COUNT 5 #define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ #define ENDPT_MAX 32 diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index ec218b0202c0c3941451d32841be26df8877a0db..e502e4807812f86e0073b047a10eb78ce34bcabf 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -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; }