linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* query on DWC3
@ 2014-12-13  5:13 sundeep subbaraya
  2014-12-13 23:51 ` Paul Zimmerman
  0 siblings, 1 reply; 8+ messages in thread
From: sundeep subbaraya @ 2014-12-13  5:13 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, linux-kernel

Hi Felipe,

In DWC3 driver, for three stage Control OUT transfer there is a check:

   else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket)

             && (dep->number == 0)) {.
    }

I understand that we check for alignment of sizes and if not we
prepare trb with maxpacket and enable interrupt on short packet. In
databook I could not find anything related to this, it talks only
about addresses should be aligned. In Control transfer programming
model there is no difference between Control OUT or IN transfer, if
three stage transfer - prepare trb with length wLength. Initially I
followed this and not able to receive data on EP0 OUT.:( .After adding
the above check it is working. Please help me to understand why we do
this?

Thank in advance,
Sundeep.B.S.

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

* RE: query on DWC3
  2014-12-13  5:13 query on DWC3 sundeep subbaraya
@ 2014-12-13 23:51 ` Paul Zimmerman
  2014-12-14  3:09   ` sundeep subbaraya
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Zimmerman @ 2014-12-13 23:51 UTC (permalink / raw)
  To: sundeep subbaraya, balbi; +Cc: linux-usb, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1810 bytes --]

> From: linux-usb-owner@vger.kernel.org [mailto:linux-usb-owner@vger.kernel.org] On Behalf Of sundeep subbaraya
> Sent: Friday, December 12, 2014 9:13 PM
> 
> Hi Felipe,
> 
> In DWC3 driver, for three stage Control OUT transfer there is a check:
> 
>    else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket)
> 
>              && (dep->number == 0)) {.
>     }
> 
> I understand that we check for alignment of sizes and if not we
> prepare trb with maxpacket and enable interrupt on short packet. In
> databook I could not find anything related to this, it talks only
> about addresses should be aligned. In Control transfer programming
> model there is no difference between Control OUT or IN transfer, if
> three stage transfer - prepare trb with length wLength. Initially I
> followed this and not able to receive data on EP0 OUT.:( .After adding
> the above check it is working. Please help me to understand why we do
> this?

Hi Sundeep,

Please see section 8.2.3.3 "Buffer Size Rules and Zero-Length Packets"
in the databook:

	For OUT endpoints, the following rules apply:

	- The total size of a Buffer Descriptor must be a multiple of
	  MaxPacketSize

The wording may be a little confusing, it actually means that the size
of the data buffer for OUT endpoints must be a multiple of MaxPacketSize.
Section 8.2.5 states it more clearly:

	- An OUT transfer’s transfer size (Total TRB buffer allocation)
	  must be a multiple of MaxPacketSize even if software is expecting
        a fixed non-multiple of MaxPacketSize transfer from the Host.

This rule applies to all OUT endpoint types, including Control endpoints.

-- 
Paul

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: query on DWC3
  2014-12-13 23:51 ` Paul Zimmerman
@ 2014-12-14  3:09   ` sundeep subbaraya
  2014-12-22 16:11     ` Felipe Balbi
  0 siblings, 1 reply; 8+ messages in thread
From: sundeep subbaraya @ 2014-12-14  3:09 UTC (permalink / raw)
  To: Paul Zimmerman; +Cc: balbi, linux-usb, linux-kernel

Hi Paul,

As per my understanding, for BULK OUT we do queue a request with 512
bytes length since we do not
know the length of the transfer Host is going to send. For Control OUT
we know the length in wLength of
Setup packet, hence I assumed there is no difference in programming
model of Control IN and OUT.
Now it is clear for me. Thanks for the clarification :)

Sundeep

