Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-22 Thread Minas Harutyunyan
Hi Zengtao,

On 3/22/2018 1:36 PM, Zengtao (B) wrote:
> Hi Minas:
> 
>> -Original Message-
>> From: Minas Harutyunyan [mailto:minas.harutyun...@synopsys.com]
>> Sent: Thursday, March 22, 2018 4:06 PM
>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
>> <minas.harutyun...@synopsys.com>; John Youn <john.y...@synopsys.com>;
>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>
>> Hi Zengtao,
>>
>> On 3/21/2018 2:45 PM, Zengtao (B) wrote:
>>> Hi Minas:
>>>
>>>> -Original Message-
>>>> From: Minas Harutyunyan [mailto:minas.harutyun...@synopsys.com]
>>>> Sent: Wednesday, March 21, 2018 4:08 PM
>>>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
>>>> <minas.harutyun...@synopsys.com>; John Youn
>> <john.y...@synopsys.com>;
>>>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
>>>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>>>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>>>
>>>> Hi Zengtao,
>>>>
>>>> On 3/21/2018 6:17 AM, Zengtao (B) wrote:
>>>>>> -Original Message-
>>>>>
>>>>>> From: linux-usb-ow...@vger.kernel.org
>>>>>
>>>>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>>>>> Harutyunyan
>>>>>
>>>>>> Sent: Tuesday, March 20, 2018 10:40 PM
>>>>>
>>>>>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
>>>>>
>>>>>> <minas.harutyun...@synopsys.com>; John Youn
>>>> <john.y...@synopsys.com>;
>>>>>
>>>>>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
>>>>>
>>>>>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>>>>>
>>>>>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>>>>
>>>>>>
>>>>>
>>>>>> Hi Zengtao,
>>>>>
>>>>>>
>>>>>
>>>>>> On 3/20/2018 6:01 AM, Zengtao (B) wrote:
>>>>>
>>>>>>> Hi Minas:
>>>>>
>>>>>>>
>>>>>
>>>>>>>
>>>>>
>>>>>>>
>>>>>
>>>>>>> A few minor comments:
>>>>>
>>>>>>>
>>>>>
>>>>>>>
>>>>>
>>>>>>>
>>>>>
>>>>>>>> -Original Message-
>>>>>
>>>>>>>
>>>>>
>>>>>>>> From: linux-usb-ow...@vger.kernel.org
>>>>>
>>>>>>>
>>>>>
>>>>>>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>>>>
>>>>>>>> Harutyunyan
>>>>>
>>>>>>>
>>>>>
>>>>>>>> Sent: Saturday, March 17, 2018 5:10 PM
>>>>>
>>>>>>>
>>>>>
>>>>>>>> To: John Youn <john.y...@synopsys.com>; Felipe Balbi
>>>>>
>>>>>>>> <ba...@kernel.org>;
>>>>>
>>>>>>>
>>>>>
>>>>>>>> Greg Kroah-Hartman <gre...@linuxfoundation.org>;
>>>>>
>>>>>>>> linux-usb@vger.kernel.org
>>>>>
>>>>>>>
>>>>>
>>>>>>>> Cc: Minas Harutyunyan <minas.harutyun...@synopsys.com>
>>>>>
>>>>>>>
>>>>>
>>>>>>>> Subject: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>>>>
>>>>>>>
>>>>>
>>>>>>>>
>>>>>
>>>>>>>
>>>>>
>>>>>>>> Changed existing two descriptor-chain flow to one chain.
>>>>>
>>>>>>>
>>>>>
>>>>>>>>
>>>>>
>>>>>>>
>>>>>
>>>>>>>> In two-c

RE: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-22 Thread Zengtao (B)
Hi Minas: 

