Difference between revisions of "U-boot musb gadget support"

From eLinux.org
Jump to: navigation, search
(Add ttypersist)
 
(23 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
[[Category: Linux]]
 
[[Category: Linux]]
 
[[Category: OMAP]]
 
[[Category: OMAP]]
This is currently publish as a patch for [[BeagleBoard#U-Boot|U-Boot]] at OMAP3 based boards (e.g. [[BeagleBoard|BeagleBoard]]) instead of a git repository since I haven't got time to setup a git somewhere.
+
[[Category: U-Boot]]
 +
The code for musb gadget support is currently available on the omap3-dev-usb branch of the [http://www.sakoman.net/cgi-bin/gitweb.cgi?p=u-boot-omap3.git;a=summary Beagle U-Boot git repository].
  
 
=== Current Status ===
 
=== Current Status ===
* Currently the patch enables beagleboard to be recognized as an usb ACM modem, and provide u-boot console over it. However some issues with initialization needs to be solved (see Known bugs section).
+
* Currently the code enables the Beagleboard to be recognized as a USB ACM modem, and provides a u-boot console over it. It keeps the console over serial as well.
  
 
=== Known bugs ===
 
=== Known bugs ===
* The twl4030 initialization isn't right yet (working on it), so the only work around to make a board bootable with this patch if by pressing the user button while applying power to the board, otherwise the USB PHY won't be properly initialized.
+
* None
* Setting the stdint,stdout,stderr to be multi-io (have the u-boot console and serial and USB at the same time) get stuck if a terminal like minicom isn't open on the USB ACM device.
+
  
 
=== Next steps ===
 
=== Next steps ===
* Fix the twl3040 initialization issues
+
* Merge in mainstream?
* Fix the problem with multi-io
+
* Prepare inf driver for Windows
  
 
=== Getting the source code ===
 
=== Getting the source code ===
  
Checkout the git source for the musb gadget support from [http://www.sakoman.net/cgi-bin/gitweb.cgi?p=u-boot-omap3.git;a=summary Beagle U-Boot git repository]. Get it by:
+
Checkout the git source for the musb gadget support from the [http://www.sakoman.net/cgi-bin/gitweb.cgi?p=u-boot-omap3.git;a=summary Beagle U-Boot git repository]. Get it by:
  
  git clone git://www.sakoman.net/git/u-boot-omap3.git
+
  git clone git://gitorious.org/u-boot-omap3/mainline.git
 
  cd u-boot-omap3
 
  cd u-boot-omap3
 
  git checkout --track -b omap3-dev-usb origin/omap3-dev-usb
 
  git checkout --track -b omap3-dev-usb origin/omap3-dev-usb
Line 29: Line 29:
  
 
=== Getting started ===
 
=== Getting started ===
* Load your new u-boot.bin image into the board using any of the existing methods. If you have a beagle running already a working u-boot, you can load it by serial using the 'loady' command and minicom or 'sb' (be sure to have lszrz installed in your distro). Then erasing the u-boot in flash and reflashing the new image with the following commands:
+
* Load your new u-boot.bin image into the board using any of the existing methods. If you have a beagle running already a working u-boot, you can load it by serial using the 'loady' command and minicom with 'sb' (be sure to have lszrz installed in your distro). Then erasing the u-boot in flash and reflashing the new image with the following commands:
  
 
  nand unlock
 
  nand unlock
 
  nand erase 80000 160000
 
  nand erase 80000 160000
  nand write.i 80000000 80000 160000
+
  nand write.i 80000000 80000 160000 #(depending on the your configuration, your start address might be 82000000)
  
* Reboot your board and keep the user button pressed while applying power (see Known bugs).
+
WARNING: in the previous instructions, please verified that your u-boot image was loaded on the address 80000000 (the last line from the ymodem transmission says where the image was loaded). On some boards I have see it uploads to 82000000 instead of 80000000
* Attach an mini-b USB cable to the beagle. Your host should recognize an ACM CDC device (works out of the box on Linux and OS X).
+
 
 +
* Reboot your board
 +
* Attach a mini-b USB cable to the beagle. Your host should recognize an ACM CDC device (works out of the box on Linux and OS X).
 
* If you want to have the u-boot console over USB use the following command:
 
* If you want to have the u-boot console over USB use the following command:
  setenv stdout usbtty; setenv stdin usbtty; setenv stderr usbtty
+
  setenv usbtty cdc_acm
* You can also use multi-io to have the console over serial and USB at the same time, but this has a bug documented in Known bugs:
+
saveenv
  setenv stdout usbtty,serial; setenv stdin usbtty,serial; setenv stderr usbtty,serial
+
Then reboot, then:
 +
  setenv stdout usbtty,serial; setenv stdin usbtty,serial; setenv stderr usbtty,serial; saveenv
 +
 
 +
Now when you plug the device into your Linux host machine you should be able to talk over serial using minicom,putty,etc over /dev/ttyACM0.
 +
 
 +
=== Issues ===
 +
 
 +
Network Manager will see this device as a modem and attempt to send it AT commands. To avoid this, edit /lib/udev/rules.d/77-nm-probe-modem-capabilities.rules and add the following lines:
 +
 
 +
ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a7", GOTO="nm_modem_probe_end"
 +
ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4aa", GOTO="nm_modem_probe_end"
 +
 
 +
Directly after the last line with a 'GOTO="nm_modem_probe_end"' statement.
 +
 
 +
Minicom doesn't work so well if the device drops out from beneath it. Check out [https://github.com/russdill/ttypersist ttypersist] or [http://gitorious.org/projects/clonetty clonetty] for a workaround.

Latest revision as of 03:34, 15 March 2012

The code for musb gadget support is currently available on the omap3-dev-usb branch of the Beagle U-Boot git repository.

Current Status

  • Currently the code enables the Beagleboard to be recognized as a USB ACM modem, and provides a u-boot console over it. It keeps the console over serial as well.

Known bugs

  • None

Next steps

  • Merge in mainstream?
  • Prepare inf driver for Windows

Getting the source code

Checkout the git source for the musb gadget support from the Beagle U-Boot git repository. Get it by:

git clone git://gitorious.org/u-boot-omap3/mainline.git
cd u-boot-omap3
git checkout --track -b omap3-dev-usb origin/omap3-dev-usb

Build (assuming Code Sourcery GCC 2007q3):

make CROSS_COMPILE=arm-none-linux-gnueabi- mrproper
make CROSS_COMPILE=arm-none-linux-gnueabi- omap3_beagle_config
make CROSS_COMPILE=arm-none-linux-gnueabi-

Getting started

  • Load your new u-boot.bin image into the board using any of the existing methods. If you have a beagle running already a working u-boot, you can load it by serial using the 'loady' command and minicom with 'sb' (be sure to have lszrz installed in your distro). Then erasing the u-boot in flash and reflashing the new image with the following commands:
nand unlock
nand erase 80000 160000
nand write.i 80000000 80000 160000 #(depending on the your configuration, your start address might be 82000000)

WARNING: in the previous instructions, please verified that your u-boot image was loaded on the address 80000000 (the last line from the ymodem transmission says where the image was loaded). On some boards I have see it uploads to 82000000 instead of 80000000

  • Reboot your board
  • Attach a mini-b USB cable to the beagle. Your host should recognize an ACM CDC device (works out of the box on Linux and OS X).
  • If you want to have the u-boot console over USB use the following command:
setenv usbtty cdc_acm
saveenv

Then reboot, then:

setenv stdout usbtty,serial; setenv stdin usbtty,serial; setenv stderr usbtty,serial; saveenv

Now when you plug the device into your Linux host machine you should be able to talk over serial using minicom,putty,etc over /dev/ttyACM0.

Issues

Network Manager will see this device as a modem and attempt to send it AT commands. To avoid this, edit /lib/udev/rules.d/77-nm-probe-modem-capabilities.rules and add the following lines:

ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a7", GOTO="nm_modem_probe_end"
ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4aa", GOTO="nm_modem_probe_end"

Directly after the last line with a 'GOTO="nm_modem_probe_end"' statement.

Minicom doesn't work so well if the device drops out from beneath it. Check out ttypersist or clonetty for a workaround.