Lines Matching refs:cmd
43 static void spi_flash_addr(uint32_t addr, uint8_t *cmd) in spi_flash_addr() argument
49 cmd[1] = addr >> 16; in spi_flash_addr()
50 cmd[2] = addr >> 8; in spi_flash_addr()
51 cmd[3] = addr >> 0; in spi_flash_addr()
86 uint8_t cmd; in spi_flash_cmd_wait() local
93 cmd = CMD_RDSR; in spi_flash_cmd_wait()
94 ret = spi_flash_cmd_read(&cmd, 1, &status, 1); in spi_flash_cmd_wait()
114 static int spi_flash_write_common(struct spi_flash *flash, const uint8_t *cmd, in spi_flash_write_common() argument
126 ret = spi_flash_cmd_write(cmd, cmd_len, buf, buf_len); in spi_flash_write_common()
141 static int spi_flash_read_common(const uint8_t *cmd, size_t cmd_len, in spi_flash_read_common() argument
146 ret = spi_flash_cmd_read(cmd, cmd_len, data, data_len); in spi_flash_read_common()
159 uint8_t cmd[SPI_FLASH_CMD_LEN]; in spi_flash_read() local
168 cmd[0] = CMD_READ_NORMAL; in spi_flash_read()
172 spi_flash_addr(read_addr, cmd); in spi_flash_read()
174 ret = spi_flash_read_common(cmd, sizeof(cmd), data, read_len); in spi_flash_read()
194 uint8_t cmd[SPI_FLASH_CMD_LEN]; in spi_flash_write() local
207 cmd[0] = flash->write_cmd; in spi_flash_write()
213 spi_flash_addr(write_addr, cmd); in spi_flash_write()
216 buf + actual, cmd[0], cmd[1], in spi_flash_write()
217 cmd[2], cmd[3], chunk_len); in spi_flash_write()
219 ret = spi_flash_write_common(flash, cmd, sizeof(cmd), in spi_flash_write()
236 uint8_t cmd[SPI_FLASH_CMD_LEN]; in spi_flash_erase() local
253 cmd[0] = flash->erase_cmd; in spi_flash_erase()
256 spi_flash_addr(erase_addr, cmd); in spi_flash_erase()
258 SPI_DEBUG("SF: erase %2x %2x %2x %2x (%x)\n", cmd[0], cmd[1], in spi_flash_erase()
259 cmd[2], cmd[3], erase_addr); in spi_flash_erase()
261 ret = spi_flash_write_common(flash, cmd, sizeof(cmd), NULL, 0); in spi_flash_erase()