Re: octeon-usb and dwc2 in staging are for the same hw

2013-08-19 Thread Sebastian Andrzej Siewior
On 08/17/2013 10:44 PM, Paul Zimmerman wrote:
 Hi Greg, all,
 
 After taking a look at the Octeon driver, it looks like that controller
 uses a customized version of the DWC2 core - it has a different DMA
 engine than the one provided by the standard hardware. So in fact these
 two drivers are actually not for the same hw.

Is it just the DMA engine? musb provides support for more than one DMA
engine. Plus you may still be able to hide the dma engine behind
drivers/dma

 
 I think it would be very complicated to combine both of these into a
 common driver. So in my opinion the best solution is to keep both drivers.
 

Sebastian

--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-18 Thread Aaro Koskinen
Hi,

On Sat, Aug 17, 2013 at 08:44:18PM +, Paul Zimmerman wrote:
  It doesn't get very far:
  
  External DMA Mode not supported
  dwc2_hcd_init() FAILED, returning -22
 
 Hi Greg, all,
 
 After taking a look at the Octeon driver, it looks like that controller
 uses a customized version of the DWC2 core - it has a different DMA
 engine than the one provided by the standard hardware. So in fact these
 two drivers are actually not for the same hw.

FWIW, I also tried forcing the DWC2 to non-DMA/FIFO mode, but could
not get that working either. Do you support any HW running in slave
mode? It seems the RX direction fails. I noticed the dwc2_read_packet()
is hard-coded to channel 0 which looks odd, but changing that didn't
change anything.

A.
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-18 Thread Paul Zimmerman
 From: Aaro Koskinen [mailto:aaro.koski...@iki.fi]
 Sent: Sunday, August 18, 2013 4:41 AM
 
 On Sat, Aug 17, 2013 at 08:44:18PM +, Paul Zimmerman wrote:
   It doesn't get very far:
  
 External DMA Mode not supported
 dwc2_hcd_init() FAILED, returning -22
 
  Hi Greg, all,
 
  After taking a look at the Octeon driver, it looks like that controller
  uses a customized version of the DWC2 core - it has a different DMA
  engine than the one provided by the standard hardware. So in fact these
  two drivers are actually not for the same hw.
 
 FWIW, I also tried forcing the DWC2 to non-DMA/FIFO mode, but could
 not get that working either. Do you support any HW running in slave
 mode? It seems the RX direction fails. I noticed the dwc2_read_packet()
 is hard-coded to channel 0 which looks odd, but changing that didn't
 change anything.

I have tested FIFO mode on x86 only. It looks like there may be a problem
with unaligned RX transfers on archs like ARM that have strict alignment
requirements. See this comment in dwc2_read_packet():

* Todo: Account for the case where dest is not dword aligned.

Hard-coding to FIFO 0 is correct for RX, since there is only one RX FIFO.

-- 
Paul

--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-17 Thread Sebastian Andrzej Siewior
On 08/17/2013 01:18 AM, Aaro Koskinen wrote:
 Looking more into this (and after a failed testing attempt), I don't think
 we can simply delete octeon-usb if we want to keep supporting Octeon:
 there's also Octeon-specific registers of which the driver needs to
 take care of before/while using DWC2 HW block. So migration to DWC2 is
 not simply a driver change, we would still need some kind of octeon-hcd
 glue for for it. I guess we should start converting octeon-usb to reuse
 code from DWC2, but this won't happen overnight.

If you look at musb / dwc3 they both have glue code around the USB IP
core.

Sebastian
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-17 Thread Aaro Koskinen
On Fri, Aug 16, 2013 at 08:02:27PM -0700, Greg KH wrote:
 dcw2 already supports different boards/systems, so perhaps there's a way
 to tie your board into that?

It doesn't get very far:

External DMA Mode not supported
dwc2_hcd_init() FAILED, returning -22

A.
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-17 Thread Paul Zimmerman
 From: Aaro Koskinen [mailto:aaro.koski...@iki.fi]
 Sent: Saturday, August 17, 2013 8:39 AM
 
 On Fri, Aug 16, 2013 at 08:02:27PM -0700, Greg KH wrote:
  dcw2 already supports different boards/systems, so perhaps there's a way
  to tie your board into that?
 
 It doesn't get very far:
 
   External DMA Mode not supported
   dwc2_hcd_init() FAILED, returning -22

