Re: MAX3421E Linux driver?

2014-04-22 Thread Greg KH
On Tue, Apr 22, 2014 at 11:10:50PM +, Dan wrote:
> Hi,
> 
> I know this discussion is about MAX3421E Linux driver but I wanted a similar 
> functionality as this post is about, so thought would be better I post here.
> First of I am no expert with either USB or SPI. Have a need to implement 
> something like shown below.
> 
> USB Connector <--USB2.0--> USB Host Controller <--SPI--> Micro-processor
> (something similar in functionality to the diagram shown in the page:
> http://www.maximintegrated.com/datasheet/index.mvp/id/3639)
> 
> Don't have USB support on the micro-processor, so have to go the round-about 
> way. MAX3421E as mentioned in this post would fit what I need but doesn't 
> have the linux driver support. 
> 
> I need a USB Host controller with a driver compatible with linux kernel 
> version 2.6.28.

You do realize just how old and obsolete that kernel version is, right?
No one in the community can do anything with that kernel.  I suggest you
work with the company that is forcing you to stay back in the
stone-ages, sorry.

Best of luck,

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: MAX3421E Linux driver?

2014-04-22 Thread Dan
Hi,

I know this discussion is about MAX3421E Linux driver but I wanted a similar 
functionality as this post is about, so thought would be better I post here.
First of I am no expert with either USB or SPI. Have a need to implement 
something like shown below.

USB Connector <--USB2.0--> USB Host Controller <--SPI--> Micro-processor
(something similar in functionality to the diagram shown in the page:
http://www.maximintegrated.com/datasheet/index.mvp/id/3639)

Don't have USB support on the micro-processor, so have to go the round-about 
way. MAX3421E as mentioned in this post would fit what I need but doesn't 
have the linux driver support. 

I need a USB Host controller with a driver compatible with linux kernel 
version 2.6.28. It would be great if anyone could suggest a controller for 
this purpose. It would be better if its almost like a plug and play. (I went 
through the data sheet for Cypress CY7C67300. Looks like its going to be too 
complex in implementation for my needs).

With Regards,
Dan

--
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: MAX3421E Linux driver?

2014-03-06 Thread David Mosberger
On Mon, Mar 3, 2014 at 2:40 PM, Daniel Mack  wrote:

> 1. Your patch has a large number of style issues, which
> scripts/checkpatch.pl will tell you more about.

Sure, I"m not really at a point of worrying about style, but that's
easy enough to change.

> 2. Is there any good reason for not using the regmap abstraction
> framework for the SPI layer? It has convenience functions for bit
> fiddling, a register cache and a nice debugging interface through
> debugfs, among other things. See include/linux/regmap.h.

I have looked at it only briefly but my impression is that it'd add a
lot of complexity and generality that is unnecessary for this case.
If somebody wanted to cook up a patch to show what it would look like
with regmap, I'd certainly be happy to look at it, though.

> Also, out of curiosity: which SPI master controller are you using in
> your setup? Is the whole thing actually fast enough for real-world
> applications? Which data rates are you able to get through on
> mass-storage devices for instance?

Yes, it's fast enough.  We just need >1Mbps at a reasonable CPU
utilization and that's what we're getting even now (no attempt to
optimize).

  --david
-- 
eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.976
--
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: MAX3421E Linux driver?

2014-03-03 Thread Daniel Mack
On 03/01/2014 07:53 AM, David Mosberger wrote:
> Attached is v0.1 of the max3421 driver.  This one actually is trying to do
> (mostly) the right things.  It's event-driven (no busy-waiting anymore).
> 
> The URB-scheduling implemented in max3421_next_ep() is still simplistic: it
> runs all periodic transfers, then runs non-periodic transfers until there
> is no more (useful) work to do or the next frame starts.
> 
> With this version of the driver:
> 
>1. A USB-keyboard seems to work reliably (as per evtest anyhow).
>2. Several USB mass-storage devices get recognized correctly.  There are
>still some issues with reliably writing data, though.
>3. Some WIFI dongles are starting to work.
> 
> I'd be very interested in getting feedback on this driver as this is the
> first time I tried my hands at a USB host-controller driver.

Without going too much into detail wrt the actual implementation, here
are two things that caught my eye:

1. Your patch has a large number of style issues, which
scripts/checkpatch.pl will tell you more about.

2. Is there any good reason for not using the regmap abstraction
framework for the SPI layer? It has convenience functions for bit
fiddling, a register cache and a nice debugging interface through
debugfs, among other things. See include/linux/regmap.h.


Also, out of curiosity: which SPI master controller are you using in
your setup? Is the whole thing actually fast enough for real-world
applications? Which data rates are you able to get through on
mass-storage devices for instance?


Thanks,
Daniel


--
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: MAX3421E Linux driver?

2014-03-03 Thread David Mosberger
On Sun, Mar 2, 2014 at 10:04 AM, Peter Stuge  wrote:
>
> David Mosberger wrote:
> > +++ b/drivers/usb/host/Kconfig
> > @@ -4,6 +4,16 @@
> >  comment "USB Host Controller Drivers"
> >   depends on USB
> >
> > +config USB_MAX3421_HCD
> > +   tristate "MAX3421 HCD (USB-over-SPI) support"
> > +   depends on USB
> > +   help
> > + The Maxim MAX3421E Host Controller Interface supports
> > +  standard USB 1.1 high-speed hardware.
>
> I'd suggest "supports USB 2.0-compliant full-speed devices" instead.

Yeah, that comment was old and wrong.  I fixed that per your suggestion, thanks.

> And before you assume that high-speed devices (flash drives, wlan, etc)
> don't work correctly because of something your driver does I would
> strongly recommend to perform the same tests using another full-speed
> HC, e.g. by using uhci_hcd as the only hcd, disabling ehci_hcd, on
> EHCI hardware.
>
> I've seen high-speed-capable devices work quite poorly at full-speed;
> who cares about correctness when there is performance?

At first, we had problems recognizing high-speed devices, but that
must have been a silly bug since it got fixed without me even trying.
Certainly there can be cases where high-speed devices wouldn't work
properly at full speed, but I don't think I'm ready to blame the
devices over my driver just yet.  I may change my mind on this, of
course. ;-)

  --david

-- 
eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768
--
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: MAX3421E Linux driver?

2014-03-02 Thread Peter Stuge
David Mosberger wrote:
> +++ b/drivers/usb/host/Kconfig
> @@ -4,6 +4,16 @@
>  comment "USB Host Controller Drivers"
>   depends on USB
>  
> +config USB_MAX3421_HCD
> +   tristate "MAX3421 HCD (USB-over-SPI) support"
> +   depends on USB
> +   help
> + The Maxim MAX3421E Host Controller Interface supports
> +  standard USB 1.1 high-speed hardware.

I'd suggest "supports USB 2.0-compliant full-speed devices" instead.

And before you assume that high-speed devices (flash drives, wlan, etc)
don't work correctly because of something your driver does I would
strongly recommend to perform the same tests using another full-speed
HC, e.g. by using uhci_hcd as the only hcd, disabling ehci_hcd, on
EHCI hardware.

I've seen high-speed-capable devices work quite poorly at full-speed;
who cares about correctness when there is performance?


//Peter
--
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: MAX3421E Linux driver?

2014-02-12 Thread David Mosberger
Well, here is a quick-and-dirty proof-of-concept.  Warning: it's ugly
and you might go blind.  Having said that, the code works well enough
to detect
all USB devices I tried and HID devices as well as USB mass storage
seem to work fine.

I'm not terribly familiar with the details of USB and/or the Linux kernel's
USB implementation so the driver is probably doing a couple of really dumb
things.  I marked a couple of places with "XXX" where I'm particularly
interested in feedback.

Also, one thing that seems tricky is NAK-handling: some of the devices we
tested with have large receive buffers and they end up returning NAK for a
long time.  So the strategy as implemented is to allow up to 4 NAKs and
after that, it sleeps for 1ms for each NAK.  I'm not sure how fancier
OHCDs handle such cases.

  --david

On Thu, Jan 30, 2014 at 5:48 PM, Felipe Balbi  wrote:
> Hi,
>
> On Thu, Jan 30, 2014 at 05:34:59PM -0700, David Mosberger wrote:
>> We have a need to graft a USB Host controller onto a SPI bus (never
>> mind the wisdom of doing that, we have little
>> choice in this particular instance).
>>
>> The Cypress CY7C67300 would fit the bill and has a Linux driver, but
>> is probably too complex and definitely
>> too expensive for our needs.
>>
>> The Maxim MAX3421E is the other option, but it has no Linux driver.
>> The chip basically implements OHCI over SPI
>> rather than PCI.  Anybody know of any particular reason why there is
>> no Linux driver?  Has anyone already written or
>> attempted to write an OHCI-over-SPI driver for MAX3421E?
>
> I don't think anybody has attempted it. If you wanna do it, we're happy
> to review the driver.
>
> cheers
>
> --
> balbi



-- 
eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index f5ed3d7..2e270cc 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_USB_DWC3)+= dwc3/
 obj-$(CONFIG_USB_MON)  += mon/
 
 obj-$(CONFIG_PCI)  += host/
