All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue
@ 2019-01-07  2:45 Ye Li
  2019-01-07  6:22 ` Marek Vasut
  2019-01-07  9:54 ` Bin Meng
  0 siblings, 2 replies; 8+ messages in thread
From: Ye Li @ 2019-01-07  2:45 UTC (permalink / raw)
  To: u-boot

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>
Reviewed-by: Marek Vasut <marex@denx.de>
---
Changes for v2:
   - Change to use sizeof(ctrl->dcbaa->dev_context_ptrs[0])

 drivers/usb/host/xhci-mem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 04ab540..84c2c33 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -369,6 +369,9 @@ 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(ctrl->dcbaa->dev_context_ptrs[0]));
+
 	page_size = xhci_readl(&hcor->or_pagesize) & 0xffff;
 	for (i = 0; i < 16; i++) {
 		if ((0x1 & page_size) != 0)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue
  2019-01-07  2:45 [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue Ye Li
@ 2019-01-07  6:22 ` Marek Vasut
  2019-01-07  9:54 ` Bin Meng
  1 sibling, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2019-01-07  6:22 UTC (permalink / raw)
  To: u-boot

On 1/7/19 3:45 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>
> Reviewed-by: Marek Vasut <marex@denx.de>

Looks good to me, waiting for A-B/R-B from Bin.

> ---
> Changes for v2:
>    - Change to use sizeof(ctrl->dcbaa->dev_context_ptrs[0])
> 
>  drivers/usb/host/xhci-mem.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 04ab540..84c2c33 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -369,6 +369,9 @@ 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(ctrl->dcbaa->dev_context_ptrs[0]));
> +
>  	page_size = xhci_readl(&hcor->or_pagesize) & 0xffff;
>  	for (i = 0; i < 16; i++) {
>  		if ((0x1 & page_size) != 0)
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue
  2019-01-07  2:45 [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue Ye Li
  2019-01-07  6:22 ` Marek Vasut
@ 2019-01-07  9:54 ` Bin Meng
  2019-01-08  4:00   ` Ye Li
  1 sibling, 1 reply; 8+ messages in thread
From: Bin Meng @ 2019-01-07  9:54 UTC (permalink / raw)
  To: u-boot

On Mon, Jan 7, 2019 at 10:45 AM Ye Li <ye.li@nxp.com> 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>
> Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> Changes for v2:
>    - Change to use sizeof(ctrl->dcbaa->dev_context_ptrs[0])
>
>  drivers/usb/host/xhci-mem.c | 3 +++
>  1 file changed, 3 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

But you need do the same in xhci_scratchpad_free() too. Please fix it in v3.

Regards,
Bin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue
  2019-01-07  9:54 ` Bin Meng
@ 2019-01-08  4:00   ` Ye Li
  2019-01-08  6:34     ` Bin Meng
  0 siblings, 1 reply; 8+ messages in thread
From: Ye Li @ 2019-01-08  4:00 UTC (permalink / raw)
  To: u-boot

On 1/7/2019 5:54 PM, Bin Meng wrote:
> On Mon, Jan 7, 2019 at 10:45 AM Ye Li <ye.li@nxp.com> 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>
>> Reviewed-by: Marek Vasut <marex@denx.de>
>> ---
>> Changes for v2:
>>    - Change to use sizeof(ctrl->dcbaa->dev_context_ptrs[0])
>>
>>  drivers/usb/host/xhci-mem.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
> 
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> 
> But you need do the same in xhci_scratchpad_free() too. Please fix it in v3.
> 
> Regards,
> Bin
> 
The xhci controller has been stopped before calling xhci_scratchpad_free, is it necessary to 
add flush in this function? And I don't see other buffers are flushed when freeing. 

Best regards,
Ye Li

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue
  2019-01-08  4:00   ` Ye Li
@ 2019-01-08  6:34     ` Bin Meng
  2019-01-08 11:11       ` Marek Vasut
  0 siblings, 1 reply; 8+ messages in thread
From: Bin Meng @ 2019-01-08  6:34 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 8, 2019 at 12:00 PM Ye Li <ye.li@nxp.com> wrote:
>
> On 1/7/2019 5:54 PM, Bin Meng wrote:
> > On Mon, Jan 7, 2019 at 10:45 AM Ye Li <ye.li@nxp.com> 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>
> >> Reviewed-by: Marek Vasut <marex@denx.de>
> >> ---
> >> Changes for v2:
> >>    - Change to use sizeof(ctrl->dcbaa->dev_context_ptrs[0])
> >>
> >>  drivers/usb/host/xhci-mem.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >
> > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> >
> > But you need do the same in xhci_scratchpad_free() too. Please fix it in v3.
> >
> The xhci controller has been stopped before calling xhci_scratchpad_free, is it necessary to
> add flush in this function? And I don't see other buffers are flushed when freeing.
>

Ah, yes. It's called after HCD reset, so that's not needed.

Regards,
Bin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue
  2019-01-08  6:34     ` Bin Meng
@ 2019-01-08 11:11       ` Marek Vasut
  2019-01-09  7:05         ` Bin Meng
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2019-01-08 11:11 UTC (permalink / raw)
  To: u-boot

On 1/8/19 7:34 AM, Bin Meng wrote:
> On Tue, Jan 8, 2019 at 12:00 PM Ye Li <ye.li@nxp.com> wrote:
>>
>> On 1/7/2019 5:54 PM, Bin Meng wrote:
>>> On Mon, Jan 7, 2019 at 10:45 AM Ye Li <ye.li@nxp.com> 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>
>>>> Reviewed-by: Marek Vasut <marex@denx.de>
>>>> ---
>>>> Changes for v2:
>>>>    - Change to use sizeof(ctrl->dcbaa->dev_context_ptrs[0])
>>>>
>>>>  drivers/usb/host/xhci-mem.c | 3 +++
>>>>  1 file changed, 3 insertions(+)
>>>>
>>>
>>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>>>
>>> But you need do the same in xhci_scratchpad_free() too. Please fix it in v3.
>>>
>> The xhci controller has been stopped before calling xhci_scratchpad_free, is it necessary to
>> add flush in this function? And I don't see other buffers are flushed when freeing.
>>
> 
> Ah, yes. It's called after HCD reset, so that's not needed.

Shall I pick this for this release then, Bin ?

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue
  2019-01-08 11:11       ` Marek Vasut
@ 2019-01-09  7:05         ` Bin Meng
  2019-01-09 15:04           ` Marek Vasut
  0 siblings, 1 reply; 8+ messages in thread
From: Bin Meng @ 2019-01-09  7:05 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 8, 2019 at 7:19 PM Marek Vasut <marex@denx.de> wrote:
>
> On 1/8/19 7:34 AM, Bin Meng wrote:
> > On Tue, Jan 8, 2019 at 12:00 PM Ye Li <ye.li@nxp.com> wrote:
> >>
> >> On 1/7/2019 5:54 PM, Bin Meng wrote:
> >>> On Mon, Jan 7, 2019 at 10:45 AM Ye Li <ye.li@nxp.com> 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>
> >>>> Reviewed-by: Marek Vasut <marex@denx.de>
> >>>> ---
> >>>> Changes for v2:
> >>>>    - Change to use sizeof(ctrl->dcbaa->dev_context_ptrs[0])
> >>>>
> >>>>  drivers/usb/host/xhci-mem.c | 3 +++
> >>>>  1 file changed, 3 insertions(+)
> >>>>
> >>>
> >>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> >>>
> >>> But you need do the same in xhci_scratchpad_free() too. Please fix it in v3.
> >>>
> >> The xhci controller has been stopped before calling xhci_scratchpad_free, is it necessary to
> >> add flush in this function? And I don't see other buffers are flushed when freeing.
> >>
> >
> > Ah, yes. It's called after HCD reset, so that's not needed.
>
> Shall I pick this for this release then, Bin ?
>

Yes, I think so.

Regards,
Bin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue
  2019-01-09  7:05         ` Bin Meng
@ 2019-01-09 15:04           ` Marek Vasut
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2019-01-09 15:04 UTC (permalink / raw)
  To: u-boot

On 1/9/19 8:05 AM, Bin Meng wrote:
> On Tue, Jan 8, 2019 at 7:19 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 1/8/19 7:34 AM, Bin Meng wrote:
>>> On Tue, Jan 8, 2019 at 12:00 PM Ye Li <ye.li@nxp.com> wrote:
>>>>
>>>> On 1/7/2019 5:54 PM, Bin Meng wrote:
>>>>> On Mon, Jan 7, 2019 at 10:45 AM Ye Li <ye.li@nxp.com> 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>
>>>>>> Reviewed-by: Marek Vasut <marex@denx.de>
>>>>>> ---
>>>>>> Changes for v2:
>>>>>>    - Change to use sizeof(ctrl->dcbaa->dev_context_ptrs[0])
>>>>>>
>>>>>>  drivers/usb/host/xhci-mem.c | 3 +++
>>>>>>  1 file changed, 3 insertions(+)
>>>>>>
>>>>>
>>>>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>>>>>
>>>>> But you need do the same in xhci_scratchpad_free() too. Please fix it in v3.
>>>>>
>>>> The xhci controller has been stopped before calling xhci_scratchpad_free, is it necessary to
>>>> add flush in this function? And I don't see other buffers are flushed when freeing.
>>>>
>>>
>>> Ah, yes. It's called after HCD reset, so that's not needed.
>>
>> Shall I pick this for this release then, Bin ?
>>
> 
> Yes, I think so.

Applied, thanks.

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-01-09 15:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07  2:45 [U-Boot] [PATCH v2] usb: xhci-mem: Fix scratchpad array issue Ye Li
2019-01-07  6:22 ` Marek Vasut
2019-01-07  9:54 ` Bin Meng
2019-01-08  4:00   ` Ye Li
2019-01-08  6:34     ` Bin Meng
2019-01-08 11:11       ` Marek Vasut
2019-01-09  7:05         ` Bin Meng
2019-01-09 15:04           ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.