Re: [PATCH RESEND] usb: otg: OMAP4: Fix the omap4430_phy_set_clk function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 20, 2012 at 4:31 PM, Tony Lindgren <tony@xxxxxxxxxxx> wrote:
>
> * Ruslan Bilovol <ruslan.bilovol@xxxxxx> [120612 10:42]:
> > If the clocks are enabled and we want to enable them again
> > omap4430_phy_set_clk disables them.
> >
> > Fix this - so now if we try to enable already enabled clocks
> > it works correctly.
>
> Sounds like Felipe is on vacation. Trying to figure out if this
> is something for the fixes branch:
>
> What happens if this not fixed, do you get some error?

The function is designed for simple clocks on-off:
if zero "on" parameter is passed - switch the clocks off,
if non-zero "on" parameter passed - switch the clocks on.

But due to error in implementation, it works wrong if called twice or more
times with non-zero "on" parameter.

For example, assuming that clocks are disabled:
    omap4430_phy_set_clk(dev, 1);   <=== enables clocks
    omap4430_phy_set_clk(dev, 1);   <=== suddenly disables clocks,
when we expect enabling.
    omap4430_phy_set_clk(dev, 1);   <=== enables clocks again

It seems impact of this wrong behavior is not observed on current code
base, but we see
crashes caused by access to non-clocked registers when heavy use this function
in the charger detection or after implementing otg EYE improvement.

> Was this caused by some recent commit?

No, we have this wrong behavior since the omap_phy_internal.c file
creation (c33fad0c37)

--
Best regards,
Ruslan Bilovol


>
> > Signed-off-by: Ruslan Bilovol <ruslan.bilovol@xxxxxx>
> > ---
> >  arch/arm/mach-omap2/omap_phy_internal.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/omap_phy_internal.c
> > b/arch/arm/mach-omap2/omap_phy_internal.c
> > index 4c90477..0196683 100644
> > --- a/arch/arm/mach-omap2/omap_phy_internal.c
> > +++ b/arch/arm/mach-omap2/omap_phy_internal.c
> > @@ -97,7 +97,7 @@ int omap4430_phy_set_clk(struct device *dev, int on)
> >               clk_enable(clk48m);
> >               clk_enable(clk32k);
> >               state = 1;
> > -     } else if (state) {
> > +     } else if (!on && state) {
> >               /* Disable the phy clocks */
> >               clk_disable(phyclk);
> >               clk_disable(clk48m);
> > --
> > 1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux