From: Pavankumar Kondeti <pkondeti@codeaurora.org>
To: greg@kroah.com, linux-usb@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, davidb@codeaurora.org,
sshtylyov@mvista.com, Anji jonnala <anjir@codeaurora.org>,
Pavankumar Kondeti <pkondeti@codeaurora.org>
Subject: [PATCH V4 2/5] USB: OTG: msm: vote for dayatona fabric clock
Date: Tue, 3 May 2011 10:43:50 +0530 [thread overview]
Message-ID: <1304399633-16120-3-git-send-email-pkondeti@codeaurora.org> (raw)
In-Reply-To: <1304399633-16120-1-git-send-email-pkondeti@codeaurora.org>
From: Anji jonnala <anjir@codeaurora.org>
HSUSB core clock is derived from daytona fabric clock and for
HSUSB operational require minimum core clock at 55MHz. Since, HSUSB
cannot tolerate daytona fabric clock change in the middle of HSUSB
operational, vote for maximum Daytona fabric clock
while usb is operational
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
---
drivers/usb/otg/msm_otg.c | 37 +++++++++++++++++++++++++++++++++++--
include/linux/usb/msm_hsusb.h | 7 +++++--
2 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index 2965986..cfbb606 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -324,6 +324,9 @@ static int msm_otg_suspend(struct msm_otg *motg)
if (motg->core_clk)
clk_disable(motg->core_clk);
+ if (!IS_ERR(motg->pclk_src))
+ clk_disable(motg->pclk_src);
+
if (device_may_wakeup(otg->dev))
enable_irq_wake(motg->irq);
if (bus)
@@ -347,6 +350,9 @@ static int msm_otg_resume(struct msm_otg *motg)
if (!atomic_read(&motg->in_lpm))
return 0;
+ if (!IS_ERR(motg->pclk_src))
+ clk_enable(motg->pclk_src);
+
clk_enable(motg->pclk);
clk_enable(motg->clk);
if (motg->core_clk)
@@ -862,12 +868,31 @@ static int __init msm_otg_probe(struct platform_device *pdev)
ret = PTR_ERR(motg->clk);
goto put_phy_reset_clk;
}
+ clk_set_rate(motg->clk, 60000000);
+
+ /*
+ * If USB Core is running its protocol engine based on CORE CLK,
+ * CORE CLK must be running at >55Mhz for correct HSUSB
+ * operation and USB core cannot tolerate frequency changes on
+ * CORE CLK. For such USB cores, vote for maximum clk frequency
+ * on pclk source
+ */
+ if (motg->pdata->pclk_src_name) {
+ motg->pclk_src = clk_get(&pdev->dev,
+ motg->pdata->pclk_src_name);
+ if (IS_ERR(motg->pclk_src))
+ goto put_clk;
+ clk_set_rate(motg->pclk_src, INT_MAX);
+ clk_enable(motg->pclk_src);
+ } else
+ motg->pclk_src = ERR_PTR(-ENOENT);
+
motg->pclk = clk_get(&pdev->dev, "usb_hs_pclk");
if (IS_ERR(motg->pclk)) {
dev_err(&pdev->dev, "failed to get usb_hs_pclk\n");
ret = PTR_ERR(motg->pclk);
- goto put_clk;
+ goto put_pclk_src;
}
/*
@@ -954,7 +979,11 @@ free_regs:
put_core_clk:
if (motg->core_clk)
clk_put(motg->core_clk);
- clk_put(motg->pclk);
+put_pclk_src:
+ if (!IS_ERR(motg->pclk_src)) {
+ clk_disable(motg->pclk_src);
+ clk_put(motg->pclk_src);
+ }
put_clk:
clk_put(motg->clk);
put_phy_reset_clk:
@@ -1004,6 +1033,10 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
clk_disable(motg->clk);
if (motg->core_clk)
clk_disable(motg->core_clk);
+ if (!IS_ERR(motg->pclk_src)) {
+ clk_disable(motg->pclk_src);
+ clk_put(motg->pclk_src);
+ }
iounmap(motg->regs);
pm_runtime_set_suspended(&pdev->dev);
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 3657403..31ef185 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -64,7 +64,8 @@ enum otg_control_type {
* @otg_control: OTG switch controlled by user/Id pin
* @default_mode: Default operational mode. Applicable only if
* OTG switch is controller by user.
- *
+ * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k
+ * dfab_usb_hs_clk in case of 8660 and 8960.
*/
struct msm_otg_platform_data {
int *phy_init_seq;
@@ -74,6 +75,7 @@ struct msm_otg_platform_data {
enum otg_control_type otg_control;
enum usb_mode_type default_mode;
void (*setup_gpio)(enum usb_otg_state state);
+ char *pclk_src_name;
};
/**
@@ -83,6 +85,7 @@ struct msm_otg_platform_data {
* @irq: IRQ number assigned for HSUSB controller.
* @clk: clock struct of usb_hs_clk.
* @pclk: clock struct of usb_hs_pclk.
+ * @pclk_src: pclk source for voting.
* @phy_reset_clk: clock struct of usb_phy_clk.
* @core_clk: clock struct of usb_hs_core_clk.
* @regs: ioremapped register base address.
@@ -90,7 +93,6 @@ struct msm_otg_platform_data {
* @sm_work: OTG state machine work.
* @in_lpm: indicates low power mode (LPM) state.
* @async_int: Async interrupt arrived.
- *
*/
struct msm_otg {
struct otg_transceiver otg;
@@ -98,6 +100,7 @@ struct msm_otg {
int irq;
struct clk *clk;
struct clk *pclk;
+ struct clk *pclk_src;
struct clk *phy_reset_clk;
struct clk *core_clk;
void __iomem *regs;
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
next prev parent reply other threads:[~2011-05-03 5:14 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 8:01 [PATCH 1/5] USB: gadget: Use Zero Interrupt Threshold Control for ci13xxx_msm Pavankumar Kondeti
2011-04-28 8:01 ` [PATCH 2/5] USB: OTG: vote for dayatona fabric clock Pavankumar Kondeti
2011-04-28 8:01 ` [PATCH 3/5] USB: OTG: msm: Implement charger detection Pavankumar Kondeti
2011-04-28 8:01 ` [PATCH 4/5] USB: OTG: msm: Configure PHY Analog and Digital voltage domains Pavankumar Kondeti
2011-04-29 10:14 ` Sergei Shtylyov
2011-05-02 6:03 ` Pavan Kondeti
2011-04-28 8:01 ` [PATCH 5/5] USB: OTG: msm: Add PHY suspend support for MSM8960 Pavankumar Kondeti
2011-04-28 14:49 ` Sergei Shtylyov
2011-04-29 5:20 ` Pavan Kondeti
2011-04-28 12:18 ` [PATCH 1/5] USB: gadget: Use Zero Interrupt Threshold Control for ci13xxx_msm Sergei Shtylyov
2011-04-29 5:16 ` Pavan Kondeti
2011-04-29 5:22 ` Pavankumar Kondeti
2011-04-29 5:22 ` [PATCH 2/5] USB: OTG: vote for dayatona fabric clock Pavankumar Kondeti
2011-04-29 5:22 ` [PATCH 4/5] USB: OTG: msm: Configure PHY Analog and Digital voltage domains Pavankumar Kondeti
[not found] ` <1304054532-3523-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-04-29 5:22 ` [PATCH 3/5] USB: OTG: msm: Implement charger detection Pavankumar Kondeti
2011-04-29 5:22 ` [PATCH 5/5] USB: OTG: msm: Add PHY suspend support for MSM8960 Pavankumar Kondeti
2011-05-02 6:36 ` [PATCH V2 0/5] USB Charging, PHY init and " Pavankumar Kondeti
2011-05-02 6:36 ` [PATCH V2 1/5] USB: gadget: Use Zero Interrupt Threshold Control for ci13xxx_msm Pavankumar Kondeti
2011-05-02 6:36 ` [PATCH V2 2/5] USB: OTG: vote for dayatona fabric clock Pavankumar Kondeti
2011-05-02 6:36 ` [PATCH V2 3/5] USB: OTG: msm: Implement charger detection Pavankumar Kondeti
[not found] ` <1304318192-24374-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-02 6:36 ` [PATCH V2 4/5] USB: OTG: msm: Configure PHY Analog and Digital voltage domains Pavankumar Kondeti
2011-05-02 6:36 ` [PATCH V2 5/5] USB: OTG: msm: Add PHY suspend support for MSM8960 Pavankumar Kondeti
2011-05-02 12:22 ` Sergei Shtylyov
2011-05-03 5:01 ` Pavan Kondeti
[not found] ` <1303977693-18389-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-02 9:58 ` [PATCH V3 0/5] USB Charging, PHY init and " Pavankumar Kondeti
[not found] ` <1304330325-21982-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-02 9:58 ` [PATCH V3 1/5] USB: gadget: Use Zero Interrupt Threshold Control for ci13xxx_msm Pavankumar Kondeti
2011-05-02 9:58 ` [PATCH V3 2/5] USB: OTG: msm: vote for dayatona fabric clock Pavankumar Kondeti
2011-05-02 9:58 ` [PATCH V3 3/5] USB: OTG: msm: Implement charger detection Pavankumar Kondeti
2011-05-02 9:58 ` [PATCH V3 4/5] USB: OTG: msm: Configure PHY Analog and Digital voltage domains Pavankumar Kondeti
2011-05-02 9:58 ` [PATCH V3 5/5] USB: OTG: msm: Add PHY suspend support for MSM8960 Pavankumar Kondeti
2011-05-03 5:13 ` [PATCH V4 0/5] USB Charging, PHY init and " Pavankumar Kondeti
[not found] ` <1304399633-16120-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-03 5:13 ` [PATCH V4 1/5] USB: gadget: Use Zero Interrupt Threshold Control for ci13xxx_msm Pavankumar Kondeti
2011-05-03 5:13 ` Pavankumar Kondeti [this message]
[not found] ` <1304399633-16120-3-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-03 11:14 ` [PATCH V4 2/5] USB: OTG: msm: vote for dayatona fabric clock Sergei Shtylyov
2011-05-03 12:29 ` Pavan Kondeti
2011-05-03 17:15 ` Greg KH
2011-05-04 4:48 ` Pavan Kondeti
2011-05-03 5:13 ` [PATCH V4 3/5] USB: OTG: msm: Implement charger detection Pavankumar Kondeti
2011-05-03 5:13 ` [PATCH V4 4/5] USB: OTG: msm: Configure PHY Analog and Digital voltage domains Pavankumar Kondeti
2011-05-03 5:13 ` [PATCH V4 5/5] USB: OTG: msm: Add PHY suspend support for MSM8960 Pavankumar Kondeti
2011-05-04 4:49 ` [PATCH V5 0/4] USB Charging, PHY init and " Pavankumar Kondeti
2011-05-04 4:49 ` [PATCH V5 1/4] USB: OTG: msm: vote for dayatona fabric clock Pavankumar Kondeti
2011-05-04 4:49 ` [PATCH V5 2/4] USB: OTG: msm: Implement charger detection Pavankumar Kondeti
[not found] ` <1304484589-17186-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-04 4:49 ` [PATCH V5 3/4] USB: OTG: msm: Configure PHY Analog and Digital voltage domains Pavankumar Kondeti
2011-05-04 4:49 ` [PATCH V5 4/4] USB: OTG: msm: Add PHY suspend support for MSM8960 Pavankumar Kondeti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1304399633-16120-3-git-send-email-pkondeti@codeaurora.org \
--to=pkondeti@codeaurora.org \
--cc=anjir@codeaurora.org \
--cc=davidb@codeaurora.org \
--cc=greg@kroah.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sshtylyov@mvista.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).