[U-Boot] USB support on beagleboard xM

Christian Spielberger c.spielberger at bct-electronic.com
Wed Jun 1 17:49:34 CEST 2011


Hi,

we try to enable the ethernet-interface on the BeagleBoard xM (Rev B) 
and therefore we need to get the USB-HOST (EHCI) working. It seems that 
the internal communication to the host is working, but the interface to 
the external PHY isn't.

We are pretty sure that the USBTLL should be bypassed. Thus we set 
P2_ULPI_BYPASS=0.

We enable the power to the PHY (USB3320) and set the reset-line 
(USB2HS_nRST) to high. But we measure no clock on the USB2HS_CLK.

We have a pre-built kernel-image (ubuntu natty) where the USB-HOST is 
started and the ethernet is working. Measuring the USB2HS_CLK shows 
60MHz .. so at least the hardware is not defective.

Any ideas why the HSB2HS_CLK is not working?

Below we pasted the u-boot output of the "usb start" command and our 
current diff to mainline.

------------------
OMAP3 beagleboard.org # usb start
(Re)start USB...
USB:   Initializing OMAP3 ECHI
USB clocks enabled
UHH initialized.
OMAP_UHH_SYSSTATUS=3
OMAP_UHH_DEBUG_CSR=20
  PM_PWSTCTRL_USBHOST=30107
  PM_PWSTST_USBHOST=3
CM (clock) Registers CM_FCLKEN_USBHOST=3
  CM_ICLKEN_USBHOST=1
  CM_IDLEST_USBHOST=0
  CM_AUTOIDLE_USBHOST=0
  CM_SLEEPDEP_USBHOST=0
  CM_CLKSTCTRL_USBHOST=0
  CM_CLKSTST_USBHOST=1
  CM_CLKSTST_CORE=7
  CM_CLKSEL_CORE=130a
UHH_HOSTCONFIG=21c
OMAP3 EHCI init done
Register 1313 NbrPorts 3
USB EHCI 1.00
scanning bus for devices... New Device 0
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 
length 0x40
req=6 (0x6), type=128 (0x80), value=256, index=0
USB_DT_DEVICE request
set address 1
usb_control_msg: request: 0x5, requesttype: 0x0, value 0x1 index 0x0 
length 0x0
req=5 (0x5), type=0 (0x0), value=1, index=0
USB_REQ_SET_ADDRESS
Len is 0
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 
length 0x12
req=6 (0x6), type=128 (0x80), value=256, index=0
USB_DT_DEVICE request
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 
length 0x9
req=6 (0x6), type=128 (0x80), value=512, index=0
USB_DT_CONFIG config
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 
length 0x19
req=6 (0x6), type=128 (0x80), value=512, index=0
USB_DT_CONFIG config
get_conf_no 0 Result 25, wLength 25
if 0, ep 0
##EP epmaxpacketin[1] = 8
set configuration 1
usb_control_msg: request: 0x9, requesttype: 0x0, value 0x1 index 0x0 
length 0x0
req=9 (0x9), type=0 (0x0), value=1, index=0
USB_REQ_SET_CONFIGURATION
Len is 0
new device strings: Mfr=1, Product=2, SerialNumber=0
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x300 index 0x0 
length 0xFF
req=6 (0x6), type=128 (0x80), value=768, index=0
USB_DT_STRING config
USB device number 1 default language ID 0x1
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x301 index 0x1 
length 0xFF
req=6 (0x6), type=128 (0x80), value=769, index=1
USB_DT_STRING config
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x302 index 0x1 
length 0xFF
req=6 (0x6), type=128 (0x80), value=770, index=1
USB_DT_STRING config
Manufacturer u-boot
Product      EHCI Host Controller
SerialNumber 9ffafbcc
USB hub found
usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0 
length 0x4
req=6 (0x6), type=160 (0xa0), value=10496, index=0
USB_DT_HUB config
usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0 
length 0x8
req=6 (0x6), type=160 (0xa0), value=10496, index=0
USB_DT_HUB config
3 ports detected
individual port power switching
standalone hub
global over-current protection
power on to power good time: 510ms
hub controller current requirement: 0mA
port 1 is removable
port 2 is removable
port 3 is removable
usb_control_msg: request: 0x0, requesttype: 0xA0, value 0x0 index 0x0 
length 0x4
req=0 (0x0), type=160 (0xa0), value=0, index=0
get_hub_status returned status 1, change 103
local power source is lost (inactive)
no over-current condition exists
enabling power on all ports
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x1 
length 0x0
req=3 (0x3), type=35 (0x23), value=8, index=1
Len is 0
port 1 returns 0
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x2 
length 0x0
req=3 (0x3), type=35 (0x23), value=8, index=2
Len is 0
port 2 returns 0
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x3 
length 0x0
req=3 (0x3), type=35 (0x23), value=8, index=3
Len is 0
port 3 returns 0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 
length 0x4
req=0 (0x0), type=163 (0xa3), value=0, index=1
Port 1 Status 500 Change 0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x2 
length 0x4
req=0 (0x0), type=163 (0xa3), value=0, index=2
Port 2 Status 500 Change 0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x3 
length 0x4
req=0 (0x0), type=163 (0xa3), value=0, index=3
Port 3 Status 500 Change 0
1 USB Device(s) found
scan end
        scanning bus for storage devices... 0 Storage Device(s) found
        scanning bus for ethernet devices... i=0
