From: Tony Lindgren <tony@atomide.com>
To: linux-omap-open-source@linux.omap.com
Subject: [PATCH 3/6] musb_hdrc: Improve tusb clock handling
Date: Sun, 21 Oct 2007 16:20:53 -0700 [thread overview]
Message-ID: <11930088601320-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <11930088592326-git-send-email-tony@atomide.com>
Do not disable clock until in tusb_allow_idle()
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/usb/musb/tusb6010.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 85afdd2..c3285ac 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -277,13 +277,10 @@ static int tusb_draw_power(struct otg_transceiver *x, unsigned mA)
/*
* Keep clock active when enabled. Note that this is not tied to
* drawing VBUS, as with OTG mA can be less than musb->min_power.
+ * Note that peripheral osc_ck gets disabled in tusb_allow_idle().
*/
- if (musb->set_clock) {
- if (mA)
+ if (musb->set_clock && mA)
musb->set_clock(musb->clock, 1);
- else
- musb->set_clock(musb->clock, 0);
- }
/* tps65030 seems to consume max 100mA, with maybe 60mA available
* (measured on one board) for things other than tps and tusb.
@@ -342,6 +339,9 @@ static void tusb_set_clock_source(struct musb *musb, unsigned mode)
void __iomem *tbase = musb->ctrl_base;
u32 reg;
+ if (musb->set_clock && (mode == 1))
+ musb->set_clock(musb->clock, 1);
+
reg = musb_readl(tbase, TUSB_PRCM_CONF);
reg &= ~TUSB_PRCM_CONF_SYS_CLKSEL(0x3);
@@ -374,6 +374,9 @@ void tusb_allow_idle(struct musb *musb, u32 wakeup_enables)
tusb_wbus_quirk(musb, 1);
tusb_set_clock_source(musb, 0);
+ if ((musb_platform_get_vbus_status(musb) == 0)
+ && (musb->xceiv.state == OTG_STATE_B_IDLE))
+ musb->set_clock(musb->clock, 0);
wakeup_enables |= TUSB_PRCM_WNORCS;
musb_writel(tbase, TUSB_PRCM_WAKEUP_MASK, ~wakeup_enables);
@@ -587,8 +590,8 @@ static void tusb_source_power(struct musb *musb, int is_on)
devctl &= ~MUSB_DEVCTL_SESSION;
conf &= ~TUSB_DEV_CONF_USB_HOST_MODE;
- if (musb->set_clock)
- musb->set_clock(musb->clock, 0);
+
+ /* Host osc_ck gets released in tusb_allow_idle() */
}
prcm &= ~(TUSB_PRCM_MNGMT_15_SW_EN | TUSB_PRCM_MNGMT_33_SW_EN);
@@ -984,6 +987,9 @@ void musb_platform_disable(struct musb *musb)
del_timer(&musb_idle_timer);
+ if (musb->set_clock)
+ musb->set_clock(musb->clock, 0);
+
if (is_dma_capable() && !dma_off) {
printk(KERN_WARNING "%s %s: dma still active\n",
__FILE__, __FUNCTION__);
--
1.5.2.5
next prev parent reply other threads:[~2007-10-21 23:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-21 23:20 [PATCH 0/6] musb_hdrc: Improve tusb clocking, add musb_platform_wakeup() Tony Lindgren
2007-10-21 23:20 ` [PATCH 1/6] musb_hdrc: Removed nestedness in musb_gadget_ep0 Tony Lindgren
2007-10-21 23:20 ` [PATCH 2/6] musb_hdrc: Move tusb PLL locking code into a separate function Tony Lindgren
2007-10-21 23:20 ` Tony Lindgren [this message]
2007-10-21 23:20 ` [PATCH 4/6] musb_hdrc: Allow more time for HNP as a_wait_bcon Tony Lindgren
2007-10-21 23:20 ` [PATCH 5/6] musb_hdrc: Add musb_platform_wakeup() Tony Lindgren
2007-10-21 23:20 ` [PATCH 6/6] musb_hdrc: Handle b_host in musb_otg_timer_func() Tony Lindgren
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=11930088601320-git-send-email-tony@atomide.com \
--to=tony@atomide.com \
--cc=linux-omap-open-source@linux.omap.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.