diff options
| author | Li Jun <jun.li@freescale.com> | 2015-11-23 15:44:31 +0800 |
|---|---|---|
| committer | Nitin Garg <nitin.garg@nxp.com> | 2016-01-14 11:02:23 -0600 |
| commit | 6ca8fd86e7974e3f96ec7ad9852e6ba41736af15 (patch) | |
| tree | 68fa1796c9deeb9ea88f312e10e5a6ab009e8de4 /drivers/usb | |
| parent | 0b205e36656552e477d0968ca7f95412ff64ea2e (diff) | |
MLK-11891-1 usb: otg-fsm: allocate DMA buffer for host request flag separately
HNP polling need a one byte buffer for usb control transfer via DMA read,
currently using a data field in a structure for DMA buffer may cause cache
incoherent issue, because the cache line for the DMA buffer also contains
other data in this structure, while dma from device is outstanding, the
access on other data in the same cache line will cause we get the old data
before DMA. This patch change the host_request_flag to be a pointer, its
memory will be allocated through kmalloc by controller driver, with this
way, the DMA buffer can be properly aligned and padded.
Signed-off-by: Li Jun <jun.li@freescale.com>
Diffstat (limited to 'drivers/usb')
| -rw-r--r-- | drivers/usb/common/usb-otg-fsm.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index c5d232dc5579..f77571f8b834 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -425,6 +425,7 @@ int otg_hnp_polling(struct otg_fsm *fsm) int retval; enum usb_otg_state state = fsm->otg->state; struct usb_otg_descriptor *desc = NULL; + u8 host_request_flag; if ((state != OTG_STATE_A_HOST || !fsm->b_hnp_enable) && state != OTG_STATE_B_HOST) @@ -460,7 +461,7 @@ int otg_hnp_polling(struct otg_fsm *fsm) } } - fsm->host_req_flag = 0; + *fsm->host_req_flag = 0; /* Get host request flag from connected USB device */ retval = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), @@ -468,13 +469,14 @@ int otg_hnp_polling(struct otg_fsm *fsm) USB_DIR_IN | USB_RECIP_DEVICE, 0, OTG_STS_SELECTOR, - &fsm->host_req_flag, + fsm->host_req_flag, 1, USB_CTRL_GET_TIMEOUT); if (retval == 1) { - if (fsm->host_req_flag == HOST_REQUEST_FLAG) { + host_request_flag = *fsm->host_req_flag; + if (host_request_flag == HOST_REQUEST_FLAG) { retval = otg_handle_role_switch(fsm, udev); - } else if (fsm->host_req_flag == 0) { + } else if (host_request_flag == 0) { /* Continue polling */ otg_add_timer(fsm, HNP_POLLING); retval = 0; |
