USB HOST mode fails on OTG port with USB TTY in u-boot

420 views
Skip to first unread message

Khasim Syed Mohammed

unread,
Feb 18, 2009, 7:07:43 AM2/18/09
to beagl...@googlegroups.com, felipe...@nokia.com, ajay....@ti.com
Hi,

Finding it strange, that USB HOST mode fails when I boot the kernel on
u-boot enabled for usb tty mode.

I tried resetting the MUSB controller, for some time I felt like it
worked but it actually doesn't. I suspect it to be USB PHY power and
pulled in some patches from Felipe and Ajay Gupta - to enable the
session bits. But even this didn't help.

Now, I am looking for other suggestions to get this working :(

More data:
- u-boot now supports USB TTY on OTG port for beagle.
- When this usb TTY mode is enabled in u-boot and kernel
(http://www.beagleboard.org/gitweb/?p=linux-2.6.git;a=shortlog;h=2.6.28-oe-r8)
is booted (with USB OTG enabled)
- USB ethernet gadget works fine
- USB Host doesn't work ( the board by default is setup for HOST mode
with mini A and hub + peripherals)
- when USB TTY is disabled in u-boot then HOST works fine in kernel
(same setup as above).

Any specific patch or code base to look at?

Regards,
Khasim

Khasim Syed Mohammed

unread,
Feb 18, 2009, 8:53:24 AM2/18/09
to felipe...@nokia.com, beagl...@googlegroups.com, ajay....@ti.com
On Wed, Feb 18, 2009 at 5:31 PM, Felipe Balbi <felipe...@nokia.com> wrote:
> could you share some debugging messages ??
>
> set musb's debug to level 5 and get those debugging for us ;-)
>
> --
> balbi
>

This is what I have after enabling "CONFIG_USB_DEBUG" and
"CONFIG_USB_MUSB_DEBUG" - Not sure if this help in any way.


Starting kernel ...

Error, the USB hardware is not on B modeUncompressing Linux.....................
................................................................................
................................................................. done, booting
the kernel.
Linux version 2.6.28-omap1 (root@tiioss) (gcc version 4.2.1 (CodeSourcery Source
ry G++ Lite 2007q3-51)) #3 Wed Feb 18 18:26:34 IST 2009
CPU: ARMv7 Processor [411fc083] revision 3 (ARMv7), cr=10c5387f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: OMAP3 Beagle Board
Memory policy: ECC disabled, Data cache writeback
OMAP3430 ES3.0
SRAM: Mapped pa 0x40200000 to va 0xd7000000 size: 0x100000
Reserving 15728640 bytes SDRAM for VRAM
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: console=ttyS2,115200n8 console=tty0 root=/dev/ram0 rw ramdi
sk_size=32768 initrd=0x81600000,32M
Clocking rate (Crystal/DPLL/ARM core): 26.0/332/500 MHz
GPMC revision 5.0
IRQ: Found an INTC at 0xd8200000 (revision 4.0) with 96 interrupts
Total of 96 interrupts on 1 active controller
OMAP34xx GPIO hardware version 2.5
PID hash table entries: 1024 (order: 10, 4096 bytes)
OMAP clockevent source: GPTIMER12 at 32768 Hz
Console: colour dummy device 80x30
console [tty0] enabled
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 128MB 128MB = 256MB total
Memory: 206080KB available (4800K code, 425K data, 168K init)
Calibrating delay loop... 509.42 BogoMIPS (lpj=1990656)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 532 bytes
regulator: core version 0.5
NET: Registered protocol family 16
Found NAND on CS0
Registering NAND on CS0
OMAP DMA hardware revision 4.0
USB: No board-specific platform config found
OMAP DSS rev 2.0
OMAP DISPC rev 3.0
OMAP VENC rev 2
OMAP DSI rev 1.0
i2c_omap i2c_omap.1: bus 1 rev3.12 at 2600 kHz
twl4030: PIH (irq 7) chaining IRQs 368..375
twl4030: power (irq 373) chaining IRQs 376..383
twl4030: gpio (irq 368) chaining IRQs 384..401
i2c_omap i2c_omap.3: bus 3 rev3.12 at 400 kHz
SCSI subsystem initialized
twl4030_usb twl4030_usb: Initialized TWL4030 USB module
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
musb_hdrc: version 6.0, musb-dma, otg (peripheral+host), debug=0
musb_hdrc: USB OTG mode controller at d80ab000 using DMA, IRQ 92
regulator: VMMC1: 1850 <--> 3150 mV normal standby
regulator: VDAC: 1800 mV normal standby
regulator: VUSB1V5: 1500 mV normal standby
regulator: VUSB1V8: 1800 mV normal standby
regulator: VUSB3V1: 3100 mV normal standby
regulator: VSIM: 1800 <--> 3000 mV normal standby
Bluetooth: Core ver 2.13
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
cfg80211: Using static regulatory domain info
cfg80211: Regulatory domain: US
(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
cfg80211: Calling CRDA for country: US
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
NET: Registered protocol family 1
checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
Freeing initrd memory: 32768K
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
JFFS2 version 2.2. (NAND) (SUMMARY) Â(c) 2001-2006 Red Hat, Inc.
msgmni has been set to 466
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver4 ports, IRQ sharing enabled
serial8250.0: ttyS0 at MMIO 0x4806a000 (irq = 72) is a ST16654
serial8250.0: ttyS1 at MMIO 0x4806c000 (irq = 73) is a ST16654
serial8250.0: ttyS2 at MMIO 0x49020000 (irq = 74) is a ST16654
console [ttyS2] enabled
brd: module loaded
loop: module loaded
usbcore: registered new interface driver asix
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver rndis_host
usbcore: registered new interface driver zd1211rw
usbcore: registered new interface driver rndis_wlan
usbcore: registered new interface driver zd1201
usbcore: registered new interface driver usb8xxx
usbcore: registered new interface driver rtl8187
usbcore: registered new interface driver rt2500usb
usbcore: registered new interface driver rt73usb
usbcore: registered new interface driver p54usb
i2c /dev entries driver
input: triton2-pwrbutton as /class/input/input0
triton2 power button driver initialized
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
omap2-nand driver initializing
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron NAND 256MiB 1,8V 16-bi
t)
cmdlinepart partition parsing not available
Creating 5 MTD partitions on "omap2-nand":
0x00000000-0x00080000 : "X-Loader"
0x00080000-0x00260000 : "U-Boot"
0x00260000-0x00280000 : "U-Boot Env"
0x00280000-0x00680000 : "Kernel"
0x00680000-0x10000000 : "File System"
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-omap ehci-omap.0: OMAP-EHCI Host Controller
ehci-omap ehci-omap.0: new USB bus registered, assigned bus number 1
ehci-omap ehci-omap.0: irq 77, io mem 0x48064800
ehci-omap ehci-omap.0: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: OMAP-EHCI Host Controller
usb usb1: Manufacturer: Linux 2.6.28-omap1 ehci_hcd
usb usb1: SerialNumber: ehci-omap.0
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
g_ether gadget: using random self ethernet address
g_ether gadget: using random host ethernet address
usb0: MAC 46:2f:ed:02:c8:94
usb0: HOST MAC ba:b2:d5:5b:4f:82
g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
g_ether gadget: g_ether ready
musb_hdrc musb_hdrc: MUSB HDRC host driver
musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 2
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: MUSB HDRC host driver
usb usb2: Manufacturer: Linux 2.6.28-omap1 musb-hcd
usb usb2: SerialNumber: musb_hdrc
mice: PS/2 mouse device common for all mice
input: gpio-keys as /class/input/input1
twl4030_rtc twl4030_rtc: rtc core: registered twl4030_rtc as rtc0
twl4030_rtc twl4030_rtc: Power up reset detected.
twl4030_rtc twl4030_rtc: Enabling TWL4030-RTC.
OMAP Watchdog Timer Rev 0x31: initial timeout 60 sec
Bluetooth: HCI USB driver ver 2.10
usbcore: registered new interface driver hci_usb
Bluetooth: Broadcom Blutonium firmware driver ver 1.2
usbcore: registered new interface driver bcm203x
Bluetooth: Digianswer Bluetooth USB driver ver 0.10
usbcore: registered new interface driver bpa10x
Bluetooth: Generic Bluetooth SDIO driver ver 0.1
mmci-omap-hs mmci-omap-hs.0: Failed to get debounce clock
Registered led device: beagleboard::usr0
Registered led device: beagleboard::usr1
leds-gpio: probe of leds-gpio failed with error -22
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.18rc3.
usbcore: registered new interface driver snd-usb-audio
ASoC version 0.13.2
OMAP3 Beagle SoC init
TWL4030 Audio Codec init
asoc: twl4030 <-> omap-mcbsp-dai-(link_id) mapping ok
ALSA device list:
#0: omap3beagle (twl4030)
oprofile: using arm/armv7
TCP cubic registered
NET: Registered protocol family 17
NET: Registered protocol family 15
Bluetooth: L2CAP ver 2.11
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO (Voice Link) ver 0.6
Bluetooth: SCO socket layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM ver 1.10
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: HIDP (Human Interface Emulation) ver 1.2
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
ieee80211: 802.11 data/management/control stack, git-1.1.13
ieee80211: Copyright (C) 2004-2005 Intel Corporation <jket...@linux.intel.com>
ThumbEE CPU extension supported.
Power Management for TI OMAP3.
SmartReflex driver initialized

< root prompt >

No device detected on USB, I have a HUB and peripherals on OTG port
connected with mini A.

Thanks

Khasim

Khasim Syed Mohammed

unread,
Feb 18, 2009, 9:58:47 AM2/18/09
to felipe...@nokia.com, beagl...@googlegroups.com, ajay....@ti.com

I am not sure, why I am not reading the DBG messages - digging more
into the code manually I found that session is not getting started.

musb->is_active = 0;
devctl = musb_readb(regs, MUSB_DEVCTL);
devctl &= ~MUSB_DEVCTL_SESSION;

if (is_otg_enabled(musb)) {
/* session started after:
* (a) ID-grounded irq, host mode;
* (b) vbus present/connect IRQ, peripheral mode;
* (c) peripheral initiates, using SRP
*/
printk("\n OTG enabled \n");
if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS)
musb->is_active = 1;
else {
devctl |= MUSB_DEVCTL_SESSION;
printk("devctl updated \n");
----------------------------> when things work I see this message,
otherwise I don't.
}

} else if (is_host_enabled(musb)) {

How do I reset the VBUS?

Regards,
Khasim

Syed Mohammed, Khasim

unread,
Feb 18, 2009, 11:54:06 AM2/18/09
to beagl...@googlegroups.com, felipe...@nokia.com, ajay....@ti.com
On Wed, Feb 18, 2009 at 8:28 PM, Khasim Syed Mohammed
I added a TWL PHY RESET in the code base, this seems to fix the issue.
Patch is as given below, I was not able to use the twl_usb in
drivers/usb/otg directory so added the T2 call directly and found no
good place to add the register definition and value - so hard coding
it for now - Please suggest / comment your views on the same.

Tested:
- USB HOST mode
- USB Ethernet Gadget (Peripheral mode)
- USB TTY on u-boot

=================

To get USB HOST mode working on USB OTG Port with USB TTY enabled U-boot

Signed-off-by: Syed Mohammed Khasim <kha...@ti.com>
---

--- linux-2.6.git/drivers/usb/musb/omap2430.c 2009-01-19
22:42:18.000000000 +0530
+++ linux-2.6.git/drivers/usb/musb/omap2430.c 2009-02-18
21:29:23.000000000 +0530
@@ -33,6 +33,7 @@
#include <linux/list.h>
#include <linux/clk.h>
#include <linux/io.h>
+#include <linux/i2c/twl4030.h>

#include <asm/mach-types.h>
#include <mach/hardware.h>
@@ -233,6 +234,14 @@ int __init musb_platform_init(struct mus
omap_cfg_reg(AE5_2430_USB0HS_STP);
#endif

+ /* Reset MUSB Controller */
+ omap_writel(SOFTRST,OTG_SYSCONFIG);
+
+#if defined(CONFIG_TWL4030_USB)
+ /* Reset the TWL USB PHY */
+ twl4030_i2c_write_u8(TWL4030_MODULE_USB, 0x20, 0x4);
+#endif
+
musb->xceiv = *x;
musb_platform_resume(musb);

Gerald Coley

unread,
Feb 18, 2009, 12:18:18 PM2/18/09
to beagl...@googlegroups.com
Khasim,
 
Any chance I can get a .bin file to try?
 
Gerald

Felipe Balbi

unread,
Feb 18, 2009, 7:01:06 AM2/18/09
to ext Khasim Syed Mohammed, beagl...@googlegroups.com, Balbi Felipe (Nokia-D/Helsinki), ajay....@ti.com
On Wed, Feb 18, 2009 at 01:07:43PM +0100, ext Khasim Syed Mohammed wrote:

could you share some debugging messages ??

Felipe Balbi

unread,
Feb 18, 2009, 10:15:31 AM2/18/09
to ext Khasim Syed Mohammed, Balbi Felipe (Nokia-D/Helsinki), beagl...@googlegroups.com, ajay....@ti.com
On Wed, Feb 18, 2009 at 03:58:47PM +0100, ext Khasim Syed Mohammed wrote:
> I am not sure, why I am not reading the DBG messages - digging more
> into the code manually I found that session is not getting started.
>
> musb->is_active = 0;
> devctl = musb_readb(regs, MUSB_DEVCTL);
> devctl &= ~MUSB_DEVCTL_SESSION;
>
> if (is_otg_enabled(musb)) {
> /* session started after:
> * (a) ID-grounded irq, host mode;
> * (b) vbus present/connect IRQ, peripheral mode;
> * (c) peripheral initiates, using SRP
> */
> printk("\n OTG enabled \n");
> if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS)
> musb->is_active = 1;
> else {
> devctl |= MUSB_DEVCTL_SESSION;
> printk("devctl updated \n");
> ----------------------------> when things work I see this message,
> otherwise I don't.
> }
>
> } else if (is_host_enabled(musb)) {

apply this:

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2cc34fa..7731042 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -114,7 +114,7 @@



-unsigned musb_debug;
+unsigned musb_debug = 5;
module_param(musb_debug, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug message level. Default = 0");

> How do I reset the VBUS?

what do you mean ? tell vbus to go off by hand ? You'd have to hack
drivers/usb/otg/twl4030-usb.c (on current kernel).

--
balbi

Reply all
Reply to author
Forward
0 new messages