Lines Matching refs:cmd
157 struct rt_mmcsd_cmd cmd; in mmcsd_switch() local
174 rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); in mmcsd_switch()
176 cmd.cmd_code = SD_SWITCH; in mmcsd_switch()
177 cmd.arg = 0x00FFFFF1; in mmcsd_switch()
178 cmd.flags = RESP_R1 | CMD_ADTC; in mmcsd_switch()
191 req.cmd = &cmd; in mmcsd_switch()
196 if (cmd.err || data.err) in mmcsd_switch()
204 rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); in mmcsd_switch()
206 cmd.cmd_code = SD_SWITCH; in mmcsd_switch()
225 cmd.arg = 0x80FFFFF0 | switch_func_timing; in mmcsd_switch()
226 cmd.flags = RESP_R1 | CMD_ADTC; in mmcsd_switch()
239 req.cmd = &cmd; in mmcsd_switch()
244 if (cmd.err || data.err) in mmcsd_switch()
309 if (cmd.err) in mmcsd_switch()
310 err = cmd.err; in mmcsd_switch()
321 struct rt_mmcsd_cmd cmd = {0}; in mmcsd_app_cmd() local
323 cmd.cmd_code = APP_CMD; in mmcsd_app_cmd()
327 cmd.arg = card->rca << 16; in mmcsd_app_cmd()
328 cmd.flags = RESP_R1 | CMD_AC; in mmcsd_app_cmd()
332 cmd.arg = 0; in mmcsd_app_cmd()
333 cmd.flags = RESP_R1 | CMD_BCR; in mmcsd_app_cmd()
336 err = mmcsd_send_cmd(host, &cmd, 0); in mmcsd_app_cmd()
341 if (!controller_is_spi(host) && !(cmd.resp[0] & R1_APP_CMD)) in mmcsd_app_cmd()
350 struct rt_mmcsd_cmd *cmd, in mmcsd_send_app_cmd() argument
373 if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) in mmcsd_send_app_cmd()
381 rt_memset(cmd->resp, 0, sizeof(cmd->resp)); in mmcsd_send_app_cmd()
383 req.cmd = cmd; in mmcsd_send_app_cmd()
388 err = cmd->err; in mmcsd_send_app_cmd()
389 if (!cmd->err) in mmcsd_send_app_cmd()
395 if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) in mmcsd_send_app_cmd()
406 struct rt_mmcsd_cmd cmd; in mmcsd_app_set_bus_width() local
408 rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); in mmcsd_app_set_bus_width()
410 cmd.cmd_code = SD_APP_SET_BUS_WIDTH; in mmcsd_app_set_bus_width()
411 cmd.flags = RESP_R1 | CMD_AC; in mmcsd_app_set_bus_width()
416 cmd.arg = MMCSD_BUS_WIDTH_1; in mmcsd_app_set_bus_width()
419 cmd.arg = MMCSD_BUS_WIDTH_4; in mmcsd_app_set_bus_width()
425 err = mmcsd_send_app_cmd(card->host, card, &cmd, 3); in mmcsd_app_set_bus_width()
436 struct rt_mmcsd_cmd cmd; in mmcsd_send_app_op_cond() local
440 rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); in mmcsd_send_app_op_cond()
442 cmd.cmd_code = SD_APP_OP_COND; in mmcsd_send_app_op_cond()
444 cmd.arg = ocr & (1 << 30); /* SPI only defines one bit */ in mmcsd_send_app_op_cond()
446 cmd.arg = ocr; in mmcsd_send_app_op_cond()
447 cmd.flags = RESP_SPI_R1 | RESP_R3 | CMD_BCR; in mmcsd_send_app_op_cond()
451 err = mmcsd_send_app_cmd(host, RT_NULL, &cmd, 3); in mmcsd_send_app_op_cond()
462 if (!(cmd.resp[0] & R1_SPI_IDLE)) in mmcsd_send_app_op_cond()
467 if (cmd.resp[0] & CARD_BUSY) in mmcsd_send_app_op_cond()
477 *rocr = cmd.resp[0]; in mmcsd_send_app_op_cond()
489 struct rt_mmcsd_cmd cmd; in mmcsd_send_if_cond() local
493 cmd.cmd_code = SD_SEND_IF_COND; in mmcsd_send_if_cond()
494 cmd.arg = ((ocr & 0xFF8000) != 0) << 8 | 0xAA; in mmcsd_send_if_cond()
495 cmd.flags = RESP_SPI_R7 | RESP_R7 | CMD_BCR; in mmcsd_send_if_cond()
497 err = mmcsd_send_cmd(host, &cmd, 0); in mmcsd_send_if_cond()
502 pattern = cmd.resp[1] & 0xFF; in mmcsd_send_if_cond()
504 pattern = cmd.resp[0] & 0xFF; in mmcsd_send_if_cond()
515 struct rt_mmcsd_cmd cmd; in mmcsd_get_card_addr() local
517 rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); in mmcsd_get_card_addr()
519 cmd.cmd_code = SD_SEND_RELATIVE_ADDR; in mmcsd_get_card_addr()
520 cmd.arg = 0; in mmcsd_get_card_addr()
521 cmd.flags = RESP_R6 | CMD_BCR; in mmcsd_get_card_addr()
523 err = mmcsd_send_cmd(host, &cmd, 3); in mmcsd_get_card_addr()
527 *rca = cmd.resp[0] >> 16; in mmcsd_get_card_addr()
542 struct rt_mmcsd_cmd cmd; in mmcsd_get_scr() local
550 rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); in mmcsd_get_scr()
553 req.cmd = &cmd; in mmcsd_get_scr()
556 cmd.cmd_code = SD_APP_SEND_SCR; in mmcsd_get_scr()
557 cmd.arg = 0; in mmcsd_get_scr()
558 cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_ADTC; in mmcsd_get_scr()
569 if (cmd.err) in mmcsd_get_scr()
570 return cmd.err; in mmcsd_get_scr()
584 struct rt_mmcsd_cmd cmd; in mmcsd_read_sd_status() local
592 rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); in mmcsd_read_sd_status()
595 req.cmd = &cmd; in mmcsd_read_sd_status()
598 cmd.cmd_code = SEND_STATUS; in mmcsd_read_sd_status()
599 cmd.arg = 0; in mmcsd_read_sd_status()
600 cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_ADTC; in mmcsd_read_sd_status()
611 if (cmd.err) in mmcsd_read_sd_status()
612 return cmd.err; in mmcsd_read_sd_status()
635 struct rt_mmcsd_cmd cmd = { 0 }; in sd_switch_voltage() local
637 cmd.cmd_code = VOLTAGE_SWITCH; in sd_switch_voltage()
638 cmd.arg = 0; in sd_switch_voltage()
639 cmd.flags = RESP_R1 | CMD_AC; in sd_switch_voltage()
641 err = mmcsd_send_cmd(host, &cmd, 0); in sd_switch_voltage()