static int qspi_flash_init_macronix(qspi_flash_t *flash) { int ret; /* * In QPI mode, only the Fast Read 1-4-4 (0xeb) op code is supported. * In SPI mode, both the Fast Read 1-1-4 (0x6b) and Fast Read 1-4-4 * (0xeb) op codes are supported but we'd rather use the Fast Read 1-4-4 * command as it is the only one which allows us to enter/leave the * peformance enhance (continuous read) mode required by XIP operations. */ flash->read_opcode = CMD_FAST_READ_1_4_4; /* * Check whether the QPI mode is enabled: if it is then we know that * the Quad Enabled (QE) non-volatile bit is already set. Otherwise, * we MUST set the QE bit before using any Quad SPI command. */ if (flash->read_proto != QSPI_PROTO_4_4_4) { ret = macronix_quad_enable(flash); if (ret) return ret; flash->read_proto = QSPI_PROTO_1_4_4; } return macronix_set_dummy_cycles(flash, 8); }
static int set_quad_mode(struct spi_nor *nor, u32 jedec_id) { int status; switch (JEDEC_MFR(jedec_id)) { case CFI_MFR_MACRONIX: status = macronix_quad_enable(nor); if (status) { dev_err(nor->dev, "Macronix quad-read not enabled\n"); return -EINVAL; } return status; default: status = spansion_quad_enable(nor); if (status) { dev_err(nor->dev, "Spansion quad-read not enabled\n"); return -EINVAL; } return status; } }