Hi Greg, all,

After taking a look at the Octeon driver, it looks like that controller
uses a customized version of the DWC2 core - it has a different DMA
engine than the one provided by the standard hardware. So in fact these
two drivers are actually not for the same hw.

I think it would be very complicated to combine both of these into a
common driver. So in my opinion the best solution is to keep both drivers.

-- 
Paul

--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-17 Thread Greg KH
On Sat, Aug 17, 2013 at 08:44:18PM +, Paul Zimmerman wrote:
  From: Aaro Koskinen [mailto:aaro.koski...@iki.fi]
  Sent: Saturday, August 17, 2013 8:39 AM
  
  On Fri, Aug 16, 2013 at 08:02:27PM -0700, Greg KH wrote:
   dcw2 already supports different boards/systems, so perhaps there's a way
   to tie your board into that?
  
  It doesn't get very far:
  
  External DMA Mode not supported
  dwc2_hcd_init() FAILED, returning -22
 
 Hi Greg, all,
 
 After taking a look at the Octeon driver, it looks like that controller
 uses a customized version of the DWC2 core - it has a different DMA
 engine than the one provided by the standard hardware. So in fact these
 two drivers are actually not for the same hw.
 
 I think it would be very complicated to combine both of these into a
 common driver. So in my opinion the best solution is to keep both drivers.

Ok, thanks for taking the time to look at it.  I guess we will end up
with multiple drivers, making it easier for the developers involved :)

thanks,

greg k-h
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Greg KH
Hi Aaro and Paul,

It was just pointed out to me by Sebastian that it looks like both the
octeon-usb and dwc2 drivers in drivers/staging/ are for the same exact
hardware core.

Were you two aware of this?

As the dwc2 code seems to be the more mature codebase, any objection
to me deleting the octeon-usb driver?

Aaro, as there is no MODULE_DEVICE_TABLE() set up for the octeon-usb
code, and your module_init() function where you grab the hardware is,
let's just say, odd[1], it's really hard to determine what hardware
platforms this code even runs on.  Any hints?

thanks,

greg k-h

[1] A raw driver_register call?  Are you crazy[2]?  Yeah, I see a
_few_ other drivers doing that in the kernel tree, but now that I've
noticed this, I'm going to go yell at all of those authors as
well...

[2] I don't think you have tested to see what happens if you load this
driver on a system _without_ the hardware in it, right?
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Aaro Koskinen
Hi,

On Fri, Aug 16, 2013 at 06:01:50AM -0700, Greg KH wrote:
 It was just pointed out to me by Sebastian that it looks like both the
 octeon-usb and dwc2 drivers in drivers/staging/ are for the same exact
 hardware core.
 
 Were you two aware of this?

It was mentioned here:

http://marc.info/?l=linux-driver-develm=13702805213w=2

At the time, I thought octeon-usb was more mature: octeon-hcd was
written because we couldn't figure out how to fix the dwc2 driver so
that it wouldn't crash.

 As the dwc2 code seems to be the more mature codebase, any objection
 to me deleting the octeon-usb driver?

If it's possible to get it working on Octeon HW, then having a single
driver is of course the best solution. Is dwc2 fully functional (there
is no TODO file)? I'll check if I get it working, otherwise I'll be
disappointed if octeon-usb is deleted and I need to carry an out-of-tree
driver to use my board. :-)

 Aaro, as there is no MODULE_DEVICE_TABLE() set up for the octeon-usb
 code, and your module_init() function where you grab the hardware is,
 let's just say, odd[1], it's really hard to determine what hardware
 platforms this code even runs on.  Any hints?

The driver is only buildable for OCTEON SoC, and the function
cvmx_usb_get_num_ports() knows each SoC version if they have the USB
block or not.

