linux/drivers/mtd/spi-nor/sfdp.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2005, Intec Automation Inc.
 * Copyright (C) 2014, Freescale Semiconductor, Inc.
 */

#ifndef __LINUX_MTD_SFDP_H
#define __LINUX_MTD_SFDP_H

/* SFDP revisions */
#define SFDP_JESD216_MAJOR
#define SFDP_JESD216_MINOR
#define SFDP_JESD216A_MINOR
#define SFDP_JESD216B_MINOR

/* SFDP DWORDS are indexed from 1 but C arrays are indexed from 0. */
#define SFDP_DWORD(i)
#define SFDP_MASK_CHECK(dword, mask)

/* Basic Flash Parameter Table */

/* JESD216 rev D defines a Basic Flash Parameter Table of 20 DWORDs. */
#define BFPT_DWORD_MAX

struct sfdp_bfpt {};

/* The first version of JESD216 defined only 9 DWORDs. */
#define BFPT_DWORD_MAX_JESD216
#define BFPT_DWORD_MAX_JESD216B

/* 1st DWORD. */
#define BFPT_DWORD1_FAST_READ_1_1_2
#define BFPT_DWORD1_ADDRESS_BYTES_MASK
#define BFPT_DWORD1_ADDRESS_BYTES_3_ONLY
#define BFPT_DWORD1_ADDRESS_BYTES_3_OR_4
#define BFPT_DWORD1_ADDRESS_BYTES_4_ONLY
#define BFPT_DWORD1_DTR
#define BFPT_DWORD1_FAST_READ_1_2_2
#define BFPT_DWORD1_FAST_READ_1_4_4
#define BFPT_DWORD1_FAST_READ_1_1_4

/* 5th DWORD. */
#define BFPT_DWORD5_FAST_READ_2_2_2
#define BFPT_DWORD5_FAST_READ_4_4_4

/* 11th DWORD. */
#define BFPT_DWORD11_PAGE_SIZE_SHIFT
#define BFPT_DWORD11_PAGE_SIZE_MASK

/* 15th DWORD. */

/*
 * (from JESD216 rev B)
 * Quad Enable Requirements (QER):
 * - 000b: Device does not have a QE bit. Device detects 1-1-4 and 1-4-4
 *         reads based on instruction. DQ3/HOLD# functions are hold during
 *         instruction phase.
 * - 001b: QE is bit 1 of status register 2. It is set via Write Status with
 *         two data bytes where bit 1 of the second byte is one.
 *         [...]
 *         Writing only one byte to the status register has the side-effect of
 *         clearing status register 2, including the QE bit. The 100b code is
 *         used if writing one byte to the status register does not modify
 *         status register 2.
 * - 010b: QE is bit 6 of status register 1. It is set via Write Status with
 *         one data byte where bit 6 is one.
 *         [...]
 * - 011b: QE is bit 7 of status register 2. It is set via Write status
 *         register 2 instruction 3Eh with one data byte where bit 7 is one.
 *         [...]
 *         The status register 2 is read using instruction 3Fh.
 * - 100b: QE is bit 1 of status register 2. It is set via Write Status with
 *         two data bytes where bit 1 of the second byte is one.
 *         [...]
 *         In contrast to the 001b code, writing one byte to the status
 *         register does not modify status register 2.
 * - 101b: QE is bit 1 of status register 2. Status register 1 is read using
 *         Read Status instruction 05h. Status register2 is read using
 *         instruction 35h. QE is set via Write Status instruction 01h with
 *         two data bytes where bit 1 of the second byte is one.
 *         [...]
 */
#define BFPT_DWORD15_QER_MASK
#define BFPT_DWORD15_QER_NONE
#define BFPT_DWORD15_QER_SR2_BIT1_BUGGY
#define BFPT_DWORD15_QER_SR1_BIT6
#define BFPT_DWORD15_QER_SR2_BIT7
#define BFPT_DWORD15_QER_SR2_BIT1_NO_RD
#define BFPT_DWORD15_QER_SR2_BIT1

#define BFPT_DWORD16_EN4B_MASK
#define BFPT_DWORD16_EN4B_ALWAYS_4B
#define BFPT_DWORD16_EN4B_4B_OPCODES
#define BFPT_DWORD16_EN4B_16BIT_NV_CR
#define BFPT_DWORD16_EN4B_BRWR
#define BFPT_DWORD16_EN4B_WREAR
#define BFPT_DWORD16_EN4B_WREN_EN4B
#define BFPT_DWORD16_EN4B_EN4B
#define BFPT_DWORD16_EX4B_MASK
#define BFPT_DWORD16_EX4B_16BIT_NV_CR
#define BFPT_DWORD16_EX4B_BRWR
#define BFPT_DWORD16_EX4B_WREAR
#define BFPT_DWORD16_EX4B_WREN_EX4B
#define BFPT_DWORD16_EX4B_EX4B
#define BFPT_DWORD16_4B_ADDR_MODE_MASK
#define BFPT_DWORD16_4B_ADDR_MODE_16BIT_NV_CR
#define BFPT_DWORD16_4B_ADDR_MODE_BRWR
#define BFPT_DWORD16_4B_ADDR_MODE_WREAR
#define BFPT_DWORD16_4B_ADDR_MODE_WREN_EN4B_EX4B
#define BFPT_DWORD16_4B_ADDR_MODE_EN4B_EX4B
#define BFPT_DWORD16_SWRST_EN_RST

#define BFPT_DWORD17_RD_1_1_8_CMD
#define BFPT_DWORD17_RD_1_1_8_MODE_CLOCKS
#define BFPT_DWORD17_RD_1_1_8_WAIT_STATES
#define BFPT_DWORD17_RD_1_8_8_CMD
#define BFPT_DWORD17_RD_1_8_8_MODE_CLOCKS
#define BFPT_DWORD17_RD_1_8_8_WAIT_STATES

#define BFPT_DWORD18_CMD_EXT_MASK
#define BFPT_DWORD18_CMD_EXT_REP
#define BFPT_DWORD18_CMD_EXT_INV
#define BFPT_DWORD18_CMD_EXT_RES
#define BFPT_DWORD18_CMD_EXT_16B

struct sfdp_parameter_header {};

#endif /* __LINUX_MTD_SFDP_H */