/* Mask off any voltages we don't support and select the lowest voltage  */
rt_uint32_t mmcsd_select_voltage(struct rt_mmcsd_host *host, rt_uint32_t ocr)
/* Mask off any voltages we don't support and select the lowest voltage  */
rt_uint32_t mmcsd_select_voltage(struct rt_mmcsd_host *host, rt_uint32_t ocr)
{
    int bit;
    extern int __rt_ffs(int value);
    ocr &= host->valid_ocr;
    bit = __rt_ffs(ocr);
    if (bit)
    {
        bit -= 1;
        ocr &= 3 << bit;
        host->io_cfg.vdd = bit;
        mmcsd_set_iocfg(host);
    }
    else
    {
        LOG_W("host doesn't support card's voltages!");
        ocr = 0;
    }
    return ocr;
}