Lines Matching refs:host
178 mmc_hostname(card->host), csd_struct); in mmc_decode_csd()
202 mmc_hostname(card->host), scr_struct); in mmc_decode_scr()
233 mmc_hostname(card->host)); in mmc_read_ssr()
244 mmc_hostname(card->host)); in mmc_read_ssr()
269 mmc_hostname(card->host)); in mmc_read_ssr()
290 mmc_hostname(card->host)); in mmc_read_switch()
300 mmc_hostname(card->host)); in mmc_read_switch()
319 mmc_hostname(card->host)); in mmc_read_switch()
354 if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) in mmc_sd_switch_hs()
363 "switch capabilities.\n", mmc_hostname(card->host)); in mmc_sd_switch_hs()
373 mmc_hostname(card->host)); in mmc_sd_switch_hs()
404 mmc_hostname(card->host)); in sd_select_driver_type()
411 mmc_set_driver_type(card->host, drv_type); in sd_select_driver_type()
422 if (!mmc_host_uhs(card->host)) { in sd_update_bus_speed_mode()
427 if ((card->host->caps & MMC_CAP_UHS_SDR104) && in sd_update_bus_speed_mode()
430 } else if ((card->host->caps & MMC_CAP_UHS_DDR50) && in sd_update_bus_speed_mode()
433 } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | in sd_update_bus_speed_mode()
437 } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | in sd_update_bus_speed_mode()
441 } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | in sd_update_bus_speed_mode()
485 mmc_hostname(card->host)); in sd_set_bus_speed_mode()
487 mmc_set_timing(card->host, timing); in sd_set_bus_speed_mode()
488 mmc_set_clock(card->host, card->sw_caps.uhs_max_dtr); in sd_set_bus_speed_mode()
495 static u32 sd_get_host_max_current(struct mmc_host *host) in sd_get_host_max_current() argument
499 voltage = 1 << host->ios.vdd; in sd_get_host_max_current()
502 max_current = host->max_current_180; in sd_get_host_max_current()
506 max_current = host->max_current_300; in sd_get_host_max_current()
510 max_current = host->max_current_330; in sd_get_host_max_current()
539 max_current = sd_get_host_max_current(card->host); in sd_set_current_limit()
565 mmc_hostname(card->host)); in sd_set_current_limit()
589 "switch capabilities.\n", mmc_hostname(card->host)); in mmc_sd_init_uhs_card()
594 if ((card->host->caps & MMC_CAP_4_BIT_DATA) && in mmc_sd_init_uhs_card()
600 mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); in mmc_sd_init_uhs_card()
628 if (!mmc_host_is_spi(card->host) && in mmc_sd_init_uhs_card()
629 (card->host->ios.timing == MMC_TIMING_UHS_SDR50 || in mmc_sd_init_uhs_card()
630 card->host->ios.timing == MMC_TIMING_UHS_DDR50 || in mmc_sd_init_uhs_card()
631 card->host->ios.timing == MMC_TIMING_UHS_SDR104)) { in mmc_sd_init_uhs_card()
641 if (err && card->host->ios.timing == MMC_TIMING_UHS_DDR50) { in mmc_sd_init_uhs_card()
643 mmc_hostname(card->host)); in mmc_sd_init_uhs_card()
694 int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr) in mmc_sd_get_cid() argument
704 pr_warn("%s: Skipping voltage switch\n", mmc_hostname(host)); in mmc_sd_get_cid()
713 mmc_go_idle(host); in mmc_sd_get_cid()
721 err = mmc_send_if_cond(host, ocr); in mmc_sd_get_cid()
730 if (retries && mmc_host_uhs(host)) in mmc_sd_get_cid()
737 max_current = sd_get_host_max_current(host); in mmc_sd_get_cid()
741 err = mmc_send_app_op_cond(host, ocr, rocr); in mmc_sd_get_cid()
749 if (!mmc_host_is_spi(host) && rocr && in mmc_sd_get_cid()
751 err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, in mmc_sd_get_cid()
762 if (mmc_host_is_spi(host)) in mmc_sd_get_cid()
763 err = mmc_send_cid(host, cid); in mmc_sd_get_cid()
765 err = mmc_all_send_cid(host, cid); in mmc_sd_get_cid()
770 int mmc_sd_get_csd(struct mmc_host *host, struct mmc_card *card) in mmc_sd_get_csd() argument
788 static int mmc_sd_get_ro(struct mmc_host *host) in mmc_sd_get_ro() argument
797 if (host->caps2 & MMC_CAP2_NO_WRITE_PROTECT) in mmc_sd_get_ro()
800 if (!host->ops->get_ro) in mmc_sd_get_ro()
803 ro = host->ops->get_ro(host); in mmc_sd_get_ro()
808 int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card, in mmc_sd_setup_card() argument
849 if (mmc_host_is_spi(host)) { in mmc_sd_setup_card()
850 err = mmc_spi_set_crc(host, use_spi_crc); in mmc_sd_setup_card()
859 int ro = mmc_sd_get_ro(host); in mmc_sd_setup_card()
863 mmc_hostname(host)); in mmc_sd_setup_card()
892 static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, in mmc_sd_init_card() argument
900 BUG_ON(!host); in mmc_sd_init_card()
901 WARN_ON(!host->claimed); in mmc_sd_init_card()
903 err = mmc_sd_get_cid(host, ocr, cid, &rocr); in mmc_sd_init_card()
916 card = mmc_alloc_card(host, &sd_type); in mmc_sd_init_card()
928 if (host->ops->init_card) in mmc_sd_init_card()
929 host->ops->init_card(host, card); in mmc_sd_init_card()
934 if (!mmc_host_is_spi(host)) { in mmc_sd_init_card()
935 err = mmc_send_relative_addr(host, &card->rca); in mmc_sd_init_card()
941 err = mmc_sd_get_csd(host, card); in mmc_sd_init_card()
952 if (card->csd.dsr_imp && host->dsr_req) in mmc_sd_init_card()
953 mmc_set_dsr(host); in mmc_sd_init_card()
958 if (!mmc_host_is_spi(host)) { in mmc_sd_init_card()
964 err = mmc_sd_setup_card(host, card, oldcard != NULL); in mmc_sd_init_card()
979 mmc_set_timing(card->host, MMC_TIMING_SD_HS); in mmc_sd_init_card()
986 mmc_set_clock(host, mmc_sd_get_max_clock(card)); in mmc_sd_init_card()
991 if ((host->caps & MMC_CAP_4_BIT_DATA) && in mmc_sd_init_card()
997 mmc_set_bus_width(host, MMC_BUS_WIDTH_4); in mmc_sd_init_card()
1001 host->card = card; in mmc_sd_init_card()
1014 static void mmc_sd_remove(struct mmc_host *host) in mmc_sd_remove() argument
1016 BUG_ON(!host); in mmc_sd_remove()
1017 BUG_ON(!host->card); in mmc_sd_remove()
1019 mmc_remove_card(host->card); in mmc_sd_remove()
1020 host->card = NULL; in mmc_sd_remove()
1026 static int mmc_sd_alive(struct mmc_host *host) in mmc_sd_alive() argument
1028 return mmc_send_status(host->card, NULL); in mmc_sd_alive()
1034 static void mmc_sd_detect(struct mmc_host *host) in mmc_sd_detect() argument
1038 BUG_ON(!host); in mmc_sd_detect()
1039 BUG_ON(!host->card); in mmc_sd_detect()
1041 mmc_get_card(host->card); in mmc_sd_detect()
1046 err = _mmc_detect_card_removed(host); in mmc_sd_detect()
1048 mmc_put_card(host->card); in mmc_sd_detect()
1051 mmc_sd_remove(host); in mmc_sd_detect()
1053 mmc_claim_host(host); in mmc_sd_detect()
1054 mmc_detach_bus(host); in mmc_sd_detect()
1055 mmc_power_off(host); in mmc_sd_detect()
1056 mmc_release_host(host); in mmc_sd_detect()
1060 static int _mmc_sd_suspend(struct mmc_host *host) in _mmc_sd_suspend() argument
1064 BUG_ON(!host); in _mmc_sd_suspend()
1065 BUG_ON(!host->card); in _mmc_sd_suspend()
1067 mmc_claim_host(host); in _mmc_sd_suspend()
1069 if (mmc_card_suspended(host->card)) in _mmc_sd_suspend()
1072 if (!mmc_host_is_spi(host)) in _mmc_sd_suspend()
1073 err = mmc_deselect_cards(host); in _mmc_sd_suspend()
1076 mmc_power_off(host); in _mmc_sd_suspend()
1077 mmc_card_set_suspended(host->card); in _mmc_sd_suspend()
1081 mmc_release_host(host); in _mmc_sd_suspend()
1088 static int mmc_sd_suspend(struct mmc_host *host) in mmc_sd_suspend() argument
1092 err = _mmc_sd_suspend(host); in mmc_sd_suspend()
1094 pm_runtime_disable(&host->card->dev); in mmc_sd_suspend()
1095 pm_runtime_set_suspended(&host->card->dev); in mmc_sd_suspend()
1105 static int _mmc_sd_resume(struct mmc_host *host) in _mmc_sd_resume() argument
1109 BUG_ON(!host); in _mmc_sd_resume()
1110 BUG_ON(!host->card); in _mmc_sd_resume()
1112 mmc_claim_host(host); in _mmc_sd_resume()
1114 if (!mmc_card_suspended(host->card)) in _mmc_sd_resume()
1117 mmc_power_up(host, host->card->ocr); in _mmc_sd_resume()
1118 err = mmc_sd_init_card(host, host->card->ocr, host->card); in _mmc_sd_resume()
1119 mmc_card_clr_suspended(host->card); in _mmc_sd_resume()
1122 mmc_release_host(host); in _mmc_sd_resume()
1129 static int mmc_sd_resume(struct mmc_host *host) in mmc_sd_resume() argument
1133 if (!(host->caps & MMC_CAP_RUNTIME_RESUME)) { in mmc_sd_resume()
1134 err = _mmc_sd_resume(host); in mmc_sd_resume()
1135 pm_runtime_set_active(&host->card->dev); in mmc_sd_resume()
1136 pm_runtime_mark_last_busy(&host->card->dev); in mmc_sd_resume()
1138 pm_runtime_enable(&host->card->dev); in mmc_sd_resume()
1146 static int mmc_sd_runtime_suspend(struct mmc_host *host) in mmc_sd_runtime_suspend() argument
1150 if (!(host->caps & MMC_CAP_AGGRESSIVE_PM)) in mmc_sd_runtime_suspend()
1153 err = _mmc_sd_suspend(host); in mmc_sd_runtime_suspend()
1156 mmc_hostname(host), err); in mmc_sd_runtime_suspend()
1164 static int mmc_sd_runtime_resume(struct mmc_host *host) in mmc_sd_runtime_resume() argument
1168 if (!(host->caps & (MMC_CAP_AGGRESSIVE_PM | MMC_CAP_RUNTIME_RESUME))) in mmc_sd_runtime_resume()
1171 err = _mmc_sd_resume(host); in mmc_sd_runtime_resume()
1174 mmc_hostname(host), err); in mmc_sd_runtime_resume()
1179 static int mmc_sd_reset(struct mmc_host *host) in mmc_sd_reset() argument
1181 mmc_power_cycle(host, host->card->ocr); in mmc_sd_reset()
1182 return mmc_sd_init_card(host, host->card->ocr, host->card); in mmc_sd_reset()
1200 int mmc_attach_sd(struct mmc_host *host) in mmc_attach_sd() argument
1205 BUG_ON(!host); in mmc_attach_sd()
1206 WARN_ON(!host->claimed); in mmc_attach_sd()
1208 err = mmc_send_app_op_cond(host, 0, &ocr); in mmc_attach_sd()
1212 mmc_attach_bus(host, &mmc_sd_ops); in mmc_attach_sd()
1213 if (host->ocr_avail_sd) in mmc_attach_sd()
1214 host->ocr_avail = host->ocr_avail_sd; in mmc_attach_sd()
1219 if (mmc_host_is_spi(host)) { in mmc_attach_sd()
1220 mmc_go_idle(host); in mmc_attach_sd()
1222 err = mmc_spi_read_ocr(host, 0, &ocr); in mmc_attach_sd()
1227 rocr = mmc_select_voltage(host, ocr); in mmc_attach_sd()
1240 err = mmc_sd_init_card(host, rocr, NULL); in mmc_attach_sd()
1244 mmc_release_host(host); in mmc_attach_sd()
1245 err = mmc_add_card(host->card); in mmc_attach_sd()
1249 mmc_claim_host(host); in mmc_attach_sd()
1253 mmc_remove_card(host->card); in mmc_attach_sd()
1254 host->card = NULL; in mmc_attach_sd()
1255 mmc_claim_host(host); in mmc_attach_sd()
1257 mmc_detach_bus(host); in mmc_attach_sd()
1260 mmc_hostname(host), err); in mmc_attach_sd()