Lines Matching refs:host
110 mmc_hostname(card->host), card->csd.mmca_vsn); in mmc_decode_cid()
144 mmc_hostname(card->host), csd->structure); in mmc_decode_csd()
184 struct mmc_host *host = card->host; in mmc_select_card_type() local
186 u32 caps = host->caps, caps2 = host->caps2; in mmc_select_card_type()
287 mmc_hostname(card->host)); in mmc_manage_enhanced_area()
317 mmc_hostname(card->host)); in mmc_manage_gp_partitions()
354 "version %d\n", mmc_hostname(card->host), in mmc_decode_ext_csd()
361 np = mmc_of_find_child_device(card->host, 0); in mmc_decode_ext_csd()
425 if (ext_csd[EXT_CSD_BOOT_MULT] && mmc_boot_partition_access(card->host)) { in mmc_decode_ext_csd()
512 mmc_hostname(card->host)); in mmc_decode_ext_csd()
537 if (ext_csd[EXT_CSD_RPMB_MULT] && mmc_host_cmd23(card->host)) { in mmc_decode_ext_csd()
623 mmc_hostname(card->host)); in mmc_read_ext_csd()
626 mmc_hostname(card->host)); in mmc_read_ext_csd()
782 struct mmc_host *host = card->host; in __mmc_select_powerclass() local
787 switch (1 << host->ios.vdd) { in __mmc_select_powerclass()
789 if (host->ios.clock <= MMC_HIGH_26_MAX_DTR) in __mmc_select_powerclass()
791 else if (host->ios.clock <= MMC_HIGH_52_MAX_DTR) in __mmc_select_powerclass()
795 else if (host->ios.clock <= MMC_HS200_MAX_DTR) in __mmc_select_powerclass()
807 if (host->ios.clock <= MMC_HIGH_26_MAX_DTR) in __mmc_select_powerclass()
809 else if (host->ios.clock <= MMC_HIGH_52_MAX_DTR) in __mmc_select_powerclass()
813 else if (host->ios.clock <= MMC_HS200_MAX_DTR) in __mmc_select_powerclass()
820 mmc_hostname(host)); in __mmc_select_powerclass()
844 struct mmc_host *host = card->host; in mmc_select_powerclass() local
852 bus_width = host->ios.bus_width; in mmc_select_powerclass()
868 mmc_hostname(host), 1 << bus_width, ddr); in mmc_select_powerclass()
888 mmc_set_clock(card->host, max_dtr); in mmc_set_bus_speed()
906 struct mmc_host *host = card->host; in mmc_select_bus_width() local
911 !(host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) in mmc_select_bus_width()
914 idx = (host->caps & MMC_CAP_8_BIT_DATA) ? 0 : 1; in mmc_select_bus_width()
938 mmc_set_bus_width(host, bus_width); in mmc_select_bus_width()
945 if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST)) in mmc_select_bus_width()
955 mmc_hostname(host), ext_csd_bits[idx]); in mmc_select_bus_width()
974 mmc_set_timing(card->host, MMC_TIMING_MMC_HS); in mmc_select_hs()
984 struct mmc_host *host = card->host; in mmc_select_hs_ddr() local
991 bus_width = host->ios.bus_width; in mmc_select_hs_ddr()
1004 mmc_hostname(host), 1 << bus_width); in mmc_select_hs_ddr()
1035 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); in mmc_select_hs_ddr()
1038 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); in mmc_select_hs_ddr()
1042 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330); in mmc_select_hs_ddr()
1045 mmc_set_timing(host, MMC_TIMING_MMC_DDR52); in mmc_select_hs_ddr()
1060 return mmc_switch_status_error(card->host, status); in mmc_switch_status()
1065 struct mmc_host *host = card->host; in mmc_select_hs400() local
1075 host->ios.bus_width == MMC_BUS_WIDTH_8)) in mmc_select_hs400()
1078 if (host->caps & MMC_CAP_WAIT_WHILE_BUSY) in mmc_select_hs400()
1083 mmc_set_clock(host, max_dtr); in mmc_select_hs400()
1093 mmc_hostname(host), err); in mmc_select_hs400()
1098 mmc_set_timing(card->host, MMC_TIMING_MMC_HS); in mmc_select_hs400()
1113 mmc_hostname(host), err); in mmc_select_hs400()
1126 mmc_hostname(host), err); in mmc_select_hs400()
1131 mmc_set_timing(host, MMC_TIMING_MMC_HS400); in mmc_select_hs400()
1143 pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host), in mmc_select_hs400()
1155 struct mmc_host *host = card->host; in mmc_hs400_to_hs200() local
1161 if (host->caps & MMC_CAP_WAIT_WHILE_BUSY) in mmc_hs400_to_hs200()
1166 mmc_set_clock(host, max_dtr); in mmc_hs400_to_hs200()
1176 mmc_set_timing(host, MMC_TIMING_MMC_DDR52); in mmc_hs400_to_hs200()
1191 mmc_set_timing(host, MMC_TIMING_MMC_HS); in mmc_hs400_to_hs200()
1208 mmc_set_timing(host, MMC_TIMING_MMC_HS200); in mmc_hs400_to_hs200()
1221 pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host), in mmc_hs400_to_hs200()
1240 mmc_set_driver_type(card->host, drv_type); in mmc_select_driver_type()
1252 struct mmc_host *host = card->host; in mmc_select_hs200() local
1259 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); in mmc_select_hs200()
1262 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); in mmc_select_hs200()
1270 if (host->caps & MMC_CAP_WAIT_WHILE_BUSY) in mmc_select_hs200()
1287 old_timing = host->ios.timing; in mmc_select_hs200()
1288 mmc_set_timing(host, MMC_TIMING_MMC_HS200); in mmc_select_hs200()
1296 mmc_set_timing(host, old_timing); in mmc_select_hs200()
1301 pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host), in mmc_select_hs200()
1328 mmc_hostname(card->host)); in mmc_select_timing()
1347 struct mmc_host *host = card->host; in mmc_hs200_tuning() local
1354 host->ios.bus_width == MMC_BUS_WIDTH_8) in mmc_hs200_tuning()
1355 if (host->ops->prepare_hs400_tuning) in mmc_hs200_tuning()
1356 host->ops->prepare_hs400_tuning(host, &host->ios); in mmc_hs200_tuning()
1367 static int mmc_init_card(struct mmc_host *host, u32 ocr, in mmc_init_card() argument
1375 BUG_ON(!host); in mmc_init_card()
1376 WARN_ON(!host->claimed); in mmc_init_card()
1379 if (!mmc_host_is_spi(host)) in mmc_init_card()
1380 mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN); in mmc_init_card()
1389 mmc_go_idle(host); in mmc_init_card()
1392 err = mmc_send_op_cond(host, ocr | (1 << 30), &rocr); in mmc_init_card()
1399 if (mmc_host_is_spi(host)) { in mmc_init_card()
1400 err = mmc_spi_set_crc(host, use_spi_crc); in mmc_init_card()
1408 if (mmc_host_is_spi(host)) in mmc_init_card()
1409 err = mmc_send_cid(host, cid); in mmc_init_card()
1411 err = mmc_all_send_cid(host, cid); in mmc_init_card()
1426 card = mmc_alloc_card(host, &mmc_type); in mmc_init_card()
1441 if (host->ops->init_card) in mmc_init_card()
1442 host->ops->init_card(host, card); in mmc_init_card()
1447 if (!mmc_host_is_spi(host)) { in mmc_init_card()
1452 mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); in mmc_init_card()
1475 if (card->csd.dsr_imp && host->dsr_req) in mmc_init_card()
1476 mmc_set_dsr(host); in mmc_init_card()
1481 if (!mmc_host_is_spi(host)) { in mmc_init_card()
1510 (card->ext_csd.rev >= 3 && (host->caps2 & MMC_CAP2_HC_ERASE_SZ))) { in mmc_init_card()
1610 mmc_hostname(card->host)); in mmc_init_card()
1632 mmc_hostname(card->host), err); in mmc_init_card()
1646 host->caps2 & MMC_CAP2_PACKED_CMD) { in mmc_init_card()
1655 mmc_hostname(card->host)); in mmc_init_card()
1664 host->card = card; in mmc_init_card()
1680 static int mmc_sleep(struct mmc_host *host) in mmc_sleep() argument
1683 struct mmc_card *card = host->card; in mmc_sleep()
1688 mmc_retune_hold(host); in mmc_sleep()
1690 err = mmc_deselect_cards(host); in mmc_sleep()
1704 if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) { in mmc_sleep()
1711 err = mmc_wait_for_cmd(host, &cmd, 0); in mmc_sleep()
1721 if (!cmd.busy_timeout || !(host->caps & MMC_CAP_WAIT_WHILE_BUSY)) in mmc_sleep()
1725 mmc_retune_release(host); in mmc_sleep()
1750 mmc_hostname(card->host), timeout); in mmc_poweroff_notify()
1761 static void mmc_remove(struct mmc_host *host) in mmc_remove() argument
1763 BUG_ON(!host); in mmc_remove()
1764 BUG_ON(!host->card); in mmc_remove()
1766 mmc_remove_card(host->card); in mmc_remove()
1767 host->card = NULL; in mmc_remove()
1773 static int mmc_alive(struct mmc_host *host) in mmc_alive() argument
1775 return mmc_send_status(host->card, NULL); in mmc_alive()
1781 static void mmc_detect(struct mmc_host *host) in mmc_detect() argument
1785 BUG_ON(!host); in mmc_detect()
1786 BUG_ON(!host->card); in mmc_detect()
1788 mmc_get_card(host->card); in mmc_detect()
1793 err = _mmc_detect_card_removed(host); in mmc_detect()
1795 mmc_put_card(host->card); in mmc_detect()
1798 mmc_remove(host); in mmc_detect()
1800 mmc_claim_host(host); in mmc_detect()
1801 mmc_detach_bus(host); in mmc_detect()
1802 mmc_power_off(host); in mmc_detect()
1803 mmc_release_host(host); in mmc_detect()
1807 static int _mmc_suspend(struct mmc_host *host, bool is_suspend) in _mmc_suspend() argument
1813 BUG_ON(!host); in _mmc_suspend()
1814 BUG_ON(!host->card); in _mmc_suspend()
1816 mmc_claim_host(host); in _mmc_suspend()
1818 if (mmc_card_suspended(host->card)) in _mmc_suspend()
1821 if (mmc_card_doing_bkops(host->card)) { in _mmc_suspend()
1822 err = mmc_stop_bkops(host->card); in _mmc_suspend()
1827 err = mmc_flush_cache(host->card); in _mmc_suspend()
1831 if (mmc_can_poweroff_notify(host->card) && in _mmc_suspend()
1832 ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend)) in _mmc_suspend()
1833 err = mmc_poweroff_notify(host->card, notify_type); in _mmc_suspend()
1834 else if (mmc_can_sleep(host->card)) in _mmc_suspend()
1835 err = mmc_sleep(host); in _mmc_suspend()
1836 else if (!mmc_host_is_spi(host)) in _mmc_suspend()
1837 err = mmc_deselect_cards(host); in _mmc_suspend()
1840 mmc_power_off(host); in _mmc_suspend()
1841 mmc_card_set_suspended(host->card); in _mmc_suspend()
1844 mmc_release_host(host); in _mmc_suspend()
1851 static int mmc_suspend(struct mmc_host *host) in mmc_suspend() argument
1855 err = _mmc_suspend(host, true); in mmc_suspend()
1857 pm_runtime_disable(&host->card->dev); in mmc_suspend()
1858 pm_runtime_set_suspended(&host->card->dev); in mmc_suspend()
1868 static int _mmc_resume(struct mmc_host *host) in _mmc_resume() argument
1872 BUG_ON(!host); in _mmc_resume()
1873 BUG_ON(!host->card); in _mmc_resume()
1875 mmc_claim_host(host); in _mmc_resume()
1877 if (!mmc_card_suspended(host->card)) in _mmc_resume()
1880 mmc_power_up(host, host->card->ocr); in _mmc_resume()
1881 err = mmc_init_card(host, host->card->ocr, host->card); in _mmc_resume()
1882 mmc_card_clr_suspended(host->card); in _mmc_resume()
1885 mmc_release_host(host); in _mmc_resume()
1892 static int mmc_shutdown(struct mmc_host *host) in mmc_shutdown() argument
1900 if (mmc_can_poweroff_notify(host->card) && in mmc_shutdown()
1901 !(host->caps2 & MMC_CAP2_FULL_PWR_CYCLE)) in mmc_shutdown()
1902 err = _mmc_resume(host); in mmc_shutdown()
1905 err = _mmc_suspend(host, false); in mmc_shutdown()
1913 static int mmc_resume(struct mmc_host *host) in mmc_resume() argument
1917 if (!(host->caps & MMC_CAP_RUNTIME_RESUME)) { in mmc_resume()
1918 err = _mmc_resume(host); in mmc_resume()
1919 pm_runtime_set_active(&host->card->dev); in mmc_resume()
1920 pm_runtime_mark_last_busy(&host->card->dev); in mmc_resume()
1922 pm_runtime_enable(&host->card->dev); in mmc_resume()
1930 static int mmc_runtime_suspend(struct mmc_host *host) in mmc_runtime_suspend() argument
1934 if (!(host->caps & MMC_CAP_AGGRESSIVE_PM)) in mmc_runtime_suspend()
1937 err = _mmc_suspend(host, true); in mmc_runtime_suspend()
1940 mmc_hostname(host), err); in mmc_runtime_suspend()
1948 static int mmc_runtime_resume(struct mmc_host *host) in mmc_runtime_resume() argument
1952 if (!(host->caps & (MMC_CAP_AGGRESSIVE_PM | MMC_CAP_RUNTIME_RESUME))) in mmc_runtime_resume()
1955 err = _mmc_resume(host); in mmc_runtime_resume()
1958 mmc_hostname(host), err); in mmc_runtime_resume()
1974 static int mmc_reset(struct mmc_host *host) in mmc_reset() argument
1976 struct mmc_card *card = host->card; in mmc_reset()
1978 if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset) in mmc_reset()
1984 mmc_set_clock(host, host->f_init); in mmc_reset()
1986 host->ops->hw_reset(host); in mmc_reset()
1989 mmc_set_initial_state(host); in mmc_reset()
1991 return mmc_init_card(host, card->ocr, card); in mmc_reset()
2009 int mmc_attach_mmc(struct mmc_host *host) in mmc_attach_mmc() argument
2014 BUG_ON(!host); in mmc_attach_mmc()
2015 WARN_ON(!host->claimed); in mmc_attach_mmc()
2018 if (!mmc_host_is_spi(host)) in mmc_attach_mmc()
2019 mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN); in mmc_attach_mmc()
2021 err = mmc_send_op_cond(host, 0, &ocr); in mmc_attach_mmc()
2025 mmc_attach_bus(host, &mmc_ops); in mmc_attach_mmc()
2026 if (host->ocr_avail_mmc) in mmc_attach_mmc()
2027 host->ocr_avail = host->ocr_avail_mmc; in mmc_attach_mmc()
2032 if (mmc_host_is_spi(host)) { in mmc_attach_mmc()
2033 err = mmc_spi_read_ocr(host, 1, &ocr); in mmc_attach_mmc()
2038 rocr = mmc_select_voltage(host, ocr); in mmc_attach_mmc()
2051 err = mmc_init_card(host, rocr, NULL); in mmc_attach_mmc()
2055 mmc_release_host(host); in mmc_attach_mmc()
2056 err = mmc_add_card(host->card); in mmc_attach_mmc()
2060 mmc_claim_host(host); in mmc_attach_mmc()
2064 mmc_remove_card(host->card); in mmc_attach_mmc()
2065 mmc_claim_host(host); in mmc_attach_mmc()
2066 host->card = NULL; in mmc_attach_mmc()
2068 mmc_detach_bus(host); in mmc_attach_mmc()
2071 mmc_hostname(host), err); in mmc_attach_mmc()