>-Original Message-
>From: Minas Harutyunyan [mailto:minas.harutyun...@synopsys.com]
>Sent: Thursday, March 22, 2018 4:06 PM
>To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
><minas.harutyun...@synopsys.com>; John Youn <john.y...@synopsys.com>;
>Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
><gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>
>Hi Zengtao,
>
>On 3/21/2018 2:45 PM, Zengtao (B) wrote:
>> Hi Minas:
>>
>>> -Original Message-
>>> From: Minas Harutyunyan [mailto:minas.harutyun...@synopsys.com]
>>> Sent: Wednesday, March 21, 2018 4:08 PM
>>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
>>> <minas.harutyun...@synopsys.com>; John Youn
><john.y...@synopsys.com>;
>>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
>>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>>
>>> Hi Zengtao,
>>>
>>> On 3/21/2018 6:17 AM, Zengtao (B) wrote:
>>>>> -Original Message-
>>>>
>>>>> From: linux-usb-ow...@vger.kernel.org
>>>>
>>>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>>>> Harutyunyan
>>>>
>>>>> Sent: Tuesday, March 20, 2018 10:40 PM
>>>>
>>>>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
>>>>
>>>>> <minas.harutyun...@synopsys.com>; John Youn
>>> <john.y...@synopsys.com>;
>>>>
>>>>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
>>>>
>>>>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>>>>
>>>>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>>>
>>>>>
>>>>
>>>>> Hi Zengtao,
>>>>
>>>>>
>>>>
>>>>> On 3/20/2018 6:01 AM, Zengtao (B) wrote:
>>>>
>>>>>> Hi Minas:
>>>>
>>>>>>
>>>>
>>>>>>
>>>>
>>>>>>
>>>>
>>>>>> A few minor comments:
>>>>
>>>>>>
>>>>
>>>>>>
>>>>
>>>>>>
>>>>
>>>>>>> -Original Message-
>>>>
>>>>>>
>>>>
>>>>>>> From: linux-usb-ow...@vger.kernel.org
>>>>
>>>>>>
>>>>
>>>>>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>>>
>>>>>>> Harutyunyan
>>>>
>>>>>>
>>>>
>>>>>>> Sent: Saturday, March 17, 2018 5:10 PM
>>>>
>>>>>>
>>>>
>>>>>>> To: John Youn <john.y...@synopsys.com>; Felipe Balbi
>>>>
>>>>>>> <ba...@kernel.org>;
>>>>
>>>>>>
>>>>
>>>>>>> Greg Kroah-Hartman <gre...@linuxfoundation.org>;
>>>>
>>>>>>> linux-usb@vger.kernel.org
>>>>
>>>>>>
>>>>
>>>>>>> Cc: Minas Harutyunyan <minas.harutyun...@synopsys.com>
>>>>
>>>>>>
>>>>
>>>>>>> Subject: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>>>
>>>>>>
>>>>
>>>>>>>
>>>>
>>>>>>
>>>>
>>>>>>> Changed existing two descriptor-chain flow to one chain.
>>>>
>>>>>>
>>>>
>>>>>>>
>>>>
>>>>>>
>>>>
>>>>>>> In two-chain implementation BNA interrupt used for switching
>>>>>>> between
>>>>
>>>>>>> two
>>>>
>>>>>>
>>>>
>>>>>>> chains. BNA interrupt asserted because of returning to beginning
>>>>>>> of
>>>>
>>>>>>> the chain
>>>>
>>>>>>
>>>>
>>>>>>> based on L-bit of last descriptor.
>>>>
>>>>>>
>>>>
>>>

Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-22 Thread Minas Harutyunyan
Hi Zengtao,

