Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2017-01-11 Thread Christian Lamparter
On Tuesday, January 10, 2017 3:23:24 PM CET John Youn wrote:
> On 1/10/2017 3:03 PM, Christian Lamparter wrote:
> > On Tuesday, January 10, 2017 1:46:56 PM CET John Youn wrote:
> >> On 12/19/2016 6:49 AM, Christian Lamparter wrote:
> >>> (Lot's of old stuff, that doesn't matter anymore)
> > 
> > Hello John,
> >  
> >> This should be fixed against the latest dwc2 param rework series [1]
> >> which i hope to get queued for 4.11. If you can give it a test, that
> >> would be great.
> > 
> > oh Ok. I see you added it to
> > "[PATCH 16/21] usb: dwc2: Remove platform static params" [0].
> > Yes, I think this should work nicely. Thank you very much for
> > your time, even though it's just for like "one old board" :-).
> 
> No problem. Sorry for the delay getting the param stuff sorted.
> 
> > 
> > Do you have a public git tree with your patches that I can
> > clone/checkout?  If not, I'll take some time on the weekend
> > for this and write back on monday. But yeah, this should 
> > work.
> Yes check here on branch 'next'
> 
> https://github.com/synopsys-usb/linux.git
Ok thanks. I cloned it and built a new kernel for the thing. 

>From the (attached) bootlog:
GAHBCFG   @0xD1210008 : 0x002E
0x2E = Bit 5 | (Bit 3 | Bit 2 | Bit 1)
 = GAHBCFG_DMA_EN |
   (GAHBCFG_HBSTLEN_INCR16 << GAHBCFG_HBSTLEN_SHIFT)

I've attached an old 1GiB USB-Stick to the dwc2 managed port
and it does work as expected. The same goes for a usb-3.0 HDD
and a USB 2.0 11n WLAN stick. (All while the DWC SATA is
copying data).

Tested-by: Christian Lamparter 

Again, thank you for your work!

Regards,
Christian
---
These are the kernel messages.

dwc2 4bff8.usbotg: mapped PA bff8 to VA d121
dwc2 4bff8.usbotg: registering common handler for irq35
dwc2 4bff8.usbotg: Forcing mode to host
dwc2 4bff8.usbotg: Core Release: 2.90a (snpsid=4f54290a)
dwc2 4bff8.usbotg: Forcing mode to host
dwc2 4bff8.usbotg: DWC OTG HCD INIT
dwc2 4bff8.usbotg: hcfg=0200
dwc2 4bff8.usbotg: dwc2_core_init(ca890810)
dwc2 4bff8.usbotg: HS UTMI+ PHY selected
dwc2 4bff8.usbotg: Internal DMA Mode
dwc2 4bff8.usbotg: host_dma:1 dma_desc_enable:0
dwc2 4bff8.usbotg: Using Buffer DMA mode
dwc2 4bff8.usbotg: Host Mode
dwc2 4bff8.usbotg: DWC OTG Controller
dwc2 4bff8.usbotg: new USB bus registered, assigned bus number 1
dwc2 4bff8.usbotg: irq 35, io mem 0x
dwc2 4bff8.usbotg: DWC OTG HCD START
dwc2 4bff8.usbotg: dwc2_core_host_init(ca890810)
dwc2 4bff8.usbotg: Initializing HCFG.FSLSPClkSel to 
dwc2 4bff8.usbotg: initial grxfsiz=0213
dwc2 4bff8.usbotg: new grxfsiz=0213
dwc2 4bff8.usbotg: initial gnptxfsiz=01000213
dwc2 4bff8.usbotg: new gnptxfsiz=01000213
dwc2 4bff8.usbotg: initial hptxfsiz=01000313
dwc2 4bff8.usbotg: new hptxfsiz=01000313
dwc2 4bff8.usbotg: dwc2_core_host_init: Halt channel 0
dwc2 4bff8.usbotg: dwc2_core_host_init: Halt channel 1
dwc2 4bff8.usbotg: dwc2_core_host_init: Halt channel 2
dwc2 4bff8.usbotg: dwc2_core_host_init: Halt channel 3
dwc2 4bff8.usbotg: Init: Port Power? op_state=9
dwc2 4bff8.usbotg: Init: Power Port (0)
dwc2 4bff8.usbotg: dwc2_enable_host_interrupts()
dwc2 4bff8.usbotg: DWC OTG HCD Has Root Hub
dwc2 4bff8.usbotg: DWC OTG HCD EP RESET: bEndpointAddress=0x81
hub 1-0:1.0: USB hub found
dwc2 4bff8.usbotg: GetHubDescriptor
hub 1-0:1.0: 1 port detected
dwc2 4bff8.usbotg: GetHubStatus
dwc2 4bff8.usbotg: SetPortFeature
dwc2 4bff8.usbotg: 
dwc2 4bff8.usbotg: 

dwc2 4bff8.usbotg: HCD State:
dwc2 4bff8.usbotg:   Num channels: 4
dwc2 4bff8.usbotg:   Channel 0:
dwc2 4bff8.usbotg: dev_addr: 0, ep_num: 0, ep_is_in: 0
dwc2 4bff8.usbotg: speed: 0
dwc2 4bff8.usbotg: ep_type: 0
dwc2 4bff8.usbotg: max_packet: 0
dwc2 4bff8.usbotg: data_pid_start: 0
dwc2 4bff8.usbotg: multi_count: 0
dwc2 4bff8.usbotg: xfer_started: 0
dwc2 4bff8.usbotg: xfer_buf:   (null)
dwc2 4bff8.usbotg: xfer_dma: 
dwc2 4bff8.usbotg: xfer_len: 0
dwc2 4bff8.usbotg: xfer_count: 0
dwc2 4bff8.usbotg: halt_on_queue: 0
dwc2 4bff8.usbotg: halt_pending: 0
dwc2 4bff8.usbotg: halt_status: 0
dwc2 4bff8.usbotg: do_split: 0
dwc2 4bff8.usbotg: complete_split: 0
dwc2 4bff8.usbotg: hub_addr: 0
dwc2 4bff8.usbotg: hub_port: 0
dwc2 4bff8.usbotg: xact_pos: 0
dwc2 4bff8.usbotg: requests: 0
dwc2 4bff8.usbotg: qh:   (null)
dwc2 4bff8.usbotg:   Channel 1:
dwc2 4bff8.usbotg: dev_addr: 0, ep_num: 0, ep_is_in: 0
dwc2 4bff8.usbotg: speed: 0
dwc2 4bff8.usbotg: ep_type: 0
dwc2 4bff8.usbotg: max_packet: 0
dwc2 4bff8.usbotg: data_pid_start: 0
dwc2 4bff8.usbotg: multi_count: 0
dwc2 4bff8.usbotg: xfer_started: 0
dwc2 4bff8.usbotg:  

Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2017-01-10 Thread John Youn
On 1/10/2017 3:03 PM, Christian Lamparter wrote:
> On Tuesday, January 10, 2017 1:46:56 PM CET John Youn wrote:
>> On 12/19/2016 6:49 AM, Christian Lamparter wrote:
>>> (Lot's of old stuff, that doesn't matter anymore)
> 
> Hello John,
>  
>> This should be fixed against the latest dwc2 param rework series [1]
>> which i hope to get queued for 4.11. If you can give it a test, that
>> would be great.
> 
> oh Ok. I see you added it to
> "[PATCH 16/21] usb: dwc2: Remove platform static params" [0].
> Yes, I think this should work nicely. Thank you very much for
> your time, even though it's just for like "one old board" :-).