A.
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Greg KH
On Fri, Aug 16, 2013 at 08:33:10PM +0300, Aaro Koskinen wrote:
 Hi,
 
 On Fri, Aug 16, 2013 at 06:01:50AM -0700, Greg KH wrote:
  It was just pointed out to me by Sebastian that it looks like both the
  octeon-usb and dwc2 drivers in drivers/staging/ are for the same exact
  hardware core.
  
  Were you two aware of this?
 
 It was mentioned here:
 
   http://marc.info/?l=linux-driver-develm=13702805213w=2
 
 At the time, I thought octeon-usb was more mature: octeon-hcd was
 written because we couldn't figure out how to fix the dwc2 driver so
 that it wouldn't crash.

Since then, dwc2 has gotten a lot of work, it should be much better now,
if not, please let us know, as it does support more devices than
octeon-usb does.  Well, I think so, given that I can't tell which
hardware octeon-usb supports right now :(

  As the dwc2 code seems to be the more mature codebase, any objection
  to me deleting the octeon-usb driver?
 
 If it's possible to get it working on Octeon HW, then having a single
 driver is of course the best solution. Is dwc2 fully functional (there
 is no TODO file)? I'll check if I get it working, otherwise I'll be
 disappointed if octeon-usb is deleted and I need to carry an out-of-tree
 driver to use my board. :-)

I agree, that wouldn't be good, making it so that this works for your
hardware is the best.

  Aaro, as there is no MODULE_DEVICE_TABLE() set up for the octeon-usb
  code, and your module_init() function where you grab the hardware is,
  let's just say, odd[1], it's really hard to determine what hardware
  platforms this code even runs on.  Any hints?
 
 The driver is only buildable for OCTEON SoC, and the function
 cvmx_usb_get_num_ports() knows each SoC version if they have the USB
 block or not.

That seems odd.  Why not just use the normal driver probing logic that
the rest of the kernel uses?

thanks,

greg k-h
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Paul Zimmerman
 From: Aaro Koskinen [mailto:aaro.koski...@iki.fi]
 Sent: Friday, August 16, 2013 10:33 AM
 
 On Fri, Aug 16, 2013 at 06:01:50AM -0700, Greg KH wrote:
  It was just pointed out to me by Sebastian that it looks like both the
  octeon-usb and dwc2 drivers in drivers/staging/ are for the same exact
  hardware core.
 
  Were you two aware of this?
 
 It was mentioned here:
 
   http://marc.info/?l=linux-driver-develm=13702805213w=2
 
 At the time, I thought octeon-usb was more mature: octeon-hcd was
 written because we couldn't figure out how to fix the dwc2 driver so
 that it wouldn't crash.
 
  As the dwc2 code seems to be the more mature codebase, any objection
  to me deleting the octeon-usb driver?
 
 If it's possible to get it working on Octeon HW, then having a single
 driver is of course the best solution. Is dwc2 fully functional (there
 is no TODO file)? I'll check if I get it working, otherwise I'll be
 disappointed if octeon-usb is deleted and I need to carry an out-of-tree
 driver to use my board. :-)
 
  Aaro, as there is no MODULE_DEVICE_TABLE() set up for the octeon-usb
  code, and your module_init() function where you grab the hardware is,
  let's just say, odd[1], it's really hard to determine what hardware
  platforms this code even runs on.  Any hints?
 
 The driver is only buildable for OCTEON SoC, and the function
 cvmx_usb_get_num_ports() knows each SoC version if they have the USB
 block or not.

I was not aware of it. I wonder why there were no emails to me or to the
linux-usb list from people who were having trouble getting the dwc2 driver
to work on Octeon? If there were any, I didn't see them.

Probably I should have a look at the Octeon driver and see if there are
any good ideas that can be borrowed for the dwc2 driver. I'm intrigued
by the email saying it generates many fewer interrupts than dwc2 does, I
would like to see how they accomplish that.

To answer Aaro's questions, I have not seen or heard of any crashes with
the dwc2 driver with the latest version. I think the driver is fully
functional in that it handles all types of USB devices that I have tried
with it. There are still some problems with it on the Raspberry Pi
platform, but those are being worked on.

Aaro, I would ask you the same question. Is the Octeon driver fully
functional? Are there any shortcomings with it that you know about?

I guess a TODO list for dwc2 would be a good idea, I'll work on that.

-- 
Paul

