All of lore.kernel.org
 help / color / mirror / Atom feed
* Need a phy function to enable / disable usb squelch detection
@ 2015-03-26 19:17 Hans de Goede
  2015-03-27  1:21 ` Peter Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2015-03-26 19:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kishon,

I've been debugging why some devices do not work with
the musb otg controller found on Allwinner SoC-s, and the
conclusion is not good, the Android kernel does a
poke to the phy before releasing the usb reset.

Now you did not want me to introduce any sunxi specific /
private phy functions in my initial patch-series for adding
sunxi support, but in this case I do not really see an
alternative, as this is a very platform specific hack
to work around an issue with the phy-s squelch detection
which causes it to see a squelch when reset is released
switching it to high speed mode when a lo speed device
is connected, after which things fall apart.

I'm open to some generic solution for this, but I do
not see one myself.

Thanks & Regards,

Hans

p.s.

A review of my existing sun4i-usb-phy otg support work
would be appreciated, this squelch thing is best left
as a fix on top.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Need a phy function to enable / disable usb squelch detection
  2015-03-26 19:17 Need a phy function to enable / disable usb squelch detection Hans de Goede
@ 2015-03-27  1:21 ` Peter Chen
  2015-03-27  8:17   ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Chen @ 2015-03-27  1:21 UTC (permalink / raw)
  To: linux-arm-kernel

 
> Hi Kishon,
> 
> I've been debugging why some devices do not work with the musb otg
> controller found on Allwinner SoC-s, and the conclusion is not good, the
> Android kernel does a poke to the phy before releasing the usb reset.
> 
> Now you did not want me to introduce any sunxi specific / private phy
> functions in my initial patch-series for adding sunxi support, but in this case I do
> not really see an alternative, as this is a very platform specific hack to work
> around an issue with the phy-s squelch detection which causes it to see a
> squelch when reset is released switching it to high speed mode when a lo
> speed device is connected, after which things fall apart.
> 

The nofity_connect API at struct usb_phy may satisfy your requirement,
it will be called after bus rest has finished.

Peter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Need a phy function to enable / disable usb squelch detection
  2015-03-27  1:21 ` Peter Chen
@ 2015-03-27  8:17   ` Hans de Goede
  0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2015-03-27  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 27-03-15 02:21, Peter Chen wrote:
>
>> Hi Kishon,
>>
>> I've been debugging why some devices do not work with the musb otg
>> controller found on Allwinner SoC-s, and the conclusion is not good, the
>> Android kernel does a poke to the phy before releasing the usb reset.
>>
>> Now you did not want me to introduce any sunxi specific / private phy
>> functions in my initial patch-series for adding sunxi support, but in this case I do
>> not really see an alternative, as this is a very platform specific hack to work
>> around an issue with the phy-s squelch detection which causes it to see a
>> squelch when reset is released switching it to high speed mode when a lo
>> speed device is connected, after which things fall apart.
>>
>
> The nofity_connect API at struct usb_phy may satisfy your requirement,
> it will be called after bus rest has finished.

Thanks for the suggestion, but that is too late, I try to write a patch
set for this tonight (my sunxi musb work is a spare time project), as
I think that will make the discussion easier.

What I need is a way to disable squelch detection on the phy before clearing
the root port reset bit in the musb controller, currently we have this:

drivers/usb/musb/musb_virthub.c: void musb_port_reset()

	if (do_reset) {
		...
	} else {
		dev_dbg(musb->controller, "root port reset stopped\n");
		musb_writeb(mbase, MUSB_POWER, power & ~MUSB_POWER_RESET);
		...
	}

In order to work around the phy bug I need to do this (I got this from
the Allwinner android kernel sources and it seems the only way):

	if (do_reset) {
		...
	} else {
		dev_dbg(musb->controller, "root port reset stopped\n");
		musb_platform_pre_reset_end();
		musb_writeb(mbase, MUSB_POWER, power & ~MUSB_POWER_RESET);
		musb_platform_post_reset_end();
		...
	}

Notice the 2 new musb_platform_... calls, these are to be empty stubs for
all platforms except sunxi, where they need to call into the phy driver.

All in all I really believe this is so specific that a platform specific
phy callback is best, so that is what I'll do for the first version of
my patchset for this,

Regards,

Hans

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-27  8:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 19:17 Need a phy function to enable / disable usb squelch detection Hans de Goede
2015-03-27  1:21 ` Peter Chen
2015-03-27  8:17   ` Hans de Goede

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.