lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120926182719.GA10326@arwen.pp.htv.fi>
Date:	Wed, 26 Sep 2012 21:27:20 +0300
From:	Felipe Balbi <balbi@...com>
To:	"ABRAHAM, KISHON VIJAY" <kishon@...com>
Cc:	balbi@...com, grant.likely@...retlab.ca, rob.herring@...xeda.com,
	rob@...dley.net, linux@....linux.org.uk, linux-usb@...r.kernel.org,
	linux-omap@...r.kernel.org, devicetree-discuss@...ts.ozlabs.org,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 4/4] usb: phy: omap-usb2: enable 960Mhz clock for omap5

Hi,

On Wed, Sep 26, 2012 at 11:10:48AM +0530, ABRAHAM, KISHON VIJAY wrote:
> Hi,
> 
> On Wed, Sep 19, 2012 at 5:26 PM, Felipe Balbi <balbi@...com> wrote:
> > On Wed, Sep 19, 2012 at 05:00:29PM +0530, Kishon Vijay Abraham I wrote:
> >> "usb_otg_ss_refclk960m" is needed by usb2 phy present in omap5. For
> >> omap4, the clk_get of this clock will fail since it does not have this
> >> clock.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon@...com>
> >> ---
> >>  Documentation/devicetree/bindings/usb/usb-phy.txt |    3 +++
> >>  drivers/usb/phy/omap-usb2.c                       |   28 ++++++++++++++++++++-
> >>  2 files changed, 30 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt
> >> index 7c5fd89..d5626de 100644
> >> --- a/Documentation/devicetree/bindings/usb/usb-phy.txt
> >> +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
> >> @@ -24,6 +24,9 @@ Required properties:
> >>  add the address of control module phy power register until a driver for
> >>  control module is added
> >>
> >> +Optional properties:
> >> + - has960mhzclk: should be added if the phy needs 960mhz clock
> >> +
> >>  This is usually a subnode of ocp2scp to which it is connected.
> >>
> >>  usb3phy@...84400 {
> >> diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c
> >> index d36c282..d6612ba 100644
> >> --- a/drivers/usb/phy/omap-usb2.c
> >> +++ b/drivers/usb/phy/omap-usb2.c
> >> @@ -146,6 +146,7 @@ static int __devinit omap_usb2_probe(struct platform_device *pdev)
> >>       struct omap_usb                 *phy;
> >>       struct usb_otg                  *otg;
> >>       struct resource                 *res;
> >> +     struct device_node              *np = pdev->dev.of_node;
> >>
> >>       phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
> >>       if (!phy) {
> >> @@ -190,6 +191,15 @@ static int __devinit omap_usb2_probe(struct platform_device *pdev)
> >>       }
> >>       clk_prepare(phy->wkupclk);
> >>
> >> +     if (of_property_read_bool(np, "has960mhzclk")) {
> >> +             phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m");
> >> +             if (IS_ERR(phy->optclk)) {
> >> +                     dev_err(&pdev->dev, "unable to get refclk960m\n");
> >> +                     return PTR_ERR(phy->optclk);
> >> +             }
> >> +             clk_prepare(phy->optclk);
> >> +     }
> >
> > instead, can't you just always try to get the clock but ignore the error
> > if it fails ?
> 
> This clock is needed for usb2 to work in dwc3 (omap5). So we have to
> report the error in case we dont get the clock no?

sure, but you don't need to bail out. Print a warning message such as:

dev_dbg(&pdev->dev, "couldn't get refclk960m, trying without\n");

or something similar. Then you don't need to add this has960mhzclk flag
to dts files.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