Lines Matching refs:host
109 mmc_hostname(card->host), card->csd.mmca_vsn); in mmc_decode_cid()
143 mmc_hostname(card->host), csd->structure); in mmc_decode_csd()
183 struct mmc_host *host = card->host; in mmc_select_card_type() local
185 u32 caps = host->caps, caps2 = host->caps2; in mmc_select_card_type()
284 mmc_hostname(card->host)); in mmc_manage_enhanced_area()
314 mmc_hostname(card->host)); in mmc_manage_gp_partitions()
351 "version %d\n", mmc_hostname(card->host), in mmc_decode_ext_csd()
358 np = mmc_of_find_child_device(card->host, 0); in mmc_decode_ext_csd()
422 if (ext_csd[EXT_CSD_BOOT_MULT] && mmc_boot_partition_access(card->host)) { in mmc_decode_ext_csd()
508 mmc_hostname(card->host)); in mmc_decode_ext_csd()
533 if (ext_csd[EXT_CSD_RPMB_MULT] && mmc_host_cmd23(card->host)) { in mmc_decode_ext_csd()
619 mmc_hostname(card->host)); in mmc_read_ext_csd()
622 mmc_hostname(card->host)); in mmc_read_ext_csd()
778 struct mmc_host *host = card->host; in __mmc_select_powerclass() local
783 switch (1 << host->ios.vdd) { in __mmc_select_powerclass()
785 if (host->ios.clock <= MMC_HIGH_26_MAX_DTR) in __mmc_select_powerclass()
787 else if (host->ios.clock <= MMC_HIGH_52_MAX_DTR) in __mmc_select_powerclass()
791 else if (host->ios.clock <= MMC_HS200_MAX_DTR) in __mmc_select_powerclass()
803 if (host->ios.clock <= MMC_HIGH_26_MAX_DTR) in __mmc_select_powerclass()
805 else if (host->ios.clock <= MMC_HIGH_52_MAX_DTR) in __mmc_select_powerclass()
809 else if (host->ios.clock <= MMC_HS200_MAX_DTR) in __mmc_select_powerclass()
816 mmc_hostname(host)); in __mmc_select_powerclass()
840 struct mmc_host *host = card->host; in mmc_select_powerclass() local
848 bus_width = host->ios.bus_width; in mmc_select_powerclass()
864 mmc_hostname(host), 1 << bus_width, ddr); in mmc_select_powerclass()
884 mmc_set_clock(card->host, max_dtr); in mmc_set_bus_speed()
902 struct mmc_host *host = card->host; in mmc_select_bus_width() local
907 !(host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) in mmc_select_bus_width()
910 idx = (host->caps & MMC_CAP_8_BIT_DATA) ? 0 : 1; in mmc_select_bus_width()
934 mmc_set_bus_width(host, bus_width); in mmc_select_bus_width()
941 if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST)) in mmc_select_bus_width()
951 mmc_hostname(host), ext_csd_bits[idx]); in mmc_select_bus_width()
970 mmc_set_timing(card->host, MMC_TIMING_MMC_HS); in mmc_select_hs()
980 struct mmc_host *host = card->host; in mmc_select_hs_ddr() local
987 bus_width = host->ios.bus_width; in mmc_select_hs_ddr()
1000 mmc_hostname(host), 1 << bus_width); in mmc_select_hs_ddr()
1031 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); in mmc_select_hs_ddr()
1034 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); in mmc_select_hs_ddr()
1038 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330); in mmc_select_hs_ddr()
1041 mmc_set_timing(host, MMC_TIMING_MMC_DDR52); in mmc_select_hs_ddr()
1048 struct mmc_host *host = card->host; in mmc_select_hs400() local
1055 host->ios.bus_width == MMC_BUS_WIDTH_8)) in mmc_select_hs400()
1062 mmc_set_timing(card->host, MMC_TIMING_MMC_HS); in mmc_select_hs400()
1071 mmc_hostname(host), err); in mmc_select_hs400()
1081 mmc_hostname(host), err); in mmc_select_hs400()
1091 mmc_hostname(host), err); in mmc_select_hs400()
1095 mmc_set_timing(host, MMC_TIMING_MMC_HS400); in mmc_select_hs400()
1110 struct mmc_host *host = card->host; in mmc_select_hs200() local
1114 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); in mmc_select_hs200()
1117 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); in mmc_select_hs200()
1134 mmc_set_timing(host, MMC_TIMING_MMC_HS200); in mmc_select_hs200()
1162 mmc_hostname(card->host)); in mmc_select_timing()
1181 struct mmc_host *host = card->host; in mmc_hs200_tuning() local
1188 host->ios.bus_width == MMC_BUS_WIDTH_8) in mmc_hs200_tuning()
1189 if (host->ops->prepare_hs400_tuning) in mmc_hs200_tuning()
1190 host->ops->prepare_hs400_tuning(host, &host->ios); in mmc_hs200_tuning()
1201 static int mmc_init_card(struct mmc_host *host, u32 ocr, in mmc_init_card() argument
1209 BUG_ON(!host); in mmc_init_card()
1210 WARN_ON(!host->claimed); in mmc_init_card()
1213 if (!mmc_host_is_spi(host)) in mmc_init_card()
1214 mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN); in mmc_init_card()
1223 mmc_go_idle(host); in mmc_init_card()
1226 err = mmc_send_op_cond(host, ocr | (1 << 30), &rocr); in mmc_init_card()
1233 if (mmc_host_is_spi(host)) { in mmc_init_card()
1234 err = mmc_spi_set_crc(host, use_spi_crc); in mmc_init_card()
1242 if (mmc_host_is_spi(host)) in mmc_init_card()
1243 err = mmc_send_cid(host, cid); in mmc_init_card()
1245 err = mmc_all_send_cid(host, cid); in mmc_init_card()
1260 card = mmc_alloc_card(host, &mmc_type); in mmc_init_card()
1275 if (host->ops->init_card) in mmc_init_card()
1276 host->ops->init_card(host, card); in mmc_init_card()
1281 if (!mmc_host_is_spi(host)) { in mmc_init_card()
1286 mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); in mmc_init_card()
1309 if (card->csd.dsr_imp && host->dsr_req) in mmc_init_card()
1310 mmc_set_dsr(host); in mmc_init_card()
1315 if (!mmc_host_is_spi(host)) { in mmc_init_card()
1344 (card->ext_csd.rev >= 3 && (host->caps2 & MMC_CAP2_HC_ERASE_SZ))) { in mmc_init_card()
1444 mmc_hostname(card->host)); in mmc_init_card()
1466 mmc_hostname(card->host), err); in mmc_init_card()
1480 host->caps2 & MMC_CAP2_PACKED_CMD) { in mmc_init_card()
1489 mmc_hostname(card->host)); in mmc_init_card()
1498 host->card = card; in mmc_init_card()
1514 static int mmc_sleep(struct mmc_host *host) in mmc_sleep() argument
1517 struct mmc_card *card = host->card; in mmc_sleep()
1521 err = mmc_deselect_cards(host); in mmc_sleep()
1535 if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) { in mmc_sleep()
1542 err = mmc_wait_for_cmd(host, &cmd, 0); in mmc_sleep()
1552 if (!cmd.busy_timeout || !(host->caps & MMC_CAP_WAIT_WHILE_BUSY)) in mmc_sleep()
1579 mmc_hostname(card->host), timeout); in mmc_poweroff_notify()
1590 static void mmc_remove(struct mmc_host *host) in mmc_remove() argument
1592 BUG_ON(!host); in mmc_remove()
1593 BUG_ON(!host->card); in mmc_remove()
1595 mmc_remove_card(host->card); in mmc_remove()
1596 host->card = NULL; in mmc_remove()
1602 static int mmc_alive(struct mmc_host *host) in mmc_alive() argument
1604 return mmc_send_status(host->card, NULL); in mmc_alive()
1610 static void mmc_detect(struct mmc_host *host) in mmc_detect() argument
1614 BUG_ON(!host); in mmc_detect()
1615 BUG_ON(!host->card); in mmc_detect()
1617 mmc_get_card(host->card); in mmc_detect()
1622 err = _mmc_detect_card_removed(host); in mmc_detect()
1624 mmc_put_card(host->card); in mmc_detect()
1627 mmc_remove(host); in mmc_detect()
1629 mmc_claim_host(host); in mmc_detect()
1630 mmc_detach_bus(host); in mmc_detect()
1631 mmc_power_off(host); in mmc_detect()
1632 mmc_release_host(host); in mmc_detect()
1636 static int _mmc_suspend(struct mmc_host *host, bool is_suspend) in _mmc_suspend() argument
1642 BUG_ON(!host); in _mmc_suspend()
1643 BUG_ON(!host->card); in _mmc_suspend()
1645 mmc_claim_host(host); in _mmc_suspend()
1647 if (mmc_card_suspended(host->card)) in _mmc_suspend()
1650 if (mmc_card_doing_bkops(host->card)) { in _mmc_suspend()
1651 err = mmc_stop_bkops(host->card); in _mmc_suspend()
1656 err = mmc_flush_cache(host->card); in _mmc_suspend()
1660 if (mmc_can_poweroff_notify(host->card) && in _mmc_suspend()
1661 ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend)) in _mmc_suspend()
1662 err = mmc_poweroff_notify(host->card, notify_type); in _mmc_suspend()
1663 else if (mmc_can_sleep(host->card)) in _mmc_suspend()
1664 err = mmc_sleep(host); in _mmc_suspend()
1665 else if (!mmc_host_is_spi(host)) in _mmc_suspend()
1666 err = mmc_deselect_cards(host); in _mmc_suspend()
1669 mmc_power_off(host); in _mmc_suspend()
1670 mmc_card_set_suspended(host->card); in _mmc_suspend()
1673 mmc_release_host(host); in _mmc_suspend()
1680 static int mmc_suspend(struct mmc_host *host) in mmc_suspend() argument
1684 err = _mmc_suspend(host, true); in mmc_suspend()
1686 pm_runtime_disable(&host->card->dev); in mmc_suspend()
1687 pm_runtime_set_suspended(&host->card->dev); in mmc_suspend()
1697 static int _mmc_resume(struct mmc_host *host) in _mmc_resume() argument
1701 BUG_ON(!host); in _mmc_resume()
1702 BUG_ON(!host->card); in _mmc_resume()
1704 mmc_claim_host(host); in _mmc_resume()
1706 if (!mmc_card_suspended(host->card)) in _mmc_resume()
1709 mmc_power_up(host, host->card->ocr); in _mmc_resume()
1710 err = mmc_init_card(host, host->card->ocr, host->card); in _mmc_resume()
1711 mmc_card_clr_suspended(host->card); in _mmc_resume()
1714 mmc_release_host(host); in _mmc_resume()
1721 static int mmc_shutdown(struct mmc_host *host) in mmc_shutdown() argument
1729 if (mmc_can_poweroff_notify(host->card) && in mmc_shutdown()
1730 !(host->caps2 & MMC_CAP2_FULL_PWR_CYCLE)) in mmc_shutdown()
1731 err = _mmc_resume(host); in mmc_shutdown()
1734 err = _mmc_suspend(host, false); in mmc_shutdown()
1742 static int mmc_resume(struct mmc_host *host) in mmc_resume() argument
1746 if (!(host->caps & MMC_CAP_RUNTIME_RESUME)) { in mmc_resume()
1747 err = _mmc_resume(host); in mmc_resume()
1748 pm_runtime_set_active(&host->card->dev); in mmc_resume()
1749 pm_runtime_mark_last_busy(&host->card->dev); in mmc_resume()
1751 pm_runtime_enable(&host->card->dev); in mmc_resume()
1759 static int mmc_runtime_suspend(struct mmc_host *host) in mmc_runtime_suspend() argument
1763 if (!(host->caps & MMC_CAP_AGGRESSIVE_PM)) in mmc_runtime_suspend()
1766 err = _mmc_suspend(host, true); in mmc_runtime_suspend()
1769 mmc_hostname(host), err); in mmc_runtime_suspend()
1777 static int mmc_runtime_resume(struct mmc_host *host) in mmc_runtime_resume() argument
1781 if (!(host->caps & (MMC_CAP_AGGRESSIVE_PM | MMC_CAP_RUNTIME_RESUME))) in mmc_runtime_resume()
1784 err = _mmc_resume(host); in mmc_runtime_resume()
1787 mmc_hostname(host), err); in mmc_runtime_resume()
1792 static int mmc_power_restore(struct mmc_host *host) in mmc_power_restore() argument
1796 mmc_claim_host(host); in mmc_power_restore()
1797 ret = mmc_init_card(host, host->card->ocr, host->card); in mmc_power_restore()
1798 mmc_release_host(host); in mmc_power_restore()
1814 static int mmc_reset(struct mmc_host *host) in mmc_reset() argument
1816 struct mmc_card *card = host->card; in mmc_reset()
1819 if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset) in mmc_reset()
1825 mmc_host_clk_hold(host); in mmc_reset()
1826 mmc_set_clock(host, host->f_init); in mmc_reset()
1828 host->ops->hw_reset(host); in mmc_reset()
1832 mmc_host_clk_release(host); in mmc_reset()
1837 mmc_set_initial_state(host); in mmc_reset()
1838 mmc_host_clk_release(host); in mmc_reset()
1840 return mmc_power_restore(host); in mmc_reset()
1859 int mmc_attach_mmc(struct mmc_host *host) in mmc_attach_mmc() argument
1864 BUG_ON(!host); in mmc_attach_mmc()
1865 WARN_ON(!host->claimed); in mmc_attach_mmc()
1868 if (!mmc_host_is_spi(host)) in mmc_attach_mmc()
1869 mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN); in mmc_attach_mmc()
1871 err = mmc_send_op_cond(host, 0, &ocr); in mmc_attach_mmc()
1875 mmc_attach_bus(host, &mmc_ops); in mmc_attach_mmc()
1876 if (host->ocr_avail_mmc) in mmc_attach_mmc()
1877 host->ocr_avail = host->ocr_avail_mmc; in mmc_attach_mmc()
1882 if (mmc_host_is_spi(host)) { in mmc_attach_mmc()
1883 err = mmc_spi_read_ocr(host, 1, &ocr); in mmc_attach_mmc()
1888 rocr = mmc_select_voltage(host, ocr); in mmc_attach_mmc()
1901 err = mmc_init_card(host, rocr, NULL); in mmc_attach_mmc()
1905 mmc_release_host(host); in mmc_attach_mmc()
1906 err = mmc_add_card(host->card); in mmc_attach_mmc()
1907 mmc_claim_host(host); in mmc_attach_mmc()
1914 mmc_release_host(host); in mmc_attach_mmc()
1915 mmc_remove_card(host->card); in mmc_attach_mmc()
1916 mmc_claim_host(host); in mmc_attach_mmc()
1917 host->card = NULL; in mmc_attach_mmc()
1919 mmc_detach_bus(host); in mmc_attach_mmc()
1922 mmc_hostname(host), err); in mmc_attach_mmc()