• Home
  • Raw
  • Download

Lines Matching refs:dev

82 void mei_cancel_work(struct mei_device *dev)  in mei_cancel_work()  argument
84 cancel_work_sync(&dev->reset_work); in mei_cancel_work()
85 cancel_work_sync(&dev->bus_rescan_work); in mei_cancel_work()
87 cancel_delayed_work_sync(&dev->timer_work); in mei_cancel_work()
98 int mei_reset(struct mei_device *dev) in mei_reset() argument
100 enum mei_dev_state state = dev->dev_state; in mei_reset()
110 mei_fw_status_str(dev, fw_sts_str, MEI_FW_STATUS_STR_SZ); in mei_reset()
111 dev_warn(dev->dev, "unexpected reset: dev_state = %s fw status = %s\n", in mei_reset()
115 mei_clear_interrupts(dev); in mei_reset()
122 mei_hbm_idle(dev); in mei_reset()
126 mei_set_devstate(dev, MEI_DEV_RESETTING); in mei_reset()
128 dev->reset_count++; in mei_reset()
129 if (dev->reset_count > MEI_MAX_CONSEC_RESET) { in mei_reset()
130 dev_err(dev->dev, "reset: reached maximal consecutive resets: disabling the device\n"); in mei_reset()
131 mei_set_devstate(dev, MEI_DEV_DISABLED); in mei_reset()
135 ret = mei_hw_reset(dev, interrupts_enabled); in mei_reset()
140 mei_cl_all_disconnect(dev); in mei_reset()
142 mei_hbm_reset(dev); in mei_reset()
144 memset(dev->rd_msg_hdr, 0, sizeof(dev->rd_msg_hdr)); in mei_reset()
147 dev_err(dev->dev, "hw_reset failed ret = %d\n", ret); in mei_reset()
152 dev_dbg(dev->dev, "powering down: end of reset\n"); in mei_reset()
153 mei_set_devstate(dev, MEI_DEV_DISABLED); in mei_reset()
157 ret = mei_hw_start(dev); in mei_reset()
159 dev_err(dev->dev, "hw_start failed ret = %d\n", ret); in mei_reset()
163 dev_dbg(dev->dev, "link is established start sending messages.\n"); in mei_reset()
165 mei_set_devstate(dev, MEI_DEV_INIT_CLIENTS); in mei_reset()
166 ret = mei_hbm_start_req(dev); in mei_reset()
168 dev_err(dev->dev, "hbm_start failed ret = %d\n", ret); in mei_reset()
169 mei_set_devstate(dev, MEI_DEV_RESETTING); in mei_reset()
184 int mei_start(struct mei_device *dev) in mei_start() argument
188 mutex_lock(&dev->device_lock); in mei_start()
191 mei_clear_interrupts(dev); in mei_start()
193 ret = mei_hw_config(dev); in mei_start()
197 dev_dbg(dev->dev, "reset in start the mei device.\n"); in mei_start()
199 dev->reset_count = 0; in mei_start()
201 mei_set_devstate(dev, MEI_DEV_INITIALIZING); in mei_start()
202 ret = mei_reset(dev); in mei_start()
204 if (ret == -ENODEV || dev->dev_state == MEI_DEV_DISABLED) { in mei_start()
205 dev_err(dev->dev, "reset failed ret = %d", ret); in mei_start()
210 if (mei_hbm_start_wait(dev)) { in mei_start()
211 dev_err(dev->dev, "HBM haven't started"); in mei_start()
215 if (!mei_host_is_ready(dev)) { in mei_start()
216 dev_err(dev->dev, "host is not ready.\n"); in mei_start()
220 if (!mei_hw_is_ready(dev)) { in mei_start()
221 dev_err(dev->dev, "ME is not ready.\n"); in mei_start()
225 if (!mei_hbm_version_is_supported(dev)) { in mei_start()
226 dev_dbg(dev->dev, "MEI start failed.\n"); in mei_start()
230 dev_dbg(dev->dev, "link layer has been established.\n"); in mei_start()
232 mutex_unlock(&dev->device_lock); in mei_start()
235 dev_err(dev->dev, "link layer initialization failed.\n"); in mei_start()
236 mei_set_devstate(dev, MEI_DEV_DISABLED); in mei_start()
237 mutex_unlock(&dev->device_lock); in mei_start()
249 int mei_restart(struct mei_device *dev) in mei_restart() argument
253 mutex_lock(&dev->device_lock); in mei_restart()
255 mei_set_devstate(dev, MEI_DEV_POWER_UP); in mei_restart()
256 dev->reset_count = 0; in mei_restart()
258 err = mei_reset(dev); in mei_restart()
260 mutex_unlock(&dev->device_lock); in mei_restart()
262 if (err == -ENODEV || dev->dev_state == MEI_DEV_DISABLED) { in mei_restart()
263 dev_err(dev->dev, "device disabled = %d\n", err); in mei_restart()
269 schedule_work(&dev->reset_work); in mei_restart()
278 struct mei_device *dev = in mei_reset_work() local
282 mei_clear_interrupts(dev); in mei_reset_work()
283 mei_synchronize_irq(dev); in mei_reset_work()
285 mutex_lock(&dev->device_lock); in mei_reset_work()
287 ret = mei_reset(dev); in mei_reset_work()
289 mutex_unlock(&dev->device_lock); in mei_reset_work()
291 if (dev->dev_state == MEI_DEV_DISABLED) { in mei_reset_work()
292 dev_err(dev->dev, "device disabled = %d\n", ret); in mei_reset_work()
298 schedule_work(&dev->reset_work); in mei_reset_work()
301 void mei_stop(struct mei_device *dev) in mei_stop() argument
303 dev_dbg(dev->dev, "stopping the device.\n"); in mei_stop()
305 mutex_lock(&dev->device_lock); in mei_stop()
306 mei_set_devstate(dev, MEI_DEV_POWERING_DOWN); in mei_stop()
307 mutex_unlock(&dev->device_lock); in mei_stop()
308 mei_cl_bus_remove_devices(dev); in mei_stop()
309 mutex_lock(&dev->device_lock); in mei_stop()
310 mei_set_devstate(dev, MEI_DEV_POWER_DOWN); in mei_stop()
311 mutex_unlock(&dev->device_lock); in mei_stop()
313 mei_cancel_work(dev); in mei_stop()
315 mei_clear_interrupts(dev); in mei_stop()
316 mei_synchronize_irq(dev); in mei_stop()
318 mutex_lock(&dev->device_lock); in mei_stop()
320 mei_reset(dev); in mei_stop()
322 mei_set_devstate(dev, MEI_DEV_DISABLED); in mei_stop()
324 mutex_unlock(&dev->device_lock); in mei_stop()
335 bool mei_write_is_idle(struct mei_device *dev) in mei_write_is_idle() argument
337 bool idle = (dev->dev_state == MEI_DEV_ENABLED && in mei_write_is_idle()
338 list_empty(&dev->ctrl_wr_list) && in mei_write_is_idle()
339 list_empty(&dev->write_list) && in mei_write_is_idle()
340 list_empty(&dev->write_waiting_list)); in mei_write_is_idle()
342 dev_dbg(dev->dev, "write pg: is idle[%d] state=%s ctrl=%01d write=%01d wwait=%01d\n", in mei_write_is_idle()
344 mei_dev_state_str(dev->dev_state), in mei_write_is_idle()
345 list_empty(&dev->ctrl_wr_list), in mei_write_is_idle()
346 list_empty(&dev->write_list), in mei_write_is_idle()
347 list_empty(&dev->write_waiting_list)); in mei_write_is_idle()
360 void mei_device_init(struct mei_device *dev, in mei_device_init() argument
365 INIT_LIST_HEAD(&dev->file_list); in mei_device_init()
366 INIT_LIST_HEAD(&dev->device_list); in mei_device_init()
367 INIT_LIST_HEAD(&dev->me_clients); in mei_device_init()
368 mutex_init(&dev->device_lock); in mei_device_init()
369 init_rwsem(&dev->me_clients_rwsem); in mei_device_init()
370 mutex_init(&dev->cl_bus_lock); in mei_device_init()
371 init_waitqueue_head(&dev->wait_hw_ready); in mei_device_init()
372 init_waitqueue_head(&dev->wait_pg); in mei_device_init()
373 init_waitqueue_head(&dev->wait_hbm_start); in mei_device_init()
374 dev->dev_state = MEI_DEV_INITIALIZING; in mei_device_init()
375 dev->reset_count = 0; in mei_device_init()
377 INIT_LIST_HEAD(&dev->write_list); in mei_device_init()
378 INIT_LIST_HEAD(&dev->write_waiting_list); in mei_device_init()
379 INIT_LIST_HEAD(&dev->ctrl_wr_list); in mei_device_init()
380 INIT_LIST_HEAD(&dev->ctrl_rd_list); in mei_device_init()
381 dev->tx_queue_limit = MEI_TX_QUEUE_LIMIT_DEFAULT; in mei_device_init()
383 INIT_DELAYED_WORK(&dev->timer_work, mei_timer); in mei_device_init()
384 INIT_WORK(&dev->reset_work, mei_reset_work); in mei_device_init()
385 INIT_WORK(&dev->bus_rescan_work, mei_cl_bus_rescan_work); in mei_device_init()
387 bitmap_zero(dev->host_clients_map, MEI_CLIENTS_MAX); in mei_device_init()
388 dev->open_handle_count = 0; in mei_device_init()
394 bitmap_set(dev->host_clients_map, 0, 1); in mei_device_init()
396 dev->pg_event = MEI_PG_EVENT_IDLE; in mei_device_init()
397 dev->ops = hw_ops; in mei_device_init()
398 dev->dev = device; in mei_device_init()