From: Sergei Shtylyov <sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
To: "Gupta, Ajay Kumar" <ajay.gupta-l0cyMroinI0@public.gmane.org>
Cc: Sergei Shtylyov
<sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>,
"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org"
<felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH resend 2/3] musb: add musb support for AM35x
Date: Sat, 03 Jul 2010 17:04:36 +0400 [thread overview]
Message-ID: <4C2F3564.8030103@ru.mvista.com> (raw)
In-Reply-To: <19F8576C6E063C45BE387C64729E7394044EAAD82A-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
Hello.
Gupta, Ajay Kumar wrote:
>>> +{
>>> + unsigned long timeout = jiffies + msecs_to_jiffies(100);
>>> + u32 devconf2;
>>> +
>>> + /*
>>> + * Start the on-chip PHY and its PLL.
>>> + */
>>> + devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2);
>>> +
>>> + devconf2 &= ~(CONF2_RESET | CONF2_PHYPWRDN | CONF2_OTGPWRDN |
>>> + CONF2_PHY_GPIOMODE);
>> BWT, what's thet GPIOMODE bit for?
> If GPIO Mode is set to '1' then UART3 Tx/Rx would come on DP and
> DM pins of USBPHY.
Hm, why GPIOMODE then I wonder... :-)
>>> + devconf2 |= CONF2_PHY_PLLON | CONF2_DATPOL;
>> So, AM35x always uses the reversed data polarity?
> It's getting set to '1' so its always normal polarity.
Ah, I got it reversed: 1 means normal polarity indeed...
>>> +static void otg_timer(unsigned long _musb)
>>> +{
>>> + struct musb *musb = (void *)_musb;
>>> + void __iomem *mregs = musb->mregs;
>>> + u8 devctl;
>>> + unsigned long flags;
>>> +
>>> + /*
>>> + * We poll because AM35x's won't expose several OTG-critical
>>> + * status change events (from the transceiver) otherwise.
>>> + */
>>> + devctl = musb_readb(mregs, MUSB_DEVCTL);
>>> + DBG(7, "Poll devctl %02x (%s)\n", devctl, otg_state_string(musb));
>>> +
>>> + spin_lock_irqsave(&musb->lock, flags);
>>> + switch (musb->xceiv->state) {
>> [...]
>>> + case OTG_STATE_A_WAIT_VFALL:
>> So, are you sure there's no need to call mod_timer() here for RTL 1.8?
> What issue did you see on earlier RTLs ?
I didn't test DaVinci much; I didn't even test DA8xx much in OTG mode. :-/
And in the DA8xx host mode VBUS error would never occur anyway (as the VBUS
comparator is overridden on the EVM board).
> As such I didn't see issue
> In my normal testing.
OK.
>>> + musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
>>> + musb_writel(musb->ctrl_base, CORE_INTR_SRC_SET_REG,
>>> + MUSB_INTR_VBUSERROR << USB_INTR_USB_SHIFT);
>>> + break;
>>> + case OTG_STATE_B_IDLE:
>>> + if (!is_peripheral_enabled(musb))
>>> + break;
>> Hm, davinci.c sets DevCtl.Session here and I'm also doing it in
>> da8xx.c --
>> can you comment why you don't do that too?
> I remember this was causing some issue in OTG testing.
Do you remember which issue?
Although I suspect that this code might be related to the comment below:
"DEVCTL.BDEVICE is invalid without DEVCTL.SESSION set".
>>> + devctl = musb_readb(mregs, MUSB_DEVCTL);
>>> + if (devctl & MUSB_DEVCTL_BDEVICE)
>>> + mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
>>> + else
>>> + musb->xceiv->state = OTG_STATE_A_IDLE;
>>> + break;
>> [...]
>>> + musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
>> This field is set by musb_core.c, so I dropped this line from
>> da8xx.c...
This has also been dropped from omap2430.c by this commit:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f7f9d63eac12b345d6243d1d608b7944a05be921
> Need to test again but I was facing a issue where OTG build image
> Was either working in host only mode or device only. Role were
> Not changing based on ID pin status.
Hm, is this related?
>>> +int musb_platform_exit(struct musb *musb)
>>> +{
>>> + struct clk *otg_fck = clk_get(musb->controller, "fck");
>>> +
>>> + if (is_host_enabled(musb))
>>> + del_timer_sync(&otg_workaround);
>>> +
>>> + /* Delay to avoid problems with module reload... */
>> Are you sure this is needed? For DA8xx, I'm not sure: at least in host
>> mode it just causes pointless delay for me (VBUS comparator is overridden
>> in host mode); I was unable to test the OTG mode properly -- for some reason
>> USB device didn't get recongnized and VBUS has probably stayed low.
Didn't have time to properly look into the OTG mode yet...
> I need to check on this, I guess it's not required though I have tested
> OTG also on AM3517EVM.
>>> + for (delay = 30; delay > 0; delay--) {
>>> + devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
>>> + if (!(devctl & MUSB_DEVCTL_VBUS))
>>> + goto done;
>>> + if ((devctl & MUSB_DEVCTL_VBUS) != warn) {
>>> + warn = devctl & MUSB_DEVCTL_VBUS;
>>> + DBG(1, "VBUS %d\n",
>>> + warn >> MUSB_DEVCTL_VBUS_SHIFT);
>>> + }
>>> + msleep(1000);
>>> + }
>>> +
>>> + /* In OTG mode, another host might be connected... */
>>> + DBG(1, "VBUS off timeout (devctl %02x)\n", devctl);
>>> + }
>>> + if (otg_fck) {
>> musb_platfrom_init() suggests that otg_fck can't be NULL. Also,
>> clk_get
>> returns error code, not NULL, so should use IS_ERR() here.
> Correct, would clean it.
Also, you call clk_get() on this clock twice, in musb_platfrom_init() and
here, but clk_put() only once.
> Thanks,
> Ajay
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-07-03 13:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-02 6:57 [PATCH resend 1/3] AM35x: Add musb support Ajay Kumar Gupta
2010-07-02 6:57 ` [PATCH resend 2/3] musb: add musb support for AM35x Ajay Kumar Gupta
2010-07-02 6:57 ` [PATCH resend 3/3] musb: AM35x: Workaround for fifo read issue Ajay Kumar Gupta
2010-07-02 12:21 ` [PATCH resend 2/3] musb: add musb support for AM35x Sergei Shtylyov
2010-07-03 3:24 ` Gupta, Ajay Kumar
[not found] ` <19F8576C6E063C45BE387C64729E7394044EAAD82A-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-07-03 13:04 ` Sergei Shtylyov [this message]
2010-07-05 11:46 ` Gupta, Ajay Kumar
2010-07-05 9:50 ` [PATCH resend 1/3] AM35x: Add musb support Tony Lindgren
2010-07-05 10:02 ` Sergei Shtylyov
[not found] ` <4C31ADCA.40607-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2010-07-05 10:23 ` Tony Lindgren
[not found] ` <20100705102322.GR15951-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2010-07-05 10:34 ` Sergei Shtylyov
[not found] ` <4C31B54F.6040109-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2010-07-05 10:48 ` Tony Lindgren
2010-07-05 11:54 ` Gupta, Ajay Kumar
[not found] ` <19F8576C6E063C45BE387C64729E7394044EAAD8F6-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-07-05 13:45 ` Tony Lindgren
[not found] ` <20100705134552.GD15951-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2010-07-05 14:50 ` Sergei Shtylyov
2010-07-06 7:23 ` Gupta, Ajay Kumar
2010-07-06 7:57 ` Tony Lindgren
[not found] ` <20100706075707.GC3192-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2010-07-06 8:46 ` Felipe Balbi
[not found] ` <20100706084603.GA3035-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-07-06 9:51 ` Tony Lindgren
2010-07-06 22:46 ` Gadiyar, Anand
2010-07-07 7:53 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C2F3564.8030103@ru.mvista.com \
--to=sshtylyov-igf4poytycdqt0dzr+alfa@public.gmane.org \
--cc=ajay.gupta-l0cyMroinI0@public.gmane.org \
--cc=felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.