]> Git Repo - u-boot.git/blobdiff - drivers/mtd/spi/sf_internal.h
mtd: spi-nor: allow registering multiple MTDs when DM is enabled
[u-boot.git] / drivers / mtd / spi / sf_internal.h
index fd00e0d1b23ba538534d8239206649996f31b637..0b63e1bfc27756ca523bed5edc93b56e7fb42574 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef _SF_INTERNAL_H_
 #define _SF_INTERNAL_H_
 
+#include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/compiler.h>
 
@@ -16,7 +17,9 @@
 #define SPI_NOR_MAX_ADDR_WIDTH 4
 
 struct flash_info {
+#if !CONFIG_IS_ENABLED(SPI_FLASH_TINY)
        char            *name;
+#endif
 
        /*
         * This array stores the ID bytes.
@@ -35,7 +38,7 @@ struct flash_info {
        u16             page_size;
        u16             addr_width;
 
-       u16             flags;
+       u32             flags;
 #define SECT_4K                        BIT(0)  /* SPINOR_OP_BE_4K works uniformly */
 #define SPI_NOR_NO_ERASE       BIT(1)  /* No erase command needed */
 #define SST_WRITE              BIT(2)  /* use SST byte programming */
@@ -63,6 +66,8 @@ struct flash_info {
 #define NO_CHIP_ERASE          BIT(12) /* Chip does not support chip erase */
 #define SPI_NOR_SKIP_SFDP      BIT(13) /* Skip parsing of SFDP tables */
 #define USE_CLSR               BIT(14) /* use CLSR command */
+#define SPI_NOR_HAS_SST26LOCK  BIT(15) /* Flash supports lock/unlock via BPR */
+#define SPI_NOR_OCTAL_READ     BIT(16) /* Flash supports Octal Read */
 };
 
 extern const struct flash_info spi_nor_ids[];
@@ -70,30 +75,22 @@ extern const struct flash_info spi_nor_ids[];
 #define JEDEC_MFR(info)        ((info)->id[0])
 #define JEDEC_ID(info)         (((info)->id[1]) << 8 | ((info)->id[2]))
 
-/* Send a single-byte command to the device and read the response */
-int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len);
-
-/*
- * Send a multi-byte command to the device and read the response. Used
- * for flash array reads, etc.
- */
-int spi_flash_cmd_read(struct spi_slave *spi, const u8 *cmd,
-               size_t cmd_len, void *data, size_t data_len);
-
-/*
- * Send a multi-byte command to the device followed by (optional)
- * data. Used for programming the flash array, etc.
- */
-int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
-               const void *data, size_t data_len);
-
-
 /* Get software write-protect value (BP bits) */
 int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
 
 
-#ifdef CONFIG_SPI_FLASH_MTD
+#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
 int spi_flash_mtd_register(struct spi_flash *flash);
-void spi_flash_mtd_unregister(void);
+void spi_flash_mtd_unregister(struct spi_flash *flash);
+#else
+static inline int spi_flash_mtd_register(struct spi_flash *flash)
+{
+       return 0;
+}
+
+static inline void spi_flash_mtd_unregister(struct spi_flash *flash)
+{
+}
 #endif
+
 #endif /* _SF_INTERNAL_H_ */
This page took 0.0275 seconds and 4 git commands to generate.