1b93931a6SPierre Ossman /* 2b93931a6SPierre Ossman * linux/drivers/mmc/core/host.h 3b93931a6SPierre Ossman * 4b93931a6SPierre Ossman * Copyright (C) 2003 Russell King, All Rights Reserved. 5b93931a6SPierre Ossman * Copyright 2007 Pierre Ossman 6b93931a6SPierre Ossman * 7b93931a6SPierre Ossman * This program is free software; you can redistribute it and/or modify 8b93931a6SPierre Ossman * it under the terms of the GNU General Public License version 2 as 9b93931a6SPierre Ossman * published by the Free Software Foundation. 10b93931a6SPierre Ossman */ 11b93931a6SPierre Ossman #ifndef _MMC_CORE_HOST_H 12b93931a6SPierre Ossman #define _MMC_CORE_HOST_H 13066185d6SUlf Hansson 145857b29bSUlf Hansson #include <linux/mmc/host.h> 15b93931a6SPierre Ossman 16b93931a6SPierre Ossman int mmc_register_host_class(void); 17b93931a6SPierre Ossman void mmc_unregister_host_class(void); 188ea926b2SAdrian Hunter 19dfa13ebbSAdrian Hunter void mmc_retune_enable(struct mmc_host *host); 20dfa13ebbSAdrian Hunter void mmc_retune_disable(struct mmc_host *host); 21dfa13ebbSAdrian Hunter void mmc_retune_hold(struct mmc_host *host); 22dfa13ebbSAdrian Hunter void mmc_retune_release(struct mmc_host *host); 23dfa13ebbSAdrian Hunter int mmc_retune(struct mmc_host *host); 245857b29bSUlf Hansson void mmc_retune_pause(struct mmc_host *host); 255857b29bSUlf Hansson void mmc_retune_unpause(struct mmc_host *host); 265857b29bSUlf Hansson 27cb39f61eSAdrian Hunter static inline void mmc_retune_hold_now(struct mmc_host *host) 28cb39f61eSAdrian Hunter { 29cb39f61eSAdrian Hunter host->retune_now = 0; 30cb39f61eSAdrian Hunter host->hold_retune += 1; 31cb39f61eSAdrian Hunter } 32cb39f61eSAdrian Hunter 335857b29bSUlf Hansson static inline void mmc_retune_recheck(struct mmc_host *host) 345857b29bSUlf Hansson { 355857b29bSUlf Hansson if (host->hold_retune <= 1) 365857b29bSUlf Hansson host->retune_now = 1; 375857b29bSUlf Hansson } 385857b29bSUlf Hansson 395857b29bSUlf Hansson static inline int mmc_host_cmd23(struct mmc_host *host) 405857b29bSUlf Hansson { 415857b29bSUlf Hansson return host->caps & MMC_CAP_CMD23; 425857b29bSUlf Hansson } 435857b29bSUlf Hansson 44*10f21df4SAdrian Hunter static inline bool mmc_host_done_complete(struct mmc_host *host) 45*10f21df4SAdrian Hunter { 46*10f21df4SAdrian Hunter return host->caps & MMC_CAP_DONE_COMPLETE; 47*10f21df4SAdrian Hunter } 48*10f21df4SAdrian Hunter 495857b29bSUlf Hansson static inline int mmc_boot_partition_access(struct mmc_host *host) 505857b29bSUlf Hansson { 515857b29bSUlf Hansson return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); 525857b29bSUlf Hansson } 535857b29bSUlf Hansson 545857b29bSUlf Hansson static inline int mmc_host_uhs(struct mmc_host *host) 555857b29bSUlf Hansson { 565857b29bSUlf Hansson return host->caps & 575857b29bSUlf Hansson (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | 585857b29bSUlf Hansson MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | 595857b29bSUlf Hansson MMC_CAP_UHS_DDR50); 605857b29bSUlf Hansson } 615857b29bSUlf Hansson 625857b29bSUlf Hansson static inline bool mmc_card_hs200(struct mmc_card *card) 635857b29bSUlf Hansson { 645857b29bSUlf Hansson return card->host->ios.timing == MMC_TIMING_MMC_HS200; 655857b29bSUlf Hansson } 665857b29bSUlf Hansson 675857b29bSUlf Hansson static inline bool mmc_card_ddr52(struct mmc_card *card) 685857b29bSUlf Hansson { 695857b29bSUlf Hansson return card->host->ios.timing == MMC_TIMING_MMC_DDR52; 705857b29bSUlf Hansson } 715857b29bSUlf Hansson 725857b29bSUlf Hansson static inline bool mmc_card_hs400(struct mmc_card *card) 735857b29bSUlf Hansson { 745857b29bSUlf Hansson return card->host->ios.timing == MMC_TIMING_MMC_HS400; 755857b29bSUlf Hansson } 765857b29bSUlf Hansson 775857b29bSUlf Hansson static inline bool mmc_card_hs400es(struct mmc_card *card) 785857b29bSUlf Hansson { 795857b29bSUlf Hansson return card->host->ios.enhanced_strobe; 805857b29bSUlf Hansson } 815857b29bSUlf Hansson 82c3d53d0dSAdrian Hunter static inline bool mmc_host_use_blk_mq(struct mmc_host *host) 83c3d53d0dSAdrian Hunter { 84c3d53d0dSAdrian Hunter return host->use_blk_mq; 85c3d53d0dSAdrian Hunter } 86dfa13ebbSAdrian Hunter 87b93931a6SPierre Ossman #endif 88b93931a6SPierre Ossman 89