i=1
0 Ethernet Device(s) found

------------------

diff --git a/arch/arm/include/asm/arch-omap3/ehci_omap3.h 
b/arch/arm/include/asm/arch-omap3/ehci_omap3.h
index cd01f50..7a30f53 100644
--- a/arch/arm/include/asm/arch-omap3/ehci_omap3.h
+++ b/arch/arm/include/asm/arch-omap3/ehci_omap3.h
@@ -39,20 +39,27 @@
  #define	OMAP_USBTLL_SYSCONFIG_SIDLEMODE			(1 << 3)
  #define	OMAP_USBTLL_SYSCONFIG_CACTIVITY			(1 << 8)

+#define	OMAP_USBTLL_REVISION				(0x0)
+
  #define	OMAP_USBTLL_SYSSTATUS				(0x14)
  #define	OMAP_USBTLL_SYSSTATUS_RESETDONE			(1 << 0)

  /* UHH Register Set */
+#define	OMAP_UHH_REVISION				(0x0)
  #define	OMAP_UHH_SYSCONFIG				(0x10)
  #define	OMAP_UHH_SYSCONFIG_SOFTRESET			(1 << 1)
  #define	OMAP_UHH_SYSCONFIG_CACTIVITY			(1 << 8)
  #define	OMAP_UHH_SYSCONFIG_SIDLEMODE			(1 << 3)
  #define	OMAP_UHH_SYSCONFIG_ENAWAKEUP			(1 << 2)
  #define	OMAP_UHH_SYSCONFIG_MIDLEMODE			(1 << 12)
+#define	OMAP_UHH_SYSSTATUS				(0x14)
+#define	OMAP_UHH_DEBUG_CSR				(0x44)

  #define	OMAP_UHH_HOSTCONFIG				(0x40)
  #define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN		(1 << 2)
  #define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN		(1 << 3)
  #define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN		(1 << 4)
+#define OMAP_UHH_HOSTCONFIG_P2_CONNECT_STATUS_EN	(1 << 9)
+#define OMAP_UHH_HOSTCONFIG_ULPI_BYPASS_EN			(1 << 11)

  #endif /* _EHCI_OMAP3_H_ */
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index e850ca3..50fcd94 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -299,7 +299,10 @@ int misc_init_r(void)
  		setenv(expansion_config.env_var, expansion_config.env_setting);

  	twl4030_power_init();
-	twl4030_led_init( TWL4030_LED_LEDEN_LEDBON | TWL4030_LED_LEDEN_LEDAON );
+	/*
+	 * Activate power for USB phy
+	 */
+	twl4030_led_init( TWL4030_LED_LEDEN_LEDBON );

  	/* Configure GPIOs to output */
  	writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
@@ -382,27 +385,10 @@ int ehci_hcd_init(void)
  	 * and USBHOST_120M_FCLK (USBHOST_FCLK2)
  	 */
  	sr32(&prcm_base->fclken_usbhost, 0, 2, 3);
-	/* Enable USBTTL_ICLK */
-	sr32(&prcm_base->iclken3_core, 2, 1, 1);
-	/* Enable USBTTL_FCLK */
-	sr32(&prcm_base->fclken3_core, 2, 1, 1);
  	pr_debug("USB clocks enabled\n");

  	udelay(10);

