|
|
@@ -113,6 +113,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.
|
|
|
*/
|
|
|
@@ -122,6 +135,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;
|
|
|
};
|
|
|
|
|
|
static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|
|
@@ -559,6 +574,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
|
|
|
|
|
|
config->num_eps = get_int_prop(dn, "mentor,num-eps");
|
|
|
config->ram_bits = get_int_prop(dn, "mentor,ram-bits");
|
|
|
+ config->host_port_deassert_reset_at_resume = 1;
|
|
|
pdata.mode = get_musb_port_mode(dev);
|
|
|
/* DT keeps this entry in mA, musb expects it as per USB spec */
|
|
|
pdata.power = get_int_prop(dn, "mentor,power") / 2;
|
|
|
@@ -683,11 +699,52 @@ 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);
|
|
|
+
|
|
|
+ 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 = musb_dsps_of_match,
|
|
|
},
|
|
|
};
|