Lines Matching refs:cmd

26 static void spi_flash_addr(u32 addr, u8 *cmd)  in spi_flash_addr()  argument
29 cmd[1] = addr >> 16; in spi_flash_addr()
30 cmd[2] = addr >> 8; in spi_flash_addr()
31 cmd[3] = addr >> 0; in spi_flash_addr()
37 u8 cmd; in read_sr() local
39 cmd = CMD_READ_STATUS; in read_sr()
40 ret = spi_flash_read_common(flash, &cmd, 1, rs, 1); in read_sr()
52 const u8 cmd = CMD_FLAG_STATUS; in read_fsr() local
54 ret = spi_flash_read_common(flash, &cmd, 1, fsr, 1); in read_fsr()
65 u8 cmd; in write_sr() local
68 cmd = CMD_WRITE_STATUS; in write_sr()
69 ret = spi_flash_write_common(flash, &cmd, 1, &ws, 1); in write_sr()
82 u8 cmd; in read_cr() local
84 cmd = CMD_READ_CONFIG; in read_cr()
85 ret = spi_flash_read_common(flash, &cmd, 1, rc, 1); in read_cr()
97 u8 cmd; in write_cr() local
104 cmd = CMD_WRITE_STATUS; in write_cr()
106 ret = spi_flash_write_common(flash, &cmd, 1, &data, 2); in write_cr()
141 u8 cmd, bank_sel = 0; in clean_bar() local
145 cmd = flash->bank_write_cmd; in clean_bar()
148 return spi_flash_write_common(flash, &cmd, 1, &bank_sel, 1); in clean_bar()
153 u8 cmd, bank_sel; in write_bar() local
160 cmd = flash->bank_write_cmd; in write_bar()
161 ret = spi_flash_write_common(flash, &cmd, 1, &bank_sel, 1); in write_bar()
288 int spi_flash_write_common(struct spi_flash *flash, const u8 *cmd, in spi_flash_write_common() argument
310 ret = spi_flash_cmd_write(spi, cmd, cmd_len, buf, buf_len); in spi_flash_write_common()
332 u8 cmd[SPI_FLASH_CMD_LEN]; in spi_flash_cmd_erase_ops() local
349 cmd[0] = flash->erase_cmd; in spi_flash_cmd_erase_ops()
362 spi_flash_addr(erase_addr, cmd); in spi_flash_cmd_erase_ops()
364 debug("SF: erase %2x %2x %2x %2x (%x)\n", cmd[0], cmd[1], in spi_flash_cmd_erase_ops()
365 cmd[2], cmd[3], erase_addr); in spi_flash_cmd_erase_ops()
367 ret = spi_flash_write_common(flash, cmd, sizeof(cmd), NULL, 0); in spi_flash_cmd_erase_ops()
391 u8 cmd[SPI_FLASH_CMD_LEN]; in spi_flash_cmd_write_ops() local
404 cmd[0] = flash->write_cmd; in spi_flash_cmd_write_ops()
422 spi->max_write_size - sizeof(cmd)); in spi_flash_cmd_write_ops()
424 spi_flash_addr(write_addr, cmd); in spi_flash_cmd_write_ops()
427 buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len); in spi_flash_cmd_write_ops()
429 ret = spi_flash_write_common(flash, cmd, sizeof(cmd), in spi_flash_cmd_write_ops()
446 int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd, in spi_flash_read_common() argument
458 ret = spi_flash_cmd_read(spi, cmd, cmd_len, data, data_len); in spi_flash_read_common()
506 u8 cmd[cmdsz]; in spi_flash_cmd_read_ops() local
508 cmd[0] = flash->read_cmd; in spi_flash_cmd_read_ops()
532 spi_flash_addr(read_addr, cmd); in spi_flash_cmd_read_ops()
534 ret = spi_flash_read_common(flash, cmd, cmdsz, data, read_len); in spi_flash_cmd_read_ops()
553 static bool sst26_process_bpr(u32 bpr_size, u8 *cmd, u32 bit, enum lock_ctl ctl) in sst26_process_bpr() argument
557 cmd[bpr_size - (bit / 8) - 1] |= BIT(bit % 8); in sst26_process_bpr()
560 cmd[bpr_size - (bit / 8) - 1] &= ~BIT(bit % 8); in sst26_process_bpr()
563 return !!(cmd[bpr_size - (bit / 8) - 1] & BIT(bit % 8)); in sst26_process_bpr()
589 u8 cmd, bpr_buff[SST26_MAX_BPR_REG_LEN] = {}; in sst26_lock_ctl() local
607 cmd = SST26_CMD_READ_BPR; in sst26_lock_ctl()
608 ret = spi_flash_read_common(flash, &cmd, 1, bpr_buff, bpr_size); in sst26_lock_ctl()
673 cmd = SST26_CMD_WRITE_BPR; in sst26_lock_ctl()
674 ret = spi_flash_write_common(flash, &cmd, 1, bpr_buff, bpr_size); in sst26_lock_ctl()
715 u8 cmd[4] = { in sst_byte_write() local
723 spi_w8r8(spi, CMD_READ_STATUS), buf, cmd[0], offset); in sst_byte_write()
729 ret = spi_flash_cmd_write(spi, cmd, sizeof(cmd), buf, 1); in sst_byte_write()
742 u8 cmd[4]; in sst_write_wp() local
764 cmd[0] = CMD_SST_AAI_WP; in sst_write_wp()
765 cmd[1] = offset >> 16; in sst_write_wp()
766 cmd[2] = offset >> 8; in sst_write_wp()
767 cmd[3] = offset; in sst_write_wp()
772 cmd[0], offset); in sst_write_wp()
774 ret = spi_flash_cmd_write(spi, cmd, cmd_len, in sst_write_wp()