On 3/21/2018 2:45 PM, Zengtao (B) wrote:
> Hi Minas:
> 
>> -Original Message-
>> From: Minas Harutyunyan [mailto:minas.harutyun...@synopsys.com]
>> Sent: Wednesday, March 21, 2018 4:08 PM
>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
>> <minas.harutyun...@synopsys.com>; John Youn <john.y...@synopsys.com>;
>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>
>> Hi Zengtao,
>>
>> On 3/21/2018 6:17 AM, Zengtao (B) wrote:
>>>> -Original Message-
>>>
>>>> From: linux-usb-ow...@vger.kernel.org
>>>
>>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>>> Harutyunyan
>>>
>>>> Sent: Tuesday, March 20, 2018 10:40 PM
>>>
>>>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
>>>
>>>> <minas.harutyun...@synopsys.com>; John Youn
>> <john.y...@synopsys.com>;
>>>
>>>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
>>>
>>>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>>>
>>>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>>
>>>>
>>>
>>>> Hi Zengtao,
>>>
>>>>
>>>
>>>> On 3/20/2018 6:01 AM, Zengtao (B) wrote:
>>>
>>>>> Hi Minas:
>>>
>>>>>
>>>
>>>>>
>>>
>>>>>
>>>
>>>>> A few minor comments:
>>>
>>>>>
>>>
>>>>>
>>>
>>>>>
>>>
>>>>>> -Original Message-
>>>
>>>>>
>>>
>>>>>> From: linux-usb-ow...@vger.kernel.org
>>>
>>>>>
>>>
>>>>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>>
>>>>>> Harutyunyan
>>>
>>>>>
>>>
>>>>>> Sent: Saturday, March 17, 2018 5:10 PM
>>>
>>>>>
>>>
>>>>>> To: John Youn <john.y...@synopsys.com>; Felipe Balbi
>>>
>>>>>> <ba...@kernel.org>;
>>>
>>>>>
>>>
>>>>>> Greg Kroah-Hartman <gre...@linuxfoundation.org>;
>>>
>>>>>> linux-usb@vger.kernel.org
>>>
>>>>>
>>>
>>>>>> Cc: Minas Harutyunyan <minas.harutyun...@synopsys.com>
>>>
>>>>>
>>>
>>>>>> Subject: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>>
>>>>>
>>>
>>>>>>
>>>
>>>>>
>>>
>>>>>> Changed existing two descriptor-chain flow to one chain.
>>>
>>>>>
>>>
>>>>>>
>>>
>>>>>
>>>
>>>>>> In two-chain implementation BNA interrupt used for switching
>>>>>> between
>>>
>>>>>> two
>>>
>>>>>
>>>
>>>>>> chains. BNA interrupt asserted because of returning to beginning of
>>>
>>>>>> the chain
>>>
>>>>>
>>>
>>>>>> based on L-bit of last descriptor.
>>>
>>>>>
>>>
>>>>>>
>>>
>>>>>
>>>
>>>>>> Because of that we lose packets. This issue resolved by using one
>> desc-chain.
>>>
>>>>>
>>>
>>>>>>
>>>
>>>>>
>>>
>>>>>> Removed all staff related to two desc-chain flow from DDMA ISOC
>>>
>>>>>> related
>>>
>>>>>
>>>
>>>>>> functions.
>>>
>>>>>
>>>
>>>>>>
>>>
>>>>>
>>>
>>>>>> Removed request length checking from dwc2_gadget_fill_isoc_desc()
>>>
>>>> function.
>>>
>>>>>
>>>
>>>>>> Request length checking added to dwc2_hsotg_ep_queue() function. If
>>>
>>>>>> request
>>>
>>>>>
>>>
>>>>>> length greater than descriptor limits then request not added to q

RE: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-21 Thread Zengtao (B)
Hi Minas:

>-Original Message-
>From: Minas Harutyunyan [mailto:minas.harutyun...@synopsys.com]
>Sent: Wednesday, March 21, 2018 4:08 PM
>To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
><minas.harutyun...@synopsys.com>; John Youn <john.y...@synopsys.com>;
>Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
><gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>
>Hi Zengtao,
>
>On 3/21/2018 6:17 AM, Zengtao (B) wrote:
>>> -Original Message-
>>
>>> From: linux-usb-ow...@vger.kernel.org
>>
>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>> Harutyunyan
>>
>>> Sent: Tuesday, March 20, 2018 10:40 PM
>>
>>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
>>
>>> <minas.harutyun...@synopsys.com>; John Youn
><john.y...@synopsys.com>;
>>
>>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
>>
>>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>>
>>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>
>>>
>>
>>> Hi Zengtao,
>>
>>>
>>
>>> On 3/20/2018 6:01 AM, Zengtao (B) wrote:
>>
>>>> Hi Minas:
>>
>>>>
>>
>>>>
>>
>>>>
>>
>>>> A few minor comments:
>>
>>>>
>>
>>>>
>>
>>>>
>>
>>>>> -Original Message-
>>
>>>>
>>
>>>>> From: linux-usb-ow...@vger.kernel.org
>>
>>>>
>>
>>>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>
>>>>> Harutyunyan
>>
>>>>
>>
>>>>> Sent: Saturday, March 17, 2018 5:10 PM
>>
>>>>
>>
>>>>> To: John Youn <john.y...@synopsys.com>; Felipe Balbi
>>
>>>>> <ba...@kernel.org>;
>>
>>>>
>>
>>>>> Greg Kroah-Hartman <gre...@linuxfoundation.org>;
>>
>>>>> linux-usb@vger.kernel.org
>>
>>>>
>>
>>>>> Cc: Minas Harutyunyan <minas.harutyun...@synopsys.com>
>>
>>>>
>>
>>>>> Subject: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> Changed existing two descriptor-chain flow to one chain.
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> In two-chain implementation BNA interrupt used for switching
>>>>> between
>>
>>>>> two
>>
>>>>
>>
>>>>> chains. BNA interrupt asserted because of returning to beginning of
>>
>>>>> the chain
>>
>>>>
>>
>>>>> based on L-bit of last descriptor.
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> Because of that we lose packets. This issue resolved by using one
>desc-chain.
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> Removed all staff related to two desc-chain flow from DDMA ISOC
>>
>>>>> related
>>
>>>>
>>
>>>>> functions.
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> Removed request length checking from dwc2_gadget_fill_isoc_desc()
>>
>>> function.
>>
>>>>
>>
>>>>> Request length checking added to dwc2_hsotg_ep_queue() function. If
>>
>>>>> request
>>
>>>>
>>
>>>>> length greater than descriptor limits then request not added to queue.
>>
>>>>
>>
>>>>> Additional checking done for High Bandwidth ISOC OUT's which not
>>
>>>>> supported by
>>
>>>>
>>
>>>>> driver. In
>>
>>>>
>>
>>>>> dwc2_gadget_fill_isoc_desc() function also checked desc-chain
>>>>> status
>>
>>>>> (full or not)
>>
>>>>
>>
>>>>> to avoid of reusing not yet processed descriptors.
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> In dwc2_gadget_start_isoc_ddma() function creation of desc-chain
&

Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-21 Thread Minas Harutyunyan
Hi Zengtao,

