* [PATCH v2 1/6] usb: phy: msm: Move mach depndend code to platform data
[not found] <1375081464-14206-1-git-send-email-iivanov@mm-sol.com>
@ 2013-07-29 7:04 ` Ivan T. Ivanov
2013-07-29 12:23 ` Felipe Balbi
2013-07-29 17:43 ` David Brown
0 siblings, 2 replies; 4+ messages in thread
From: Ivan T. Ivanov @ 2013-07-29 7:04 UTC (permalink / raw)
To: linux-arm-kernel
From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
This patch fix compilation error and is an intermediate step
before the addition of DeviceTree support for newer targets.
Fix suggested here: https://lkml.org/lkml/2013/6/19/381
Cc: David Brown <davidb@codeaurora.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-usb at vger.kernel.org
Signed-off-by: Ivan T. Ivanov <iivanov@mm-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 | 55 ++++++++++---------------------------
include/linux/usb/msm_hsusb.h | 3 ++
4 files changed, 87 insertions(+), 41 deletions(-)
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index db3d8c0..6b35953 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -31,6 +31,7 @@
#include <asm/setup.h>
#include <mach/board.h>
+#include <mach/clk.h>
#include <mach/msm_iomap.h>
#include <mach/dma.h>
@@ -61,10 +62,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 f14a73d..eb013f7 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -32,6 +32,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"
@@ -82,10 +83,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 d08f334..7b74b26 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"
@@ -306,51 +304,20 @@ static void ulpi_init(struct msm_otg *motg)
}
}
-static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
-{
- int ret;
-
- 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;
-
- ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT);
- if (ret) {
- dev_err(motg->phy.dev, "usb phy clk assert failed\n");
- return ret;
- }
- usleep_range(10000, 12000);
- ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT);
- if (ret)
- dev_err(motg->phy.dev, "usb phy clk deassert failed\n");
- return ret;
-}
-
static int msm_otg_phy_reset(struct msm_otg *motg)
{
+ struct msm_otg_platform_data *pdata = motg->pdata;
u32 val;
int ret;
int retries;
- ret = msm_otg_link_clk_reset(motg, 1);
+ ret = pdata->link_clk_reset(motg->clk, true);
if (ret)
return ret;
- ret = msm_otg_phy_clk_reset(motg);
+ ret = pdata->phy_clk_reset(motg->phy_reset_clk);
if (ret)
return ret;
- ret = msm_otg_link_clk_reset(motg, 0);
+ ret = pdata->link_clk_reset(motg->clk, false);
if (ret)
return ret;
@@ -362,7 +329,7 @@ static int msm_otg_phy_reset(struct msm_otg *motg)
ULPI_CLR(ULPI_FUNC_CTRL));
if (!ret)
break;
- ret = msm_otg_phy_clk_reset(motg);
+ ret = pdata->phy_clk_reset(motg->phy_reset_clk);
if (ret)
return ret;
}
@@ -370,7 +337,7 @@ static int msm_otg_phy_reset(struct msm_otg *motg)
return -ETIMEDOUT;
/* This reset calibrates the phy, if the above write succeeded */
- ret = msm_otg_phy_clk_reset(motg);
+ ret = pdata->phy_clk_reset(motg->phy_reset_clk);
if (ret)
return ret;
@@ -378,7 +345,7 @@ static int msm_otg_phy_reset(struct msm_otg *motg)
ret = ulpi_read(&motg->phy, ULPI_DEBUG);
if (ret != -ETIMEDOUT)
break;
- ret = msm_otg_phy_clk_reset(motg);
+ ret = pdata->phy_clk_reset(motg->phy_reset_clk);
if (ret)
return ret;
}
@@ -1414,16 +1381,22 @@ static void msm_otg_debugfs_cleanup(void)
static int __init msm_otg_probe(struct platform_device *pdev)
{
int ret = 0;
+ struct msm_otg_platform_data *pdata = pdev->dev.platform_data;
struct resource *res;
struct msm_otg *motg;
struct usb_phy *phy;
dev_info(&pdev->dev, "msm_otg probe\n");
- if (!pdev->dev.platform_data) {
+ if (!pdata) {
dev_err(&pdev->dev, "No platform data given. Bailing out\n");
return -ENODEV;
}
+ if (!pdata->phy_clk_reset || !pdata->link_clk_reset) {
+ dev_err(&pdev->dev, "No phy or link clock reset methods\n");
+ return -ENODEV;
+ }
+
motg = kzalloc(sizeof(struct msm_otg), GFP_KERNEL);
if (!motg) {
dev_err(&pdev->dev, "unable to allocate msm_otg\n");
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 22a396c..3275483 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -20,6 +20,7 @@
#include <linux/types.h>
#include <linux/usb/otg.h>
+#include <linux/clk.h>
/**
* Supported USB modes
@@ -135,6 +136,8 @@ struct msm_otg_platform_data {
enum msm_usb_phy_type phy_type;
void (*setup_gpio)(enum usb_otg_state state);
char *pclk_src_name;
+ int (*link_clk_reset)(struct clk *link_clk, bool assert);
+ int (*phy_clk_reset)(struct clk *phy_clk);
};
/**
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 1/6] usb: phy: msm: Move mach depndend code to platform data
2013-07-29 7:04 ` [PATCH v2 1/6] usb: phy: msm: Move mach depndend code to platform data Ivan T. Ivanov
@ 2013-07-29 12:23 ` Felipe Balbi
2013-07-29 19:02 ` Ivan T. Ivanov
2013-07-29 17:43 ` David Brown
1 sibling, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2013-07-29 12:23 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Mon, Jul 29, 2013 at 10:04:19AM +0300, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>
> This patch fix compilation error and is an intermediate step
> before the addition of DeviceTree support for newer targets.
> Fix suggested here: https://lkml.org/lkml/2013/6/19/381
>
> Cc: David Brown <davidb@codeaurora.org>
> Cc: Daniel Walker <dwalker@fifo99.com>
> Cc: Bryan Huntsman <bryanh@codeaurora.org>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Cc: linux-usb at vger.kernel.org
>
> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> ---
> arch/arm/mach-msm/board-msm7x30.c | 35 +++++++++++++++++++++++
> arch/arm/mach-msm/board-qsd8x50.c | 35 +++++++++++++++++++++++
I need acks for these.
> drivers/usb/phy/phy-msm-usb.c | 55 ++++++++++---------------------------
> include/linux/usb/msm_hsusb.h | 3 ++
> 4 files changed, 87 insertions(+), 41 deletions(-)
>
> diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
> index db3d8c0..6b35953 100644
> --- a/arch/arm/mach-msm/board-msm7x30.c
> +++ b/arch/arm/mach-msm/board-msm7x30.c
> @@ -31,6 +31,7 @@
> #include <asm/setup.h>
>
> #include <mach/board.h>
> +#include <mach/clk.h>
> #include <mach/msm_iomap.h>
> #include <mach/dma.h>
>
> @@ -61,10 +62,44 @@ static int hsusb_phy_init_seq[] = {
> -1
> };
>
> +static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
looks like you should be using the reset controller framework ?
(drivers/reset)
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130729/77f677a7/attachment-0001.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/6] usb: phy: msm: Move mach depndend code to platform data
2013-07-29 7:04 ` [PATCH v2 1/6] usb: phy: msm: Move mach depndend code to platform data Ivan T. Ivanov
2013-07-29 12:23 ` Felipe Balbi
@ 2013-07-29 17:43 ` David Brown
1 sibling, 0 replies; 4+ messages in thread
From: David Brown @ 2013-07-29 17:43 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 29, 2013 at 10:04:19AM +0300, Ivan T. Ivanov wrote:
>From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>
>This patch fix compilation error and is an intermediate step
>before the addition of DeviceTree support for newer targets.
>Fix suggested here: https://lkml.org/lkml/2013/6/19/381
>
>Cc: David Brown <davidb@codeaurora.org>
>Cc: Daniel Walker <dwalker@fifo99.com>
>Cc: Bryan Huntsman <bryanh@codeaurora.org>
>Cc: Felipe Balbi <balbi@ti.com>
>Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>Cc: linux-arm-kernel at lists.infradead.org
>Cc: linux-kernel at vger.kernel.org
>Cc: linux-usb at vger.kernel.org
>
>Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
>---
> arch/arm/mach-msm/board-msm7x30.c | 35 +++++++++++++++++++++++
> arch/arm/mach-msm/board-qsd8x50.c | 35 +++++++++++++++++++++++
Acked-by: David Brown <davidb@codeaurora.org>
--
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/6] usb: phy: msm: Move mach depndend code to platform data
2013-07-29 12:23 ` Felipe Balbi
@ 2013-07-29 19:02 ` Ivan T. Ivanov
0 siblings, 0 replies; 4+ messages in thread
From: Ivan T. Ivanov @ 2013-07-29 19:02 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
> > Cc: Bryan Huntsman <bryanh@codeaurora.org>
> > Cc: Felipe Balbi <balbi@ti.com>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: linux-arm-kernel at lists.infradead.org
> > Cc: linux-kernel at vger.kernel.org
> > Cc: linux-usb at vger.kernel.org
> >
> > Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> > ---
> > arch/arm/mach-msm/board-msm7x30.c | 35 +++++++++++++++++++++++
> > arch/arm/mach-msm/board-qsd8x50.c | 35 +++++++++++++++++++++++
>
> I need acks for these.
>
> > drivers/usb/phy/phy-msm-usb.c | 55 ++++++++++---------------------------
> > include/linux/usb/msm_hsusb.h | 3 ++
> > 4 files changed, 87 insertions(+), 41 deletions(-)
> >
> > diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
> > index db3d8c0..6b35953 100644
> > --- a/arch/arm/mach-msm/board-msm7x30.c
> > +++ b/arch/arm/mach-msm/board-msm7x30.c
> > @@ -31,6 +31,7 @@
> > #include <asm/setup.h>
> >
> > #include <mach/board.h>
> > +#include <mach/clk.h>
> > #include <mach/msm_iomap.h>
> > #include <mach/dma.h>
> >
> > @@ -61,10 +62,44 @@ static int hsusb_phy_init_seq[] = {
> > -1
> > };
> >
> > +static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
>
> looks like you should be using the reset controller framework ?
> (drivers/reset)
Probably, but there still nothing in place in the msm,
which provide this functionality. I am looking it to
right now.
Regards,
Ivan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-29 19:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1375081464-14206-1-git-send-email-iivanov@mm-sol.com>
2013-07-29 7:04 ` [PATCH v2 1/6] usb: phy: msm: Move mach depndend code to platform data Ivan T. Ivanov
2013-07-29 12:23 ` Felipe Balbi
2013-07-29 19:02 ` Ivan T. Ivanov
2013-07-29 17:43 ` David Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).