+obj-$(CONFIG_USB_MAX3421_HCD)  += host/
 obj-$(CONFIG_USB_EHCI_HCD) += host/
 obj-$(CONFIG_USB_ISP116X_HCD)  += host/
 obj-$(CONFIG_USB_OHCI_HCD) += host/
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d6bb128..5b226de 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -4,6 +4,16 @@
 comment "USB Host Controller Drivers"
depends on USB
 
+config USB_MAX3421_HCD
+   tristate "MAX3421 HCD (USB-over-SPI) support"
+   depends on USB
+   help
+ The Maxim MAX3421E Host Controller Interface supports
+standard USB 1.1 high-speed hardware.
+
+ To compile this driver as a module, choose M here: the module will
+be called max3421.
+
 config USB_C67X00_HCD
tristate "Cypress C67x00 HCD support"
depends on USB
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 1eb4c30..1dfb836 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -23,6 +23,8 @@ obj-$(CONFIG_USB_WHCI_HCD)+= whci/
 
 obj-$(CONFIG_PCI)  += pci-quirks.o
 
+obj-$(CONFIG_USB_MAX3421_HCD)  += max3421.o
+
 obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
 obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
 obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)+= ehci-platform.o
diff --git a/drivers/usb/host/max3421.c b/drivers/usb/host/max3421.c
new file mode 100644
index 000..61df0e6
--- /dev/null
+++ b/drivers/usb/host/max3421.c
@@ -0,0 +1,1406 @@
+/*
+ * MAX3421 Host Controller driver for USB.
+ *
+ * Maintainer: David Mosberger-Tang 
+ *
+ * (C) Copyright 2014 David Mosberger-Tang 
+ *
+ * MAX3421 is a chip implementing a USB 2.0 Full-/Low-Speed host
+ * controller on a SPI bus.
+ *
+ * Based on:
+ * o MAX3421E datasheet
+ * http://datasheets.maximintegrated.com/en/ds/MAX3421E.pdf
+ * o MAX3421E Programming Guide
+ * http://www.hdl.co.jp/ftpdata/utl-001/AN3785.pdf
+ * o gadget/dummy_hcd.c
+ * For USB HCD implementation.
+ * o Arduino MAX3421 driver
+ * https://github.com/felis/USB_Host_Shield_2.0/blob/master/Usb.cpp
+ *
+ * This file is licenced under the GPL.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_DESC"MAX3421 USB Host-Controller Driver"
+#define DRIVER_VERSION "0.0"
+
+#define POWER_BUDGET   500 // in mA; use 8 for low-power port testing
+
+// Port-change mask:
+#define PORT_C_MASK((USB_PORT_STAT_C_CONNECTION |  \
+ USB_PORT_STAT_C_ENABLE |  \
+ USB_PORT_STAT_C_SUSPEND | \
+ USB_PORT_STAT_C_OVERCURRENT | \
+ USB_PORT_STAT_C_RESET) << 16)
+
+enum max3421_rh_state {
+   MAX3421_RH_RESET,
+   MAX3421_RH_SUSPENDED,
+   MAX3421_RH_RUNNING
+};
+
+struct max3421_hcd {
+   spinlock_t  lock;
+
+   struct max3421_hcd  *next;
+
+

Re: MAX3421E Linux driver and DGStation

2014-01-31 Thread simon
Some further digging suggests that there was support for the MAX3421 in a
couple of Linux  based satellite receivers, specficially the IpBox 250s
and DGStation Mutant-200s

The producer of the later was even subject to a GPL violation and
resolution where they made a kernel patch available, although this apears
'lost' too.

http://web.archive.org/web/20090709064234/http://www.dgstation.co.kr/new/news_software.php?code=27&mode=view

So if anyone here was involved in that scene it migth be a good time to
see if you have a copy of 'linux-2.6.17.14.DGStation.patch.tar.gz' siting
on a harddisk and upload it somewhere, so we can see whether it contains
this and other goodies.

Cheers,
Simon.

--
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: MAX3421E Linux driver?

2014-01-30 Thread simon
> We have a need to graft a USB Host controller onto a SPI bus (never
> mind the wisdom of doing that, we have little
> choice in this particular instance).
>
> The Cypress CY7C67300 would fit the bill and has a Linux driver, but
> is probably too complex and definitely
> too expensive for our needs.
>
> The Maxim MAX3421E is the other option, but it has no Linux driver.

Since the device sounds very interesting, I started googling around to
find this comment:
http://hary040314.blog.163.com/blog/static/77162442200822125922706/
--
Today ,I add max3421e to linux kernel 2.6.13 as usb host controller on
platform s3c2440 successful.

For now,I can mount mobile hard disk to sysfs of linux,and list all the
files and folders on the mobile hard disk.

But the speed is slow,and even worse,I can't exchange files larger than 8M
through it.I thought ,the road to success finally ahead is long.
--

The rest of the page is Chinese(?), but it might suggest that someone got
something working at one time
Simon

--
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: MAX3421E Linux driver?

2014-01-30 Thread simon
> Great find, I'm impressed!  Yeah, probably not much hope of contacting
> the author (it's from 2008), but it sounds like the basics were pretty
> straight-forward.  Good to know.

Yep, probably lost to the sands of time I found a linked copy of that
blog and clicked through for the year but nothing else helpful.

Best help is (as already mentioned I think):
https://bitbucket.org/bufferlabs/usb_host_shield_2.0

Good luck, and publish if you get anything working,
Simon

--
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: MAX3421E Linux driver?

2014-01-30 Thread Paul Zimmerman
> From: linux-usb-ow...@vger.kernel.org 
> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of David Mosberger
> Sent: Thursday, January 30, 2014 4:35 PM
> 
> We have a need to graft a USB Host controller onto a SPI bus (never
> mind the wisdom of doing that, we have little
> choice in this particular instance).
> 
> The Cypress CY7C67300 would fit the bill and has a Linux driver, but
> is probably too complex and definitely
> too expensive for our needs.
> 
> The Maxim MAX3421E is the other option, but it has no Linux driver.
> The chip basically implements OHCI over SPI
> rather than PCI.  Anybody know of any particular reason why there is
> no Linux driver?  Has anyone already written or
> attempted to write an OHCI-over-SPI driver for MAX3421E?

ISTR that the MAX3421E does not in fact have an OHCI register interface;
I believe it's some proprietary thing. If I'm right, that might help
explain why there's no Linux driver for it.

-- 
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: MAX3421E Linux driver?

2014-01-30 Thread David Mosberger
Great find, I'm impressed!  Yeah, probably not much hope of contacting
the author (it's from 2008), but it sounds like the basics were pretty
straight-forward.  Good to know.

  --david

On Thu, Jan 30, 2014 at 6:54 PM,   wrote:
>> We have a need to graft a USB Host controller onto a SPI bus (never
>> mind the wisdom of doing that, we have little
>> choice in this particular instance).
>>
>> The Cypress CY7C67300 would fit the bill and has a Linux driver, but
>> is probably too complex and definitely
>> too expensive for our needs.
>>
>> The Maxim MAX3421E is the other option, but it has no Linux driver.
>
> Since the device sounds very interesting, I started googling around to
> find this comment:
> http://hary040314.blog.163.com/blog/static/77162442200822125922706/
> --
> Today ,I add max3421e to linux kernel 2.6.13 as usb host controller on
> platform s3c2440 successful.
>
> For now,I can mount mobile hard disk to sysfs of linux,and list all the
> files and folders on the mobile hard disk.
>
> But the speed is slow,and even worse,I can't exchange files larger than 8M
> through it.I thought ,the road to success finally ahead is long.
> --
>
> The rest of the page is Chinese(?), but it might suggest that someone got
> something working at one time
> Simon
>



-- 
eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768
--
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: MAX3421E Linux driver?

2014-01-30 Thread Peter Stuge
David Mosberger wrote:
> > David Mosberger wrote:
> >> The Maxim MAX3421E is the other option, but it has no Linux driver.
> >
> > You could look at http://arduino.cc/en/Main/ArduinoBoardADK for a
> > reference that might even work.
> 
> We are aware of Arduino but the point of our project is to be able to
> use normal Linux USB drivers.  As far as I know, Arduino has it's own
> (limited) USB stack.  Perhaps I'm missing something?

Sorry, I absolutely did not suggest that you actually use the Arduino
for anything, but the ADK code might actually work and could serve as
a reference for driving the MAX.


//Peter
--
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: MAX3421E Linux driver?

2014-01-30 Thread David Mosberger
Peter,

On Thu, Jan 30, 2014 at 6:09 PM, Peter Stuge  wrote:
> David Mosberger wrote:
>> The Maxim MAX3421E is the other option, but it has no Linux driver.
>
> You could look at http://arduino.cc/en/Main/ArduinoBoardADK for a
> reference that might even work.

We are aware of Arduino but the point of our project is to be able to
use normal Linux USB drivers.  As far as I know, Arduino has it's own
(limited) USB stack.  Perhaps I'm missing something?

  --david

>
>
> //Peter



-- 
eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768
--
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: MAX3421E Linux driver?

2014-01-30 Thread Peter Stuge
David Mosberger wrote:
> The Maxim MAX3421E is the other option, but it has no Linux driver.

You could look at http://arduino.cc/en/Main/ArduinoBoardADK for a
reference that might even work.


//Peter
--
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: MAX3421E Linux driver?

2014-01-30 Thread Felipe Balbi
Hi,

On Thu, Jan 30, 2014 at 05:34:59PM -0700, David Mosberger wrote:
> We have a need to graft a USB Host controller onto a SPI bus (never
> mind the wisdom of doing that, we have little
> choice in this particular instance).
> 
> The Cypress CY7C67300 would fit the bill and has a Linux driver, but
> is probably too complex and definitely
> too expensive for our needs.
> 
> The Maxim MAX3421E is the other option, but it has no Linux driver.
> The chip basically implements OHCI over SPI
> rather than PCI.  Anybody know of any particular reason why there is
> no Linux driver?  Has anyone already written or
> attempted to write an OHCI-over-SPI driver for MAX3421E?

I don't think anybody has attempted it. If you wanna do it, we're happy
to review the driver.

cheers

-- 
balbi


signature.asc
Description: Digital signature


MAX3421E Linux driver?

2014-01-30 Thread David Mosberger
We have a need to graft a USB Host controller onto a SPI bus (never
mind the wisdom of doing that, we have little
choice in this particular instance).

The Cypress CY7C67300 would fit the bill and has a Linux driver, but
is probably too complex and definitely
too expensive for our needs.

The Maxim MAX3421E is the other option, but it has no Linux driver.
The chip basically implements OHCI over SPI
rather than PCI.  Anybody know of any particular reason why there is
no Linux driver?  Has anyone already written or
attempted to write an OHCI-over-SPI driver for MAX3421E?

Best regards,

  --david
-- 
eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768
--
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