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()
365 "switch capabilities.\n", mmc_hostname(card->host)); in mmc_sd_switch_hs()
375 mmc_hostname(card->host)); in mmc_sd_switch_hs()
399 if (!(card->host->caps & (MMC_CAP_DRIVER_TYPE_A | MMC_CAP_DRIVER_TYPE_C in sd_select_driver_type()
403 if (!card->host->ops->select_drive_strength) in sd_select_driver_type()
406 if (card->host->caps & MMC_CAP_DRIVER_TYPE_A) in sd_select_driver_type()
409 if (card->host->caps & MMC_CAP_DRIVER_TYPE_C) in sd_select_driver_type()
412 if (card->host->caps & MMC_CAP_DRIVER_TYPE_D) in sd_select_driver_type()
430 mmc_host_clk_hold(card->host); in sd_select_driver_type()
431 drive_strength = card->host->ops->select_drive_strength( in sd_select_driver_type()
434 mmc_host_clk_release(card->host); in sd_select_driver_type()
442 mmc_hostname(card->host)); in sd_select_driver_type()
446 mmc_set_driver_type(card->host, drive_strength); in sd_select_driver_type()
457 if (!mmc_host_uhs(card->host)) { in sd_update_bus_speed_mode()
462 if ((card->host->caps & MMC_CAP_UHS_SDR104) && in sd_update_bus_speed_mode()
465 } else if ((card->host->caps & MMC_CAP_UHS_DDR50) && in sd_update_bus_speed_mode()
468 } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | in sd_update_bus_speed_mode()
472 } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | in sd_update_bus_speed_mode()
476 } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | in sd_update_bus_speed_mode()
520 mmc_hostname(card->host)); in sd_set_bus_speed_mode()
522 mmc_set_timing(card->host, timing); in sd_set_bus_speed_mode()
523 mmc_set_clock(card->host, card->sw_caps.uhs_max_dtr); in sd_set_bus_speed_mode()
530 static u32 sd_get_host_max_current(struct mmc_host *host) in sd_get_host_max_current() argument
534 voltage = 1 << host->ios.vdd; in sd_get_host_max_current()
537 max_current = host->max_current_180; in sd_get_host_max_current()
541 max_current = host->max_current_300; in sd_get_host_max_current()
545 max_current = host->max_current_330; in sd_get_host_max_current()
574 max_current = sd_get_host_max_current(card->host); in sd_set_current_limit()
600 mmc_hostname(card->host)); in sd_set_current_limit()
624 "switch capabilities.\n", mmc_hostname(card->host)); in mmc_sd_init_uhs_card()
629 if ((card->host->caps & MMC_CAP_4_BIT_DATA) && in mmc_sd_init_uhs_card()
635 mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); in mmc_sd_init_uhs_card()
663 if (!mmc_host_is_spi(card->host) && in mmc_sd_init_uhs_card()
664 (card->host->ios.timing == MMC_TIMING_UHS_SDR50 || in mmc_sd_init_uhs_card()
665 card->host->ios.timing == MMC_TIMING_UHS_DDR50 || in mmc_sd_init_uhs_card()
666 card->host->ios.timing == MMC_TIMING_UHS_SDR104)) { in mmc_sd_init_uhs_card()
676 if (err && card->host->ios.timing == MMC_TIMING_UHS_DDR50) { in mmc_sd_init_uhs_card()
678 mmc_hostname(card->host)); in mmc_sd_init_uhs_card()
729 int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr) in mmc_sd_get_cid() argument
739 pr_warn("%s: Skipping voltage switch\n", mmc_hostname(host)); in mmc_sd_get_cid()
748 mmc_go_idle(host); in mmc_sd_get_cid()
756 err = mmc_send_if_cond(host, ocr); in mmc_sd_get_cid()
765 if (retries && mmc_host_uhs(host)) in mmc_sd_get_cid()
772 max_current = sd_get_host_max_current(host); in mmc_sd_get_cid()
776 err = mmc_send_app_op_cond(host, ocr, rocr); in mmc_sd_get_cid()
784 if (!mmc_host_is_spi(host) && rocr && in mmc_sd_get_cid()
786 err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, in mmc_sd_get_cid()
797 if (mmc_host_is_spi(host)) in mmc_sd_get_cid()
798 err = mmc_send_cid(host, cid); in mmc_sd_get_cid()
800 err = mmc_all_send_cid(host, cid); in mmc_sd_get_cid()
805 int mmc_sd_get_csd(struct mmc_host *host, struct mmc_card *card) in mmc_sd_get_csd() argument
823 int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card, in mmc_sd_setup_card() argument
864 if (mmc_host_is_spi(host)) { in mmc_sd_setup_card()
865 err = mmc_spi_set_crc(host, use_spi_crc); in mmc_sd_setup_card()
876 if (host->ops->get_ro) { in mmc_sd_setup_card()
877 mmc_host_clk_hold(card->host); in mmc_sd_setup_card()
878 ro = host->ops->get_ro(host); in mmc_sd_setup_card()
879 mmc_host_clk_release(card->host); in mmc_sd_setup_card()
884 mmc_hostname(host)); in mmc_sd_setup_card()
913 static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, in mmc_sd_init_card() argument
921 BUG_ON(!host); in mmc_sd_init_card()
922 WARN_ON(!host->claimed); in mmc_sd_init_card()
924 err = mmc_sd_get_cid(host, ocr, cid, &rocr); in mmc_sd_init_card()
937 card = mmc_alloc_card(host, &sd_type); in mmc_sd_init_card()
949 if (host->ops->init_card) in mmc_sd_init_card()
950 host->ops->init_card(host, card); in mmc_sd_init_card()
955 if (!mmc_host_is_spi(host)) { in mmc_sd_init_card()
956 err = mmc_send_relative_addr(host, &card->rca); in mmc_sd_init_card()
962 err = mmc_sd_get_csd(host, card); in mmc_sd_init_card()
973 if (card->csd.dsr_imp && host->dsr_req) in mmc_sd_init_card()
974 mmc_set_dsr(host); in mmc_sd_init_card()
979 if (!mmc_host_is_spi(host)) { in mmc_sd_init_card()
985 err = mmc_sd_setup_card(host, card, oldcard != NULL); in mmc_sd_init_card()
1000 mmc_set_timing(card->host, MMC_TIMING_SD_HS); in mmc_sd_init_card()
1007 mmc_set_clock(host, mmc_sd_get_max_clock(card)); in mmc_sd_init_card()
1012 if ((host->caps & MMC_CAP_4_BIT_DATA) && in mmc_sd_init_card()
1018 mmc_set_bus_width(host, MMC_BUS_WIDTH_4); in mmc_sd_init_card()
1022 host->card = card; in mmc_sd_init_card()
1035 static void mmc_sd_remove(struct mmc_host *host) in mmc_sd_remove() argument
1037 BUG_ON(!host); in mmc_sd_remove()
1038 BUG_ON(!host->card); in mmc_sd_remove()
1040 mmc_remove_card(host->card); in mmc_sd_remove()
1041 host->card = NULL; in mmc_sd_remove()
1047 static int mmc_sd_alive(struct mmc_host *host) in mmc_sd_alive() argument
1049 return mmc_send_status(host->card, NULL); in mmc_sd_alive()
1055 static void mmc_sd_detect(struct mmc_host *host) in mmc_sd_detect() argument
1059 BUG_ON(!host); in mmc_sd_detect()
1060 BUG_ON(!host->card); in mmc_sd_detect()
1062 mmc_get_card(host->card); in mmc_sd_detect()
1067 err = _mmc_detect_card_removed(host); in mmc_sd_detect()
1069 mmc_put_card(host->card); in mmc_sd_detect()
1072 mmc_sd_remove(host); in mmc_sd_detect()
1074 mmc_claim_host(host); in mmc_sd_detect()
1075 mmc_detach_bus(host); in mmc_sd_detect()
1076 mmc_power_off(host); in mmc_sd_detect()
1077 mmc_release_host(host); in mmc_sd_detect()
1081 static int _mmc_sd_suspend(struct mmc_host *host) in _mmc_sd_suspend() argument
1085 BUG_ON(!host); in _mmc_sd_suspend()
1086 BUG_ON(!host->card); in _mmc_sd_suspend()
1088 mmc_claim_host(host); in _mmc_sd_suspend()
1090 if (mmc_card_suspended(host->card)) in _mmc_sd_suspend()
1093 if (!mmc_host_is_spi(host)) in _mmc_sd_suspend()
1094 err = mmc_deselect_cards(host); in _mmc_sd_suspend()
1097 mmc_power_off(host); in _mmc_sd_suspend()
1098 mmc_card_set_suspended(host->card); in _mmc_sd_suspend()
1102 mmc_release_host(host); in _mmc_sd_suspend()
1109 static int mmc_sd_suspend(struct mmc_host *host) in mmc_sd_suspend() argument
1113 err = _mmc_sd_suspend(host); in mmc_sd_suspend()
1115 pm_runtime_disable(&host->card->dev); in mmc_sd_suspend()
1116 pm_runtime_set_suspended(&host->card->dev); in mmc_sd_suspend()
1126 static int _mmc_sd_resume(struct mmc_host *host) in _mmc_sd_resume() argument
1130 BUG_ON(!host); in _mmc_sd_resume()
1131 BUG_ON(!host->card); in _mmc_sd_resume()
1133 mmc_claim_host(host); in _mmc_sd_resume()
1135 if (!mmc_card_suspended(host->card)) in _mmc_sd_resume()
1138 mmc_power_up(host, host->card->ocr); in _mmc_sd_resume()
1139 err = mmc_sd_init_card(host, host->card->ocr, host->card); in _mmc_sd_resume()
1140 mmc_card_clr_suspended(host->card); in _mmc_sd_resume()
1143 mmc_release_host(host); in _mmc_sd_resume()
1150 static int mmc_sd_resume(struct mmc_host *host) in mmc_sd_resume() argument
1154 if (!(host->caps & MMC_CAP_RUNTIME_RESUME)) { in mmc_sd_resume()
1155 err = _mmc_sd_resume(host); in mmc_sd_resume()
1156 pm_runtime_set_active(&host->card->dev); in mmc_sd_resume()
1157 pm_runtime_mark_last_busy(&host->card->dev); in mmc_sd_resume()
1159 pm_runtime_enable(&host->card->dev); in mmc_sd_resume()
1167 static int mmc_sd_runtime_suspend(struct mmc_host *host) in mmc_sd_runtime_suspend() argument
1171 if (!(host->caps & MMC_CAP_AGGRESSIVE_PM)) in mmc_sd_runtime_suspend()
1174 err = _mmc_sd_suspend(host); in mmc_sd_runtime_suspend()
1177 mmc_hostname(host), err); in mmc_sd_runtime_suspend()
1185 static int mmc_sd_runtime_resume(struct mmc_host *host) in mmc_sd_runtime_resume() argument
1189 if (!(host->caps & (MMC_CAP_AGGRESSIVE_PM | MMC_CAP_RUNTIME_RESUME))) in mmc_sd_runtime_resume()
1192 err = _mmc_sd_resume(host); in mmc_sd_runtime_resume()
1195 mmc_hostname(host), err); in mmc_sd_runtime_resume()
1200 static int mmc_sd_power_restore(struct mmc_host *host) in mmc_sd_power_restore() argument
1204 mmc_claim_host(host); in mmc_sd_power_restore()
1205 ret = mmc_sd_init_card(host, host->card->ocr, host->card); in mmc_sd_power_restore()
1206 mmc_release_host(host); in mmc_sd_power_restore()
1211 static int mmc_sd_reset(struct mmc_host *host) in mmc_sd_reset() argument
1213 mmc_power_cycle(host, host->card->ocr); in mmc_sd_reset()
1214 return mmc_sd_power_restore(host); in mmc_sd_reset()
1233 int mmc_attach_sd(struct mmc_host *host) in mmc_attach_sd() argument
1238 BUG_ON(!host); in mmc_attach_sd()
1239 WARN_ON(!host->claimed); in mmc_attach_sd()
1241 err = mmc_send_app_op_cond(host, 0, &ocr); in mmc_attach_sd()
1245 mmc_attach_bus(host, &mmc_sd_ops); in mmc_attach_sd()
1246 if (host->ocr_avail_sd) in mmc_attach_sd()
1247 host->ocr_avail = host->ocr_avail_sd; in mmc_attach_sd()
1252 if (mmc_host_is_spi(host)) { in mmc_attach_sd()
1253 mmc_go_idle(host); in mmc_attach_sd()
1255 err = mmc_spi_read_ocr(host, 0, &ocr); in mmc_attach_sd()
1260 rocr = mmc_select_voltage(host, ocr); in mmc_attach_sd()
1273 err = mmc_sd_init_card(host, rocr, NULL); in mmc_attach_sd()
1277 mmc_release_host(host); in mmc_attach_sd()
1278 err = mmc_add_card(host->card); in mmc_attach_sd()
1279 mmc_claim_host(host); in mmc_attach_sd()
1286 mmc_release_host(host); in mmc_attach_sd()
1287 mmc_remove_card(host->card); in mmc_attach_sd()
1288 host->card = NULL; in mmc_attach_sd()
1289 mmc_claim_host(host); in mmc_attach_sd()
1291 mmc_detach_bus(host); in mmc_attach_sd()
1294 mmc_hostname(host), err); in mmc_attach_sd()