No problem. Sorry for the delay getting the param stuff sorted.

> 
> Do you have a public git tree with your patches that I can
> clone/checkout?  If not, I'll take some time on the weekend
> for this and write back on monday. But yeah, this should 
> work.

Yes check here on branch 'next'

https://github.com/synopsys-usb/linux.git

Regards,
John
--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2017-01-10 Thread Christian Lamparter
On Tuesday, January 10, 2017 1:46:56 PM CET John Youn wrote:
> On 12/19/2016 6:49 AM, Christian Lamparter wrote:
> > (Lot's of old stuff, that doesn't matter anymore)

Hello John,
 
> This should be fixed against the latest dwc2 param rework series [1]
> which i hope to get queued for 4.11. If you can give it a test, that
> would be great.

oh Ok. I see you added it to
"[PATCH 16/21] usb: dwc2: Remove platform static params" [0].
Yes, I think this should work nicely. Thank you very much for
your time, even though it's just for like "one old board" :-).

Do you have a public git tree with your patches that I can
clone/checkout?  If not, I'll take some time on the weekend
for this and write back on monday. But yeah, this should 
work.

Regards,
Christian

[0] 
--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2017-01-10 Thread John Youn
On 12/19/2016 6:49 AM, Christian Lamparter wrote:
> Hello John, hello Felipe
> 
> On Monday, November 28, 2016 7:32:20 PM CET John Youn wrote:
>> On 11/22/2016 12:51 PM, Christian Lamparter wrote:
>>> On Monday, November 21, 2016 7:32:30 PM CET John Youn wrote:
 On 11/21/2016 1:10 PM, Christian Lamparter wrote:
> On Monday, November 21, 2016 12:16:31 PM CET John Youn wrote:
>> On 11/18/2016 12:18 PM, Christian Lamparter wrote:
>>> On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
 Also, perhaps you should allow that the compatible string can define 
 the 
 default.

>>> I hoped you would say that :).
>>>
>>> I've attached a patch (on top of John Youn changes) [...]
>>> ---
>>> Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for 
>>> amcc,dwc-otg
>>> [...]
>>> @@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
>>> +/* [...] */
>>> +static const struct of_device_id dwc2_compat_ahb_bursts[] = {
>>> +   {
>>> +   .compatible = "amcc,dwc-otg",
>>> +   .data = (void *) GAHBCFG_HBSTLEN_INCR16,
>>> +   },
>>> +};
 [...]
 @@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct 
 dwc2_hsotg *hsotg)
>>> ret = device_property_read_string(hsotg->dev, "snps,ahb-burst", 
>>> &str);
>>> if (ret < 0) {
>>> +   const struct of_device_id *match;
>>> +
>>> +   match = of_match_node(dwc2_compat_ahb_bursts, node);
>>> +   if (match)
>>> +   ret = (int)match->data;
>>> +
 [...]
>> I'd prefer if you use the binding which requires no extra code in
>> dwc2.
> I'm fine with either option. However it think that this would require
> that either Mark or Rob would allow an exception to the "keep existing
> dts the way they are) and ack the following change to the 
> canyonlands.dts. 
 [...]
>>
>> Ok thanks for clearing that up. I understand.
>>
>> For now we can just set the property to "INCR16" based on the
>> compatible string. Perhaps in the future do this from a glue-layer
>> driver which binds to all compatible strings other than "snps,dwc2".
>>
>> I won't be able to do anything with this until next week though.
> Ok, I think enough time has passed. I would like to see this
> patch series (v3 [0]) being queued for 4.11+ together with
> "usb: dwc2: add a default ahb-burst setting for amcc,dwc-otg" [1].
> 
> Felipe, if you want I can resend the series and add the
> "amcc,dwc-otg" patch to it as well. Just let me know what you
> prefer here.
> 
> Regards,
> Christian
> 
> [0] 
>   >
> [1] 
>   >
> 

Hi Christian,

This should be fixed against the latest dwc2 param rework series [1]
which i hope to get queued for 4.11. If you can give it a test, that
would be great.

Regards,
John

[1] https://www.spinics.net/lists/linux-usb/msg151693.html
--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-12-19 Thread Christian Lamparter
Hello John, hello Felipe

On Monday, November 28, 2016 7:32:20 PM CET John Youn wrote:
> On 11/22/2016 12:51 PM, Christian Lamparter wrote:
> > On Monday, November 21, 2016 7:32:30 PM CET John Youn wrote:
> >> On 11/21/2016 1:10 PM, Christian Lamparter wrote:
> >>> On Monday, November 21, 2016 12:16:31 PM CET John Youn wrote:
>  On 11/18/2016 12:18 PM, Christian Lamparter wrote:
> > On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
> >> Also, perhaps you should allow that the compatible string can define 
> >> the 
> >> default.
> >>
> > I hoped you would say that :).
> >
> > I've attached a patch (on top of John Youn changes) [...]
> > ---
> > Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for 
> > amcc,dwc-otg
> > [...]
> > @@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
> > +/* [...] */
> > +static const struct of_device_id dwc2_compat_ahb_bursts[] = {
> > +   {
> > +   .compatible = "amcc,dwc-otg",
> > +   .data = (void *) GAHBCFG_HBSTLEN_INCR16,
> > +   },
> > +};
> >> [...]
> >> @@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct 
> >> dwc2_hsotg *hsotg)
> > ret = device_property_read_string(hsotg->dev, "snps,ahb-burst", 
> > &str);
> > if (ret < 0) {
> > +   const struct of_device_id *match;
> > +
> > +   match = of_match_node(dwc2_compat_ahb_bursts, node);
> > +   if (match)
> > +   ret = (int)match->data;
> > +
> >> [...]
>  I'd prefer if you use the binding which requires no extra code in
>  dwc2.
> >>> I'm fine with either option. However it think that this would require
> >>> that either Mark or Rob would allow an exception to the "keep existing
> >>> dts the way they are) and ack the following change to the 
> >>> canyonlands.dts. 
> >> [...]
>
> Ok thanks for clearing that up. I understand.
> 
> For now we can just set the property to "INCR16" based on the
> compatible string. Perhaps in the future do this from a glue-layer
> driver which binds to all compatible strings other than "snps,dwc2".
> 
> I won't be able to do anything with this until next week though.
Ok, I think enough time has passed. I would like to see this
patch series (v3 [0]) being queued for 4.11+ together with
"usb: dwc2: add a default ahb-burst setting for amcc,dwc-otg" [1].