--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Aaro Koskinen
On Fri, Aug 16, 2013 at 08:51:57PM +, Paul Zimmerman wrote:
  From: Aaro Koskinen [mailto:aaro.koski...@iki.fi]
  Sent: Friday, August 16, 2013 1:45 PM
  
  On Fri, Aug 16, 2013 at 06:35:10PM +, Paul Zimmerman wrote:
   Aaro, I would ask you the same question. Is the Octeon driver fully
   functional? Are there any shortcomings with it that you know about?
  
  I sent this driver when mainlining the support for EdgeRouter Lite
  (http://www.ubnt.com/edgemax), and at the time I thought it was purely
  Octeon specific HCD driver (the source code does not give much hits
  about the actual HW block, and the vendor's GPL tar ball is my only
  documentation). On that hardware it works well - I have run stress tests
  with duration of couple of days with the mainline kernel and never
  seen any stability or any other issues. But if you consider it as a
  general purpose DWC2 driver it's probably a pile of crap, as it's full
  Octeon-specific hacks and assumptions.
 
 Thanks for the info.
 
 What sort of devices have you tested it with? Keyboards and mice?
 Webcams? Speakers? Hubs? Multiple levels of hubs?

I only use it for mass storage (the disk/rootfs on EdgeRouter Lite is
behind the USB). So the stress test mentioned above was for disk I/O,
sorry for not being more specific. I have only briefly tested it with
keyboard  disk behind a hub.

A.
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Aaro Koskinen
Hi,

On Fri, Aug 16, 2013 at 06:35:10PM +, Paul Zimmerman wrote:
 Aaro, I would ask you the same question. Is the Octeon driver fully
 functional? Are there any shortcomings with it that you know about?

I sent this driver when mainlining the support for EdgeRouter Lite
(http://www.ubnt.com/edgemax), and at the time I thought it was purely
Octeon specific HCD driver (the source code does not give much hits
about the actual HW block, and the vendor's GPL tar ball is my only
documentation). On that hardware it works well - I have run stress tests
with duration of couple of days with the mainline kernel and never
seen any stability or any other issues. But if you consider it as a
general purpose DWC2 driver it's probably a pile of crap, as it's full
Octeon-specific hacks and assumptions.

A.
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread David Daney

On 08/16/2013 02:07 PM, Aaro Koskinen wrote:

On Fri, Aug 16, 2013 at 08:51:57PM +, Paul Zimmerman wrote:

From: Aaro Koskinen [mailto:aaro.koski...@iki.fi]
Sent: Friday, August 16, 2013 1:45 PM

On Fri, Aug 16, 2013 at 06:35:10PM +, Paul Zimmerman wrote:

Aaro, I would ask you the same question. Is the Octeon driver fully
functional? Are there any shortcomings with it that you know about?


I sent this driver when mainlining the support for EdgeRouter Lite
(http://www.ubnt.com/edgemax), and at the time I thought it was purely
Octeon specific HCD driver (the source code does not give much hits
about the actual HW block, and the vendor's GPL tar ball is my only
documentation). On that hardware it works well - I have run stress tests
with duration of couple of days with the mainline kernel and never
seen any stability or any other issues. But if you consider it as a
general purpose DWC2 driver it's probably a pile of crap, as it's full
Octeon-specific hacks and assumptions.



octeon-usb doesn't support device mode operation, only host mode.

As far as host mode operation is concerned, I know of no deficiencies.

If all the problems RaspberryPi users have had with the DWC2 driver have 
been fixed, I have no problem with making OCTEON work with that driver. 
 Otherwise, to say that octeon-usb has shortcomings is a bit disingenuous.


I haven't been following DWC2 driver development, so I don't really know 
its current status.


David Daney


--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Aaro Koskinen
Hi,

On Fri, Aug 16, 2013 at 10:39:39AM -0700, Greg KH wrote:
   As the dwc2 code seems to be the more mature codebase, any objection
   to me deleting the octeon-usb driver?
  
  If it's possible to get it working on Octeon HW, then having a single
  driver is of course the best solution. Is dwc2 fully functional (there
  is no TODO file)? I'll check if I get it working, otherwise I'll be
  disappointed if octeon-usb is deleted and I need to carry an out-of-tree
  driver to use my board. :-)
 
 I agree, that wouldn't be good, making it so that this works for your
 hardware is the best.

Looking more into this (and after a failed testing attempt), I don't think
we can simply delete octeon-usb if we want to keep supporting Octeon:
there's also Octeon-specific registers of which the driver needs to
take care of before/while using DWC2 HW block. So migration to DWC2 is
not simply a driver change, we would still need some kind of octeon-hcd
glue for for it. I guess we should start converting octeon-usb to reuse
code from DWC2, but this won't happen overnight.

(BTW, there maybe be also bits DWC2 could steal from octeon-usb,
e.g. documentation - compare e.g. what's being said about GINTSTS or
other regs.)

  The driver is only buildable for OCTEON SoC, and the function
  cvmx_usb_get_num_ports() knows each SoC version if they have the USB
  block or not.
 
 That seems odd.  Why not just use the normal driver probing logic that
 the rest of the kernel uses?

Yes, this driver is in staging because of multiple odd things, and I
am/was trying to fix them. Please accept I'm not the original author or
designer of this driver.

A.
--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Paul Zimmerman
 From: Aaro Koskinen [mailto:aaro.koski...@iki.fi]
 Sent: Friday, August 16, 2013 1:45 PM
 
 On Fri, Aug 16, 2013 at 06:35:10PM +, Paul Zimmerman wrote:
  Aaro, I would ask you the same question. Is the Octeon driver fully
  functional? Are there any shortcomings with it that you know about?
 
 I sent this driver when mainlining the support for EdgeRouter Lite
 (http://www.ubnt.com/edgemax), and at the time I thought it was purely
 Octeon specific HCD driver (the source code does not give much hits
 about the actual HW block, and the vendor's GPL tar ball is my only
 documentation). On that hardware it works well - I have run stress tests
 with duration of couple of days with the mainline kernel and never
 seen any stability or any other issues. But if you consider it as a
 general purpose DWC2 driver it's probably a pile of crap, as it's full
 Octeon-specific hacks and assumptions.

Thanks for the info.

What sort of devices have you tested it with? Keyboards and mice?
Webcams? Speakers? Hubs? Multiple levels of hubs?

-- 
Paul

--
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: octeon-usb and dwc2 in staging are for the same hw

2013-08-16 Thread Greg KH
On Sat, Aug 17, 2013 at 02:18:27AM +0300, Aaro Koskinen wrote:
 Hi,
 
 On Fri, Aug 16, 2013 at 10:39:39AM -0700, Greg KH wrote:
As the dwc2 code seems to be the more mature codebase, any objection
to me deleting the octeon-usb driver?
   
   If it's possible to get it working on Octeon HW, then having a single
   driver is of course the best solution. Is dwc2 fully functional (there
   is no TODO file)? I'll check if I get it working, otherwise I'll be
   disappointed if octeon-usb is deleted and I need to carry an out-of-tree
   driver to use my board. :-)
  
  I agree, that wouldn't be good, making it so that this works for your
  hardware is the best.
 
 Looking more into this (and after a failed testing attempt), I don't think
 we can simply delete octeon-usb if we want to keep supporting Octeon:
 there's also Octeon-specific registers of which the driver needs to
 take care of before/while using DWC2 HW block. So migration to DWC2 is
 not simply a driver change, we would still need some kind of octeon-hcd
 glue for for it. I guess we should start converting octeon-usb to reuse
 code from DWC2, but this won't happen overnight.

dcw2 already supports different boards/systems, so perhaps there's a way
to tie your board into that?

As a matter of course, I can't merge this driver into the main part of
the tree if it's really the same core as dwc2, as we don't allow that to
happen anymore (we did in the past and it got really messy.)

 (BTW, there maybe be also bits DWC2 could steal from octeon-usb,
 e.g. documentation - compare e.g. what's being said about GINTSTS or
 other regs.)

That would be good to see happen.

   The driver is only buildable for OCTEON SoC, and the function
   cvmx_usb_get_num_ports() knows each SoC version if they have the USB
   block or not.
  
  That seems odd.  Why not just use the normal driver probing logic that
  the rest of the kernel uses?
 
 Yes, this driver is in staging because of multiple odd things, and I
 am/was trying to fix them. Please accept I'm not the original author or
 designer of this driver.

I understand, it wasn't ment personally, just complaining about the code :)

thanks,

greg k-h
--
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