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]
Date:	Tue, 15 Oct 2013 10:01:03 +0300
From:	"Ivan T. Ivanov" <iivanov@...sol.com>
To:	balbi@...com
Cc:	rob.herring@...xeda.com, pawel.moll@....com, mark.rutland@....com,
	swarren@...dotorg.org, ijc+devicetree@...lion.org.uk,
	rob@...dley.net, davidb@...eaurora.org, dwalker@...o99.com,
	bryanh@...eaurora.org, linux@....linux.org.uk,
	gregkh@...uxfoundation.org, grant.likely@...aro.org,
	jackp@...eaurora.org, mgautam@...eaurora.org,
	dsegal@...eaurora.org, linux-usb@...r.kernel.org,
	devicetree@...r.kernel.org, linux-doc@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3 01/13] usb: phy: msm: Move mach depndend code to
 platform data

On Mon, 2013-10-14 at 17:52 -0500, Felipe Balbi wrote: 
> Hi,
> 
> On Mon, Oct 14, 2013 at 06:24:28PM +0300, Ivan T. Ivanov wrote:
> > From: "Ivan T. Ivanov" <iivanov@...sol.com>
> > 
> > This patch fix compilation error and is an intermediate step
> > before the addition of DeviceTree support for newer targets.
> > 
> > Cc: David Brown <davidb@...eaurora.org>
> > Cc: Daniel Walker <dwalker@...o99.com>
> > Cc: Felipe Balbi <balbi@...com>
> > Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > Signed-off-by: Ivan T. Ivanov <iivanov@...sol.com>
> > ---
> >  arch/arm/mach-msm/board-msm7x30.c |   35 +++++++++++++++++++++++++++++++++++
> >  arch/arm/mach-msm/board-qsd8x50.c |   35 +++++++++++++++++++++++++++++++++++
> >  drivers/usb/phy/phy-msm-usb.c     |   34 ++++++++++++++--------------------
> >  include/linux/usb/msm_hsusb.h     |    3 +++
> >  4 files changed, 87 insertions(+), 20 deletions(-)
> > 
> > diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
> > index f9af5a4..46de789 100644
> > --- a/arch/arm/mach-msm/board-msm7x30.c
> > +++ b/arch/arm/mach-msm/board-msm7x30.c
> > @@ -30,6 +30,7 @@
> >  #include <asm/memory.h>
> >  #include <asm/setup.h>
> >  
> > +#include <mach/clk.h>
> >  #include <mach/msm_iomap.h>
> >  #include <mach/dma.h>
> >  
> > @@ -60,10 +61,44 @@ static int hsusb_phy_init_seq[] = {
> >  	-1
> >  };
> >  
> > +static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
> > +{
> > +	int ret;
> > +
> > +	if (assert) {
> > +		ret = clk_reset(link_clk, CLK_RESET_ASSERT);
> > +		if (ret)
> > +			pr_err("usb hs_clk assert failed\n");
> > +	} else {
> > +		ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
> > +		if (ret)
> > +			pr_err("usb hs_clk deassert failed\n");
> > +	}
> > +	return ret;
> > +}
> > +
> > +static int hsusb_phy_clk_reset(struct clk *phy_clk)
> > +{
> > +	int ret;
> > +
> > +	ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
> > +	if (ret) {
> > +		pr_err("usb phy clk assert failed\n");
> > +		return ret;
> > +	}
> > +	usleep_range(10000, 12000);
> > +	ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
> > +	if (ret)
> > +		pr_err("usb phy clk deassert failed\n");
> > +	return ret;
> > +}
> > +
> >  static struct msm_otg_platform_data msm_otg_pdata = {
> >  	.phy_init_seq		= hsusb_phy_init_seq,
> >  	.mode                   = USB_PERIPHERAL,
> >  	.otg_control		= OTG_PHY_CONTROL,
> > +	.link_clk_reset		= hsusb_link_clk_reset,
> > +	.phy_clk_reset		= hsusb_phy_clk_reset,
> >  };
> >  
> >  struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
> > diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
> > index 5f933bc..9169ec3 100644
> > --- a/arch/arm/mach-msm/board-qsd8x50.c
> > +++ b/arch/arm/mach-msm/board-qsd8x50.c
> > @@ -31,6 +31,7 @@
> >  #include <mach/irqs.h>
> >  #include <mach/sirc.h>
> >  #include <mach/vreg.h>
> > +#include <mach/clk.h>
> >  #include <linux/platform_data/mmc-msm_sdcc.h>
> >  
> >  #include "devices.h"
> > @@ -81,10 +82,44 @@ static int hsusb_phy_init_seq[] = {
> >  	-1
> >  };
> >  
> > +static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
> > +{
> > +	int ret;
> > +
> > +	if (assert) {
> > +		ret = clk_reset(link_clk, CLK_RESET_ASSERT);
> > +		if (ret)
> > +			pr_err("usb hs_clk assert failed\n");
> > +	} else {
> > +		ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
> > +		if (ret)
> > +			pr_err("usb hs_clk deassert failed\n");
> > +	}
> > +	return ret;
> > +}
> > +
> > +static int hsusb_phy_clk_reset(struct clk *phy_clk)
> > +{
> > +	int ret;
> > +
> > +	ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
> > +	if (ret) {
> > +		pr_err("usb phy clk assert failed\n");
> > +		return ret;
> > +	}
> > +	usleep_range(10000, 12000);
> > +	ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
> > +	if (ret)
> > +		pr_err("usb phy clk deassert failed\n");
> > +	return ret;
> > +}
> > +
> >  static struct msm_otg_platform_data msm_otg_pdata = {
> >  	.phy_init_seq		= hsusb_phy_init_seq,
> >  	.mode                   = USB_PERIPHERAL,
> >  	.otg_control		= OTG_PHY_CONTROL,
> > +	.link_clk_reset		= hsusb_link_clk_reset,
> > +	.phy_clk_reset		= hsusb_phy_clk_reset,
> >  };
> >  
> >  static struct platform_device *devices[] __initdata = {
> > diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> > index e9d4cd9..118798d 100644
> > --- a/drivers/usb/phy/phy-msm-usb.c
> > +++ b/drivers/usb/phy/phy-msm-usb.c
> > @@ -40,8 +40,6 @@
> >  #include <linux/usb/msm_hsusb_hw.h>
> >  #include <linux/regulator/consumer.h>
> >  
> > -#include <mach/clk.h>
> > -
> >  #define MSM_USB_BASE	(motg->regs)
> >  #define DRIVER_NAME	"msm_otg"
> >  
> > @@ -308,33 +306,29 @@ static void ulpi_init(struct msm_otg *motg)
> >  
> >  static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
> >  {
> > -	int ret;
> > +	int ret = 0;
> > +
> > +	if (!motg->pdata->link_clk_reset)
> > +		return ret;
> > +
> > +	ret = motg->pdata->link_clk_reset(motg->clk, assert);
> > +	if (ret)
> > +		dev_err(motg->phy.dev, "usb link clk reset failed\n");
> >  
> > -	if (assert) {
> > -		ret = clk_reset(motg->clk, CLK_RESET_ASSERT);
> > -		if (ret)
> > -			dev_err(motg->phy.dev, "usb hs_clk assert failed\n");
> > -	} else {
> > -		ret = clk_reset(motg->clk, CLK_RESET_DEASSERT);
> > -		if (ret)
> > -			dev_err(motg->phy.dev, "usb hs_clk deassert failed\n");
> > -	}
> >  	return ret;
> >  }
> >  
> >  static int msm_otg_phy_clk_reset(struct msm_otg *motg)
> >  {
> > -	int ret;
> > +	int ret = 0;
> >  
> > -	ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT);
> > -	if (ret) {
> > -		dev_err(motg->phy.dev, "usb phy clk assert failed\n");
> > +	if (!motg->pdata->phy_clk_reset)
> >  		return ret;
> > -	}
> > -	usleep_range(10000, 12000);
> > -	ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT);
> > +
> > +	ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk);
> >  	if (ret)
> > -		dev_err(motg->phy.dev, "usb phy clk deassert failed\n");
> > +		dev_err(motg->phy.dev, "usb phy clk assert failed\n");
> 
> seems like you're doing more than *just* fixing the build error. Which
> build error do you get ?

clk_reset() is defined only in mach code which is not available in 
multi platform builds. But you are right, probably I have to mention
that some error messages are also changed. 

With this change driver will loss ability to reset PHY and LINk
controllers on newer targets, but I don't think it is functional 
on them right now (driver resources are not defined on these
boards). I am planing to add reset framework support to driver in
order to support them.

Regards,
Ivan


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