Lines Matching full: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_set_ext_csd() local
112 ret = mmc_send_cmd(MMC_CMD(6), in mmc_set_ext_csd()
116 if (ret != 0) { in mmc_set_ext_csd()
117 return ret; in mmc_set_ext_csd()
121 ret = mmc_device_state(); in mmc_set_ext_csd()
122 if (ret < 0) { in mmc_set_ext_csd()
123 return ret; in mmc_set_ext_csd()
125 } while (ret == MMC_STATE_PRG); in mmc_set_ext_csd()
132 int ret; in mmc_sd_switch() local
136 ret = ops->prepare(0, (uintptr_t)&scr, sizeof(scr)); in mmc_sd_switch()
137 if (ret != 0) { in mmc_sd_switch()
138 return ret; in mmc_sd_switch()
142 ret = mmc_send_cmd(MMC_CMD(55), rca << RCA_SHIFT_OFFSET, in mmc_sd_switch()
144 if (ret != 0) { in mmc_sd_switch()
145 return ret; in mmc_sd_switch()
150 ret = mmc_send_cmd(MMC_ACMD(51), 0, MMC_RESPONSE_R1, NULL); in mmc_sd_switch()
151 if ((ret != 0) && (retries == 0)) { in mmc_sd_switch()
152 ERROR("ACMD51 failed after %d retries (ret=%d)\n", in mmc_sd_switch()
153 MMC_DEFAULT_MAX_RETRIES, ret); in mmc_sd_switch()
154 return ret; in mmc_sd_switch()
158 } while (ret != 0); in mmc_sd_switch()
160 ret = ops->read(0, (uintptr_t)&scr, sizeof(scr)); in mmc_sd_switch()
161 if (ret != 0) { in mmc_sd_switch()
162 return ret; in mmc_sd_switch()
171 ret = mmc_send_cmd(MMC_CMD(55), rca << RCA_SHIFT_OFFSET, in mmc_sd_switch()
173 if (ret != 0) { in mmc_sd_switch()
174 return ret; in mmc_sd_switch()
178 ret = mmc_send_cmd(MMC_ACMD(6), bus_width_arg, MMC_RESPONSE_R1, NULL); in mmc_sd_switch()
179 if (ret != 0) { in mmc_sd_switch()
180 return ret; in mmc_sd_switch()
184 ret = mmc_device_state(); in mmc_sd_switch()
185 if (ret < 0) { in mmc_sd_switch()
186 return ret; in mmc_sd_switch()
188 } while (ret == MMC_STATE_PRG); in mmc_sd_switch()
195 int ret; in mmc_set_ios() local
203 ret = mmc_sd_switch(width); in mmc_set_ios()
204 if (ret != 0) { in mmc_set_ios()
205 return ret; in mmc_set_ios()
208 ret = mmc_set_ext_csd(CMD_EXTCSD_BUS_WIDTH, in mmc_set_ios()
210 if (ret != 0) { in mmc_set_ios()
211 return ret; in mmc_set_ios()
226 int ret = 0; in mmc_fill_device_info() local
233 ret = ops->prepare(0, (uintptr_t)&mmc_ext_csd, in mmc_fill_device_info()
235 if (ret != 0) { in mmc_fill_device_info()
236 return ret; in mmc_fill_device_info()
240 ret = mmc_send_cmd(MMC_CMD(8), 0, MMC_RESPONSE_R1, NULL); in mmc_fill_device_info()
241 if (ret != 0) { in mmc_fill_device_info()
242 return ret; in mmc_fill_device_info()
245 ret = ops->read(0, (uintptr_t)&mmc_ext_csd, in mmc_fill_device_info()
247 if (ret != 0) { in mmc_fill_device_info()
248 return ret; in mmc_fill_device_info()
252 ret = mmc_device_state(); in mmc_fill_device_info()
253 if (ret < 0) { in mmc_fill_device_info()
254 return ret; in mmc_fill_device_info()
256 } while (ret != MMC_STATE_TRAN); in mmc_fill_device_info()
300 ret = -EINVAL; in mmc_fill_device_info()
304 if (ret < 0) { in mmc_fill_device_info()
305 return ret; in mmc_fill_device_info()
336 int ret; in sd_send_op_cond() local
339 ret = mmc_send_cmd(MMC_CMD(55), 0, MMC_RESPONSE_R1, NULL); in sd_send_op_cond()
340 if (ret != 0) { in sd_send_op_cond()
341 return ret; in sd_send_op_cond()
345 ret = mmc_send_cmd(MMC_ACMD(41), OCR_HCS | in sd_send_op_cond()
348 if (ret != 0) { in sd_send_op_cond()
349 return ret; in sd_send_op_cond()
374 int ret; in mmc_reset_to_idle() local
377 ret = mmc_send_cmd(MMC_CMD(0), 0, 0, NULL); in mmc_reset_to_idle()
378 if (ret != 0) { in mmc_reset_to_idle()
379 return ret; in mmc_reset_to_idle()
389 int ret, n; in mmc_send_op_cond() local
392 ret = mmc_reset_to_idle(); in mmc_send_op_cond()
393 if (ret != 0) { in mmc_send_op_cond()
394 return ret; in mmc_send_op_cond()
398 ret = mmc_send_cmd(MMC_CMD(1), OCR_SECTOR_MODE | in mmc_send_op_cond()
401 if (ret != 0) { in mmc_send_op_cond()
402 return ret; in mmc_send_op_cond()
420 int ret; in mmc_enumerate() local
425 ret = mmc_reset_to_idle(); in mmc_enumerate()
426 if (ret != 0) { in mmc_enumerate()
427 return ret; in mmc_enumerate()
431 ret = mmc_send_op_cond(); in mmc_enumerate()
434 ret = mmc_send_cmd(MMC_CMD(8), VHS_2_7_3_6_V | CMD8_CHECK_PATTERN, in mmc_enumerate()
437 if ((ret == 0) && ((resp_data[0] & 0xffU) == CMD8_CHECK_PATTERN)) { in mmc_enumerate()
438 ret = sd_send_op_cond(); in mmc_enumerate()
441 if (ret != 0) { in mmc_enumerate()
442 return ret; in mmc_enumerate()
446 ret = mmc_send_cmd(MMC_CMD(2), 0, MMC_RESPONSE_R2, NULL); in mmc_enumerate()
447 if (ret != 0) { in mmc_enumerate()
448 return ret; in mmc_enumerate()
454 ret = mmc_send_cmd(MMC_CMD(3), rca << RCA_SHIFT_OFFSET, in mmc_enumerate()
456 if (ret != 0) { in mmc_enumerate()
457 return ret; in mmc_enumerate()
460 ret = mmc_send_cmd(MMC_CMD(3), 0, in mmc_enumerate()
462 if (ret != 0) { in mmc_enumerate()
463 return ret; in mmc_enumerate()
470 ret = mmc_send_cmd(MMC_CMD(9), rca << RCA_SHIFT_OFFSET, in mmc_enumerate()
472 if (ret != 0) { in mmc_enumerate()
473 return ret; in mmc_enumerate()
479 ret = mmc_send_cmd(MMC_CMD(7), rca << RCA_SHIFT_OFFSET, in mmc_enumerate()
481 if (ret != 0) { in mmc_enumerate()
482 return ret; in mmc_enumerate()
486 ret = mmc_device_state(); in mmc_enumerate()
487 if (ret < 0) { in mmc_enumerate()
488 return ret; in mmc_enumerate()
490 } while (ret != MMC_STATE_TRAN); in mmc_enumerate()
492 ret = mmc_set_ios(clk, bus_width); in mmc_enumerate()
493 if (ret != 0) { in mmc_enumerate()
494 return ret; in mmc_enumerate()
502 int ret; in mmc_read_blocks() local
510 ret = ops->prepare(lba, buf, size); in mmc_read_blocks()
511 if (ret != 0) { in mmc_read_blocks()
517 ret = mmc_send_cmd(MMC_CMD(23), size / MMC_BLOCK_SIZE, in mmc_read_blocks()
519 if (ret != 0) { in mmc_read_blocks()
539 ret = mmc_send_cmd(cmd_idx, cmd_arg, MMC_RESPONSE_R1, NULL); in mmc_read_blocks()
540 if (ret != 0) { in mmc_read_blocks()
544 ret = ops->read(lba, buf, size); in mmc_read_blocks()
545 if (ret != 0) { in mmc_read_blocks()
551 ret = mmc_device_state(); in mmc_read_blocks()
552 if (ret < 0) { in mmc_read_blocks()
555 } while ((ret != MMC_STATE_TRAN) && (ret != MMC_STATE_DATA)); in mmc_read_blocks()
558 ret = mmc_send_cmd(MMC_CMD(12), 0, MMC_RESPONSE_R1B, NULL); in mmc_read_blocks()
559 if (ret != 0) { in mmc_read_blocks()
569 int ret; in mmc_write_blocks() local
578 ret = ops->prepare(lba, buf, size); in mmc_write_blocks()
579 if (ret != 0) { in mmc_write_blocks()
585 ret = mmc_send_cmd(MMC_CMD(23), size / MMC_BLOCK_SIZE, in mmc_write_blocks()
587 if (ret != 0) { in mmc_write_blocks()
606 ret = mmc_send_cmd(cmd_idx, cmd_arg, MMC_RESPONSE_R1, NULL); in mmc_write_blocks()
607 if (ret != 0) { in mmc_write_blocks()
611 ret = ops->write(lba, buf, size); in mmc_write_blocks()
612 if (ret != 0) { in mmc_write_blocks()
618 ret = mmc_device_state(); in mmc_write_blocks()
619 if (ret < 0) { in mmc_write_blocks()
622 } while ((ret != MMC_STATE_TRAN) && (ret != MMC_STATE_RCV)); in mmc_write_blocks()
625 ret = mmc_send_cmd(MMC_CMD(12), 0, MMC_RESPONSE_R1B, NULL); in mmc_write_blocks()
626 if (ret != 0) { in mmc_write_blocks()
636 int ret; in mmc_erase_blocks() local
641 ret = mmc_send_cmd(MMC_CMD(35), lba, MMC_RESPONSE_R1, NULL); in mmc_erase_blocks()
642 if (ret != 0) { in mmc_erase_blocks()
646 ret = mmc_send_cmd(MMC_CMD(36), lba + (size / MMC_BLOCK_SIZE) - 1U, in mmc_erase_blocks()
648 if (ret != 0) { in mmc_erase_blocks()
652 ret = mmc_send_cmd(MMC_CMD(38), lba, MMC_RESPONSE_R1B, NULL); in mmc_erase_blocks()
653 if (ret != 0) { in mmc_erase_blocks()
658 ret = mmc_device_state(); in mmc_erase_blocks()
659 if (ret < 0) { in mmc_erase_blocks()
662 } while (ret != MMC_STATE_TRAN); in mmc_erase_blocks()