Felipe, if you want I can resend the series and add the
"amcc,dwc-otg" patch to it as well. Just let me know what you
prefer here.

Regards,
Christian

[0] 
[1] 
--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-28 Thread John Youn
On 11/22/2016 12:51 PM, Christian Lamparter wrote:
> On Monday, November 21, 2016 7:32:30 PM CET John Youn wrote:
>> On 11/21/2016 1:10 PM, Christian Lamparter wrote:
>>> On Monday, November 21, 2016 12:16:31 PM CET John Youn wrote:
 On 11/18/2016 12:18 PM, Christian Lamparter wrote:
> On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
>> Also, perhaps you should allow that the compatible string can define the 
>> default.
>>
> I hoped you would say that :).
>
> I've attached a patch (on top of John Youn changes) [...]
> ---
> Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for 
> amcc,dwc-otg
> [...]
> @@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
> +/* [...] */
> +static const struct of_device_id dwc2_compat_ahb_bursts[] = {
> + {
> + .compatible = "amcc,dwc-otg",
> + .data = (void *) GAHBCFG_HBSTLEN_INCR16,
> + },
> +};
>> [...]
>> @@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct 
>> dwc2_hsotg *hsotg)
>   ret = device_property_read_string(hsotg->dev, "snps,ahb-burst", &str);
>   if (ret < 0) {
> + const struct of_device_id *match;
> +
> + match = of_match_node(dwc2_compat_ahb_bursts, node);
> + if (match)
> + ret = (int)match->data;
> +
>> [...]
 I'd prefer if you use the binding which requires no extra code in
 dwc2.
>>> I'm fine with either option. However it think that this would require
>>> that either Mark or Rob would allow an exception to the "keep existing
>>> dts the way they are) and ack the following change to the canyonlands.dts. 
>>
>> I don't know about that. Under what circumstance can the dts change?
> As far as I know, the justification for not changing the DTS is that a
> compiled DTB might be stored in an read-only ROM on a board. So it would
> be impossible to update it. Hence, the driver have work with the existing
> (and sometimes buggy or incomplete) information to stay compatible.
> 
> (Note: Thankfully, the canyonlands dtb is stored in flash, it's possible
> to update it. But it is an extra step that's not done automatically
> with make install). 
> 
>> The canyonlands dts was binding to an external vendor driver. So it
>> wasn't documented nor expected to work with dwc2 until your recent
>> patch adding the compatible string.
> 
> Oh, no that's not what happend. Let me explain why there was no "external 
> vendor driver": AMCC/APM were planing to upstream their hole platform. And
> in fact, the devs tried very hard to include their driver back in 2011 [0].
> But this driver was denied inclusion back then due to:
> 
> "[...]
> I would also like to point out that the same Synopsys USB controller
> is used in a number of other SoCs (especially ARM chips), and
> supported by other drivers, some of these even in mainline.
> 
> See http://thread.gmane.org/gmane.linux.usb.general/61714/focus=62139
> for a related thread.
> 
> Instead of trying to add a completely new driver to mainline (and one
> which has been repeatedly been rejected), I vote for focusing on the
> existing driver code that is already in mainline, and testing and
> improving this so we can use a single implementation of this driver
> code for all SoCs that use the same IP block." [1]
> 
> Of course: The listed link goes the "USB Host driver for i.MX28" driver.
> And this is an ehci-hcd like driver... Which is as you are well aware not
> that similar to the dwc2 OTG. And as far as I can tell: AMCC abandoned
> the patch series right there. 
> 
> Note: AMCC did however succeed in pushing your employer's Synopsys
> DesignWare SATA and DMA drivers to the kernel back then. And I'm happy
> to report that both drivers are still around and working fine for the 460EX 
> (sata_dwc_460ex.c[2] and the DW AHB DMA [3]). (The drivers also work for
> different platforms than the original PPC. I know that because I helped
> Andy Shevchenko with testing and pushing some fixes to it when he was
> adding support for the Intel Quark SoC, which uses the DWC SATA and DMA).

Ok thanks for clearing that up. I understand.

For now we can just set the property to "INCR16" based on the
compatible string. Perhaps in the future do this from a glue-layer
driver which binds to all compatible strings other than "snps,dwc2".

I won't be able to do anything with this until next week though.

Regards,
John
--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-22 Thread Rob Herring
On Tue, Nov 22, 2016 at 2:51 PM, Christian Lamparter
 wrote:
> On Monday, November 21, 2016 7:32:30 PM CET John Youn wrote:
>> On 11/21/2016 1:10 PM, Christian Lamparter wrote:
>> > On Monday, November 21, 2016 12:16:31 PM CET John Youn wrote:
>> >> On 11/18/2016 12:18 PM, Christian Lamparter wrote:
>> >>> On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
>>  Also, perhaps you should allow that the compatible string can define the
>>  default.
>> 
>> >>> I hoped you would say that :).
>> >>>
>> >>> I've attached a patch (on top of John Youn changes) [...]
>> >>> ---
>> >>> Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for 
>> >>> amcc,dwc-otg
>> >>> [...]
>> >>> @@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
>> >>> +/* [...] */
>> >>> +static const struct of_device_id dwc2_compat_ahb_bursts[] = {
>> >>> + {
>> >>> + .compatible = "amcc,dwc-otg",
>> >>> + .data = (void *) GAHBCFG_HBSTLEN_INCR16,
>> >>> + },
>> >>> +};
>> [...]
>> > >>> @@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct 
>> > >>> dwc2_hsotg *hsotg)
>> >>>   ret = device_property_read_string(hsotg->dev, "snps,ahb-burst", &str);
>> >>>   if (ret < 0) {
>> >>> + const struct of_device_id *match;
>> >>> +
>> >>> + match = of_match_node(dwc2_compat_ahb_bursts, node);
>> >>> + if (match)
>> >>> + ret = (int)match->data;
>> >>> +
>> [...]
>> >> I'd prefer if you use the binding which requires no extra code in
>> >> dwc2.
>> > I'm fine with either option. However it think that this would require
>> > that either Mark or Rob would allow an exception to the "keep existing
>> > dts the way they are) and ack the following change to the canyonlands.dts.
>>
>> I don't know about that. Under what circumstance can the dts change?
> As far as I know, the justification for not changing the DTS is that a
> compiled DTB might be stored in an read-only ROM on a board. So it would
> be impossible to update it. Hence, the driver have work with the existing
> (and sometimes buggy or incomplete) information to stay compatible.
>
> (Note: Thankfully, the canyonlands dtb is stored in flash, it's possible
> to update it. But it is an extra step that's not done automatically
> with make install).
>
>> The canyonlands dts was binding to an external vendor driver. So it
>> wasn't documented nor expected to work with dwc2 until your recent
>> patch adding the compatible string.
>
> Oh, no that's not what happend. Let me explain why there was no "external
> vendor driver": AMCC/APM were planing to upstream their hole platform. And
> in fact, the devs tried very hard to include their driver back in 2011 [0].
> But this driver was denied inclusion back then due to:
>
> "[...]
> I would also like to point out that the same Synopsys USB controller
> is used in a number of other SoCs (especially ARM chips), and
> supported by other drivers, some of these even in mainline.
>
> See http://thread.gmane.org/gmane.linux.usb.general/61714/focus=62139
> for a related thread.
>
> Instead of trying to add a completely new driver to mainline (and one
> which has been repeatedly been rejected), I vote for focusing on the
> existing driver code that is already in mainline, and testing and
> improving this so we can use a single implementation of this driver
> code for all SoCs that use the same IP block." [1]
>
> Of course: The listed link goes the "USB Host driver for i.MX28" driver.
> And this is an ehci-hcd like driver... Which is as you are well aware not
> that similar to the dwc2 OTG. And as far as I can tell: AMCC abandoned
> the patch series right there.
>
> Note: AMCC did however succeed in pushing your employer's Synopsys
> DesignWare SATA and DMA drivers to the kernel back then. And I'm happy
> to report that both drivers are still around and working fine for the 460EX
> (sata_dwc_460ex.c[2] and the DW AHB DMA [3]). (The drivers also work for
> different platforms than the original PPC. I know that because I helped
> Andy Shevchenko with testing and pushing some fixes to it when he was
> adding support for the Intel Quark SoC, which uses the DWC SATA and DMA).
>
> So Please?
>> Systems that use the vendor driver will still work with the dts. If
>> you remove the vendor driver and configure it to use dwc2, it won't
>> work due to a quirk of the canyonlands hardware, for which you need to
>> add a dts property.
> Sadly, there is no up to date vendor driver. The canyonlands.dts binding
> is still in place and the hardware works fine. I'm interested in this
> platform since it is a cheap BigEndian system which is useful for usb
> driver development (carl9170 and rtl8192su)... and I would like to
> have out-of-the-box support.
>
>> I think this is reasonable. Rob or Mark, any feedback?
> I recall that Rob has already voiced his opinion about the ahb-burst setting:
> "Also, perhaps you should allow that the compatible string can define the 
> default."
>
> 

Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-22 Thread Christian Lamparter
On Monday, November 21, 2016 7:32:30 PM CET John Youn wrote:
> On 11/21/2016 1:10 PM, Christian Lamparter wrote:
> > On Monday, November 21, 2016 12:16:31 PM CET John Youn wrote:
> >> On 11/18/2016 12:18 PM, Christian Lamparter wrote:
> >>> On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
>  Also, perhaps you should allow that the compatible string can define the 
>  default.
> 
> >>> I hoped you would say that :).
> >>>
> >>> I've attached a patch (on top of John Youn changes) [...]
> >>> ---
> >>> Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for 
> >>> amcc,dwc-otg
> >>> [...]
> >>> @@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
> >>> +/* [...] */
> >>> +static const struct of_device_id dwc2_compat_ahb_bursts[] = {
> >>> + {
> >>> + .compatible = "amcc,dwc-otg",
> >>> + .data = (void *) GAHBCFG_HBSTLEN_INCR16,
> >>> + },
> >>> +};
> [...]
> > >>> @@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct 
> > >>> dwc2_hsotg *hsotg)
> >>>   ret = device_property_read_string(hsotg->dev, "snps,ahb-burst", &str);
> >>>   if (ret < 0) {
> >>> + const struct of_device_id *match;
> >>> +
> >>> + match = of_match_node(dwc2_compat_ahb_bursts, node);
> >>> + if (match)
> >>> + ret = (int)match->data;
> >>> +
> [...]
> >> I'd prefer if you use the binding which requires no extra code in
> >> dwc2.
> > I'm fine with either option. However it think that this would require
> > that either Mark or Rob would allow an exception to the "keep existing
> > dts the way they are) and ack the following change to the canyonlands.dts. 
> 
> I don't know about that. Under what circumstance can the dts change?
As far as I know, the justification for not changing the DTS is that a
compiled DTB might be stored in an read-only ROM on a board. So it would
be impossible to update it. Hence, the driver have work with the existing
(and sometimes buggy or incomplete) information to stay compatible.

(Note: Thankfully, the canyonlands dtb is stored in flash, it's possible
to update it. But it is an extra step that's not done automatically
with make install). 

> The canyonlands dts was binding to an external vendor driver. So it
> wasn't documented nor expected to work with dwc2 until your recent
> patch adding the compatible string.

Oh, no that's not what happend. Let me explain why there was no "external 
vendor driver": AMCC/APM were planing to upstream their hole platform. And
in fact, the devs tried very hard to include their driver back in 2011 [0].
But this driver was denied inclusion back then due to:

"[...]
I would also like to point out that the same Synopsys USB controller
is used in a number of other SoCs (especially ARM chips), and
supported by other drivers, some of these even in mainline.

See http://thread.gmane.org/gmane.linux.usb.general/61714/focus=62139
for a related thread.

Instead of trying to add a completely new driver to mainline (and one
which has been repeatedly been rejected), I vote for focusing on the
existing driver code that is already in mainline, and testing and
improving this so we can use a single implementation of this driver
code for all SoCs that use the same IP block." [1]

Of course: The listed link goes the "USB Host driver for i.MX28" driver.
And this is an ehci-hcd like driver... Which is as you are well aware not
that similar to the dwc2 OTG. And as far as I can tell: AMCC abandoned
the patch series right there. 

Note: AMCC did however succeed in pushing your employer's Synopsys
DesignWare SATA and DMA drivers to the kernel back then. And I'm happy
to report that both drivers are still around and working fine for the 460EX 
(sata_dwc_460ex.c[2] and the DW AHB DMA [3]). (The drivers also work for
different platforms than the original PPC. I know that because I helped
Andy Shevchenko with testing and pushing some fixes to it when he was
adding support for the Intel Quark SoC, which uses the DWC SATA and DMA).

So Please?
> Systems that use the vendor driver will still work with the dts. If
> you remove the vendor driver and configure it to use dwc2, it won't
> work due to a quirk of the canyonlands hardware, for which you need to
> add a dts property.
Sadly, there is no up to date vendor driver. The canyonlands.dts binding
is still in place and the hardware works fine. I'm interested in this
platform since it is a cheap BigEndian system which is useful for usb
driver development (carl9170 and rtl8192su)... and I would like to
have out-of-the-box support.

> I think this is reasonable. Rob or Mark, any feedback?
I recall that Rob has already voiced his opinion about the ahb-burst setting: 
"Also, perhaps you should allow that the compatible string can define the 
default."

And based on that, I made the "add a default ahb-burst setting for amcc,dwc-otg"
patch above. Of course, it would be nice to have any feedback too. But unless I
hear otherwise, I'll continue with posti

Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-21 Thread John Youn
On 11/21/2016 1:10 PM, Christian Lamparter wrote:
> Hello John,
> 
> On Monday, November 21, 2016 12:16:31 PM CET John Youn wrote:
>> On 11/18/2016 12:18 PM, Christian Lamparter wrote:
>>> On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
 On Thu, Nov 17, 2016 at 04:35:10PM +0100, Stefan Wahren wrote:
