[U-Boot] usb: xhci-mem: Fix scratchpad array issue
diff mbox series

Message ID 1546595776-41769-1-git-send-email-ye.li@nxp.com
State Superseded
Headers show
Series
  • [U-Boot] usb: xhci-mem: Fix scratchpad array issue
Related show

Commit Message

Ye Li Jan. 4, 2019, 9:56 a.m. UTC
After updating the value of dev_context_ptrs[0], we should flush this
from cache to memory. Otherwise the xhci controller won't use it.

Signed-off-by: Ye Li <ye.li@nxp.com>
---
 drivers/usb/host/xhci-mem.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Marek Vasut Jan. 4, 2019, 2:53 p.m. UTC | #1
On 1/4/19 10:56 AM, Ye Li wrote:
> After updating the value of dev_context_ptrs[0], we should flush this
> from cache to memory. Otherwise the xhci controller won't use it.
> 
> Signed-off-by: Ye Li <ye.li@nxp.com>
> ---
>  drivers/usb/host/xhci-mem.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 04ab540..0f34522 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -369,6 +369,8 @@ static int xhci_scratchpad_alloc(struct xhci_ctrl *ctrl)
>  	ctrl->dcbaa->dev_context_ptrs[0] =
>  		cpu_to_le64((uintptr_t)scratchpad->sp_array);
>  
> +	xhci_flush_cache((uintptr_t)&ctrl->dcbaa->dev_context_ptrs[0], sizeof(__le64));

Don't you want to use some sizeof(ctrl->dcbaa->dev_context_ptrs[0])
instead of sizeof(__le64) here ?

btw Bin, A-B/R-B please.

> +
>  	page_size = xhci_readl(&hcor->or_pagesize) & 0xffff;
>  	for (i = 0; i < 16; i++) {
>  		if ((0x1 & page_size) != 0)
>

Patch
diff mbox series

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 04ab540..0f34522 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -369,6 +369,8 @@  static int xhci_scratchpad_alloc(struct xhci_ctrl *ctrl)
 	ctrl->dcbaa->dev_context_ptrs[0] =
 		cpu_to_le64((uintptr_t)scratchpad->sp_array);
 
+	xhci_flush_cache((uintptr_t)&ctrl->dcbaa->dev_context_ptrs[0], sizeof(__le64));
+
 	page_size = xhci_readl(&hcor->or_pagesize) & 0xffff;
 	for (i = 0; i < 16; i++) {
 		if ((0x1 & page_size) != 0)