maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   N900 will not allow USB OTG! (https://talk.maemo.org/showthread.php?t=31921)

titan 2010-05-23 21:10

Re: N900 will not allow USB OTG!
 
unfortunately it doesn't work. I already uncommented it during our last IRC session
and verified that one cannot force the chip to hostmode. It ignores the flag even if you properly also change the flag in the context register that is normally restored as suspend or during connect.
some other conditions need to fulfilled (device connected as peripheral?) for this flag to be effective.

Quote:

Originally Posted by joerg_rw (Post 671948)
http://mxr.maemo.org/fremantle/sourc...b_procfs.c#661

Code:

656        case 'H':
657                if (mbase) {
658                        reg = musb_readb(mbase, MUSB_DEVCTL);
659                        reg |= MUSB_DEVCTL_HR;
660                        musb_writeb(mbase, MUSB_DEVCTL, reg);
661                        /* MUSB_HST_MODE( ((struct musb*)data) ); */
662                        /* WARNING("Host Mode\n"); */
663                }
664                break;



joerg_rw 2010-05-24 03:47

Re: N900 will not allow USB OTG!
 
just to keep you up to date (quite some kernel patches were used, including FORCE_HOSTMODE for SoC musb. NO kickstart host PC involved).


for reference:
[2010-05-24 03:59:09] <javispedro> plug b-device into
[2010-05-24 03:59:39] <javispedro> n8x0:
[2010-05-24 03:59:40] <javispedro> [25277.234375] musb_stage0_irq 645: CONNECT (a_host) devctl 5d
[2010-05-24 03:59:40] <javispedro> [25277.234375] hub 1-0:1.0: state 8 ports 1 chg 0000 evt 0000
[2010-05-24 03:59:40] <javispedro> [25277.234375] usb usb1: usb auto-resume
[2010-05-24 03:59:40] <javispedro> [25277.234375] usb usb1: finish resume
[2010-05-24 03:59:40] <javispedro> [25277.234375] hub 1-0:1.0: hub_resume
[2010-05-24 03:59:43] <javispedro> ...
[2010-05-24 03:59:56] <javispedro> Status: MHDRC, Mode=Host (Power=f0, DevCtl=5d)
[2010-05-24 03:59:57] <javispedro> OTG state: a_host; active



N900:
[2010-05-24 04:35:46] <javispedro> Status: MHDRC, Mode=Host (Power=60, DevCtl=5f)
[2010-05-24 04:35:47] <javispedro> OTG state: a_host; active
[2010-05-24 04:35:50] <javispedro> that
[2010-05-24 04:35:55] <javispedro> devctl changed after pumping power
[2010-05-24 04:35:58] <DocScrutinizer> STRIKE!
[2010-05-24 04:36:14] <javispedro> [20987.088165] generic_interrupt
[2010-05-24 04:36:14] <javispedro> [20987.088256] musb_interrupt
[2010-05-24 04:36:14] <javispedro> [20987.088287] musb_interrupt 1818: ** IRQ host usb000d tx0000 rx0000
[2010-05-24 04:36:14] <javispedro> [20987.088317] musb_stage0_irq
[2010-05-24 04:36:14] <javispedro> [20987.088348] musb_stage0_irq 580: <== Power=60, DevCtl=c4, int_usb=0x5
[2010-05-24 04:36:15] <javispedro> [20987.088378] musb_stage0_irq 764: SUSPEND (b_idle) devctl c4 power 60
[2010-05-24 04:36:17] <javispedro> [20987.088439] musb_stage0_irq 960: BABBLE devctl: c4
[2010-05-24 04:36:21] <javispedro> interrupts!!!
[2010-05-24 04:36:24] <javispedro> my beloved interrupts.
[2010-05-24 04:39:02] <javispedro> 5f is "session started"
[2010-05-24 04:39:07] <javispedro> 5d isn't
[2010-05-24 04:41:04] <javispedro> I am stable in devctl=5f as long as I keep running i2cset

Icsoft 2010-05-24 13:04

Re: N900 will not allow USB OTG!
 
Does the new commit for meego help at all?
http://meego.gitorious.org/+meego-ar...7f2aca16d605e3

joerg_rw 2010-05-24 14:24

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by Icsoft (Post 673210)
Does the new commit for meego help at all?
http://meego.gitorious.org/+meego-ar...7f2aca16d605e3

Alas not really.
This are patches to expose a few values (of questionable relevance) from low level hardware stuff to sysfs-nodes, and similar. The whole purpose is to make bme blob work (or test if it does), under meego.
Nevertheless many thanks for sharing the pointer :-)