On Sun, Dec 14, 2014 at 5:21 AM, Paul Zimmerman
<Paul.Zimmerman@synopsys.com> wrote:
>> From: linux-usb-owner@vger.kernel.org [mailto:linux-usb-owner@vger.kernel.org] On Behalf Of sundeep subbaraya
>> Sent: Friday, December 12, 2014 9:13 PM
>>
>> Hi Felipe,
>>
>> In DWC3 driver, for three stage Control OUT transfer there is a check:
>>
>>    else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket)
>>
>>              && (dep->number == 0)) {.
>>     }
>>
>> I understand that we check for alignment of sizes and if not we
>> prepare trb with maxpacket and enable interrupt on short packet. In
>> databook I could not find anything related to this, it talks only
>> about addresses should be aligned. In Control transfer programming
>> model there is no difference between Control OUT or IN transfer, if
>> three stage transfer - prepare trb with length wLength. Initially I
>> followed this and not able to receive data on EP0 OUT.:( .After adding
>> the above check it is working. Please help me to understand why we do
>> this?
>
> Hi Sundeep,
>
> Please see section 8.2.3.3 "Buffer Size Rules and Zero-Length Packets"
> in the databook:
>
>         For OUT endpoints, the following rules apply:
>
>         - The total size of a Buffer Descriptor must be a multiple of
>           MaxPacketSize
>
> The wording may be a little confusing, it actually means that the size
> of the data buffer for OUT endpoints must be a multiple of MaxPacketSize.
> Section 8.2.5 states it more clearly:
>
>         - An OUT transfer’s transfer size (Total TRB buffer allocation)
>           must be a multiple of MaxPacketSize even if software is expecting
>         a fixed non-multiple of MaxPacketSize transfer from the Host.
>
> This rule applies to all OUT endpoint types, including Control endpoints.
>
> --
> Paul
>

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

* Re: query on DWC3
  2014-12-14  3:09   ` sundeep subbaraya
@ 2014-12-22 16:11     ` Felipe Balbi
  2014-12-22 16:12       ` Felipe Balbi
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2014-12-22 16:11 UTC (permalink / raw)
  To: sundeep subbaraya; +Cc: Paul Zimmerman, balbi, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

Hi,

(please don't top-post)

On Sun, Dec 14, 2014 at 08:39:18AM +0530, sundeep subbaraya wrote:
> Hi Paul,
> 
> As per my understanding, for BULK OUT we do queue a request with 512
> bytes length since we do not

sometimes we _do_ know the size. In case of Mass Storage, we _know_ that
the first bulk out transfer will be 31-bytes (CBW), if we were to start
a 31-byte transfer, we would't receive anything.

> know the length of the transfer Host is going to send. For Control OUT
> we know the length in wLength of
> Setup packet, hence I assumed there is no difference in programming
> model of Control IN and OUT.

there is _no_ difference. It's just that it was agreed that for anything
other than control ep, the function drivers would take care of it. See
the uses of quirk_ep_out_aligned_size.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: query on DWC3
  2014-12-22 16:11     ` Felipe Balbi
@ 2014-12-22 16:12       ` Felipe Balbi
  2015-01-06  7:09         ` sundeep subbaraya
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2014-12-22 16:12 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: sundeep subbaraya, Paul Zimmerman, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

Hi again,

On Mon, Dec 22, 2014 at 10:11:23AM -0600, Felipe Balbi wrote:
> (please don't top-post)
> 
> On Sun, Dec 14, 2014 at 08:39:18AM +0530, sundeep subbaraya wrote:
> > Hi Paul,
> > 
> > As per my understanding, for BULK OUT we do queue a request with 512
> > bytes length since we do not
> 
> sometimes we _do_ know the size. In case of Mass Storage, we _know_ that
> the first bulk out transfer will be 31-bytes (CBW), if we were to start
> a 31-byte transfer, we would't receive anything.
> 
> > know the length of the transfer Host is going to send. For Control OUT
> > we know the length in wLength of
> > Setup packet, hence I assumed there is no difference in programming
> > model of Control IN and OUT.
> 
> there is _no_ difference. It's just that it was agreed that for anything
> other than control ep, the function drivers would take care of it. See
> the uses of quirk_ep_out_aligned_size.

btw, why are you reimplementing the driver when there's a perfectly good
driver to use in mainline kernel ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: query on DWC3
  2014-12-22 16:12       ` Felipe Balbi
@ 2015-01-06  7:09         ` sundeep subbaraya
  2015-01-08 16:57           ` Felipe Balbi
  0 siblings, 1 reply; 8+ messages in thread
From: sundeep subbaraya @ 2015-01-06  7:09 UTC (permalink / raw)
  To: balbi; +Cc: Paul Zimmerman, linux-usb, linux-kernel

Hi,

On Mon, Dec 22, 2014 at 9:42 PM, Felipe Balbi <balbi@ti.com> wrote:
> Hi again,
>
> On Mon, Dec 22, 2014 at 10:11:23AM -0600, Felipe Balbi wrote:
>> (please don't top-post)

Sure.

>>
>> On Sun, Dec 14, 2014 at 08:39:18AM +0530, sundeep subbaraya wrote:
>> > Hi Paul,
>> >
>> > As per my understanding, for BULK OUT we do queue a request with 512
>> > bytes length since we do not
>>
>> sometimes we _do_ know the size. In case of Mass Storage, we _know_ that
>> the first bulk out transfer will be 31-bytes (CBW), if we were to start
>> a 31-byte transfer, we would't receive anything.
>>
>> > know the length of the transfer Host is going to send. For Control OUT
>> > we know the length in wLength of
>> > Setup packet, hence I assumed there is no difference in programming
>> > model of Control IN and OUT.
>>
>> there is _no_ difference. It's just that it was agreed that for anything
>> other than control ep, the function drivers would take care of it. See
>> the uses of quirk_ep_out_aligned_size.

got it..:)

>
> btw, why are you reimplementing the driver when there's a perfectly good
> driver to use in mainline kernel ?

I am writing a bare metal driver and it didn't work without alignment
check mentioned above.

>
> --
> balbi

Thanks,
Sundeep.B.S.

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

* Re: query on DWC3
  2015-01-06  7:09         ` sundeep subbaraya
@ 2015-01-08 16:57           ` Felipe Balbi
  2015-01-19  6:05             ` sundeep subbaraya
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2015-01-08 16:57 UTC (permalink / raw)
  To: sundeep subbaraya; +Cc: balbi, Paul Zimmerman, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]

Hi,

On Tue, Jan 06, 2015 at 12:39:55PM +0530, sundeep subbaraya wrote:
> >> On Sun, Dec 14, 2014 at 08:39:18AM +0530, sundeep subbaraya wrote:
> >> > Hi Paul,
> >> >
> >> > As per my understanding, for BULK OUT we do queue a request with 512
> >> > bytes length since we do not
> >>
> >> sometimes we _do_ know the size. In case of Mass Storage, we _know_ that
> >> the first bulk out transfer will be 31-bytes (CBW), if we were to start
> >> a 31-byte transfer, we would't receive anything.
> >>
> >> > know the length of the transfer Host is going to send. For Control OUT
> >> > we know the length in wLength of
> >> > Setup packet, hence I assumed there is no difference in programming
> >> > model of Control IN and OUT.
> >>
> >> there is _no_ difference. It's just that it was agreed that for anything
> >> other than control ep, the function drivers would take care of it. See
> >> the uses of quirk_ep_out_aligned_size.
> 
> got it..:)
> 
> >
> > btw, why are you reimplementing the driver when there's a perfectly good
> > driver to use in mainline kernel ?
> 
> I am writing a bare metal driver and it didn't work without alignment
> check mentioned above.

