aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/init.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-04-18 16:03:48 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-19 13:58:21 -0400
commit9b0d5efc421ac79d9a6d97c681eff93288093784 (patch)
treefcde453f66d5eb63dcea84ba9e04f9381ecd1e08 /drivers/misc/mei/init.c
parent3a189b3ba027d4fe79100f728e19e935377f2e60 (diff)
mei: revamp hbm state machine
1. Rename init_clients_state to hbm_state and use MEI_HBM_ prefix for HBM states 2. Remove recvd_msg and use hbm state for synchronizing hbm protocol has successful start. We can wake up the hbm event from start response handler and remove the hack from the interrupt thread 3. mei_hbm_start_wait function encapsulate start completion waiting Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/init.c')
-rw-r--r--drivers/misc/mei/init.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 4e102ad7ebc0..59159e05446c 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -80,8 +80,6 @@ EXPORT_SYMBOL_GPL(mei_device_init);
80 */ 80 */
81int mei_start(struct mei_device *dev) 81int mei_start(struct mei_device *dev)
82{ 82{
83 int ret = 0;
84
85 mutex_lock(&dev->device_lock); 83 mutex_lock(&dev->device_lock);
86 84
87 /* acknowledge interrupt and stop interupts */ 85 /* acknowledge interrupt and stop interupts */
@@ -89,29 +87,15 @@ int mei_start(struct mei_device *dev)
89 87
90 mei_hw_config(dev); 88 mei_hw_config(dev);
91 89
92 dev->recvd_msg = false;
93 dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n"); 90 dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n");
94 91
95 mei_reset(dev, 1); 92 mei_reset(dev, 1);
96 93
97 /* wait for ME to turn on ME_RDY */ 94 if (mei_hbm_start_wait(dev)) {
98 if (!dev->recvd_msg) { 95 dev_err(&dev->pdev->dev, "HBM haven't started");
99 mutex_unlock(&dev->device_lock);
100 ret = wait_event_interruptible_timeout(dev->wait_recvd_msg,
101 dev->recvd_msg,
102 mei_secs_to_jiffies(MEI_INTEROP_TIMEOUT));
103 mutex_lock(&dev->device_lock);
104 }
105
106 if (ret <= 0 && !dev->recvd_msg) {
107 dev->dev_state = MEI_DEV_DISABLED;
108 dev_dbg(&dev->pdev->dev,
109 "wait_event_interruptible_timeout failed"
110 "on wait for ME to turn on ME_RDY.\n");
111 goto err; 96 goto err;
112 } 97 }
113 98
114
115 if (!mei_host_is_ready(dev)) { 99 if (!mei_host_is_ready(dev)) {
116 dev_err(&dev->pdev->dev, "host is not ready.\n"); 100 dev_err(&dev->pdev->dev, "host is not ready.\n");
117 goto err; 101 goto err;
@@ -128,7 +112,6 @@ int mei_start(struct mei_device *dev)
128 goto err; 112 goto err;
129 } 113 }
130 114
131 dev->recvd_msg = false;
132 dev_dbg(&dev->pdev->dev, "link layer has been established.\n"); 115 dev_dbg(&dev->pdev->dev, "link layer has been established.\n");
133 116
134 mutex_unlock(&dev->device_lock); 117 mutex_unlock(&dev->device_lock);
@@ -158,6 +141,7 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
158 141
159 mei_hw_reset(dev, interrupts_enabled); 142 mei_hw_reset(dev, interrupts_enabled);
160 143
144 dev->hbm_state = MEI_HBM_IDLE;
161 145
162 if (dev->dev_state != MEI_DEV_INITIALIZING) { 146 if (dev->dev_state != MEI_DEV_INITIALIZING) {
163 if (dev->dev_state != MEI_DEV_DISABLED && 147 if (dev->dev_state != MEI_DEV_DISABLED &&