-	/* perform TLL soft reset, and wait until reset is complete */
-	writel(OMAP_USBTLL_SYSCONFIG_SOFTRESET,
-		OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSCONFIG);
-	/* Wait for TLL reset to complete */
-	while (!(readl(OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSSTATUS)
-			& OMAP_USBTLL_SYSSTATUS_RESETDONE));
-	pr_debug("TLL reset done\n");
-
-	writel(OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
-		OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
-		OMAP_USBTLL_SYSCONFIG_CACTIVITY,
-		OMAP3_USBTLL_BASE + OMAP_USBTLL_SYSCONFIG);
-
  	/* Put UHH in NoIdle/NoStandby mode */
  	writel(OMAP_UHH_SYSCONFIG_ENAWAKEUP
  		| OMAP_UHH_SYSCONFIG_SIDLEMODE
@@ -413,9 +399,43 @@ int ehci_hcd_init(void)
  	/* setup burst configurations */
  	writel(OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN
  		| OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN
-		| OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN,
+		| OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN
+		| OMAP_UHH_HOSTCONFIG_P2_CONNECT_STATUS_EN,
  		OMAP3_UHH_BASE + OMAP_UHH_HOSTCONFIG);

+	printf("UHH initialized.\n");
+
+	printf("OMAP_UHH_SYSSTATUS=%x\n",
+			readl(OMAP3_UHH_BASE + OMAP_UHH_SYSSTATUS));
+	printf("OMAP_UHH_DEBUG_CSR=%x\n",
+			readl(OMAP3_UHH_BASE + OMAP_UHH_DEBUG_CSR));
+	printf(" PM_PWSTCTRL_USBHOST=%x\n",
+			readl(0x483074E0UL));
+	printf(" PM_PWSTST_USBHOST=%x\n",
+			readl(0x483074E4UL));
+	printf("CM (clock) Registers");
+	printf(" CM_FCLKEN_USBHOST=%x\n",
+			readl(0x48005400UL));
+	printf(" CM_ICLKEN_USBHOST=%x\n",
+			readl(0x48005410UL));
+	printf(" CM_IDLEST_USBHOST=%x\n",
+			readl(0x48005420UL));
+	printf(" CM_AUTOIDLE_USBHOST=%x\n",
+			readl(0x48005430UL));
+	printf(" CM_SLEEPDEP_USBHOST=%x\n",
+			readl(0x48005444UL));
+	printf(" CM_CLKSTCTRL_USBHOST=%x\n",
+			readl(0x48005448UL));
+	printf(" CM_CLKSTST_USBHOST=%x\n",
+			readl(0x4800544CUL));
+	printf(" CM_CLKSTST_CORE=%x\n",
+			readl(0x48004A4CUL));
+	printf(" CM_CLKSEL_CORE=%x\n",
+			readl(0x48004A40UL));
+
+	printf("UHH_HOSTCONFIG=%x\n",
+			readl(OMAP3_UHH_BASE + OMAP_UHH_HOSTCONFIG));
+
  	/*
  	 * Refer ISSUE1:
  	 * Hold the PHY in RESET for enough time till
@@ -423,7 +443,7 @@ int ehci_hcd_init(void)
  	 */
  	udelay(10);
  	omap_set_gpio_dataout(GPIO_PHY_RESET, 1);
-	twl4030_led_init( TWL4030_LED_LEDEN_LEDBON );
+	udelay(10);

  	hccr = (struct ehci_hccr *)(OMAP3_EHCI_BASE);
  	hcor = (struct ehci_hcor *)(OMAP3_EHCI_BASE + 0x10);
diff --git a/board/ti/beagle/beagle.h b/board/ti/beagle/beagle.h
index b164465..9054104 100644
--- a/board/ti/beagle/beagle.h
+++ b/board/ti/beagle/beagle.h
@@ -388,6 +388,18 @@ const omap3_sysinfo sysinfo = {
  	MUX_VAL(CP(UART2_RX),		(IDIS | PTU | EN  | M4)) /*GPIO_147*/

  #define MUX_BEAGLE_XM() \
+	MUX_VAL(CP(ETK_D11_ES2),	(IDIS | PTD | DIS | M3)) /*HSUSB2_STP*/\
+	MUX_VAL(CP(ETK_D10_ES2),	(IEN  | PTD | DIS | M3)) /*HSUSB2_CLK*/\
+	MUX_VAL(CP(ETK_D12_ES2),	(IEN  | PTD | EN  | M3)) /*HSUSB2_DIR*/\
+	MUX_VAL(CP(ETK_D13_ES2),	(IEN  | PTD | EN  | M3)) /*HSUSB2_NXT*/\
+	MUX_VAL(CP(ETK_D14_ES2),	(IEN  | PTD | EN  | M3)) /*HSUSB2_DATA0*/\
+	MUX_VAL(CP(ETK_D15_ES2),	(IEN  | PTD | EN  | M3)) /*HSUSB2_DATA1*/\
+	MUX_VAL(CP(MCSPI1_CS3),		(IEN  | PTD | EN  | M3)) /*HSUSB2_DATA2*/\
+	MUX_VAL(CP(MCSPI2_CS1),		(IEN  | PTD | EN  | M3)) /*HSUSB2_DATA3*/\
+	MUX_VAL(CP(MCSPI2_SIMO),	(IEN  | PTD | EN  | M3)) /*HSUSB2_DATA4*/\
+	MUX_VAL(CP(MCSPI2_SOMI),	(IEN  | PTD | EN  | M3)) /*HSUSB2_DATA5*/\
+	MUX_VAL(CP(MCSPI2_CS0),		(IEN  | PTD | EN  | M3)) /*HSUSB2_DATA6*/\
+	MUX_VAL(CP(MCSPI2_CLK),		(IEN  | PTD | EN  | M3)) /*HSUSB2_DATA7*/\
  	MUX_VAL(CP(GPMC_NCS5),		(IDIS | PTD | EN  | M4)) /*GPIO_56*/\
  	MUX_VAL(CP(GPMC_WAIT0),		(IDIS | PTU | EN  | M4)) /*GPIO_63*/\
  	MUX_VAL(CP(MMC1_DAT7),		(IDIS | PTU | EN  | M4)) /*GPIO_129*/\
@@ -399,7 +411,6 @@ const omap3_sysinfo sysinfo = {
  	MUX_VAL(CP(UART2_RTS),		(IDIS | PTD | DIS | M0)) /*UART2_RTS*/\
  	MUX_VAL(CP(UART2_TX),		(IDIS | PTD | DIS | M0)) /*UART2_TX*/\
      MUX_VAL(CP(UART2_RX),		(IDIS | PTD | DIS | M4)) /*GPIO_147*/ \
-	MUX_VAL(CP(ETK_D10_ES2),	(IEN  | PTD | DIS | M3)) /*HSUSB2_CLK*/\
  	MUX_VAL(CP(DSS_DATA0),		(IDIS | PTD | DIS | M7)) /*safe_mode*/\
  	MUX_VAL(CP(DSS_DATA1),		(IDIS | PTD | DIS | M7)) /*safe_mode*/\
  	MUX_VAL(CP(DSS_DATA2),		(IDIS | PTD | DIS | M7)) /*safe_mode*/\
diff --git a/common/usb.c b/common/usb.c
index 4f7c520..6f33858 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -930,7 +930,7 @@ int usb_new_device(struct usb_device *dev)
  			   dev->serial, sizeof(dev->serial));
  	USB_PRINTF("Manufacturer %s\n", dev->mf);
  	USB_PRINTF("Product      %s\n", dev->prod);
-	USB_PRINTF("SerialNumber %s\n", dev->serial);
+	USB_PRINTF("SerialNumber %x\n", dev->serial);
  	/* now prode if the device is a hub */
  	usb_hub_probe(dev, 0);
  	return 0;
diff --git a/include/configs/omap3_beagle_xm.h 
b/include/configs/omap3_beagle_xm.h
index c52552e..0869376 100644
--- a/include/configs/omap3_beagle_xm.h
+++ b/include/configs/omap3_beagle_xm.h
@@ -125,8 +125,8 @@
  #define CONFIG_USB_OMAP3		1
  #define CONFIG_TWL4030_USB		1
  #define CONFIG_USB_KEYBOARD            1
-//#define CONFIG_USB_HOST_ETHER  1
-//#define CONFIG_USB_ETHER_SMSC95XX 1
+#define CONFIG_USB_HOST_ETHER  1
+#define CONFIG_USB_ETHER_SMSC95XX 1

  /* USB device configuration */
  #define CONFIG_USB_DEVICE		1
@@ -162,9 +162,18 @@
  #undef CONFIG_CMD_FPGA		/* FPGA configuration Support	*/
  #undef CONFIG_CMD_IMI		/* iminfo			*/
  #undef CONFIG_CMD_IMLS		/* List all found images	*/
-#undef CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
-#undef CONFIG_CMD_NET_MULTI  1		/* bootp, tftpboot, rarpboot	*/
+#define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
+#define CONFIG_NET_MULTI /* bootp, tftpboot, rarpboot	*/
+#define CONFIG_CMD_PING
+#undef CONFIG_CMD_DHCP
  #undef CONFIG_CMD_NFS		/* NFS support			*/
+#define CONFIG_BOOTP_SUBNETMASK		255.255.255.0
+#define CONFIG_BOOTP_GATEWAY		192.168.233.1
+#define CONFIG_BOOTP_HOSTNAME		192.168.233.56
+#define CONFIG_BOOTP_BOOTPATH		/home/cspiel/beagle/boot
+#define CONFIG_IPADDR				192.168.233.203
+#define CONFIG_SERVERIP				192.168.233.56
+#define CONFIG_BOOTFILE				uImage

  #define CONFIG_SYS_NO_FLASH
  #define CONFIG_HARD_I2C			1
------------------




More information about the U-Boot mailing list