Lines Matching full:if

35 #if CONFIG_IS_ENABLED(MMC_TINY)
48 if (m->preinit) in mmc_do_preinit()
58 #if !CONFIG_IS_ENABLED(DM_MMC)
70 if (wp < 0) { in mmc_getwp()
71 if (mmc->cfg->ops->getwp) in mmc_getwp()
98 if (ret) { in mmmc_trace_after_send()
154 #if !CONFIG_IS_ENABLED(DM_MMC)
174 if (!mmc_host_is_spi(mmc)) in mmc_send_status()
179 if (!err) { in mmc_send_status()
180 if ((cmd.response[0] & MMC_STATUS_RDY_FOR_DATA) && in mmc_send_status()
184 else if (cmd.response[0] & MMC_STATUS_MASK) { in mmc_send_status()
185 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) in mmc_send_status()
191 } else if (--retries < 0) in mmc_send_status()
194 if (timeout-- <= 0) in mmc_send_status()
201 if (timeout <= 0) { in mmc_send_status()
202 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) in mmc_send_status()
215 if (mmc_card_ddr(mmc)) in mmc_set_blocklen()
231 if (is_rel_write) in mmc_set_blockcount()
244 if (blkcnt > 1) in mmc_read_blocks()
249 if (mmc->high_capacity) in mmc_read_blocks()
261 if (mmc_send_cmd(mmc, &cmd, &data)) in mmc_read_blocks()
264 if (blkcnt > 1) { in mmc_read_blocks()
268 if (mmc_send_cmd(mmc, &cmd, NULL)) { in mmc_read_blocks()
269 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) in mmc_read_blocks()
286 if (blkcnt > 1) { in mmc_read_blocks_prepare()
293 if (mmc->high_capacity) in mmc_read_blocks_prepare()
305 if (mmc_send_cmd_prepare(mmc, &cmd, &data)) in mmc_read_blocks_prepare()
313 #if CONFIG_IS_ENABLED(BLK)
320 #if CONFIG_IS_ENABLED(BLK) in mmc_bread_prepare()
327 if (blkcnt == 0) in mmc_bread_prepare()
332 if (!mmc) in mmc_bread_prepare()
335 if (CONFIG_IS_ENABLED(MMC_TINY)) in mmc_bread_prepare()
340 if (err < 0) in mmc_bread_prepare()
343 if ((start + blkcnt) > block_dev->lba) { in mmc_bread_prepare()
344 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) in mmc_bread_prepare()
351 if (mmc_set_blocklen(mmc, mmc->read_bl_len)) { in mmc_bread_prepare()
356 if (mmc_read_blocks_prepare(mmc, dst, start, blkcnt) != blkcnt) { in mmc_bread_prepare()
363 if (timeout > 7) { in mmc_bread_prepare()
369 if (mmc_init(mmc)) in mmc_bread_prepare()
372 if (mmc_read_blocks_prepare(mmc, dst, start, blkcnt) != blkcnt) { in mmc_bread_prepare()
383 #if CONFIG_IS_ENABLED(BLK)
390 #if CONFIG_IS_ENABLED(BLK) in mmc_bread()
398 if (block_dev->op_flag == BLK_PRE_RW) in mmc_bread()
399 #if CONFIG_IS_ENABLED(BLK) in mmc_bread()
405 if (blkcnt == 0) in mmc_bread()
409 if (!mmc) in mmc_bread()
412 if (CONFIG_IS_ENABLED(MMC_TINY)) in mmc_bread()
417 if (err < 0) in mmc_bread()
420 if ((start + blkcnt) > block_dev->lba) { in mmc_bread()
421 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) in mmc_bread()
428 if (mmc_set_blocklen(mmc, mmc->read_bl_len)) { in mmc_bread()
436 if (mmc_read_blocks(mmc, dst, start, cur) != cur) { in mmc_bread()
444 if (timeout > 7) { in mmc_bread()
450 if (mmc_init(mmc)) in mmc_bread()
453 if (mmc_read_blocks(mmc, dst, start, cur) != cur) { in mmc_bread()
469 if (clock > mmc->cfg->f_max) in mmc_set_clock()
472 if (clock < mmc->cfg->f_min) in mmc_set_clock()
506 if (err) in mmc_go_idle()
528 if (err) in sd_send_op_cond()
535 * Most cards do not answer if some reserved bits in sd_send_op_cond()
544 if (mmc->version == SD_VERSION_2) in sd_send_op_cond()
549 if (err) in sd_send_op_cond()
552 if (cmd.response[0] & OCR_BUSY) in sd_send_op_cond()
555 if (timeout-- <= 0) in sd_send_op_cond()
561 if (mmc->version != SD_VERSION_2) in sd_send_op_cond()
564 if (mmc_host_is_spi(mmc)) { /* read OCR for spi */ in sd_send_op_cond()
571 if (err) in sd_send_op_cond()
592 if (use_arg && !mmc_host_is_spi(mmc)) in mmc_send_op_cond_iter()
599 if (err) in mmc_send_op_cond_iter()
616 if (err) in mmc_send_op_cond()
619 /* exit if not busy (flag seems to be inverted) */ in mmc_send_op_cond()
620 if (mmc->ocr & OCR_BUSY) in mmc_send_op_cond()
635 if (!(mmc->ocr & OCR_BUSY)) { in mmc_complete_op_cond()
642 if (err) in mmc_complete_op_cond()
644 if (mmc->ocr & OCR_BUSY) in mmc_complete_op_cond()
646 if (get_timer(start) > timeout) in mmc_complete_op_cond()
652 if (mmc_host_is_spi(mmc)) { /* read OCR for spi */ in mmc_complete_op_cond()
659 if (err) in mmc_complete_op_cond()
682 if (initialized) { in mmc_send_ext_csd()
701 #if defined(CONFIG_MMC_USE_PRE_CONFIG) && defined(CONFIG_SPL_BUILD) in mmc_send_ext_csd()
707 if (mmc_ecsd_base) { in mmc_send_ext_csd()
729 if (!send_status && !mmc_can_card_busy(mmc)) { in mmc_poll_for_busy()
735 if (!send_status) { in mmc_poll_for_busy()
740 if (ret) in mmc_poll_for_busy()
743 if (cmd.response[0] & MMC_STATUS_SWITCH_ERROR) in mmc_poll_for_busy()
749 if (get_timer(start) > timeout && busy) in mmc_poll_for_busy()
772 if (!ret) in __mmc_switch()
799 if (mmc->version < MMC_VERSION_4 || in mmc_select_bus_width()
805 if (err) in mmc_select_bus_width()
819 * the device to work in 8bit transfer mode. If the in mmc_select_bus_width()
826 if (err) in mmc_select_bus_width()
834 if (err) in mmc_select_bus_width()
838 if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] == in mmc_select_bus_width()
896 if (mmc->bus_width == MMC_BUS_WIDTH_8BIT) { in mmc_send_tuning()
899 } else if (mmc->bus_width == MMC_BUS_WIDTH_4BIT) { in mmc_send_tuning()
907 if (!data_buf) in mmc_send_tuning()
920 if (err) { in mmc_send_tuning()
927 if (memcmp(data_buf, tuning_block_pattern, size)) in mmc_send_tuning()
941 if (IS_SD(mmc))
947 if (mmc->cfg->ops->execute_tuning) {
950 if (ops->execute_tuning) {
977 if (!ret)
988 if (mmc->bus_width == MMC_BUS_WIDTH_1BIT)
996 if (err)
1011 * switch to HS200 mode if bus width is set successfully.
1015 if (ret > 0) {
1020 if (ret)
1049 if (ret)
1059 if (ret)
1066 if (ret)
1071 if (ret)
1087 if (err)
1094 if (err)
1102 if (err) {
1109 if (err)
1131 if ((host_caps & MMC_MODE_HS) &&
1135 if ((host_caps & MMC_MODE_HS) &&
1145 if ((host_caps & MMC_MODE_DDR_52MHz) &&
1149 if ((host_caps & MMC_MODE_HS200) &&
1154 * If host can support HS400, it means that host can also
1157 if ((host_caps & MMC_MODE_HS400) &&
1163 if ((host_caps & MMC_MODE_HS400ES) &&
1178 if (mmc_card_hs(mmc))
1181 else if (mmc_card_hs200(mmc) ||
1197 if (mmc_host_is_spi(mmc))
1201 if (mmc->version < MMC_VERSION_4)
1208 if (err)
1213 if (avail_type & EXT_CSD_CARD_TYPE_HS400ES) {
1215 if (err > 0 && mmc->bus_width == MMC_BUS_WIDTH_8BIT) {
1218 if (!err)
1223 if (avail_type & EXT_CSD_CARD_TYPE_HS200)
1225 else if (avail_type & EXT_CSD_CARD_TYPE_HS)
1230 if (err)
1235 if (mmc_card_hs200(mmc)) {
1237 if (avail_type & EXT_CSD_CARD_TYPE_HS400 &&
1242 } else if (!mmc_card_hs400es(mmc)) {
1244 if (!err && avail_type & EXT_CSD_CARD_TYPE_DDR_52)
1288 * Set the capacity if the switch succeeded or was intended
1291 if ((ret == 0) || ((ret == -ENODEV) && (part_num == 0))) {
1313 if (mode < MMC_HWPART_CONF_CHECK || mode > MMC_HWPART_CONF_COMPLETE)
1316 if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4_41)) {
1321 if (!(mmc->part_support & PART_SUPPORT)) {
1326 if (!mmc->hc_wp_grp_size) {
1332 if (conf->user.enh_size) {
1333 if (conf->user.enh_size % mmc->hc_wp_grp_size ||
1341 if (mmc->high_capacity) {
1353 if (conf->gp_part[pidx].size % mmc->hc_wp_grp_size) {
1359 if (conf->gp_part[pidx].size && conf->gp_part[pidx].enhanced) {
1365 if (part_attrs && ! (mmc->part_support & ENHNCD_SUPPORT)) {
1371 if (err)
1378 if (tot_enh_size_mult > max_enh_size_mult) {
1385 * dependent, the values can only be changed if the
1389 if (conf->user.wr_rel_change) {
1390 if (conf->user.wr_rel_set)
1396 if (conf->gp_part[pidx].wr_rel_change) {
1397 if (conf->gp_part[pidx].wr_rel_set)
1404 if (wr_rel_set != ext_csd[EXT_CSD_WR_REL_SET] &&
1411 if (ext_csd[EXT_CSD_PARTITION_SETTING] &
1417 if (mode == MMC_HWPART_CONF_CHECK)
1421 if (!(ext_csd[EXT_CSD_ERASE_GROUP_DEF] & 0x01)) {
1425 if (err)
1441 if (err)
1448 if (err)
1456 if (err)
1462 if (err)
1465 if (mode == MMC_HWPART_CONF_SET)
1472 if (wr_rel_set != ext_csd[EXT_CSD_WR_REL_SET]) {
1475 if (err)
1487 if (err)
1493 #if !CONFIG_IS_ENABLED(DM_MMC)
1500 if (cd < 0) {
1501 if (mmc->cfg->ops->getcd)
1543 if (mmc_host_is_spi(mmc))
1546 /* Read the SCR to find out if this card supports higher speeds */
1553 if (err)
1570 if (err) {
1571 if (timeout--)
1589 if ((mmc->scr[0] >> 15) & 0x1)
1597 if (mmc->scr[0] & SD_DATA_4BIT)
1601 if (mmc->version == SD_VERSION_1_0)
1609 if (err)
1613 if (!(__be32_to_cpu(switch_status[7]) & SD_HIGHSPEED_BUSY))
1617 /* If high-speed isn't supported, we return */
1618 if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
1622 * If the host doesn't support SD_HIGHSPEED, do not switch card to
1623 * HIGHSPEED mode even if the card support SD_HIGHSPPED.
1627 if (!((mmc->cfg->host_caps & MMC_MODE_HS_52MHz) &&
1633 if (err)
1636 if ((__be32_to_cpu(switch_status[4]) & 0x0f000000) == 0x01000000)
1656 if (err)
1670 if (err) {
1671 if (timeout--)
1681 if ((au <= 9) || (mmc->version == SD_VERSION_3)) {
1686 if (es && et) {
1729 #if !CONFIG_IS_ENABLED(DM_MMC)
1732 if (mmc->cfg->ops->set_ios)
1738 if (!mmc->cfg->ops->card_busy)
1762 if (mmc_host_is_spi(mmc)) { /* enable CRC check for spi */
1768 if (err)
1781 if (err)
1791 if (!mmc_host_is_spi(mmc)) { /* cmd not supported in spi */
1798 if (err)
1801 if (IS_SD(mmc))
1812 if (err)
1820 if (mmc->version == MMC_VERSION_UNKNOWN) {
1854 if (IS_SD(mmc))
1859 if (mmc->high_capacity) {
1876 if (mmc->read_bl_len > MMC_MAX_BLOCK_LEN)
1879 if (mmc->write_bl_len > MMC_MAX_BLOCK_LEN)
1882 if ((mmc->dsr_imp) && (0xffffffff != mmc->dsr)) {
1886 if (mmc_send_cmd(mmc, &cmd, NULL))
1891 if (!mmc_host_is_spi(mmc)) { /* cmd not supported in spi */
1897 if (err)
1906 if (!IS_SD(mmc) && (mmc->version >= MMC_VERSION_4)) {
1913 if (err)
1915 if (ext_csd[EXT_CSD_REV] >= 2) {
1918 * ext_csd's capacity is valid if the value is more
1926 if ((capacity >> 20) > 2 * 1024)
1955 * effective if PARTITION_SETTING_COMPLETED is set in
1956 * EXT_CSD, so ignore any data if this bit is not set,
1964 if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) ||
1967 if (part_completed &&
1970 if (ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] & EXT_CSD_SEC_GB_CL_EN)
1981 if (mult)
1983 if (!part_completed)
1992 if (part_completed) {
2005 if (mmc->high_capacity)
2010 * Host needs to enable ERASE_GRP_DEF bit if device is
2014 if (part_completed)
2016 if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) &&
2019 if (has_parts) {
2023 if (err)
2029 if (ext_csd[EXT_CSD_ERASE_GROUP_DEF] & 0x01) {
2034 * if high capacity and partition setting completed
2035 * SEC_COUNT is valid even if it is smaller than 2 GiB
2038 if (mmc->high_capacity && part_completed) {
2065 if (err)
2068 if (IS_SD(mmc))
2073 if (err)
2079 if (IS_SD(mmc)) {
2080 if (mmc->card_caps & MMC_MODE_4BIT) {
2086 if (err)
2093 if (err)
2100 if (err)
2103 if (mmc->card_caps & MMC_MODE_HS)
2112 if (mmc_card_ddr(mmc)) {
2125 #if !defined(CONFIG_SPL_BUILD) || \
2142 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
2156 /* We set the bit if the host supports voltages between 2.7 and 3.6 V */
2162 if (err)
2165 if ((cmd.response[0] & 0xff) != 0xaa)
2174 #if !CONFIG_IS_ENABLED(DM_MMC)
2184 #if CONFIG_IS_ENABLED(DM_MMC)
2185 #if defined(CONFIG_DM_REGULATOR) && !defined(CONFIG_SPL_BUILD)
2191 if (ret) {
2197 if (ret) {
2219 if (!mmc_host_is_spi(mmc)) { /* cmd not supported in spi */
2237 if (mmc->cfg->host_caps & MMC_MODE_8BIT)
2239 else if (mmc->cfg->host_caps & MMC_MODE_4BIT)
2268 #if !CONFIG_IS_ENABLED(DM_MMC)
2271 if (no_card) {
2273 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
2279 if (mmc->has_init)
2286 if (err)
2289 #if CONFIG_IS_ENABLED(DM_MMC)
2294 if (err)
2304 if (err)
2316 /* If the command timed out, we check for an MMC card */
2317 if (err == -ETIMEDOUT) {
2320 if (err) {
2321 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
2328 if (!err)
2340 if (mmc->op_cond_pending)
2343 if (!err)
2345 if (err)
2356 #if CONFIG_IS_ENABLED(DM_MMC)
2361 if (mmc->has_init)
2366 if (!mmc->init_in_progress)
2369 if (!err)
2371 if (err)
2400 #if CONFIG_IS_ENABLED(DM_MMC) && defined(CONFIG_SPL_BUILD)
2413 if (ret)
2419 * So if we request 0, 1, 3 we will get 0, 1, 2.
2423 if (ret == -ENODEV)
2428 if (ret)
2437 if (board_mmc_init(bis) < 0)
2448 if (initialized) /* Avoid initializing mmc multiple times */
2452 #if !CONFIG_IS_ENABLED(BLK)
2453 #if !CONFIG_IS_ENABLED(MMC_TINY)
2458 if (ret)
2476 if (err) {
2481 if (!(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) {
2486 if (ext_csd[EXT_CSD_BKOPS_EN] & 0x1) {
2492 if (err) {