]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/spi_flash.h
sf: Separate the flash params table
[karo-tx-uboot.git] / include / spi_flash.h
index afc3a5809eac7ee4b1f31dda895f02042bc322fa..8e0bb46e8124a31e65fee04780653c817c631048 100644 (file)
 #include <linux/types.h>
 #include <linux/compiler.h>
 
+/* No enum list for write commands only QPP */
+#define WR_QPP         1 << 4
+
+/* Enum list - Full read commands */
+enum spi_read_cmds {
+       ARRAY_SLOW = 1 << 0,
+       DUAL_OUTPUT_FAST = 1 << 1,
+       DUAL_IO_FAST = 1 << 2,
+       QUAD_OUTPUT_FAST = 1 << 3,
+};
+#define RD_EXTN                ARRAY_SLOW | DUAL_OUTPUT_FAST | DUAL_IO_FAST
+#define RD_FULL                RD_EXTN | QUAD_OUTPUT_FAST
+
+/**
+ * struct spi_flash_params - SPI/QSPI flash device params structure
+ *
+ * @name:              Device name ([MANUFLETTER][DEVTYPE][DENSITY][EXTRAINFO])
+ * @jedec:             Device jedec ID (0x[1byte_manuf_id][2byte_dev_id])
+ * @ext_jedec:         Device ext_jedec ID
+ * @sector_size:       Sector size of this device
+ * @nr_sectors:                No.of sectors on this device
+ * @e_rd_cmd:          Enum list for read commands
+ * @flags:             Importent param, for flash specific behaviour
+ */
+struct spi_flash_params {
+       const char *name;
+       u32 jedec;
+       u16 ext_jedec;
+       u32 sector_size;
+       u32 nr_sectors;
+       u8 e_rd_cmd;
+       u16 flags;
+};
+
+extern const struct spi_flash_params spi_flash_params_table[];
+
 /**
  * struct spi_flash - SPI flash structure
  *
@@ -33,6 +69,8 @@
  * @bank_curr:         Current flash bank
  * @poll_cmd:          Poll cmd - for flash erase/program
  * @erase_cmd:         Erase cmd 4K, 32K, 64K
+ * @read_cmd:          Read cmd - Array Fast, Extn read and quad read.
+ * @write_cmd:         Write cmd - page and quad program.
  * @memory_map:                Address of read-only SPI flash access
  * @read:              Flash read ops: Read len bytes at offset into buf
  *                     Supported cmds: Fast Array Read
@@ -57,6 +95,8 @@ struct spi_flash {
 #endif
        u8 poll_cmd;
        u8 erase_cmd;
+       u8 read_cmd;
+       u8 write_cmd;
 
        void *memory_map;
        int (*read)(struct spi_flash *flash, u32 offset, size_t len, void *buf);