just make sure you don't copy GPL code into your bare metal driver,
otherwise your bare metal driver will be GPL by definition. Also, since
you're not using Linux at all, you should be asking support from
Synopsys instead, not the Linux USB mailing list.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: query on DWC3
  2015-01-08 16:57           ` Felipe Balbi
@ 2015-01-19  6:05             ` sundeep subbaraya
  0 siblings, 0 replies; 8+ messages in thread
From: sundeep subbaraya @ 2015-01-19  6:05 UTC (permalink / raw)
  To: balbi; +Cc: Paul Zimmerman, linux-usb, linux-kernel

Hi Felipe,

On Thu, Jan 8, 2015 at 10:27 PM, Felipe Balbi <balbi@ti.com> wrote:
> Hi,
>
> On Tue, Jan 06, 2015 at 12:39:55PM +0530, sundeep subbaraya wrote:
>> >> On Sun, Dec 14, 2014 at 08:39:18AM +0530, sundeep subbaraya wrote:
>> >> > Hi Paul,
>> >> >
>> >> > As per my understanding, for BULK OUT we do queue a request with 512
>> >> > bytes length since we do not
>> >>
>> >> sometimes we _do_ know the size. In case of Mass Storage, we _know_ that
>> >> the first bulk out transfer will be 31-bytes (CBW), if we were to start
>> >> a 31-byte transfer, we would't receive anything.
>> >>
>> >> > know the length of the transfer Host is going to send. For Control OUT
>> >> > we know the length in wLength of
>> >> > Setup packet, hence I assumed there is no difference in programming
>> >> > model of Control IN and OUT.
>> >>
>> >> there is _no_ difference. It's just that it was agreed that for anything
>> >> other than control ep, the function drivers would take care of it. See
>> >> the uses of quirk_ep_out_aligned_size.
>>
>> got it..:)
>>
>> >
>> > btw, why are you reimplementing the driver when there's a perfectly good
>> > driver to use in mainline kernel ?
>>
>> I am writing a bare metal driver and it didn't work without alignment
>> check mentioned above.
>
> just make sure you don't copy GPL code into your bare metal driver,
> otherwise your bare metal driver will be GPL by definition. Also, since

I didn't copy linux code. I have gone through dwc3 driver while
writing udc-xilinx.c
and now it is helping me to understand dwc3 controller quickly.:)

> you're not using Linux at all, you should be asking support from
> Synopsys instead, not the Linux USB mailing list.

Sure will ask support from Synopsis.

Thanks,
Sundeep

>
> --
> balbi

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

end of thread, other threads:[~2015-01-19  6:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-13  5:13 query on DWC3 sundeep subbaraya
2014-12-13 23:51 ` Paul Zimmerman
2014-12-14  3:09   ` sundeep subbaraya
2014-12-22 16:11     ` Felipe Balbi
2014-12-22 16:12       ` Felipe Balbi
2015-01-06  7:09         ` sundeep subbaraya
2015-01-08 16:57           ` Felipe Balbi
2015-01-19  6:05             ` sundeep subbaraya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).