> Hi John,
>
> Am 17.11.2016 um 00:47 schrieb John Youn:
>> Add the "snps,ahb-burst" binding and read it in.
>>
>> This property controls which burst type to perform on the AHB bus as a
>> master in internal DMA mode. This overrides the legacy param value,
>> which we need to keep around for now since several platforms use it.
>>
>> Some platforms may see better or worse performance based on this
>> value. The HAPS platform is one example where all INCRx have worse
>> performance than INCR.
>>
>> Other platforms (such as the Canyonlands board) report that the default
>> value causes system hangs.
>>
>> Signed-off-by: John Youn 
>> Cc: Christian Lamparter 
>> ---
>>  Documentation/devicetree/bindings/usb/dwc2.txt |  2 +
>>  drivers/usb/dwc2/core.h|  9 +
>>  drivers/usb/dwc2/params.c  | 56 
>> ++
>>  3 files changed, 67 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
>> b/Documentation/devicetree/bindings/usb/dwc2.txt
>> index 6c7c2bce..9e7b4b4 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc2.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc2.txt
>
> according to Documentation/devicetree/bindings/submitting-patches.txt
> this change should be a separate patch.
>
>> @@ -26,6 +26,8 @@ Optional properties:
>>  Refer to phy/phy-bindings.txt for generic phy consumer properties
>>  - dr_mode: shall be one of "host", "peripheral" and "otg"
>>Refer to usb/generic.txt
>> +- snps,ahb-burst: specifies the ahb burst length. Valid arguments are:
>> +  "SINGLE", "INCR", "INCR4", "INCR8", "INCR16". Defaults to "INCR4".
>
> This doesn't apply in case of the bcm2835. I would prefer this option is
> ignored in that case with a dev_warn("snps,ahb-burst is not supported on
> this platform").

 Also, perhaps you should allow that the compatible string can define the 
 default.

>>> I hoped you would say that :).
>>>
>>> I've attached a patch (on top of John Youn changes) that does
>>> just that for the amcc,dwc-otg. I put the GAHBCFG_HBSTLEN_INCR
>>> value into the .data, if that's a problem, I can certainly 
>>> respin the patch and put it in a dedicated struct.
>>>
>>> Regards
>>>
>>> Christian
>>> ---
>>> From 4c31a029dde714828810b1c3e61a5b1412ac939a Mon Sep 17 00:00:00 2001
>>> From: Christian Lamparter 
>>> Date: Fri, 18 Nov 2016 21:03:19 +0100
>>> Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for amcc,dwc-otg
>>>
>>> This patch adds a of_device_id table which can be used by
>>> existing devices to supply a ahb-burst value for the platform
>>> without having to add a "snps,ahb-burst" entry to the dts.
>>>
>>> Note: Adding new devices to this table is discouraged.
>>>   please consider adding the "snps,ahb-burst" property
>>>   with the correct configuration to your device tree
>>>   file instead.
>>>
>>> Signed-off-by: Christian Lamparter 
>>> ---
>>>  drivers/usb/dwc2/params.c | 22 ++
>>>  1 file changed, 22 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
>>> index e0fc9aa..51be266 100644
>>> --- a/drivers/usb/dwc2/params.c
>>> +++ b/drivers/usb/dwc2/params.c
>>> @@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
>>> [GAHBCFG_HBSTLEN_INCR16]= "INCR16",
>>>  };
>>>  
>>> +/*
>>> + * This table provides AHB burst configuration for existing
>>> + * device tree bindings that work poorly with the default setting.
>>> + *
>>> + * Note: Adding new devices to this table is discouraged.
>>> + *  please consider adding the "snps,ahb-burst" property
>>> + *  with the correct configuration to your device tree
>>> + *  file instead.
>>> + */
>>> +static const struct of_device_id dwc2_compat_ahb_bursts[] = {
>>> +   {
>>> +   .compatible = "amcc,dwc-otg",
>>> +   .data = (void *) GAHBCFG_HBSTLEN_INCR16,
>>> +   },
>>> +};
>>> +
>>>  static int dwc2_get_property_ahb_burst(struct dwc2_hsotg *hsotg)
>>>  {
>>> struct device_node *node = hsotg->dev->of_node;
>>> @@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct 
>>> dwc2_hsotg *hsotg)
>>> ret = device_property_read_string(hsotg->dev,
>>>   "snps,ahb-burst", &str);
>>> if (ret < 0) {
>>> +   const struct of_device_id *match;
>>> +
>>> +   match = of_match_node(dwc2_compat_ahb_bursts, node);
>>> +   if (match)
>>> +   ret = (int)match->d

Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-21 Thread Christian Lamparter
Hello John,

On Monday, November 21, 2016 12:16:31 PM CET John Youn wrote:
> On 11/18/2016 12:18 PM, Christian Lamparter wrote:
> > On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
> >> On Thu, Nov 17, 2016 at 04:35:10PM +0100, Stefan Wahren wrote:
> >>> Hi John,
> >>>
> >>> Am 17.11.2016 um 00:47 schrieb John Youn:
>  Add the "snps,ahb-burst" binding and read it in.
> 
>  This property controls which burst type to perform on the AHB bus as a
>  master in internal DMA mode. This overrides the legacy param value,
>  which we need to keep around for now since several platforms use it.
> 
>  Some platforms may see better or worse performance based on this
>  value. The HAPS platform is one example where all INCRx have worse
>  performance than INCR.
> 
>  Other platforms (such as the Canyonlands board) report that the default
>  value causes system hangs.
> 
>  Signed-off-by: John Youn 
>  Cc: Christian Lamparter 
>  ---
>   Documentation/devicetree/bindings/usb/dwc2.txt |  2 +
>   drivers/usb/dwc2/core.h|  9 +
>   drivers/usb/dwc2/params.c  | 56 
>  ++
>   3 files changed, 67 insertions(+)
> 
>  diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
>  b/Documentation/devicetree/bindings/usb/dwc2.txt
>  index 6c7c2bce..9e7b4b4 100644
>  --- a/Documentation/devicetree/bindings/usb/dwc2.txt
>  +++ b/Documentation/devicetree/bindings/usb/dwc2.txt
> >>>
> >>> according to Documentation/devicetree/bindings/submitting-patches.txt
> >>> this change should be a separate patch.
> >>>
>  @@ -26,6 +26,8 @@ Optional properties:
>   Refer to phy/phy-bindings.txt for generic phy consumer properties
>   - dr_mode: shall be one of "host", "peripheral" and "otg"
> Refer to usb/generic.txt
>  +- snps,ahb-burst: specifies the ahb burst length. Valid arguments are:
>  +  "SINGLE", "INCR", "INCR4", "INCR8", "INCR16". Defaults to "INCR4".
> >>>
> >>> This doesn't apply in case of the bcm2835. I would prefer this option is
> >>> ignored in that case with a dev_warn("snps,ahb-burst is not supported on
> >>> this platform").
> >>
> >> Also, perhaps you should allow that the compatible string can define the 
> >> default.
> >>
> > I hoped you would say that :).
> > 
> > I've attached a patch (on top of John Youn changes) that does
> > just that for the amcc,dwc-otg. I put the GAHBCFG_HBSTLEN_INCR
> > value into the .data, if that's a problem, I can certainly 
> > respin the patch and put it in a dedicated struct.
> > 
> > Regards
> > 
> > Christian
> > ---
> > From 4c31a029dde714828810b1c3e61a5b1412ac939a Mon Sep 17 00:00:00 2001
> > From: Christian Lamparter 
> > Date: Fri, 18 Nov 2016 21:03:19 +0100
> > Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for amcc,dwc-otg
> > 
> > This patch adds a of_device_id table which can be used by
> > existing devices to supply a ahb-burst value for the platform
> > without having to add a "snps,ahb-burst" entry to the dts.
> > 
> > Note: Adding new devices to this table is discouraged.
> >   please consider adding the "snps,ahb-burst" property
> >   with the correct configuration to your device tree
> >   file instead.
> > 
> > Signed-off-by: Christian Lamparter 
> > ---
> >  drivers/usb/dwc2/params.c | 22 ++
> >  1 file changed, 22 insertions(+)
> > 
> > diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> > index e0fc9aa..51be266 100644
> > --- a/drivers/usb/dwc2/params.c
> > +++ b/drivers/usb/dwc2/params.c
> > @@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
> > [GAHBCFG_HBSTLEN_INCR16]= "INCR16",
> >  };
> >  
> > +/*
> > + * This table provides AHB burst configuration for existing
> > + * device tree bindings that work poorly with the default setting.
> > + *
> > + * Note: Adding new devices to this table is discouraged.
> > + *  please consider adding the "snps,ahb-burst" property
> > + *  with the correct configuration to your device tree
> > + *  file instead.
> > + */
> > +static const struct of_device_id dwc2_compat_ahb_bursts[] = {
> > +   {
> > +   .compatible = "amcc,dwc-otg",
> > +   .data = (void *) GAHBCFG_HBSTLEN_INCR16,
> > +   },
> > +};
> > +
> >  static int dwc2_get_property_ahb_burst(struct dwc2_hsotg *hsotg)
> >  {
> > struct device_node *node = hsotg->dev->of_node;
> > @@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct 
> > dwc2_hsotg *hsotg)
> > ret = device_property_read_string(hsotg->dev,
> >   "snps,ahb-burst", &str);
> > if (ret < 0) {
> > +   const struct of_device_id *match;
> > +
> > +   match = of_match_node(dwc2_compat_ahb_bursts, node);
> > +   if (match)
> > +   ret = (int)match->data;
> > +
> > return ret;
> > } e

Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-21 Thread John Youn
On 11/18/2016 12:18 PM, Christian Lamparter wrote:
> On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
>> On Thu, Nov 17, 2016 at 04:35:10PM +0100, Stefan Wahren wrote:
>>> Hi John,
>>>
>>> Am 17.11.2016 um 00:47 schrieb John Youn:
 Add the "snps,ahb-burst" binding and read it in.

 This property controls which burst type to perform on the AHB bus as a
 master in internal DMA mode. This overrides the legacy param value,
 which we need to keep around for now since several platforms use it.

 Some platforms may see better or worse performance based on this
 value. The HAPS platform is one example where all INCRx have worse
 performance than INCR.

 Other platforms (such as the Canyonlands board) report that the default
 value causes system hangs.

 Signed-off-by: John Youn 
 Cc: Christian Lamparter 
 ---
  Documentation/devicetree/bindings/usb/dwc2.txt |  2 +
  drivers/usb/dwc2/core.h|  9 +
  drivers/usb/dwc2/params.c  | 56 
 ++
  3 files changed, 67 insertions(+)

 diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
 b/Documentation/devicetree/bindings/usb/dwc2.txt
 index 6c7c2bce..9e7b4b4 100644
 --- a/Documentation/devicetree/bindings/usb/dwc2.txt
 +++ b/Documentation/devicetree/bindings/usb/dwc2.txt
