Lines Matching refs:host
42 struct mmc_host *host = cls_dev_to_mmc_host(dev); in mmc_host_classdev_release() local
44 idr_remove(&mmc_host_idr, host->index); in mmc_host_classdev_release()
46 kfree(host); in mmc_host_classdev_release()
64 void mmc_retune_enable(struct mmc_host *host) in mmc_retune_enable() argument
66 host->can_retune = 1; in mmc_retune_enable()
67 if (host->retune_period) in mmc_retune_enable()
68 mod_timer(&host->retune_timer, in mmc_retune_enable()
69 jiffies + host->retune_period * HZ); in mmc_retune_enable()
72 void mmc_retune_disable(struct mmc_host *host) in mmc_retune_disable() argument
74 host->can_retune = 0; in mmc_retune_disable()
75 del_timer_sync(&host->retune_timer); in mmc_retune_disable()
76 host->retune_now = 0; in mmc_retune_disable()
77 host->need_retune = 0; in mmc_retune_disable()
80 void mmc_retune_timer_stop(struct mmc_host *host) in mmc_retune_timer_stop() argument
82 del_timer_sync(&host->retune_timer); in mmc_retune_timer_stop()
86 void mmc_retune_hold(struct mmc_host *host) in mmc_retune_hold() argument
88 if (!host->hold_retune) in mmc_retune_hold()
89 host->retune_now = 1; in mmc_retune_hold()
90 host->hold_retune += 1; in mmc_retune_hold()
93 void mmc_retune_release(struct mmc_host *host) in mmc_retune_release() argument
95 if (host->hold_retune) in mmc_retune_release()
96 host->hold_retune -= 1; in mmc_retune_release()
101 int mmc_retune(struct mmc_host *host) in mmc_retune() argument
106 if (host->retune_now) in mmc_retune()
107 host->retune_now = 0; in mmc_retune()
111 if (!host->need_retune || host->doing_retune || !host->card) in mmc_retune()
114 host->need_retune = 0; in mmc_retune()
116 host->doing_retune = 1; in mmc_retune()
118 if (host->ios.timing == MMC_TIMING_MMC_HS400) { in mmc_retune()
119 err = mmc_hs400_to_hs200(host->card); in mmc_retune()
125 if (host->ops->prepare_hs400_tuning) in mmc_retune()
126 host->ops->prepare_hs400_tuning(host, &host->ios); in mmc_retune()
129 err = mmc_execute_tuning(host->card); in mmc_retune()
134 err = mmc_hs200_to_hs400(host->card); in mmc_retune()
136 host->doing_retune = 0; in mmc_retune()
143 struct mmc_host *host = (struct mmc_host *)data; in mmc_retune_timer() local
145 mmc_retune_needed(host); in mmc_retune_timer()
157 int mmc_of_parse(struct mmc_host *host) in mmc_of_parse() argument
165 if (!host->parent || !host->parent->of_node) in mmc_of_parse()
168 np = host->parent->of_node; in mmc_of_parse()
172 dev_dbg(host->parent, in mmc_of_parse()
179 host->caps |= MMC_CAP_8_BIT_DATA; in mmc_of_parse()
182 host->caps |= MMC_CAP_4_BIT_DATA; in mmc_of_parse()
187 dev_err(host->parent, in mmc_of_parse()
193 of_property_read_u32(np, "max-frequency", &host->f_max); in mmc_of_parse()
209 host->caps |= MMC_CAP_NONREMOVABLE; in mmc_of_parse()
214 host->caps |= MMC_CAP_NEEDS_POLL; in mmc_of_parse()
216 ret = mmc_gpiod_request_cd(host, "cd", 0, true, in mmc_of_parse()
219 dev_info(host->parent, "Got CD GPIO\n"); in mmc_of_parse()
235 host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; in mmc_of_parse()
241 ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert); in mmc_of_parse()
243 dev_info(host->parent, "Got WP GPIO\n"); in mmc_of_parse()
248 host->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; in mmc_of_parse()
252 host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; in mmc_of_parse()
255 host->caps |= MMC_CAP_SD_HIGHSPEED; in mmc_of_parse()
257 host->caps |= MMC_CAP_MMC_HIGHSPEED; in mmc_of_parse()
259 host->caps |= MMC_CAP_UHS_SDR12; in mmc_of_parse()
261 host->caps |= MMC_CAP_UHS_SDR25; in mmc_of_parse()
263 host->caps |= MMC_CAP_UHS_SDR50; in mmc_of_parse()
265 host->caps |= MMC_CAP_UHS_SDR104; in mmc_of_parse()
267 host->caps |= MMC_CAP_UHS_DDR50; in mmc_of_parse()
269 host->caps |= MMC_CAP_POWER_OFF_CARD; in mmc_of_parse()
271 host->caps |= MMC_CAP_HW_RESET; in mmc_of_parse()
273 host->caps |= MMC_CAP_SDIO_IRQ; in mmc_of_parse()
275 host->caps2 |= MMC_CAP2_FULL_PWR_CYCLE; in mmc_of_parse()
277 host->pm_caps |= MMC_PM_KEEP_POWER; in mmc_of_parse()
279 host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ; in mmc_of_parse()
281 host->caps |= MMC_CAP_1_8V_DDR; in mmc_of_parse()
283 host->caps |= MMC_CAP_1_2V_DDR; in mmc_of_parse()
285 host->caps2 |= MMC_CAP2_HS200_1_8V_SDR; in mmc_of_parse()
287 host->caps2 |= MMC_CAP2_HS200_1_2V_SDR; in mmc_of_parse()
289 host->caps2 |= MMC_CAP2_HS400_1_8V | MMC_CAP2_HS200_1_8V_SDR; in mmc_of_parse()
291 host->caps2 |= MMC_CAP2_HS400_1_2V | MMC_CAP2_HS200_1_2V_SDR; in mmc_of_parse()
293 host->dsr_req = !of_property_read_u32(np, "dsr", &host->dsr); in mmc_of_parse()
294 if (host->dsr_req && (host->dsr & ~0xffff)) { in mmc_of_parse()
295 dev_err(host->parent, in mmc_of_parse()
297 host->dsr); in mmc_of_parse()
298 host->dsr_req = 0; in mmc_of_parse()
301 return mmc_pwrseq_alloc(host); in mmc_of_parse()
316 struct mmc_host *host; in mmc_alloc_host() local
318 host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); in mmc_alloc_host()
319 if (!host) in mmc_alloc_host()
323 host->rescan_disable = 1; in mmc_alloc_host()
326 err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); in mmc_alloc_host()
328 host->index = err; in mmc_alloc_host()
332 kfree(host); in mmc_alloc_host()
336 dev_set_name(&host->class_dev, "mmc%d", host->index); in mmc_alloc_host()
338 host->parent = dev; in mmc_alloc_host()
339 host->class_dev.parent = dev; in mmc_alloc_host()
340 host->class_dev.class = &mmc_host_class; in mmc_alloc_host()
341 device_initialize(&host->class_dev); in mmc_alloc_host()
343 if (mmc_gpio_alloc(host)) { in mmc_alloc_host()
344 put_device(&host->class_dev); in mmc_alloc_host()
348 spin_lock_init(&host->lock); in mmc_alloc_host()
349 init_waitqueue_head(&host->wq); in mmc_alloc_host()
350 INIT_DELAYED_WORK(&host->detect, mmc_rescan); in mmc_alloc_host()
352 host->pm_notify.notifier_call = mmc_pm_notify; in mmc_alloc_host()
354 setup_timer(&host->retune_timer, mmc_retune_timer, (unsigned long)host); in mmc_alloc_host()
360 host->max_segs = 1; in mmc_alloc_host()
361 host->max_seg_size = PAGE_CACHE_SIZE; in mmc_alloc_host()
363 host->max_req_size = PAGE_CACHE_SIZE; in mmc_alloc_host()
364 host->max_blk_size = 512; in mmc_alloc_host()
365 host->max_blk_count = PAGE_CACHE_SIZE / 512; in mmc_alloc_host()
367 return host; in mmc_alloc_host()
380 int mmc_add_host(struct mmc_host *host) in mmc_add_host() argument
384 WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) && in mmc_add_host()
385 !host->ops->enable_sdio_irq); in mmc_add_host()
387 err = device_add(&host->class_dev); in mmc_add_host()
391 led_trigger_register_simple(dev_name(&host->class_dev), &host->led); in mmc_add_host()
394 mmc_add_host_debugfs(host); in mmc_add_host()
397 mmc_start_host(host); in mmc_add_host()
398 register_pm_notifier(&host->pm_notify); in mmc_add_host()
413 void mmc_remove_host(struct mmc_host *host) in mmc_remove_host() argument
415 unregister_pm_notifier(&host->pm_notify); in mmc_remove_host()
416 mmc_stop_host(host); in mmc_remove_host()
419 mmc_remove_host_debugfs(host); in mmc_remove_host()
422 device_del(&host->class_dev); in mmc_remove_host()
424 led_trigger_unregister_simple(host->led); in mmc_remove_host()
435 void mmc_free_host(struct mmc_host *host) in mmc_free_host() argument
437 mmc_pwrseq_free(host); in mmc_free_host()
438 put_device(&host->class_dev); in mmc_free_host()