Lines Matching refs:slave
18 static int flash_cmd(struct spi_slave *slave, uchar cmd, uchar *buf, int len)
21 return spi_xfer(slave, 8 * len, buf, buf, SPI_XFER_BEGIN | SPI_XFER_END);
24 static int flash_status(struct spi_slave *slave)
27 if (flash_cmd(slave, CMD_STAT, buf, sizeof(buf)))
32 static int flash_set_pow2(struct spi_slave *slave)
41 ret = flash_cmd(slave, CMD_CFG, buf, sizeof(buf));
48 ret = flash_status(slave);
55 static int flash_check(struct spi_slave *slave)
60 ret = flash_cmd(slave, CMD_ID, buf, sizeof(buf));
131 struct spi_slave *slave;
163 slave = spi_setup_slave(bus, cs, 1000, SPI_MODE_3);
164 if (!slave) {
165 puts("unable to setup slave\n");
169 if (spi_claim_bus(slave)) {
170 spi_free_slave(slave);
174 if (flash_check(slave)) {
179 status = flash_status(slave);
196 if (flash_set_pow2(slave)) {
207 spi_release_bus(slave);
208 spi_free_slave(slave);