cheers
jOERG

javispedro 2010-05-24 18:29

Re: N900 will not allow USB OTG!
 
At least it's a bit cleaned up.

Tiptronic 2010-05-24 18:57

Re: N900 will not allow USB OTG!
 
So.. Impossible?

egoshin 2010-05-24 19:24

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by joerg_rw (Post 672582)
just to keep you up to date (quite some kernel patches were used, including FORCE_HOSTMODE for SoC musb. NO kickstart host PC involved).


for reference:
[2010-05-24 03:59:09] <javispedro> plug b-device into
[2010-05-24 03:59:39] <javispedro> n8x0:
[2010-05-24 03:59:40] <javispedro> [25277.234375] musb_stage0_irq 645: CONNECT (a_host) devctl 5d
[2010-05-24 03:59:40] <javispedro> [25277.234375] hub 1-0:1.0: state 8 ports 1 chg 0000 evt 0000
[2010-05-24 03:59:40] <javispedro> [25277.234375] usb usb1: usb auto-resume
[2010-05-24 03:59:40] <javispedro> [25277.234375] usb usb1: finish resume
[2010-05-24 03:59:40] <javispedro> [25277.234375] hub 1-0:1.0: hub_resume
[2010-05-24 03:59:43] <javispedro> ...
[2010-05-24 03:59:56] <javispedro> Status: MHDRC, Mode=Host (Power=f0, DevCtl=5d)
[2010-05-24 03:59:57] <javispedro> OTG state: a_host; active



N900:
[2010-05-24 04:35:46] <javispedro> Status: MHDRC, Mode=Host (Power=60, DevCtl=5f)
[2010-05-24 04:35:47] <javispedro> OTG state: a_host; active
[2010-05-24 04:35:50] <javispedro> that
[2010-05-24 04:35:55] <javispedro> devctl changed after pumping power
[2010-05-24 04:35:58] <DocScrutinizer> STRIKE!
[2010-05-24 04:36:14] <javispedro> [20987.088165] generic_interrupt
[2010-05-24 04:36:14] <javispedro> [20987.088256] musb_interrupt
[2010-05-24 04:36:14] <javispedro> [20987.088287] musb_interrupt 1818: ** IRQ host usb000d tx0000 rx0000
[2010-05-24 04:36:14] <javispedro> [20987.088317] musb_stage0_irq
[2010-05-24 04:36:14] <javispedro> [20987.088348] musb_stage0_irq 580: <== Power=60, DevCtl=c4, int_usb=0x5
[2010-05-24 04:36:15] <javispedro> [20987.088378] musb_stage0_irq 764: SUSPEND (b_idle) devctl c4 power 60
[2010-05-24 04:36:17] <javispedro> [20987.088439] musb_stage0_irq 960: BABBLE devctl: c4
[2010-05-24 04:36:21] <javispedro> interrupts!!!
[2010-05-24 04:36:24] <javispedro> my beloved interrupts.
[2010-05-24 04:39:02] <javispedro> 5f is "session started"
[2010-05-24 04:39:07] <javispedro> 5d isn't
[2010-05-24 04:41:04] <javispedro> I am stable in devctl=5f as long as I keep running i2cset

I got the same result with FORCE_HOSTMODE last week with 3.5V from TWL4030. For a moment it is a clear response from other side - "protocol violation" (BABBLE). I am reading USB docs now to understand why is it. Your log shows that the problem is not in 3.5V vs 5V - is it right, that you use 5V VBUS?

