summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0007-mfd-global-Suspend-and-resume-support-of-ehci-and-oh.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0007-mfd-global-Suspend-and-resume-support-of-ehci-and-oh.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0007-mfd-global-Suspend-and-resume-support-of-ehci-and-oh.patch165
1 files changed, 165 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0007-mfd-global-Suspend-and-resume-support-of-ehci-and-oh.patch b/extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0007-mfd-global-Suspend-and-resume-support-of-ehci-and-oh.patch
new file mode 100644
index 00000000..94d5f591
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap-2.6.39/mfd/0007-mfd-global-Suspend-and-resume-support-of-ehci-and-oh.patch
@@ -0,0 +1,165 @@
1From bf583f2924fd9b2f0356cbd0bbfd58c48d98ef15 Mon Sep 17 00:00:00 2001
2From: Keshava Munegowda <Keshava_mgowda@ti.com>
3Date: Wed, 1 Jun 2011 11:03:03 -0700
4Subject: [PATCH 07/13] mfd: global Suspend and resume support of ehci and ohci
5
6The global suspend and resume functions for usbhs core driver
7are implemented.These routine are called when the global suspend
8and resume occurs. Before calling these functions, the
9bus suspend and resume of ehci and ohci drivers are called
10from runtime pm.
11
12Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com>
13---
14 drivers/mfd/omap-usb-host.c | 103 +++++++++++++++++++++++++++++++++++++++++++
15 1 files changed, 103 insertions(+), 0 deletions(-)
16
17diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
18index 43de12a..32d19e2 100644
19--- a/drivers/mfd/omap-usb-host.c
20+++ b/drivers/mfd/omap-usb-host.c
21@@ -146,6 +146,10 @@
22 #define is_ehci_hsic_mode(x) (x == OMAP_EHCI_PORT_MODE_HSIC)
23
24
25+/* USBHS state bits */
26+#define OMAP_USBHS_INIT 0
27+#define OMAP_USBHS_SUSPEND 4
28+
29 struct usbhs_hcd_omap {
30 struct clk *xclk60mhsp1_ck;
31 struct clk *xclk60mhsp2_ck;
32@@ -165,6 +169,7 @@ struct usbhs_hcd_omap {
33 u32 usbhs_rev;
34 spinlock_t lock;
35 int count;
36+ unsigned long state;
37 };
38 /*-------------------------------------------------------------------------*/
39
40@@ -809,6 +814,8 @@ static int usbhs_enable(struct device *dev)
41 (pdata->ehci_data->reset_gpio_port[1], 1);
42 }
43
44+ set_bit(OMAP_USBHS_INIT, &omap->state);
45+
46 end_count:
47 omap->count++;
48 spin_unlock_irqrestore(&omap->lock, flags);
49@@ -897,6 +904,7 @@ static void usbhs_disable(struct device *dev)
50 }
51
52 pm_runtime_put_sync(dev);
53+ clear_bit(OMAP_USBHS_INIT, &omap->state);
54
55 /* The gpio_free migh sleep; so unlock the spinlock */
56 spin_unlock_irqrestore(&omap->lock, flags);
57@@ -926,10 +934,105 @@ void omap_usbhs_disable(struct device *dev)
58 }
59 EXPORT_SYMBOL_GPL(omap_usbhs_disable);
60
61+#ifdef CONFIG_PM
62+
63+static int usbhs_resume(struct device *dev)
64+{
65+ struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
66+ struct usbhs_omap_platform_data *pdata = &omap->platdata;
67+ unsigned long flags = 0;
68+
69+ dev_dbg(dev, "Resuming TI HSUSB Controller\n");
70+
71+ if (!pdata) {
72+ dev_dbg(dev, "missing platform_data\n");
73+ return -ENODEV;
74+ }
75+
76+ spin_lock_irqsave(&omap->lock, flags);
77+
78+ if (!test_bit(OMAP_USBHS_INIT, &omap->state) ||
79+ !test_bit(OMAP_USBHS_SUSPEND, &omap->state))
80+ goto end_resume;
81+
82+ pm_runtime_get_sync(dev);
83+
84+ if (is_omap_usbhs_rev2(omap)) {
85+ if (is_ehci_tll_mode(pdata->port_mode[0])) {
86+ clk_enable(omap->usbhost_p1_fck);
87+ clk_enable(omap->usbtll_p1_fck);
88+ }
89+ if (is_ehci_tll_mode(pdata->port_mode[1])) {
90+ clk_enable(omap->usbhost_p2_fck);
91+ clk_enable(omap->usbtll_p2_fck);
92+ }
93+ clk_enable(omap->utmi_p1_fck);
94+ clk_enable(omap->utmi_p2_fck);
95+ }
96+ clear_bit(OMAP_USBHS_SUSPEND, &omap->state);
97+
98+end_resume:
99+ spin_unlock_irqrestore(&omap->lock, flags);
100+ return 0;
101+}
102+
103+
104+static int usbhs_suspend(struct device *dev)
105+{
106+ struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
107+ struct usbhs_omap_platform_data *pdata = &omap->platdata;
108+ unsigned long flags = 0;
109+
110+ dev_dbg(dev, "Suspending TI HSUSB Controller\n");
111+
112+ if (!pdata) {
113+ dev_dbg(dev, "missing platform_data\n");
114+ return -ENODEV;
115+ }
116+
117+ spin_lock_irqsave(&omap->lock, flags);
118+
119+ if (!test_bit(OMAP_USBHS_INIT, &omap->state) ||
120+ test_bit(OMAP_USBHS_SUSPEND, &omap->state))
121+ goto end_suspend;
122+
123+ if (is_omap_usbhs_rev2(omap)) {
124+ if (is_ehci_tll_mode(pdata->port_mode[0])) {
125+ clk_disable(omap->usbhost_p1_fck);
126+ clk_disable(omap->usbtll_p1_fck);
127+ }
128+ if (is_ehci_tll_mode(pdata->port_mode[1])) {
129+ clk_disable(omap->usbhost_p2_fck);
130+ clk_disable(omap->usbtll_p2_fck);
131+ }
132+ clk_disable(omap->utmi_p2_fck);
133+ clk_disable(omap->utmi_p1_fck);
134+ }
135+
136+ set_bit(OMAP_USBHS_SUSPEND, &omap->state);
137+ pm_runtime_put_sync(dev);
138+
139+end_suspend:
140+ spin_unlock_irqrestore(&omap->lock, flags);
141+ return 0;
142+}
143+
144+
145+static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
146+ .suspend = usbhs_suspend,
147+ .resume = usbhs_resume,
148+};
149+
150+#define USBHS_OMAP_DEV_PM_OPS (&usbhsomap_dev_pm_ops)
151+#else
152+#define USBHS_OMAP_DEV_PM_OPS NULL
153+#endif
154+
155 static struct platform_driver usbhs_omap_driver = {
156 .driver = {
157 .name = (char *)usbhs_driver_name,
158 .owner = THIS_MODULE,
159+ .pm = USBHS_OMAP_DEV_PM_OPS,
160 },
161 .remove = __exit_p(usbhs_omap_remove),
162 };
163--
1641.6.6.1
165