>>>
>>> according to Documentation/devicetree/bindings/submitting-patches.txt
>>> this change should be a separate patch.
>>>
 @@ -26,6 +26,8 @@ Optional properties:
  Refer to phy/phy-bindings.txt for generic phy consumer properties
  - dr_mode: shall be one of "host", "peripheral" and "otg"
Refer to usb/generic.txt
 +- snps,ahb-burst: specifies the ahb burst length. Valid arguments are:
 +  "SINGLE", "INCR", "INCR4", "INCR8", "INCR16". Defaults to "INCR4".
>>>
>>> This doesn't apply in case of the bcm2835. I would prefer this option is
>>> ignored in that case with a dev_warn("snps,ahb-burst is not supported on
>>> this platform").
>>
>> Also, perhaps you should allow that the compatible string can define the 
>> default.
>>
> I hoped you would say that :).
> 
> I've attached a patch (on top of John Youn changes) that does
> just that for the amcc,dwc-otg. I put the GAHBCFG_HBSTLEN_INCR
> value into the .data, if that's a problem, I can certainly 
> respin the patch and put it in a dedicated struct.
> 
> Regards
> 
> Christian
> ---
> From 4c31a029dde714828810b1c3e61a5b1412ac939a Mon Sep 17 00:00:00 2001
> From: Christian Lamparter 
> Date: Fri, 18 Nov 2016 21:03:19 +0100
> Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for amcc,dwc-otg
> 
> This patch adds a of_device_id table which can be used by
> existing devices to supply a ahb-burst value for the platform
> without having to add a "snps,ahb-burst" entry to the dts.
> 
> Note: Adding new devices to this table is discouraged.
>   please consider adding the "snps,ahb-burst" property
>   with the correct configuration to your device tree
>   file instead.
> 
> Signed-off-by: Christian Lamparter 
> ---
>  drivers/usb/dwc2/params.c | 22 ++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> index e0fc9aa..51be266 100644
> --- a/drivers/usb/dwc2/params.c
> +++ b/drivers/usb/dwc2/params.c
> @@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
>   [GAHBCFG_HBSTLEN_INCR16]= "INCR16",
>  };
>  
> +/*
> + * This table provides AHB burst configuration for existing
> + * device tree bindings that work poorly with the default setting.
> + *
> + * Note: Adding new devices to this table is discouraged.
> + *please consider adding the "snps,ahb-burst" property
> + *with the correct configuration to your device tree
> + *file instead.
> + */
> +static const struct of_device_id dwc2_compat_ahb_bursts[] = {
> + {
> + .compatible = "amcc,dwc-otg",
> + .data = (void *) GAHBCFG_HBSTLEN_INCR16,
> + },
> +};
> +
>  static int dwc2_get_property_ahb_burst(struct dwc2_hsotg *hsotg)
>  {
>   struct device_node *node = hsotg->dev->of_node;
> @@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct 
> dwc2_hsotg *hsotg)
>   ret = device_property_read_string(hsotg->dev,
> "snps,ahb-burst", &str);
>   if (ret < 0) {
> + const struct of_device_id *match;
> +
> + match = of_match_node(dwc2_compat_ahb_bursts, node);
> + if (match)
> + ret = (int)match->data;
> +
>   return ret;
>   } else if (of_device_is_compatible(node, "brcm,bcm2835-usb")) {
>   dev_warn(hsotg->dev,
> 

Hi Christian,

I'd prefer if you use the binding which requires no extra code in
dwc2.

Regards,
John
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
th

Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-18 Thread Christian Lamparter
On Friday, November 18, 2016 8:16:08 AM CET Rob Herring wrote:
> On Thu, Nov 17, 2016 at 04:35:10PM +0100, Stefan Wahren wrote:
> > Hi John,
> > 
> > Am 17.11.2016 um 00:47 schrieb John Youn:
> > > Add the "snps,ahb-burst" binding and read it in.
> > >
> > > This property controls which burst type to perform on the AHB bus as a
> > > master in internal DMA mode. This overrides the legacy param value,
> > > which we need to keep around for now since several platforms use it.
> > >
> > > Some platforms may see better or worse performance based on this
> > > value. The HAPS platform is one example where all INCRx have worse
> > > performance than INCR.
> > >
> > > Other platforms (such as the Canyonlands board) report that the default
> > > value causes system hangs.
> > >
> > > Signed-off-by: John Youn 
> > > Cc: Christian Lamparter 
> > > ---
> > >  Documentation/devicetree/bindings/usb/dwc2.txt |  2 +
> > >  drivers/usb/dwc2/core.h|  9 +
> > >  drivers/usb/dwc2/params.c  | 56 
> > > ++
> > >  3 files changed, 67 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
> > > b/Documentation/devicetree/bindings/usb/dwc2.txt
> > > index 6c7c2bce..9e7b4b4 100644
> > > --- a/Documentation/devicetree/bindings/usb/dwc2.txt
> > > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt
> > 
> > according to Documentation/devicetree/bindings/submitting-patches.txt
> > this change should be a separate patch.
> > 
> > > @@ -26,6 +26,8 @@ Optional properties:
> > >  Refer to phy/phy-bindings.txt for generic phy consumer properties
> > >  - dr_mode: shall be one of "host", "peripheral" and "otg"
> > >Refer to usb/generic.txt
> > > +- snps,ahb-burst: specifies the ahb burst length. Valid arguments are:
> > > +  "SINGLE", "INCR", "INCR4", "INCR8", "INCR16". Defaults to "INCR4".
> > 
> > This doesn't apply in case of the bcm2835. I would prefer this option is
> > ignored in that case with a dev_warn("snps,ahb-burst is not supported on
> > this platform").
> 
> Also, perhaps you should allow that the compatible string can define the 
> default.
> 
I hoped you would say that :).

I've attached a patch (on top of John Youn changes) that does
just that for the amcc,dwc-otg. I put the GAHBCFG_HBSTLEN_INCR
value into the .data, if that's a problem, I can certainly 
respin the patch and put it in a dedicated struct.

Regards

Christian
---
>From 4c31a029dde714828810b1c3e61a5b1412ac939a Mon Sep 17 00:00:00 2001
From: Christian Lamparter 
Date: Fri, 18 Nov 2016 21:03:19 +0100
Subject: [PATCH] usb: dwc2: add a default ahb-burst setting for amcc,dwc-otg

This patch adds a of_device_id table which can be used by
existing devices to supply a ahb-burst value for the platform
without having to add a "snps,ahb-burst" entry to the dts.

Note: Adding new devices to this table is discouraged.
  please consider adding the "snps,ahb-burst" property
  with the correct configuration to your device tree
  file instead.

Signed-off-by: Christian Lamparter 
---
 drivers/usb/dwc2/params.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index e0fc9aa..51be266 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -1097,6 +1097,22 @@ static const char *const ahb_bursts[] = {
[GAHBCFG_HBSTLEN_INCR16]= "INCR16",
 };
 
+/*
+ * This table provides AHB burst configuration for existing
+ * device tree bindings that work poorly with the default setting.
+ *
+ * Note: Adding new devices to this table is discouraged.
+ *  please consider adding the "snps,ahb-burst" property
+ *  with the correct configuration to your device tree
+ *  file instead.
+ */
+static const struct of_device_id dwc2_compat_ahb_bursts[] = {
+   {
+   .compatible = "amcc,dwc-otg",
+   .data = (void *) GAHBCFG_HBSTLEN_INCR16,
+   },
+};
+
 static int dwc2_get_property_ahb_burst(struct dwc2_hsotg *hsotg)
 {
struct device_node *node = hsotg->dev->of_node;
@@ -1107,6 +1123,12 @@ static int dwc2_get_property_ahb_burst(struct dwc2_hsotg 
*hsotg)
ret = device_property_read_string(hsotg->dev,
  "snps,ahb-burst", &str);
if (ret < 0) {
+   const struct of_device_id *match;
+
+   match = of_match_node(dwc2_compat_ahb_bursts, node);
+   if (match)
+   ret = (int)match->data;
+
return ret;
} else if (of_device_is_compatible(node, "brcm,bcm2835-usb")) {
dev_warn(hsotg->dev,
-- 
2.10.2





--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-18 Thread Rob Herring
On Thu, Nov 17, 2016 at 04:35:10PM +0100, Stefan Wahren wrote:
> Hi John,
> 
> Am 17.11.2016 um 00:47 schrieb John Youn:
> > Add the "snps,ahb-burst" binding and read it in.
> >
> > This property controls which burst type to perform on the AHB bus as a
> > master in internal DMA mode. This overrides the legacy param value,
> > which we need to keep around for now since several platforms use it.
> >
> > Some platforms may see better or worse performance based on this
> > value. The HAPS platform is one example where all INCRx have worse
> > performance than INCR.
> >
> > Other platforms (such as the Canyonlands board) report that the default
> > value causes system hangs.
> >
> > Signed-off-by: John Youn 
> > Cc: Christian Lamparter 
> > ---
> >  Documentation/devicetree/bindings/usb/dwc2.txt |  2 +
> >  drivers/usb/dwc2/core.h|  9 +
> >  drivers/usb/dwc2/params.c  | 56 
> > ++
> >  3 files changed, 67 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
> > b/Documentation/devicetree/bindings/usb/dwc2.txt
> > index 6c7c2bce..9e7b4b4 100644
> > --- a/Documentation/devicetree/bindings/usb/dwc2.txt
> > +++ b/Documentation/devicetree/bindings/usb/dwc2.txt
> 
> according to Documentation/devicetree/bindings/submitting-patches.txt
> this change should be a separate patch.
> 
> > @@ -26,6 +26,8 @@ Optional properties:
> >  Refer to phy/phy-bindings.txt for generic phy consumer properties
> >  - dr_mode: shall be one of "host", "peripheral" and "otg"
> >Refer to usb/generic.txt
> > +- snps,ahb-burst: specifies the ahb burst length. Valid arguments are:
> > +  "SINGLE", "INCR", "INCR4", "INCR8", "INCR16". Defaults to "INCR4".
> 
> This doesn't apply in case of the bcm2835. I would prefer this option is
> ignored in that case with a dev_warn("snps,ahb-burst is not supported on
> this platform").

Also, perhaps you should allow that the compatible string can define the 
default.

Rob
--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-18 Thread Rob Herring
On Wed, Nov 16, 2016 at 03:47:18PM -0800, John Youn wrote:
> Add the "snps,ahb-burst" binding and read it in.
> 
> This property controls which burst type to perform on the AHB bus as a
> master in internal DMA mode. This overrides the legacy param value,
> which we need to keep around for now since several platforms use it.
> 
> Some platforms may see better or worse performance based on this
> value. The HAPS platform is one example where all INCRx have worse
> performance than INCR.
> 
> Other platforms (such as the Canyonlands board) report that the default
> value causes system hangs.
> 
> Signed-off-by: John Youn 
> Cc: Christian Lamparter 
> ---
>  Documentation/devicetree/bindings/usb/dwc2.txt |  2 +

Acked-by: Rob Herring 

>  drivers/usb/dwc2/core.h|  9 +
>  drivers/usb/dwc2/params.c  | 56 
> ++
>  3 files changed, 67 insertions(+)
--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-17 Thread John Youn
On 11/17/2016 3:28 AM, Felipe Balbi wrote:
> 
> Hi,
> 
> John Youn  writes:
>> Add the "snps,ahb-burst" binding and read it in.
>>
>> This property controls which burst type to perform on the AHB bus as a
>> master in internal DMA mode. This overrides the legacy param value,
>> which we need to keep around for now since several platforms use it.
>>
>> Some platforms may see better or worse performance based on this
>> value. The HAPS platform is one example where all INCRx have worse
>> performance than INCR.
>>
>> Other platforms (such as the Canyonlands board) report that the default
>> value causes system hangs.
>>
>> Signed-off-by: John Youn 
>> Cc: Christian Lamparter 
> 
> it's getting rather late for this merge window. I still need an ack by
> Rob or any of the devicetree folks.
> 

Sure, no problem if it doesn't make it.

Regards,
John

--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-17 Thread John Youn
On 11/17/2016 7:35 AM, Stefan Wahren wrote:
> Hi John,
> 
> Am 17.11.2016 um 00:47 schrieb John Youn:
>> Add the "snps,ahb-burst" binding and read it in.
>>
>> This property controls which burst type to perform on the AHB bus as a
>> master in internal DMA mode. This overrides the legacy param value,
>> which we need to keep around for now since several platforms use it.
>>
>> Some platforms may see better or worse performance based on this
>> value. The HAPS platform is one example where all INCRx have worse
>> performance than INCR.
>>
>> Other platforms (such as the Canyonlands board) report that the default
>> value causes system hangs.
>>
>> Signed-off-by: John Youn 
>> Cc: Christian Lamparter 
>> ---
>>  Documentation/devicetree/bindings/usb/dwc2.txt |  2 +
>>  drivers/usb/dwc2/core.h|  9 +
>>  drivers/usb/dwc2/params.c  | 56 
>> ++
>>  3 files changed, 67 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
>> b/Documentation/devicetree/bindings/usb/dwc2.txt
>> index 6c7c2bce..9e7b4b4 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc2.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc2.txt
> 
> according to Documentation/devicetree/bindings/submitting-patches.txt
> this change should be a separate patch.

Ok

> 
>> @@ -26,6 +26,8 @@ Optional properties:
>>  Refer to phy/phy-bindings.txt for generic phy consumer properties
>>  - dr_mode: shall be one of "host", "peripheral" and "otg"
>>Refer to usb/generic.txt
>> +- snps,ahb-burst: specifies the ahb burst length. Valid arguments are:
>> +  "SINGLE", "INCR", "INCR4", "INCR8", "INCR16". Defaults to "INCR4".
> 
> This doesn't apply in case of the bcm2835. I would prefer this option is
> ignored in that case with a dev_warn("snps,ahb-burst is not supported on
> this platform").

Sure I'll add this.

Regards,
John


--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-17 Thread Stefan Wahren
Hi John,

Am 17.11.2016 um 00:47 schrieb John Youn:
> Add the "snps,ahb-burst" binding and read it in.
>
> This property controls which burst type to perform on the AHB bus as a
> master in internal DMA mode. This overrides the legacy param value,
> which we need to keep around for now since several platforms use it.
>
> Some platforms may see better or worse performance based on this
> value. The HAPS platform is one example where all INCRx have worse
> performance than INCR.
>
> Other platforms (such as the Canyonlands board) report that the default
> value causes system hangs.
>
> Signed-off-by: John Youn 
> Cc: Christian Lamparter 
> ---
>  Documentation/devicetree/bindings/usb/dwc2.txt |  2 +
>  drivers/usb/dwc2/core.h|  9 +
>  drivers/usb/dwc2/params.c  | 56 
> ++
>  3 files changed, 67 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
> b/Documentation/devicetree/bindings/usb/dwc2.txt
> index 6c7c2bce..9e7b4b4 100644
> --- a/Documentation/devicetree/bindings/usb/dwc2.txt
> +++ b/Documentation/devicetree/bindings/usb/dwc2.txt

according to Documentation/devicetree/bindings/submitting-patches.txt
this change should be a separate patch.

> @@ -26,6 +26,8 @@ Optional properties:
>  Refer to phy/phy-bindings.txt for generic phy consumer properties
>  - dr_mode: shall be one of "host", "peripheral" and "otg"
>Refer to usb/generic.txt
> +- snps,ahb-burst: specifies the ahb burst length. Valid arguments are:
> +  "SINGLE", "INCR", "INCR4", "INCR8", "INCR16". Defaults to "INCR4".

This doesn't apply in case of the bcm2835. I would prefer this option is
ignored in that case with a dev_warn("snps,ahb-burst is not supported on
this platform").

Stefan
--
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


Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst

2016-11-17 Thread Felipe Balbi

Hi,

John Youn  writes:
> Add the "snps,ahb-burst" binding and read it in.
>
> This property controls which burst type to perform on the AHB bus as a
> master in internal DMA mode. This overrides the legacy param value,
> which we need to keep around for now since several platforms use it.
>
> Some platforms may see better or worse performance based on this
> value. The HAPS platform is one example where all INCRx have worse
> performance than INCR.
>
> Other platforms (such as the Canyonlands board) report that the default
> value causes system hangs.
>
> Signed-off-by: John Youn 
> Cc: Christian Lamparter 

it's getting rather late for this merge window. I still need an ack by
Rob or any of the devicetree folks.

-- 
balbi


signature.asc
Description: PGP signature