README.usb 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. * (C) Copyright 2001
  3. * Denis Peter, MPL AG Switzerland
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. USB Support for PIP405 and MIP405 (UHCI)
  8. ========================================
  9. The USB support is implemented on the base of the UHCI Host
  10. controller.
  11. Currently supported are USB Hubs, USB Keyboards, USB Floppys, USB
  12. flash sticks and USB network adaptors.
  13. Tested with a TEAC Floppy TEAC FD-05PUB and Chicony KU-8933 Keyboard.
  14. How it works:
  15. -------------
  16. The USB (at least the USB UHCI) needs a frame list (4k), transfer
  17. descripor and queue headers which are all located in the main memory.
  18. The UHCI allocates every milisecond the PCI bus and reads the current
  19. frame pointer. This may cause to crash the OS during boot. So the USB
  20. _MUST_ be stopped during OS boot. This is the reason, why the USB is
  21. NOT automatically started during start-up. If someone needs the USB
  22. he has to start it and should therefore be aware that he had to stop
  23. it before booting the OS.
  24. For USB keyboards this can be done by a script which is automatically
  25. started after the U-Boot is up and running. To boot an OS with a an
  26. USB keyboard another script is necessary, which first disables the
  27. USB and then executes the boot command. If the boot command fails,
  28. the script can reenable the USB kbd.
  29. Common USB Commands:
  30. - usb start:
  31. - usb reset: (re)starts the USB. All USB devices will be
  32. initialized and a device tree is build for them.
  33. - usb tree: shows all USB devices in a tree like display
  34. - usb info [dev]: shows all USB infos of the device dev, or of all
  35. the devices
  36. - usb stop [f]: stops the USB. If f==1 the USB will also stop if
  37. an USB keyboard is assigned as stdin. The stdin
  38. is then switched to serial input.
  39. Storage USB Commands:
  40. - usb scan: scans the USB for storage devices.The USB must be
  41. running for this command (usb start)
  42. - usb device [dev]: show or set current USB storage device
  43. - usb part [dev]: print partition table of one or all USB storage
  44. devices
  45. - usb read addr blk# cnt:
  46. read `cnt' blocks starting at block `blk#'to
  47. memory address `addr'
  48. - usbboot addr dev:part:
  49. boot from USB device
  50. Config Switches:
  51. ----------------
  52. CONFIG_CMD_USB enables basic USB support and the usb command
  53. CONFIG_USB_UHCI defines the lowlevel part.A lowlevel part must be defined
  54. if using CONFIG_CMD_USB
  55. CONFIG_USB_KEYBOARD enables the USB Keyboard
  56. CONFIG_USB_STORAGE enables the USB storage devices
  57. CONFIG_USB_HOST_ETHER enables USB ethernet adapter support
  58. USB Host Networking
  59. ===================
  60. If you have a supported USB Ethernet adapter you can use it in U-Boot
  61. to obtain an IP address and load a kernel from a network server.
  62. Note: USB Host Networking is not the same as making your board act as a USB
  63. client. In that case your board is pretending to be an Ethernet adapter
  64. and will appear as a network interface to an attached computer. In that
  65. case the connection is via a USB cable with the computer acting as the host.
  66. With USB Host Networking, your board is the USB host. It controls the
  67. Ethernet adapter to which it is directly connected and the connection to
  68. the outside world is your adapter's Ethernet cable. Your board becomes an
  69. independent network device, able to connect and perform network operations
  70. independently of your computer.
  71. Device support
  72. --------------
  73. Currently supported devices are listed in the drivers according to
  74. their vendor and product IDs. You can check your device by connecting it
  75. to a Linux machine and typing 'lsusb'. The drivers are in
  76. drivers/usb/eth.
  77. For example this lsusb output line shows a device with Vendor ID 0x0x95
  78. and product ID 0x7720:
  79. Bus 002 Device 010: ID 0b95:7720 ASIX Electronics Corp. AX88772
  80. If you look at drivers/usb/eth/asix.c you will see this line within the
  81. supported device list, so we know this adapter is supported.
  82. { 0x0b95, 0x7720 }, /* Trendnet TU2-ET100 V3.0R */
  83. If your adapter is not listed there is a still a chance that it will
  84. work. Try looking up the manufacturer of the chip inside your adapter.
  85. or take the adapter apart and look for chip markings. Then add a line
  86. for your vendor/product ID into the table of the appropriate driver,
  87. build U-Boot and see if it works. If not then there might be differences
  88. between the chip in your adapter and the driver. You could try to get a
  89. datasheet for your device and add support for it to U-Boot. This is not
  90. particularly difficult - you only need to provide support for four basic
  91. functions: init, halt, send and recv.
  92. Enabling USB Host Networking
  93. ----------------------------
  94. The normal U-Boot commands are used with USB networking, but you must
  95. start USB first. For example:
  96. usb start
  97. setenv bootfile /tftpboot/uImage
  98. bootp
  99. To enable USB Host Ethernet in U-Boot, your platform must of course
  100. support USB with CONFIG_CMD_USB enabled and working. You will need to
  101. add some config settings to your board header file:
  102. #define CONFIG_CMD_USB /* the 'usb' interactive command */
  103. #define CONFIG_USB_HOST_ETHER /* Enable USB Ethernet adapters */
  104. and one or more of the following for individual adapter hardware:
  105. #define CONFIG_USB_ETHER_ASIX
  106. #define CONFIG_USB_ETHER_MCS7830
  107. #define CONFIG_USB_ETHER_SMSC95XX
  108. As with built-in networking, you will also want to enable some network
  109. commands, for example:
  110. #define CONFIG_CMD_NET
  111. #define CONFIG_CMD_PING
  112. #define CONFIG_CMD_DHCP
  113. and some bootp options, which tell your board to obtain its subnet,
  114. gateway IP, host name and boot path from the bootp/dhcp server. These
  115. settings should start you off:
  116. #define CONFIG_BOOTP_SUBNETMASK
  117. #define CONFIG_BOOTP_GATEWAY
  118. #define CONFIG_BOOTP_HOSTNAME
  119. #define CONFIG_BOOTP_BOOTPATH
  120. You can also set the default IP address of your board and the server
  121. as well as the default file to load when a 'bootp' command is issued.
  122. However note that encoding these individual network settings into a
  123. common exectuable is discouraged, as it leads to potential conflicts,
  124. and all the parameters can either get stored in the board's external
  125. environment, or get obtained from the bootp server if not set.
  126. #define CONFIG_IPADDR 10.0.0.2 (replace with your value)
  127. #define CONFIG_SERVERIP 10.0.0.1 (replace with your value)
  128. #define CONFIG_BOOTFILE "uImage"
  129. The 'usb start' command should identify the adapter something like this:
  130. CrOS> usb start
  131. (Re)start USB...
  132. USB EHCI 1.00
  133. scanning bus for devices... 3 USB Device(s) found
  134. scanning bus for storage devices... 0 Storage Device(s) found
  135. scanning bus for ethernet devices... 1 Ethernet Device(s) found
  136. CrOS> print ethact
  137. ethact=asx0
  138. You can see that it found an ethernet device and we can print out the
  139. device name (asx0 in this case).
  140. Then 'bootp' or 'dhcp' should use it to obtain an IP address from DHCP,
  141. perhaps something like this:
  142. CrOS> bootp
  143. Waiting for Ethernet connection... done.
  144. BOOTP broadcast 1
  145. BOOTP broadcast 2
  146. DHCP client bound to address 172.22.73.81
  147. Using asx0 device
  148. TFTP from server 172.22.72.144; our IP address is 172.22.73.81
  149. Filename '/tftpboot/uImage-sjg-seaboard-261347'.
  150. Load address: 0x40c000
  151. Loading: #################################################################
  152. #################################################################
  153. #################################################################
  154. ################################################
  155. done
  156. Bytes transferred = 3557464 (364858 hex)
  157. CrOS>
  158. Another way of doing this is to issue a tftp command, which will cause the
  159. bootp to happen automatically.
  160. MAC Addresses
  161. -------------
  162. Most Ethernet dongles have a built-in MAC address which is unique in the
  163. world. This is important so that devices on the network can be
  164. distinguised from each other. MAC address conflicts are evil and
  165. generally result in strange and eratic behaviour.
  166. Some boards have USB Ethernet chips on-board, and these sometimes do not
  167. have an assigned MAC address. In this case it is up to you to assign
  168. one which is unique. You should obtain a valid MAC address from a range
  169. assigned to you before you ship the product.
  170. Built-in Ethernet adapters support setting the MAC address by means of
  171. an ethaddr environment variable for each interface (ethaddr, eth1addr,
  172. eth2addr). There is similar support on the USB network side, using the
  173. names usbethaddr, usbeth1addr, etc. They are kept separate since we
  174. don't want a USB device taking the MAC address of a built-in device or
  175. vice versa.
  176. So if your USB Ethernet chip doesn't have a MAC address available then
  177. you must set usbethaddr to a suitable MAC address. At the time of
  178. writing this functionality is only supported by the SMSC driver.