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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 18 Jun 2013 12:47:03 +0300
From:	Felipe Balbi <balbi@...com>
To:	Kishon Vijay Abraham I <kishon@...com>
CC:	<grant.likely@...aro.org>, <tony@...mide.com>, <balbi@...com>,
	<arnd@...db.de>, <swarren@...dia.com>,
	<sylvester.nawrocki@...il.com>, <linux-kernel@...r.kernel.org>,
	<linux-omap@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>,
	<linux-usb@...r.kernel.org>, <gregkh@...uxfoundation.org>,
	<akpm@...ux-foundation.org>, <rob.herring@...xeda.com>,
	<rob@...dley.net>, <b-cousson@...com>, <linux@....linux.org.uk>,
	<benoit.cousson@...aro.org>, <mchehab@...hat.com>,
	<cesarb@...arb.net>, <davem@...emloft.net>, <rnayak@...com>,
	<shawn.guo@...aro.org>, <santosh.shilimkar@...com>,
	<devicetree-discuss@...ts.ozlabs.org>, <linux-doc@...r.kernel.org>,
	<nsekhar@...com>
Subject: Re: [PATCH v7 7/9] usb: musb: omap2430: use the new generic PHY
 framework

Hi,

On Thu, Jun 13, 2013 at 02:13:57PM +0530, Kishon Vijay Abraham I wrote:
> Use the generic PHY framework API to get the PHY. The usb_phy_set_resume
> and usb_phy_set_suspend is replaced with power_on/get_sync and
> power_off/put_sync to align with the new PHY framework.
> 
> musb->xceiv can't be removed as of now because musb core uses xceiv.state and
> xceiv.otg. Once there is a separate state machine to handle otg, these can be
> moved out of xceiv and then we can start using the generic PHY framework.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@...com>
> ---
>  drivers/usb/musb/musb_core.c |    1 +
>  drivers/usb/musb/musb_core.h |    3 +++
>  drivers/usb/musb/omap2430.c  |   29 +++++++++++++++++++++--------
>  3 files changed, 25 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 37a261a..f732bcc 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -1864,6 +1864,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
>  	musb->board_set_power = plat->set_power;
>  	musb->min_power = plat->min_power;
>  	musb->ops = plat->platform_ops;
> +	musb->phy_label = plat->phy_label;
>  
>  	/* The musb_platform_init() call:
>  	 *   - adjusts musb->mregs
> diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
> index 7fb4819..498ae21 100644
> --- a/drivers/usb/musb/musb_core.h
> +++ b/drivers/usb/musb/musb_core.h
> @@ -46,6 +46,7 @@
>  #include <linux/usb.h>
>  #include <linux/usb/otg.h>
>  #include <linux/usb/musb.h>
> +#include <linux/phy/phy.h>
>  
>  struct musb;
>  struct musb_hw_ep;
> @@ -357,6 +358,7 @@ struct musb {
>  	u16			int_tx;
>  
>  	struct usb_phy		*xceiv;
> +	struct phy		*phy;
>  
>  	int nIrq;
>  	unsigned		irq_wake:1;
> @@ -434,6 +436,7 @@ struct musb {
>  	unsigned                double_buffer_not_ok:1;
>  
>  	struct musb_hdrc_config	*config;
> +	const char		*phy_label;
>  
>  #ifdef MUSB_CONFIG_PROC_FS
>  	struct proc_dir_entry *proc_entry;
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index 628b93f..c62a004 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -348,14 +348,24 @@ static int omap2430_musb_init(struct musb *musb)
>  	 * up through ULPI.  TWL4030-family PMICs include one,
>  	 * which needs a driver, drivers aren't always needed.
>  	 */
> -	if (dev->parent->of_node)
> +	if (dev->parent->of_node) {
> +		musb->phy = devm_phy_get(dev->parent, "usb2-phy");
> +
> +		/* We can't totally remove musb->xceiv as of now because
> +		 * musb core uses xceiv.state and xceiv.otg. Once we have
> +		 * a separate state machine to handle otg, these can be moved
> +		 * out of xceiv and then we can start using the generic PHY
> +		 * framework
> +		 */
>  		musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent,
>  		    "usb-phy", 0);
> -	else
> +	} else {
>  		musb->xceiv = devm_usb_get_phy_dev(dev, 0);
> +		musb->phy = devm_phy_get(dev, musb->phy_label);
> +	}
>  
> -	if (IS_ERR(musb->xceiv)) {
> -		status = PTR_ERR(musb->xceiv);
> +	if (IS_ERR(musb->xceiv) || IS_ERR(musb->phy)) {
> +		status = PTR_ERR(musb->xceiv) | PTR_ERR(musb->phy);
>  
>  		if (status == -ENXIO)
>  			return status;
> @@ -397,9 +407,10 @@ static int omap2430_musb_init(struct musb *musb)
>  	if (glue->status != OMAP_MUSB_UNKNOWN)
>  		omap_musb_set_mailbox(glue);
>  
> -	usb_phy_init(musb->xceiv);
> +	phy_init(musb->phy);
>  
>  	pm_runtime_put_noidle(musb->controller);
> +	phy_pm_runtime_put(musb->phy);

see, weird unbalanced calls :-)

Make it all explicit:

phy_pm_runtime_get_sync(phy);
phy_init(phy);
phy_pm_runtime_put(phy);

-- 
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