Lines Matching refs:host_div
758 void sdmmc_host_get_clk_dividers(uint32_t freq_khz, int *host_div, int *card_div) in sdmmc_host_get_clk_dividers() argument
768 *host_div = 4; /* 160 MHz / 4 = 40 MHz */ in sdmmc_host_get_clk_dividers()
771 *host_div = 8; /* 160 MHz / 8 = 20 MHz */ in sdmmc_host_get_clk_dividers()
774 *host_div = 10; /* 160 MHz / 10 / (20 * 2) = 400 kHz */ in sdmmc_host_get_clk_dividers()
783 *host_div = (clk_src_freq_hz) / (freq_khz * 1000); in sdmmc_host_get_clk_dividers()
784 if (*host_div > 15) { in sdmmc_host_get_clk_dividers()
785 *host_div = 2; in sdmmc_host_get_clk_dividers()
791 (*host_div)++; in sdmmc_host_get_clk_dividers()
796 static int sdmmc_host_calc_freq(const int host_div, const int card_div) in sdmmc_host_calc_freq() argument
804 return clk_src_freq_hz / host_div / ((card_div == 0) ? 1 : card_div * 2) / 1000; in sdmmc_host_calc_freq()
823 int host_div = 0; /* clock divider of the host (sdio_hw->clock) */ in sdmmc_host_set_card_clk() local
826 sdmmc_host_get_clk_dividers(freq_khz, &host_div, &card_div); in sdmmc_host_set_card_clk()
828 int real_freq = sdmmc_host_calc_freq(host_div, card_div); in sdmmc_host_set_card_clk()
830 LOG_DBG("slot=%d host_div=%d card_div=%d freq=%dkHz (max %" PRIu32 "kHz)", slot, host_div, in sdmmc_host_set_card_clk()
835 err = sdmmc_host_set_clk_div(sdio_hw, host_div); in sdmmc_host_set_card_clk()