BTW, can you publish your actual commands to configure chip - it may help?

blue_led 2010-05-24 20:08

Re: N900 will not allow USB OTG!
 
i prepare for receiving tomatoes on my face ....
preface, facts
as i understand on n900 there is 4 usb channels the first one is otg capable and the last 3 are pure hosts. isp1707 chip is connected to first channel ( otg )
until now nothing new so concentrate to this otg controller
i read a mentor datasheet saying this controller is made with ~50.000 logical gates . this assembly may work stand alone or with help of core microprocessor like cheap soft "controllers", i don't care. some logic is inside this and kernel drivers must fit this.
if designers of this controller follow the otg specifications saying otg session ( & state machine ) start from peripheral i wonder how can force this state machine with almost generic kernel routines trying to trick this blackbox
if phy would be connected to host only port i don't have any problem, host kernel routines may fit well.
so if any hacker who attempt doing host work don't have full access to full datasheet of this controller to have a clear idea how it work, which command force host and which prerequisites are necessary we grope in the dark
my english prevent me to develop this ideas
i watched this thread and tried to help but i don't "see" anybody wonder about what is real otg controller
until now any success of host mode don't trick the specifications saying : start from peripheral mode & vbus valid ( over 4.4 V)

is host working on meego ?

javispedro 2010-05-24 20:20

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by egoshin (Post 673798)
BTW, can you publish your actual commands to configure chip - it may help?

At that point,1707 was not configured in any special way other than soft reset -- so yes, it is same as your old setup.

Some snippets...
Read / Set 1707 registers:
Code:

    case 'm':
        if (mbase) {
            u8 r;
            u32 l;
            r = gpio_get_value(RX51_USB_TRANSCEIVER_RST_GPIO);
            printk("RX51_USB_TRANSCEIVER_RST_GPIO = %hu\n", r);
            l = omap_readl(OTG_SYSCONFIG);
            printk("OTG_SYSCONFIG = %x\n", l);
            r = musb_ulpi_readb(mbase, ISP1704_OTG_CTRL);
            printk("ulpi read result isp1704_otg_ctrl=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_FUNC_CTRL);
            printk("                isp1704_func_ctrl=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_USB_INTRISE);
            printk("                isp1704_usb_intr_en_r=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_USB_INTFALL);
            printk("                isp1704_usb_intr_en_f=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_USB_INTSTAT);
            printk("                isp1704_usb_intr_stat=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_PWR_CTRL);
            printk("                isp1704_pwr_ctrl=%hx\n", r);
        }
        break;

    case 'M':
        if (mbase) {
                u8 r;
                        r = ISP1704_OTG_CTRL_DP_PULLDOWN | ISP1704_OTG_CTRL_DM_PULLDOWN;
                        musb_ulpi_writeb(mbase, ISP1704_OTG_CTRL, r);
                        printk("writing otg_ctrl=%hx\n", r);
        }
        break;

Power up the 1707 (usually powered on/off by twl4030 vbus sense interrupts, so if you commented/removed them down it should not be needed).
Code:

    case '2':
        musb->xceiv->set_suspend(musb->xceiv, 0);
        break;

Then wait two or three seconds.

And configuring the bq vbus pump was done via user space as per DocScrutinizer instructions.

Note: after seeing all this myself I don't feel this is the right way. It's hard for me to explain a feeling, but basically, it's getting interrupts that would case the state machine to move on the n8x0, but it's not moving on the n900 -- for example one that wasn't quoted was a SESSION REQUEST while in a_wait_bcon.
Nothing happened, while on the N8x0 it would mean the state machine moves on to a_host state. After a while, when I killed the 5V pump, I got the BABBLE as the device died but the musb state machine didn't move either.

bhavinfirst 2010-05-25 10:58

Re: N900 will not allow USB OTG!
 
im sorry if it has been posted before but this seems to be a good alternative till some one gets the usb host working on n900.
http://www.airstash.com//support/index.html
At 99$ i think its worth it considering it features.


All times are GMT. The time now is 23:25.

vBulletin® Version 3.8.8