On 3/21/2018 6:17 AM, Zengtao (B) wrote:
>> -Original Message-
> 
>> From: linux-usb-ow...@vger.kernel.org
> 
>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas Harutyunyan
> 
>> Sent: Tuesday, March 20, 2018 10:40 PM
> 
>> To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
> 
>> <minas.harutyun...@synopsys.com>; John Youn <john.y...@synopsys.com>;
> 
>> Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
> 
>> <gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
> 
>> Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
> 
>>
> 
>> Hi Zengtao,
> 
>>
> 
>> On 3/20/2018 6:01 AM, Zengtao (B) wrote:
> 
>>> Hi Minas:
> 
>>>
> 
>>>
> 
>>>
> 
>>> A few minor comments:
> 
>>>
> 
>>>
> 
>>>
> 
>>>> -Original Message-
> 
>>>
> 
>>>> From: linux-usb-ow...@vger.kernel.org
> 
>>>
> 
>>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
> 
>>>> Harutyunyan
> 
>>>
> 
>>>> Sent: Saturday, March 17, 2018 5:10 PM
> 
>>>
> 
>>>> To: John Youn <john.y...@synopsys.com>; Felipe Balbi
> 
>>>> <ba...@kernel.org>;
> 
>>>
> 
>>>> Greg Kroah-Hartman <gre...@linuxfoundation.org>;
> 
>>>> linux-usb@vger.kernel.org
> 
>>>
> 
>>>> Cc: Minas Harutyunyan <minas.harutyun...@synopsys.com>
> 
>>>
> 
>>>> Subject: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> Changed existing two descriptor-chain flow to one chain.
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> In two-chain implementation BNA interrupt used for switching between
> 
>>>> two
> 
>>>
> 
>>>> chains. BNA interrupt asserted because of returning to beginning of
> 
>>>> the chain
> 
>>>
> 
>>>> based on L-bit of last descriptor.
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> Because of that we lose packets. This issue resolved by using one 
>>>> desc-chain.
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> Removed all staff related to two desc-chain flow from DDMA ISOC
> 
>>>> related
> 
>>>
> 
>>>> functions.
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> Removed request length checking from dwc2_gadget_fill_isoc_desc()
> 
>> function.
> 
>>>
> 
>>>> Request length checking added to dwc2_hsotg_ep_queue() function. If
> 
>>>> request
> 
>>>
> 
>>>> length greater than descriptor limits then request not added to queue.
> 
>>>
> 
>>>> Additional checking done for High Bandwidth ISOC OUT's which not
> 
>>>> supported by
> 
>>>
> 
>>>> driver. In
> 
>>>
> 
>>>> dwc2_gadget_fill_isoc_desc() function also checked desc-chain status
> 
>>>> (full or not)
> 
>>>
> 
>>>> to avoid of reusing not yet processed descriptors.
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> In dwc2_gadget_start_isoc_ddma() function creation of desc-chain
> 
>>>> always
> 
>>>
> 
>>>> started from descriptor 0. Before filling descriptors, they were
> 
>>>> initialized by
> 
>>>
> 
>>>> HOST BUSY status.
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> In dwc2_gadget_complete_isoc_request_ddma() added checking for
> 
>>>> desc-chain
> 
>>>
> 
>>>> rollover. Also added checking completion status.
> 
>>>
> 
>>>> Request completed successfully if DEV_DMA_STS is DEV_DMA_STS_SUCC,
> 
>>>
> 
>>>> otherwise complete with -ETIMEDOUT.
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> Actually removed dwc2_gadget_start_next_isoc_ddma() function because
> 
>>>> now
> 
>>>
> 
>>>> driver use only one desc-chain and instead that function added
> 
>>>
> 
>>>> dwc2_gadget_handle_isoc_bna() function for handling BNA interrupts.
> 
>>>
> 
>>>>
> 
>>>
> 
>>>> Handling BNA interru

