USB: gadget: ci13xxx: don't assume that PAGE_SIZE is 4096
Page size for transaction descriptors for CI13XXX has nothing common with page size from MM. Using platform and configuration specific PAGE_SIZE is wrong. Signed-off-by: Artem Leonenko <tikkeri@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
7c25a82684
commit
0a313c4d24
2 changed files with 6 additions and 5 deletions
|
@ -1460,7 +1460,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
|
||||||
mReq->ptr->page[0] = mReq->req.dma;
|
mReq->ptr->page[0] = mReq->req.dma;
|
||||||
for (i = 1; i < 5; i++)
|
for (i = 1; i < 5; i++)
|
||||||
mReq->ptr->page[i] =
|
mReq->ptr->page[i] =
|
||||||
(mReq->req.dma + i * PAGE_SIZE) & ~TD_RESERVED_MASK;
|
(mReq->req.dma + i * CI13XXX_PAGE_SIZE) & ~TD_RESERVED_MASK;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* QH configuration
|
* QH configuration
|
||||||
|
@ -2159,8 +2159,8 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req->length > (4 * PAGE_SIZE)) {
|
if (req->length > (4 * CI13XXX_PAGE_SIZE)) {
|
||||||
req->length = (4 * PAGE_SIZE);
|
req->length = (4 * CI13XXX_PAGE_SIZE);
|
||||||
retval = -EMSGSIZE;
|
retval = -EMSGSIZE;
|
||||||
warn("request length truncated");
|
warn("request length truncated");
|
||||||
}
|
}
|
||||||
|
@ -2410,13 +2410,13 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
|
||||||
/* alloc resources */
|
/* alloc resources */
|
||||||
udc->qh_pool = dma_pool_create("ci13xxx_qh", &udc->gadget.dev,
|
udc->qh_pool = dma_pool_create("ci13xxx_qh", &udc->gadget.dev,
|
||||||
sizeof(struct ci13xxx_qh),
|
sizeof(struct ci13xxx_qh),
|
||||||
64, PAGE_SIZE);
|
64, CI13XXX_PAGE_SIZE);
|
||||||
if (udc->qh_pool == NULL)
|
if (udc->qh_pool == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
udc->td_pool = dma_pool_create("ci13xxx_td", &udc->gadget.dev,
|
udc->td_pool = dma_pool_create("ci13xxx_td", &udc->gadget.dev,
|
||||||
sizeof(struct ci13xxx_td),
|
sizeof(struct ci13xxx_td),
|
||||||
64, PAGE_SIZE);
|
64, CI13XXX_PAGE_SIZE);
|
||||||
if (udc->td_pool == NULL) {
|
if (udc->td_pool == NULL) {
|
||||||
dma_pool_destroy(udc->qh_pool);
|
dma_pool_destroy(udc->qh_pool);
|
||||||
udc->qh_pool = NULL;
|
udc->qh_pool = NULL;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* DEFINE
|
* DEFINE
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */
|
||||||
#define ENDPT_MAX (16)
|
#define ENDPT_MAX (16)
|
||||||
#define CTRL_PAYLOAD_MAX (64)
|
#define CTRL_PAYLOAD_MAX (64)
|
||||||
#define RX (0) /* similar to USB_DIR_OUT but can be used as an index */
|
#define RX (0) /* similar to USB_DIR_OUT but can be used as an index */
|
||||||
|
|
Loading…
Add table
Reference in a new issue