aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-06-23 03:42:49 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 19:32:31 -0400
commitc20c68d535409f2ff000415d5e0578529c016521 (patch)
tree2403718e9c823d1845e33382a81bccfcb0653269 /drivers/misc
parent206ecfc21121aa272f3f9fa23e1ed252a12e8a5c (diff)
mei: check if the hardware reset succeeded
The hw may have multiple steps for resetting so we need to check if it has really succeeded. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/hw-me.c3
-rw-r--r--drivers/misc/mei/init.c8
-rw-r--r--drivers/misc/mei/mei_dev.h6
3 files changed, 12 insertions, 5 deletions
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index 822170f00348..e4f8dec4dc3c 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -171,7 +171,7 @@ static void mei_me_hw_reset_release(struct mei_device *dev)
171 * @dev: the device structure 171 * @dev: the device structure
172 * @intr_enable: if interrupt should be enabled after reset. 172 * @intr_enable: if interrupt should be enabled after reset.
173 */ 173 */
174static void mei_me_hw_reset(struct mei_device *dev, bool intr_enable) 174static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
175{ 175{
176 struct mei_me_hw *hw = to_me_hw(dev); 176 struct mei_me_hw *hw = to_me_hw(dev);
177 u32 hcsr = mei_hcsr_read(hw); 177 u32 hcsr = mei_hcsr_read(hw);
@@ -191,6 +191,7 @@ static void mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
191 mei_me_hw_reset_release(dev); 191 mei_me_hw_reset_release(dev);
192 192
193 dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", mei_hcsr_read(hw)); 193 dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", mei_hcsr_read(hw));
194 return 0;
194} 195}
195 196
196/** 197/**
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 79e9e1c30562..15253886f37e 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -132,13 +132,19 @@ EXPORT_SYMBOL_GPL(mei_start);
132void mei_reset(struct mei_device *dev, int interrupts_enabled) 132void mei_reset(struct mei_device *dev, int interrupts_enabled)
133{ 133{
134 bool unexpected; 134 bool unexpected;
135 int ret;
135 136
136 unexpected = (dev->dev_state != MEI_DEV_INITIALIZING && 137 unexpected = (dev->dev_state != MEI_DEV_INITIALIZING &&
137 dev->dev_state != MEI_DEV_DISABLED && 138 dev->dev_state != MEI_DEV_DISABLED &&
138 dev->dev_state != MEI_DEV_POWER_DOWN && 139 dev->dev_state != MEI_DEV_POWER_DOWN &&
139 dev->dev_state != MEI_DEV_POWER_UP); 140 dev->dev_state != MEI_DEV_POWER_UP);
140 141
141 mei_hw_reset(dev, interrupts_enabled); 142 ret = mei_hw_reset(dev, interrupts_enabled);
143 if (ret) {
144 dev_err(&dev->pdev->dev, "hw reset failed disabling the device\n");
145 interrupts_enabled = false;
146 dev->dev_state = MEI_DEV_DISABLED;
147 }
142 148
143 dev->hbm_state = MEI_HBM_IDLE; 149 dev->hbm_state = MEI_HBM_IDLE;
144 150
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 80a90319fc29..1aa499782abe 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -233,7 +233,7 @@ struct mei_hw_ops {
233 bool (*host_is_ready) (struct mei_device *dev); 233 bool (*host_is_ready) (struct mei_device *dev);
234 234
235 bool (*hw_is_ready) (struct mei_device *dev); 235 bool (*hw_is_ready) (struct mei_device *dev);
236 void (*hw_reset) (struct mei_device *dev, bool enable); 236 int (*hw_reset) (struct mei_device *dev, bool enable);
237 int (*hw_start) (struct mei_device *dev); 237 int (*hw_start) (struct mei_device *dev);
238 void (*hw_config) (struct mei_device *dev); 238 void (*hw_config) (struct mei_device *dev);
239 239
@@ -539,9 +539,9 @@ static inline void mei_hw_config(struct mei_device *dev)
539{ 539{
540 dev->ops->hw_config(dev); 540 dev->ops->hw_config(dev);
541} 541}
542static inline void mei_hw_reset(struct mei_device *dev, bool enable) 542static inline int mei_hw_reset(struct mei_device *dev, bool enable)
543{ 543{
544 dev->ops->hw_reset(dev, enable); 544 return dev->ops->hw_reset(dev, enable);
545} 545}
546 546
547static inline void mei_hw_start(struct mei_device *dev) 547static inline void mei_hw_start(struct mei_device *dev)