* [PATCH v2 1/5] usb: musb: move port reset to worker
2013-10-01 13:39 [PATCH v2 0/5] usb: musb_dsps: support for suspend and resume Daniel Mack
@ 2013-10-01 13:39 ` Daniel Mack
2013-10-02 10:46 ` Sebastian Andrzej Siewior
[not found] ` <1380634797-29541-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (3 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Daniel Mack @ 2013-10-01 13:39 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, neumann, bigeasy, vinod.koul, dan.j.williams, balbi,
Daniel Mack
musb_port_reset() sleeps, so we can't call it from atomic context. It
is, however, called from places inside musb_hub_control() while
&musb->lock is held, which leads to a "scheduling while atomic" warning.
Fix this by moving the logic into a worker, and call it where the
function was previously called directly.
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
drivers/usb/musb/musb_core.c | 7 +++++++
drivers/usb/musb/musb_core.h | 3 +++
drivers/usb/musb/musb_host.h | 2 ++
drivers/usb/musb/musb_virthub.c | 13 ++++++++-----
4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 18e877f..2b9f4b4 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1699,6 +1699,12 @@ static void musb_irq_work(struct work_struct *data)
}
}
+static void musb_port_reset_work(struct work_struct *data)
+{
+ struct musb *musb = container_of(data, struct musb, port_reset_work);
+ musb_port_reset(musb);
+}
+
/* --------------------------------------------------------------------------
* Init support
*/
@@ -1857,6 +1863,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
/* Init IRQ workqueue before request_irq */
INIT_WORK(&musb->irq_work, musb_irq_work);
+ INIT_WORK(&musb->port_reset_work, musb_port_reset_work);
/* attach to the IRQ */
if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 65f3917..9529512 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -294,6 +294,9 @@ struct musb {
irqreturn_t (*isr)(int, void *);
struct work_struct irq_work;
+ struct work_struct port_reset_work;
+ bool port_reset_state;
+
u16 hwvers;
u16 intrrxe;
diff --git a/drivers/usb/musb/musb_host.h b/drivers/usb/musb/musb_host.h
index 960d735..843f48e 100644
--- a/drivers/usb/musb/musb_host.h
+++ b/drivers/usb/musb/musb_host.h
@@ -92,6 +92,7 @@ extern void musb_host_rx(struct musb *, u8);
extern void musb_root_disconnect(struct musb *musb);
extern void musb_host_resume_root_hub(struct musb *musb);
extern void musb_host_poke_root_hub(struct musb *musb);
+extern void musb_port_reset(struct musb *musb);
#else
static inline struct musb *hcd_to_musb(struct usb_hcd *hcd)
{
@@ -121,6 +122,7 @@ static inline void musb_root_disconnect(struct musb *musb) {}
static inline void musb_host_resume_root_hub(struct musb *musb) {}
static inline void musb_host_poll_rh_status(struct musb *musb) {}
static inline void musb_host_poke_root_hub(struct musb *musb) {}
+static inline void musb_port_reset(struct musb *musb) {}
#endif
struct usb_hcd;
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index a523950..30b43a1 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -155,7 +155,7 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend)
}
}
-static void musb_port_reset(struct musb *musb, bool do_reset)
+void musb_port_reset(struct musb *musb)
{
u8 power;
void __iomem *mbase = musb->mregs;
@@ -173,7 +173,7 @@ static void musb_port_reset(struct musb *musb, bool do_reset)
* the appropriate amount of time has passed
*/
power = musb_readb(mbase, MUSB_POWER);
- if (do_reset) {
+ if (musb->port_reset_state) {
/*
* If RESUME is set, we must make sure it stays minimum 20 ms.
@@ -356,8 +356,10 @@ int musb_hub_control(
/* finish RESET signaling? */
if ((musb->port1_status & USB_PORT_STAT_RESET)
- && time_after_eq(jiffies, musb->rh_timer))
- musb_port_reset(musb, false);
+ && time_after_eq(jiffies, musb->rh_timer)) {
+ musb->port_reset_state = false;
+ schedule_work(&musb->port_reset_work);
+ }
/* finish RESUME signaling? */
if ((musb->port1_status & MUSB_PORT_STAT_RESUME)
@@ -412,7 +414,8 @@ int musb_hub_control(
musb_start(musb);
break;
case USB_PORT_FEAT_RESET:
- musb_port_reset(musb, true);
+ musb->port_reset_state = true;
+ schedule_work(&musb->port_reset_work);
break;
case USB_PORT_FEAT_SUSPEND:
musb_port_suspend(musb, true);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/5] usb: musb: move port reset to worker
2013-10-01 13:39 ` [PATCH v2 1/5] usb: musb: move port reset to worker Daniel Mack
@ 2013-10-02 10:46 ` Sebastian Andrzej Siewior
2013-10-02 11:19 ` Daniel Mack
0 siblings, 1 reply; 16+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-10-02 10:46 UTC (permalink / raw)
To: Daniel Mack
Cc: linux-usb, linux-omap, neumann, vinod.koul, dan.j.williams, balbi
* Daniel Mack | 2013-10-01 15:39:53 [+0200]:
>musb_port_reset() sleeps, so we can't call it from atomic context. It
>is, however, called from places inside musb_hub_control() while
>&musb->lock is held, which leads to a "scheduling while atomic" warning.
I guess you are hit by the msleep(1) here.
>Fix this by moving the logic into a worker, and call it where the
>function was previously called directly.
I *think* the better approach here would be to replace the msleep(1) by
a busy loop. The thing is that you do now want to continue the operation
and having the reset in progress. It should complete _right_ _now_ i.e.
SET_PORT_FEATURE RESET is completed before the the next SET/GET request
arrives and with a workqueue you can not guarantee this.
>Signed-off-by: Daniel Mack <zonque@gmail.com>
Sebastian
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/5] usb: musb: move port reset to worker
2013-10-02 10:46 ` Sebastian Andrzej Siewior
@ 2013-10-02 11:19 ` Daniel Mack
0 siblings, 0 replies; 16+ messages in thread
From: Daniel Mack @ 2013-10-02 11:19 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-usb, linux-omap, neumann, vinod.koul, dan.j.williams, balbi
On 02.10.2013 12:46, Sebastian Andrzej Siewior wrote:
> * Daniel Mack | 2013-10-01 15:39:53 [+0200]:
>
>> musb_port_reset() sleeps, so we can't call it from atomic context. It
>> is, however, called from places inside musb_hub_control() while
>> &musb->lock is held, which leads to a "scheduling while atomic" warning.
>
> I guess you are hit by the msleep(1) here.
Yes.
>> Fix this by moving the logic into a worker, and call it where the
>> function was previously called directly.
>
> I *think* the better approach here would be to replace the msleep(1) by
> a busy loop. The thing is that you do now want to continue the operation
> and having the reset in progress. It should complete _right_ _now_ i.e.
> SET_PORT_FEATURE RESET is completed before the the next SET/GET request
> arrives and with a workqueue you can not guarantee this.
Hmm, ok. I'm just not sure what time periods we're really sleeping for
here. After all, we're blocking all interrupts from occuring while the
lock is held.
So my question is rather whether it's sensible at all to hold the lock
while waiting. We might change some of the execution pathes to mutexes
and waitqueues as well. Felipe?
Thanks,
Daniel
^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <1380634797-29541-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH v2 2/5] usb: musb: call musb_port_suspend from musb_bus_suspend
[not found] ` <1380634797-29541-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-10-01 13:39 ` Daniel Mack
2013-10-02 10:49 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 16+ messages in thread
From: Daniel Mack @ 2013-10-01 13:39 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, neumann-SRDuVqtxQLSzQB+pC5nmwQ,
bigeasy-hfZtesqFncYOwBW4kG4KsQ, vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w, balbi-l0cyMroinI0,
Daniel Mack
Make musb_port_suspend() externally available, and call it when to host
goes into suspend. This allows the core to go into suspend while a
device is connected.
Signed-off-by: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/musb_host.c | 2 ++
drivers/usb/musb/musb_host.h | 2 ++
drivers/usb/musb/musb_virthub.c | 2 +-
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 9a2b8c8..2b60596 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2433,6 +2433,8 @@ static int musb_bus_suspend(struct usb_hcd *hcd)
struct musb *musb = hcd_to_musb(hcd);
u8 devctl;
+ musb_port_suspend(musb, true);
+
if (!is_host_active(musb))
return 0;
diff --git a/drivers/usb/musb/musb_host.h b/drivers/usb/musb/musb_host.h
index 843f48e..dcffea7 100644
--- a/drivers/usb/musb/musb_host.h
+++ b/drivers/usb/musb/musb_host.h
@@ -93,6 +93,7 @@ extern void musb_root_disconnect(struct musb *musb);
extern void musb_host_resume_root_hub(struct musb *musb);
extern void musb_host_poke_root_hub(struct musb *musb);
extern void musb_port_reset(struct musb *musb);
+extern void musb_port_suspend(struct musb *musb, bool do_suspend);
#else
static inline struct musb *hcd_to_musb(struct usb_hcd *hcd)
{
@@ -123,6 +124,7 @@ static inline void musb_host_resume_root_hub(struct musb *musb) {}
static inline void musb_host_poll_rh_status(struct musb *musb) {}
static inline void musb_host_poke_root_hub(struct musb *musb) {}
static inline void musb_port_reset(struct musb *musb) {}
+static inline void musb_port_suspend(struct musb *musb, bool do_suspend) {}
#endif
struct usb_hcd;
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index 30b43a1..9f3a0f3 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -90,7 +90,7 @@ static void musb_start(struct musb *musb)
musb_writeb(regs, MUSB_DEVCTL, devctl);
}
-static void musb_port_suspend(struct musb *musb, bool do_suspend)
+void musb_port_suspend(struct musb *musb, bool do_suspend)
{
struct usb_otg *otg = musb->xceiv->otg;
u8 power;
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/5] usb: musb: call musb_port_suspend from musb_bus_suspend
2013-10-01 13:39 ` [PATCH v2 2/5] usb: musb: call musb_port_suspend from musb_bus_suspend Daniel Mack
@ 2013-10-02 10:49 ` Sebastian Andrzej Siewior
2013-10-02 11:14 ` Daniel Mack
0 siblings, 1 reply; 16+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-10-02 10:49 UTC (permalink / raw)
To: Daniel Mack
Cc: linux-usb, linux-omap, neumann, vinod.koul, dan.j.williams, balbi
* Daniel Mack | 2013-10-01 15:39:54 [+0200]:
>Make musb_port_suspend() externally available, and call it when to host
>goes into suspend. This allows the core to go into suspend while a
>device is connected.
Sorry for asking this stupid question but what is usally happening when
the host goes to suspend and a device is connected? I think it is
disconnected & re-enumerated and resume and this not what you want,
right?
What happens if the device is unplugged while the host is suspended and
not there on resume?
>Signed-off-by: Daniel Mack <zonque@gmail.com>
Sebastian
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/5] usb: musb: call musb_port_suspend from musb_bus_suspend
2013-10-02 10:49 ` Sebastian Andrzej Siewior
@ 2013-10-02 11:14 ` Daniel Mack
[not found] ` <524C001B.8040901-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Daniel Mack @ 2013-10-02 11:14 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-usb, linux-omap, neumann, vinod.koul, dan.j.williams, balbi
On 02.10.2013 12:49, Sebastian Andrzej Siewior wrote:
> * Daniel Mack | 2013-10-01 15:39:54 [+0200]:
>
>> Make musb_port_suspend() externally available, and call it when to host
>> goes into suspend. This allows the core to go into suspend while a
>> device is connected.
>
> Sorry for asking this stupid question but what is usally happening when
> the host goes to suspend and a device is connected? I think it is
> disconnected & re-enumerated and resume and this not what you want,
> right?
It is usually put into USB suspend and the host preserves its state.
After resume, the usb storage driver, for example, will not register new
partitions but expect things to be as they were before. That is, your
previously mounted devices remain functional.
However, the enumeration process has to be done again, because when the
device looses power, it can't memorize its address.
> What happens if the device is unplugged while the host is suspended and
> not there on resume?
That condition is detected and a full teardown of the connected drivers
is conducted. Try what happens on your notebook when you do that.
Embedded systems should behave just the same.
Daniel
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 3/5] usb: musb: conditionally save and restore the context on suspend
2013-10-01 13:39 [PATCH v2 0/5] usb: musb_dsps: support for suspend and resume Daniel Mack
2013-10-01 13:39 ` [PATCH v2 1/5] usb: musb: move port reset to worker Daniel Mack
[not found] ` <1380634797-29541-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-10-01 13:39 ` Daniel Mack
2013-10-01 13:39 ` [PATCH v2 4/5] usb: musb: dsps: add {tx,rx}_mode to wrapper Daniel Mack
2013-10-01 13:39 ` [PATCH v2 5/5] usb: musb: dsps: add support for suspend and resume Daniel Mack
4 siblings, 0 replies; 16+ messages in thread
From: Daniel Mack @ 2013-10-01 13:39 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, neumann, bigeasy, vinod.koul, dan.j.williams, balbi,
Daniel Mack
It appears not all platforms featuring a musb core need to save the musb
core registers at suspend time and restore them on resume.
The dsps platform does, however. So add a bit in struct
musb_hdrc_platform_data to let platforms specify their need of such
action being taken.
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
drivers/usb/musb/musb_core.c | 17 ++++++++++++++++-
include/linux/usb/musb.h | 1 +
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2b9f4b4..f17604e 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2152,6 +2152,7 @@ static int musb_suspend(struct device *dev)
{
struct musb *musb = dev_to_musb(dev);
unsigned long flags;
+ struct musb_hdrc_platform_data *plat = dev_get_platdata(dev);
spin_lock_irqsave(&musb->lock, flags);
@@ -2165,16 +2166,30 @@ static int musb_suspend(struct device *dev)
*/
}
+ if (plat->restore_after_suspend)
+ musb_save_context(musb);
+
spin_unlock_irqrestore(&musb->lock, flags);
return 0;
}
static int musb_resume_noirq(struct device *dev)
{
- /* for static cmos like DaVinci, register values were preserved
+ struct musb *musb = dev_to_musb(dev);
+ struct musb_hdrc_platform_data *plat = dev_get_platdata(dev);
+
+ /*
+ * For static cmos like DaVinci, register values were preserved
* unless for some reason the whole soc powered down or the USB
* module got reset through the PSC (vs just being disabled).
+ *
+ * The plaform data tells us about the necessity of saving and
+ * restoring the context across a suspend cycle.
*/
+
+ if (plat->restore_after_suspend)
+ musb_restore_context(musb);
+
return 0;
}
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 053c268..296be6c 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -100,6 +100,7 @@ struct musb_hdrc_platform_data {
u8 mode;
u8 has_mailbox:1;
+ u8 restore_after_suspend:1;
/* for clk_get() */
const char *clock;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 4/5] usb: musb: dsps: add {tx,rx}_mode to wrapper
2013-10-01 13:39 [PATCH v2 0/5] usb: musb_dsps: support for suspend and resume Daniel Mack
` (2 preceding siblings ...)
2013-10-01 13:39 ` [PATCH v2 3/5] usb: musb: conditionally save and restore the context on suspend Daniel Mack
@ 2013-10-01 13:39 ` Daniel Mack
2013-10-01 13:39 ` [PATCH v2 5/5] usb: musb: dsps: add support for suspend and resume Daniel Mack
4 siblings, 0 replies; 16+ messages in thread
From: Daniel Mack @ 2013-10-01 13:39 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, neumann, bigeasy, vinod.koul, dan.j.williams, balbi,
Daniel Mack
rx_mode and tx_mode need to be read at suspend time and restored on
resume for dsps platforms. So add it to the wrapper struct first, and
initialize the values.
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
drivers/usb/musb/musb_dsps.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 4047cbb..f3085bc 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -83,6 +83,8 @@ struct dsps_musb_wrapper {
u16 coreintr_status;
u16 phy_utmi;
u16 mode;
+ u16 tx_mode;
+ u16 rx_mode;
/* bit positions for control */
unsigned reset:5;
@@ -600,6 +602,8 @@ static const struct dsps_musb_wrapper am33xx_driver_data = {
.coreintr_status = 0x34,
.phy_utmi = 0xe0,
.mode = 0xe8,
+ .tx_mode = 0x70,
+ .rx_mode = 0x74,
.reset = 0,
.otg_disable = 21,
.iddig = 8,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 5/5] usb: musb: dsps: add support for suspend and resume
2013-10-01 13:39 [PATCH v2 0/5] usb: musb_dsps: support for suspend and resume Daniel Mack
` (3 preceding siblings ...)
2013-10-01 13:39 ` [PATCH v2 4/5] usb: musb: dsps: add {tx,rx}_mode to wrapper Daniel Mack
@ 2013-10-01 13:39 ` Daniel Mack
2013-10-01 14:59 ` Felipe Balbi
4 siblings, 1 reply; 16+ messages in thread
From: Daniel Mack @ 2013-10-01 13:39 UTC (permalink / raw)
To: linux-usb
Cc: linux-omap, neumann, bigeasy, vinod.koul, dan.j.williams, balbi,
Daniel Mack
The dsps platform needs to save save some registers at suspend time and
restore them after resume. This patch adds a struct for these registers,
and also lets the musb core know that the core registers need to be
saved as well.
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
drivers/usb/musb/musb_dsps.c | 60 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index f3085bc..ac68e29 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -112,6 +112,19 @@ struct dsps_musb_wrapper {
u8 poll_seconds;
};
+/*
+ * register shadow for suspend
+ */
+struct dsps_context {
+ u32 control;
+ u32 epintr;
+ u32 coreintr;
+ u32 phy_utmi;
+ u32 mode;
+ u32 tx_mode;
+ u32 rx_mode;
+};
+
/**
* DSPS glue structure.
*/
@@ -121,6 +134,8 @@ struct dsps_glue {
const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
struct timer_list timer; /* otg_workaround timer */
unsigned long last_timer; /* last timer data for each instance */
+
+ struct dsps_context context;
};
/**
@@ -504,6 +519,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
}
pdata.config = config;
pdata.platform_ops = &dsps_ops;
+ pdata.restore_after_suspend = 1;
config->num_eps = get_int_prop(dn, "mentor,num-eps");
config->ram_bits = get_int_prop(dn, "mentor,ram-bits");
@@ -627,11 +643,55 @@ static const struct of_device_id musb_dsps_of_match[] = {
};
MODULE_DEVICE_TABLE(of, musb_dsps_of_match);
+#ifdef CONFIG_PM
+static int dsps_suspend(struct device *dev)
+{
+ struct dsps_glue *glue = dev_get_drvdata(dev);
+ const struct dsps_musb_wrapper *wrp = glue->wrp;
+ struct musb *musb = platform_get_drvdata(glue->musb);
+ void __iomem *mbase = musb->ctrl_base;
+
+ glue->context.control = dsps_readl(mbase, wrp->control);
+ glue->context.epintr = dsps_readl(mbase, wrp->epintr_set);
+ glue->context.coreintr = dsps_readl(mbase, wrp->coreintr_set);
+ glue->context.phy_utmi = dsps_readl(mbase, wrp->phy_utmi);
+ glue->context.mode = dsps_readl(mbase, wrp->mode);
+ glue->context.tx_mode = dsps_readl(mbase, wrp->tx_mode);
+ glue->context.rx_mode = dsps_readl(mbase, wrp->rx_mode);
+
+ return 0;
+}
+
+static int dsps_resume(struct device *dev)
+{
+ struct dsps_glue *glue = dev_get_drvdata(dev);
+ const struct dsps_musb_wrapper *wrp = glue->wrp;
+ struct musb *musb = platform_get_drvdata(glue->musb);
+ void __iomem *mbase = musb->ctrl_base;
+
+ dsps_writel(mbase, wrp->control, glue->context.control);
+ dsps_writel(mbase, wrp->epintr_set, glue->context.epintr);
+ dsps_writel(mbase, wrp->coreintr_set, glue->context.coreintr);
+ dsps_writel(mbase, wrp->phy_utmi, glue->context.phy_utmi);
+ dsps_writel(mbase, wrp->mode, glue->context.mode);
+ dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode);
+ dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode);
+
+ musb->port_reset_state = false;
+ schedule_work(&musb->port_reset_work);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume);
+
static struct platform_driver dsps_usbss_driver = {
.probe = dsps_probe,
.remove = dsps_remove,
.driver = {
.name = "musb-dsps",
+ .pm = &dsps_pm_ops,
.of_match_table = of_match_ptr(musb_dsps_of_match),
},
};
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 5/5] usb: musb: dsps: add support for suspend and resume
2013-10-01 13:39 ` [PATCH v2 5/5] usb: musb: dsps: add support for suspend and resume Daniel Mack
@ 2013-10-01 14:59 ` Felipe Balbi
2013-10-01 15:04 ` Daniel Mack
0 siblings, 1 reply; 16+ messages in thread
From: Felipe Balbi @ 2013-10-01 14:59 UTC (permalink / raw)
To: Daniel Mack
Cc: linux-usb, linux-omap, neumann, bigeasy, vinod.koul,
dan.j.williams, balbi
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
Hi,
On Tue, Oct 01, 2013 at 03:39:57PM +0200, Daniel Mack wrote:
> The dsps platform needs to save save some registers at suspend time and
> restore them after resume. This patch adds a struct for these registers,
> and also lets the musb core know that the core registers need to be
> saved as well.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>
this last patch didn't apply. can you rebase on my 'testing' branch ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 5/5] usb: musb: dsps: add support for suspend and resume
2013-10-01 14:59 ` Felipe Balbi
@ 2013-10-01 15:04 ` Daniel Mack
[not found] ` <524AE464.3020201-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Daniel Mack @ 2013-10-01 15:04 UTC (permalink / raw)
To: balbi; +Cc: linux-usb, linux-omap, neumann, bigeasy, vinod.koul,
dan.j.williams
On 01.10.2013 16:59, Felipe Balbi wrote:
> On Tue, Oct 01, 2013 at 03:39:57PM +0200, Daniel Mack wrote:
>> The dsps platform needs to save save some registers at suspend time and
>> restore them after resume. This patch adds a struct for these registers,
>> and also lets the musb core know that the core registers need to be
>> saved as well.
>>
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>
> this last patch didn't apply. can you rebase on my 'testing' branch ?
I've seen that you already applied the others, so I'm going to resend
only that last one. Hope that's ok.
Daniel
^ permalink raw reply [flat|nested] 16+ messages in thread