RE: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-20 Thread Zengtao (B)
>-Original Message-
>From: linux-usb-ow...@vger.kernel.org
>[mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas Harutyunyan
>Sent: Tuesday, March 20, 2018 10:40 PM
>To: Zengtao (B) <prime.z...@hisilicon.com>; Minas Harutyunyan
><minas.harutyun...@synopsys.com>; John Youn <john.y...@synopsys.com>;
>Felipe Balbi <ba...@kernel.org>; Greg Kroah-Hartman
><gre...@linuxfoundation.org>; linux-usb@vger.kernel.org
>Subject: Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>
>Hi Zengtao,
>
>On 3/20/2018 6:01 AM, Zengtao (B) wrote:
>> Hi Minas:
>>
>>
>>
>> A few minor comments:
>>
>>
>>
>>> -Original Message-
>>
>>> From: linux-usb-ow...@vger.kernel.org
>>
>>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas
>>> Harutyunyan
>>
>>> Sent: Saturday, March 17, 2018 5:10 PM
>>
>>> To: John Youn <john.y...@synopsys.com>; Felipe Balbi
>>> <ba...@kernel.org>;
>>
>>> Greg Kroah-Hartman <gre...@linuxfoundation.org>;
>>> linux-usb@vger.kernel.org
>>
>>> Cc: Minas Harutyunyan <minas.harutyun...@synopsys.com>
>>
>>> Subject: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>>
>>>
>>
>>> Changed existing two descriptor-chain flow to one chain.
>>
>>>
>>
>>> In two-chain implementation BNA interrupt used for switching between
>>> two
>>
>>> chains. BNA interrupt asserted because of returning to beginning of
>>> the chain
>>
>>> based on L-bit of last descriptor.
>>
>>>
>>
>>> Because of that we lose packets. This issue resolved by using one 
>>> desc-chain.
>>
>>>
>>
>>> Removed all staff related to two desc-chain flow from DDMA ISOC
>>> related
>>
>>> functions.
>>
>>>
>>
>>> Removed request length checking from dwc2_gadget_fill_isoc_desc()
>function.
>>
>>> Request length checking added to dwc2_hsotg_ep_queue() function. If
>>> request
>>
>>> length greater than descriptor limits then request not added to queue.
>>
>>> Additional checking done for High Bandwidth ISOC OUT's which not
>>> supported by
>>
>>> driver. In
>>
>>> dwc2_gadget_fill_isoc_desc() function also checked desc-chain status
>>> (full or not)
>>
>>> to avoid of reusing not yet processed descriptors.
>>
>>>
>>
>>> In dwc2_gadget_start_isoc_ddma() function creation of desc-chain
>>> always
>>
>>> started from descriptor 0. Before filling descriptors, they were
>>> initialized by
>>
>>> HOST BUSY status.
>>
>>>
>>
>>> In dwc2_gadget_complete_isoc_request_ddma() added checking for
>>> desc-chain
>>
>>> rollover. Also added checking completion status.
>>
>>> Request completed successfully if DEV_DMA_STS is DEV_DMA_STS_SUCC,
>>
>>> otherwise complete with -ETIMEDOUT.
>>
>>>
>>
>>> Actually removed dwc2_gadget_start_next_isoc_ddma() function because
>>> now
>>
>>> driver use only one desc-chain and instead that function added
>>
>>> dwc2_gadget_handle_isoc_bna() function for handling BNA interrupts.
>>
>>>
>>
>>> Handling BNA interrupt done by flushing TxFIFOs for OUT EPs,
>>> completing
>>
>>> request with -EIO and resetting desc-chain number and target frame to
>>> initial
>>
>>> values for restarting transfers.
>>
>>>
>>
>>> On handling NAK request completed with -ENODATA. Incremented target
>>> frame
>>
>>> to allow fill desc chain and start transfers.
>>
>>> In DDMA mode avoided of frame number incrementing, because tracking
>>> of
>>
>>> frame number performed in dwc2_gadget_fill_isoc_desc() function.
>>
>>>
>>
>>> When core assert XferCompl along with BNA, we should ignore XferCompl
>>> in
>>
>>> dwc2_hsotg_epint() function.
>>
>>>
>>
>>> On BNA interrupt replaced dwc2_gadget_start_next_isoc_ddma() by above
>>
>>> mentioned BNA handler.
>>
>>>
>>
>>> In dwc2_hsotg_ep_enable() function added sanity check of bInterval
>>> for ISOC IN
>>
>>> in DDMA mode, because HW not supported EP's with bInterval more than 12.
>>
>>>
>>
&

Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-20 Thread Minas Harutyunyan
Hi Zengtao,

On 3/20/2018 6:01 AM, Zengtao (B) wrote:
> Hi Minas:
> 
> 
> 
> A few minor comments:
> 
> 
> 
>> -Original Message-
> 
>> From: linux-usb-ow...@vger.kernel.org
> 
>> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas Harutyunyan
> 
>> Sent: Saturday, March 17, 2018 5:10 PM
> 
>> To: John Youn ; Felipe Balbi ;
> 
>> Greg Kroah-Hartman ; linux-usb@vger.kernel.org
> 
>> Cc: Minas Harutyunyan 
> 
>> Subject: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
> 
>>
> 
>> Changed existing two descriptor-chain flow to one chain.
> 
>>
> 
>> In two-chain implementation BNA interrupt used for switching between two
> 
>> chains. BNA interrupt asserted because of returning to beginning of the chain
> 
>> based on L-bit of last descriptor.
> 
>>
> 
>> Because of that we lose packets. This issue resolved by using one desc-chain.
> 
>>
> 
>> Removed all staff related to two desc-chain flow from DDMA ISOC related
> 
>> functions.
> 
>>
> 
>> Removed request length checking from dwc2_gadget_fill_isoc_desc() function.
> 
>> Request length checking added to dwc2_hsotg_ep_queue() function. If request
> 
>> length greater than descriptor limits then request not added to queue.
> 
>> Additional checking done for High Bandwidth ISOC OUT's which not supported by
> 
>> driver. In
> 
>> dwc2_gadget_fill_isoc_desc() function also checked desc-chain status (full 
>> or not)
> 
>> to avoid of reusing not yet processed descriptors.
> 
>>
> 
>> In dwc2_gadget_start_isoc_ddma() function creation of desc-chain always
> 
>> started from descriptor 0. Before filling descriptors, they were initialized 
>> by
> 
>> HOST BUSY status.
> 
>>
> 
>> In dwc2_gadget_complete_isoc_request_ddma() added checking for desc-chain
> 
>> rollover. Also added checking completion status.
> 
>> Request completed successfully if DEV_DMA_STS is DEV_DMA_STS_SUCC,
> 
>> otherwise complete with -ETIMEDOUT.
> 
>>
> 
>> Actually removed dwc2_gadget_start_next_isoc_ddma() function because now
> 
>> driver use only one desc-chain and instead that function added
> 
>> dwc2_gadget_handle_isoc_bna() function for handling BNA interrupts.
> 
>>
> 
>> Handling BNA interrupt done by flushing TxFIFOs for OUT EPs, completing
> 
>> request with -EIO and resetting desc-chain number and target frame to initial
> 
>> values for restarting transfers.
> 
>>
> 
>> On handling NAK request completed with -ENODATA. Incremented target frame
> 
>> to allow fill desc chain and start transfers.
> 
>> In DDMA mode avoided of frame number incrementing, because tracking of
> 
>> frame number performed in dwc2_gadget_fill_isoc_desc() function.
> 
>>
> 
>> When core assert XferCompl along with BNA, we should ignore XferCompl in
> 
>> dwc2_hsotg_epint() function.
> 
>>
> 
>> On BNA interrupt replaced dwc2_gadget_start_next_isoc_ddma() by above
> 
>> mentioned BNA handler.
> 
>>
> 
>> In dwc2_hsotg_ep_enable() function added sanity check of bInterval for ISOC 
>> IN
> 
>> in DDMA mode, because HW not supported EP's with bInterval more than 12.
> 
>>
> 
>> Signed-off-by: Minas Harutyunyan 
> 
>> ---
> 
>> drivers/usb/dwc2/core.h   |   2 -
> 
>> drivers/usb/dwc2/gadget.c | 235 
>> ++
> 
>> 2 files changed, 113 insertions(+), 124 deletions(-)
> 
>>
> 
>> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index
> 
>> d83be5651f87..093d078adaf4 100644
> 
>> --- a/drivers/usb/dwc2/core.h
> 
>> +++ b/drivers/usb/dwc2/core.h
> 
>> @@ -178,7 +178,6 @@ struct dwc2_hsotg_req;
> 
>>   * @desc_list_dma: The DMA address of descriptor chain currently in use.
> 
>>   * @desc_list: Pointer to descriptor DMA chain head currently in use.
> 
>>   * @desc_count: Count of entries within the DMA descriptor chain of EP.
> 
>> - * @isoc_chain_num: Number of ISOC chain currently in use - either 0 or 1.
> 
>>   * @next_desc: index of next free descriptor in the ISOC chain under SW
> 
>> control.
> 
>>   * @total_data: The total number of data bytes done.
> 
>>   * @fifo_size: The size of the FIFO (for periodic IN endpoints) @@ -231,7
> 
>> +230,6 @@ struct dwc2_hsotg_ep {
> 
>>  struct dwc2_dma_desc*desc_list;
> 
>>  u8  desc_count;
> 
>>
> 
>> -unsigned char   isoc_chain_num;
> 
>>  unsigned intnext_desc;
> 
>>
> 
>>  charname[10];
> 
>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index
> 
>> c231321656f9..1b9c84cb58fb 100644
> 
>> --- a/drivers/usb/dwc2/gadget.c
> 
>> +++ b/drivers/usb/dwc2/gadget.c
> 
>> @@ -793,9 +793,7 @@ static void
> 
>> dwc2_gadget_config_nonisoc_xfer_ddma(struct dwc2_hsotg_ep *hs_ep,
> 
>>   * @dma_buff: usb requests dma buffer.
> 
>>   * @len: usb request transfer length.
> 
>>   *
> 
>> - * Finds out index of first free entry either in the bottom or up half of
> 
>> - * descriptor chain 

RE: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-19 Thread Zengtao (B)
Hi Minas:

A few minor comments:

>-Original Message-
>From: linux-usb-ow...@vger.kernel.org
>[mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Minas Harutyunyan
>Sent: Saturday, March 17, 2018 5:10 PM
>To: John Youn ; Felipe Balbi ;
>Greg Kroah-Hartman ; linux-usb@vger.kernel.org
>Cc: Minas Harutyunyan 
>Subject: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow
>
>Changed existing two descriptor-chain flow to one chain.
>
>In two-chain implementation BNA interrupt used for switching between two
>chains. BNA interrupt asserted because of returning to beginning of the chain
>based on L-bit of last descriptor.
>
>Because of that we lose packets. This issue resolved by using one desc-chain.
>
>Removed all staff related to two desc-chain flow from DDMA ISOC related
>functions.
>
>Removed request length checking from dwc2_gadget_fill_isoc_desc() function.
>Request length checking added to dwc2_hsotg_ep_queue() function. If request
>length greater than descriptor limits then request not added to queue.
>Additional checking done for High Bandwidth ISOC OUT's which not supported by
>driver. In
>dwc2_gadget_fill_isoc_desc() function also checked desc-chain status (full or 
>not)
>to avoid of reusing not yet processed descriptors.
>
>In dwc2_gadget_start_isoc_ddma() function creation of desc-chain always
>started from descriptor 0. Before filling descriptors, they were initialized by
>HOST BUSY status.
>
>In dwc2_gadget_complete_isoc_request_ddma() added checking for desc-chain
>rollover. Also added checking completion status.
>Request completed successfully if DEV_DMA_STS is DEV_DMA_STS_SUCC,
>otherwise complete with -ETIMEDOUT.
>
>Actually removed dwc2_gadget_start_next_isoc_ddma() function because now
>driver use only one desc-chain and instead that function added
>dwc2_gadget_handle_isoc_bna() function for handling BNA interrupts.
>
>Handling BNA interrupt done by flushing TxFIFOs for OUT EPs, completing
>request with -EIO and resetting desc-chain number and target frame to initial
>values for restarting transfers.
>
>On handling NAK request completed with -ENODATA. Incremented target frame
>to allow fill desc chain and start transfers.
>In DDMA mode avoided of frame number incrementing, because tracking of
>frame number performed in dwc2_gadget_fill_isoc_desc() function.
>
>When core assert XferCompl along with BNA, we should ignore XferCompl in
>dwc2_hsotg_epint() function.
>
>On BNA interrupt replaced dwc2_gadget_start_next_isoc_ddma() by above
>mentioned BNA handler.
>
>In dwc2_hsotg_ep_enable() function added sanity check of bInterval for ISOC IN
>in DDMA mode, because HW not supported EP's with bInterval more than 12.
>
>Signed-off-by: Minas Harutyunyan 
>---
> drivers/usb/dwc2/core.h   |   2 -
> drivers/usb/dwc2/gadget.c | 235 ++
> 2 files changed, 113 insertions(+), 124 deletions(-)
>
>diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index
>d83be5651f87..093d078adaf4 100644
>--- a/drivers/usb/dwc2/core.h
>+++ b/drivers/usb/dwc2/core.h
>@@ -178,7 +178,6 @@ struct dwc2_hsotg_req;
>  * @desc_list_dma: The DMA address of descriptor chain currently in use.
>  * @desc_list: Pointer to descriptor DMA chain head currently in use.
>  * @desc_count: Count of entries within the DMA descriptor chain of EP.
>- * @isoc_chain_num: Number of ISOC chain currently in use - either 0 or 1.
>  * @next_desc: index of next free descriptor in the ISOC chain under SW
>control.
>  * @total_data: The total number of data bytes done.
>  * @fifo_size: The size of the FIFO (for periodic IN endpoints) @@ -231,7
>+230,6 @@ struct dwc2_hsotg_ep {
>   struct dwc2_dma_desc*desc_list;
>   u8  desc_count;
>
>-  unsigned char   isoc_chain_num;
>   unsigned intnext_desc;
>
>   charname[10];
>diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index
>c231321656f9..1b9c84cb58fb 100644
>--- a/drivers/usb/dwc2/gadget.c
>+++ b/drivers/usb/dwc2/gadget.c
>@@ -793,9 +793,7 @@ static void
>dwc2_gadget_config_nonisoc_xfer_ddma(struct dwc2_hsotg_ep *hs_ep,
>  * @dma_buff: usb requests dma buffer.
>  * @len: usb request transfer length.
>  *
>- * Finds out index of first free entry either in the bottom or up half of
>- * descriptor chain depend on which is under SW control and not processed
>- * by HW. Then fills that descriptor with the data of the arrived usb request,
>+ * Fills next free descriptor with the data of the arrived usb request,
>  * frame info, sets Last and IOC bits increments next_desc. If filled
>  * descriptor is not the first one, removes L bit from the previous descriptor
>  * status.
>@@ -810,34 +808,17 @@ static int dwc2_gadget_fill_isoc_desc(struct
>dwc2_hsotg_ep *hs_ep,
>   u32 mask = 0;
>
>   maxsize = 

Re: [PATCH v1 2/3] usb: dwc2: Change ISOC DDMA flow

2018-03-19 Thread Minas Harutyunyan
Hi Zengtao,

You email not received by linux-usb@vger.kernel.org. I suspect it 
rejected due to your email format have some issues, violate 
linux-usb@vger.kernel.org rules. I think you received email from 
linux-usb similar to this:

: host vger.kernel.org[209.132.180.67] said: 550
 5.7.1 Content-Policy reject msg: Your message is highly unlikely to be
 accepted here BF:; S1751783AbeCPIS1 (in reply to end of DATA 
command)

Kindly request you to correct your email and resend. I will reply you as 
soon as will be received by linux-usb and will be seen archive.
It's important that our communication archived.


Thanks,
Minas
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html