Re: Beaglebone USB driver (Mentor Graphics OTG)

2013-04-07 Thread Hans Petter Selasky

On 04/06/13 22:50, Oleksandr Tymoshenko wrote:

Hello,

This is first iteration of Host Mode support for Mentor Graphics
OTG USB controller. I tested it by building kernel with USB memory
stick mounted as /usr/obj, resulting kernel was bootable and worked fine.
I reused some ideas (mostly for channel-management) from
DWT OTG driver.

Some pieces are still missing:
- Support for SPLIT transactions, I don not have high speed hub
 right now to test it, but implementing it should be really
straighforward.
- Isochronous transfers. I do not have hardware to test this. Does
 anybody have any suggestion about simple use case?
- Control Data OUT transaction
- Wrapper for atmel HW has not ben synced with new core logic requirements
 yet

Please review and test. I tested it only with gcc-built kernel/world.
Now when
first iteration is finished I'm going to update all my boards to new
world order
(clang/EABI) and re-test this stuff.

Patch:
http://people.freebsd.org/~gonzo/arm/patches/beaglebone-musb.diff


Hi,

Supporting split transactions is required:

+
+   /* SPLIT transaction */
+   MUSB2_WRITE_1(sc, MUSB2_REG_RXHADDR(0), 0);
+   MUSB2_WRITE_1(sc, MUSB2_REG_RXHUBPORT(0), 0);
+

See EHCI driver:

EHCI_QH_SET_HUBA(xfer-xroot-udev-hs_hub_addr) |
EHCI_QH_SET_PORT(xfer-xroot-udev-hs_port_no));

This feature should be enabled when:

Connected root HUB port is running HIGH speed, and the connected device 
is LOW or FULL speed. Try connecting a USB keyboard through any high 
speed USB HUB.


--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: Beaglebone USB driver (Mentor Graphics OTG)

2013-04-07 Thread Hans Petter Selasky

On 04/06/13 22:50, Oleksandr Tymoshenko wrote:

Hello,

This is first iteration of Host Mode support for Mentor Graphics
OTG USB controller. I tested it by building kernel with USB memory
stick mounted as /usr/obj, resulting kernel was bootable and worked fine.
I reused some ideas (mostly for channel-management) from
DWT OTG driver.

Some pieces are still missing:
- Support for SPLIT transactions, I don not have high speed hub
 right now to test it, but implementing it should be really
straighforward.
- Isochronous transfers. I do not have hardware to test this. Does
 anybody have any suggestion about simple use case?
- Control Data OUT transaction
- Wrapper for atmel HW has not ben synced with new core logic requirements
 yet

Please review and test. I tested it only with gcc-built kernel/world.
Now when
first iteration is finished I'm going to update all my boards to new
world order
(clang/EABI) and re-test this stuff.

Patch:
http://people.freebsd.org/~gonzo/arm/patches/beaglebone-musb.diff


Hi,

Looks like you've got the grasp of the USB controller stuff :-)

Some comments:

1) Use DPRINTFN(-1, ...) instead of printf() for all printf() that are 
not part of boot dmesg.


+   break;
+   default:
+   td-transfer_type = 0;
+   printf(Invalid USB speed: %d\n, speed);
+   break;
+   }


2) You should implement if HOST mode, support for SUSPEND and RESUME. 
See EHCI driver. Basically what you need is:


a) USB transfers are stopped/paused. I know there is a hack you need if 
the host transfer cancel hangs, and that is to write a dummy device 
address and wait for the USB transfer to error out after 250 us max.


b) switch on USB suspend signalling.


At resume:

c) do resume signalling, similar to EHCI/UHCI I think.

d) switch on channel tokens.

case UHF_PORT_SUSPEND:
+   if (sc-sc_mode == MUSB2_HOST_MODE)
+   printf(TODO: Set UHF_PORT_SUSPEND\n);
+   break;



3) Make sure that channels are not generating tokens if they are aborted 
/ cancelled / timedout. This can not be verified using a USB mass 
storage device. Verify this by connecting a USB serial adapter. Try to 
open/close /dev/cuaU0. Make sure it does not loose any bytes and that 
channel cancel does not hang forever.


--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: Beaglebone USB driver (Mentor Graphics OTG)

2013-04-07 Thread Hans Petter Selasky

On 04/07/13 09:04, Hans Petter Selasky wrote:


3) Make sure that channels are not generating tokens if they are aborted
/ cancelled / timedout. This can not be verified using a USB mass
storage device. Verify this by connecting a USB serial adapter. Try to
open/close /dev/cuaU0. Make sure it does not loose any bytes and that
channel cancel does not hang forever.


Hi,

I recommend that cancel works like this:

1) Set invalid device address, like 127.

2) Use DMA delay feature to make a 4ms wait (see XHCI driver for example).

3) Free host channel (final).

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org