Lines Matching refs:ret

51 	int ret;  in mmc_send_cmd()  local
59 ret = ops->send_cmd(&cmd); in mmc_send_cmd()
61 if ((ret == 0) && (r_data != NULL)) { in mmc_send_cmd()
70 if (ret != 0) { in mmc_send_cmd()
71 VERBOSE("Send command %u error: %d\n", idx, ret); in mmc_send_cmd()
74 return ret; in mmc_send_cmd()
83 int ret; in mmc_device_state() local
91 ret = mmc_send_cmd(MMC_CMD(13), rca << RCA_SHIFT_OFFSET, in mmc_device_state()
93 if (ret != 0) { in mmc_device_state()
110 int ret; in mmc_send_part_switch_cmd() local
113 ret = mmc_send_cmd(MMC_CMD(6), in mmc_send_part_switch_cmd()
119 if (ret != 0) { in mmc_send_part_switch_cmd()
120 return ret; in mmc_send_part_switch_cmd()
129 ret = mmc_device_state(); in mmc_send_part_switch_cmd()
130 if (ret < 0) { in mmc_send_part_switch_cmd()
131 return ret; in mmc_send_part_switch_cmd()
133 } while (ret == MMC_STATE_PRG); in mmc_send_part_switch_cmd()
140 int ret; in mmc_set_ext_csd() local
142 ret = mmc_send_cmd(MMC_CMD(6), in mmc_set_ext_csd()
146 if (ret != 0) { in mmc_set_ext_csd()
147 return ret; in mmc_set_ext_csd()
151 ret = mmc_device_state(); in mmc_set_ext_csd()
152 if (ret < 0) { in mmc_set_ext_csd()
153 return ret; in mmc_set_ext_csd()
155 } while (ret == MMC_STATE_PRG); in mmc_set_ext_csd()
162 int ret; in mmc_sd_switch() local
166 ret = ops->prepare(0, (uintptr_t)&scr, sizeof(scr)); in mmc_sd_switch()
167 if (ret != 0) { in mmc_sd_switch()
168 return ret; in mmc_sd_switch()
172 ret = mmc_send_cmd(MMC_CMD(55), rca << RCA_SHIFT_OFFSET, in mmc_sd_switch()
174 if (ret != 0) { in mmc_sd_switch()
175 return ret; in mmc_sd_switch()
180 ret = mmc_send_cmd(MMC_ACMD(51), 0, MMC_RESPONSE_R1, NULL); in mmc_sd_switch()
181 if ((ret != 0) && (retries == 0)) { in mmc_sd_switch()
183 MMC_DEFAULT_MAX_RETRIES, ret); in mmc_sd_switch()
184 return ret; in mmc_sd_switch()
188 } while (ret != 0); in mmc_sd_switch()
190 ret = ops->read(0, (uintptr_t)&scr, sizeof(scr)); in mmc_sd_switch()
191 if (ret != 0) { in mmc_sd_switch()
192 return ret; in mmc_sd_switch()
201 ret = mmc_send_cmd(MMC_CMD(55), rca << RCA_SHIFT_OFFSET, in mmc_sd_switch()
203 if (ret != 0) { in mmc_sd_switch()
204 return ret; in mmc_sd_switch()
208 ret = mmc_send_cmd(MMC_ACMD(6), bus_width_arg, MMC_RESPONSE_R1, NULL); in mmc_sd_switch()
209 if (ret != 0) { in mmc_sd_switch()
210 return ret; in mmc_sd_switch()
214 ret = mmc_device_state(); in mmc_sd_switch()
215 if (ret < 0) { in mmc_sd_switch()
216 return ret; in mmc_sd_switch()
218 } while (ret == MMC_STATE_PRG); in mmc_sd_switch()
225 int ret; in mmc_set_ios() local
233 ret = mmc_sd_switch(width); in mmc_set_ios()
234 if (ret != 0) { in mmc_set_ios()
235 return ret; in mmc_set_ios()
238 ret = mmc_set_ext_csd(CMD_EXTCSD_BUS_WIDTH, in mmc_set_ios()
240 if (ret != 0) { in mmc_set_ios()
241 return ret; in mmc_set_ios()
256 int ret = 0; in mmc_fill_device_info() local
263 ret = ops->prepare(0, (uintptr_t)&mmc_ext_csd, in mmc_fill_device_info()
265 if (ret != 0) { in mmc_fill_device_info()
266 return ret; in mmc_fill_device_info()
270 ret = mmc_send_cmd(MMC_CMD(8), 0, MMC_RESPONSE_R1, NULL); in mmc_fill_device_info()
271 if (ret != 0) { in mmc_fill_device_info()
272 return ret; in mmc_fill_device_info()
275 ret = ops->read(0, (uintptr_t)&mmc_ext_csd, in mmc_fill_device_info()
277 if (ret != 0) { in mmc_fill_device_info()
278 return ret; in mmc_fill_device_info()
282 ret = mmc_device_state(); in mmc_fill_device_info()
283 if (ret < 0) { in mmc_fill_device_info()
284 return ret; in mmc_fill_device_info()
286 } while (ret != MMC_STATE_TRAN); in mmc_fill_device_info()
330 ret = -EINVAL; in mmc_fill_device_info()
334 if (ret < 0) { in mmc_fill_device_info()
335 return ret; in mmc_fill_device_info()
366 int ret; in sd_send_op_cond() local
369 ret = mmc_send_cmd(MMC_CMD(55), 0, MMC_RESPONSE_R1, NULL); in sd_send_op_cond()
370 if (ret != 0) { in sd_send_op_cond()
371 return ret; in sd_send_op_cond()
375 ret = mmc_send_cmd(MMC_ACMD(41), OCR_HCS | in sd_send_op_cond()
378 if (ret != 0) { in sd_send_op_cond()
379 return ret; in sd_send_op_cond()
404 int ret; in mmc_reset_to_idle() local
407 ret = mmc_send_cmd(MMC_CMD(0), 0, 0, NULL); in mmc_reset_to_idle()
408 if (ret != 0) { in mmc_reset_to_idle()
409 return ret; in mmc_reset_to_idle()
419 int ret, n; in mmc_send_op_cond() local
422 ret = mmc_reset_to_idle(); in mmc_send_op_cond()
423 if (ret != 0) { in mmc_send_op_cond()
424 return ret; in mmc_send_op_cond()
428 ret = mmc_send_cmd(MMC_CMD(1), OCR_SECTOR_MODE | in mmc_send_op_cond()
431 if (ret != 0) { in mmc_send_op_cond()
432 return ret; in mmc_send_op_cond()
450 int ret; in mmc_enumerate() local
455 ret = mmc_reset_to_idle(); in mmc_enumerate()
456 if (ret != 0) { in mmc_enumerate()
457 return ret; in mmc_enumerate()
461 ret = mmc_send_op_cond(); in mmc_enumerate()
464 ret = mmc_send_cmd(MMC_CMD(8), VHS_2_7_3_6_V | CMD8_CHECK_PATTERN, in mmc_enumerate()
467 if ((ret == 0) && ((resp_data[0] & 0xffU) == CMD8_CHECK_PATTERN)) { in mmc_enumerate()
468 ret = sd_send_op_cond(); in mmc_enumerate()
471 if (ret != 0) { in mmc_enumerate()
472 return ret; in mmc_enumerate()
476 ret = mmc_send_cmd(MMC_CMD(2), 0, MMC_RESPONSE_R2, NULL); in mmc_enumerate()
477 if (ret != 0) { in mmc_enumerate()
478 return ret; in mmc_enumerate()
484 ret = mmc_send_cmd(MMC_CMD(3), rca << RCA_SHIFT_OFFSET, in mmc_enumerate()
486 if (ret != 0) { in mmc_enumerate()
487 return ret; in mmc_enumerate()
490 ret = mmc_send_cmd(MMC_CMD(3), 0, in mmc_enumerate()
492 if (ret != 0) { in mmc_enumerate()
493 return ret; in mmc_enumerate()
500 ret = mmc_send_cmd(MMC_CMD(9), rca << RCA_SHIFT_OFFSET, in mmc_enumerate()
502 if (ret != 0) { in mmc_enumerate()
503 return ret; in mmc_enumerate()
509 ret = mmc_send_cmd(MMC_CMD(7), rca << RCA_SHIFT_OFFSET, in mmc_enumerate()
511 if (ret != 0) { in mmc_enumerate()
512 return ret; in mmc_enumerate()
516 ret = mmc_device_state(); in mmc_enumerate()
517 if (ret < 0) { in mmc_enumerate()
518 return ret; in mmc_enumerate()
520 } while (ret != MMC_STATE_TRAN); in mmc_enumerate()
522 ret = mmc_set_ios(clk, bus_width); in mmc_enumerate()
523 if (ret != 0) { in mmc_enumerate()
524 return ret; in mmc_enumerate()
532 int ret; in mmc_read_blocks() local
540 ret = ops->prepare(lba, buf, size); in mmc_read_blocks()
541 if (ret != 0) { in mmc_read_blocks()
547 ret = mmc_send_cmd(MMC_CMD(23), size / MMC_BLOCK_SIZE, in mmc_read_blocks()
549 if (ret != 0) { in mmc_read_blocks()
569 ret = mmc_send_cmd(cmd_idx, cmd_arg, MMC_RESPONSE_R1, NULL); in mmc_read_blocks()
570 if (ret != 0) { in mmc_read_blocks()
574 ret = ops->read(lba, buf, size); in mmc_read_blocks()
575 if (ret != 0) { in mmc_read_blocks()
581 ret = mmc_device_state(); in mmc_read_blocks()
582 if (ret < 0) { in mmc_read_blocks()
585 } while ((ret != MMC_STATE_TRAN) && (ret != MMC_STATE_DATA)); in mmc_read_blocks()
588 ret = mmc_send_cmd(MMC_CMD(12), 0, MMC_RESPONSE_R1B, NULL); in mmc_read_blocks()
589 if (ret != 0) { in mmc_read_blocks()
599 int ret; in mmc_write_blocks() local
608 ret = ops->prepare(lba, buf, size); in mmc_write_blocks()
609 if (ret != 0) { in mmc_write_blocks()
615 ret = mmc_send_cmd(MMC_CMD(23), size / MMC_BLOCK_SIZE, in mmc_write_blocks()
617 if (ret != 0) { in mmc_write_blocks()
636 ret = mmc_send_cmd(cmd_idx, cmd_arg, MMC_RESPONSE_R1, NULL); in mmc_write_blocks()
637 if (ret != 0) { in mmc_write_blocks()
641 ret = ops->write(lba, buf, size); in mmc_write_blocks()
642 if (ret != 0) { in mmc_write_blocks()
648 ret = mmc_device_state(); in mmc_write_blocks()
649 if (ret < 0) { in mmc_write_blocks()
652 } while ((ret != MMC_STATE_TRAN) && (ret != MMC_STATE_RCV)); in mmc_write_blocks()
655 ret = mmc_send_cmd(MMC_CMD(12), 0, MMC_RESPONSE_R1B, NULL); in mmc_write_blocks()
656 if (ret != 0) { in mmc_write_blocks()
666 int ret; in mmc_erase_blocks() local
671 ret = mmc_send_cmd(MMC_CMD(35), lba, MMC_RESPONSE_R1, NULL); in mmc_erase_blocks()
672 if (ret != 0) { in mmc_erase_blocks()
676 ret = mmc_send_cmd(MMC_CMD(36), lba + (size / MMC_BLOCK_SIZE) - 1U, in mmc_erase_blocks()
678 if (ret != 0) { in mmc_erase_blocks()
682 ret = mmc_send_cmd(MMC_CMD(38), lba, MMC_RESPONSE_R1B, NULL); in mmc_erase_blocks()
683 if (ret != 0) { in mmc_erase_blocks()
688 ret = mmc_device_state(); in mmc_erase_blocks()
689 if (ret < 0) { in mmc_erase_blocks()
692 } while (ret != MMC_STATE_TRAN); in mmc_erase_blocks()
761 int ret; in mmc_boot_part_read_blocks() local
770 ret = mmc_part_switch(current_boot_part); in mmc_boot_part_read_blocks()
771 if (ret < 0) { in mmc_boot_part_read_blocks()
772 ERROR("Failed to switch to boot partition, %d\n", ret); in mmc_boot_part_read_blocks()
778 ret = mmc_part_switch(0); in mmc_boot_part_read_blocks()
779 if (ret < 0) { in mmc_boot_part_read_blocks()
780 ERROR("Failed to switch back to user partition, %d\n", ret); in mmc_boot_part_read_blocks()