diff options
author | Huang Shijie <b32955@freescale.com> | 2014-02-24 05:37:37 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-04-14 14:22:58 -0400 |
commit | b199489d37b21c5e294f95bf265acc5dde3fc3a2 (patch) | |
tree | a498f39ae5035cdb9091eb96d95662db3fc54a82 /include/linux/mtd | |
parent | 6e602ef73334550bbbb8be1041a3ce6eecbd42f1 (diff) |
mtd: spi-nor: add the framework for SPI NOR
This patch cloned most of the m25p80.c. In theory, it adds a new spi-nor layer.
Before this patch, the layer is like:
MTD
------------------------
m25p80
------------------------
spi bus driver
------------------------
SPI NOR chip
After this patch, the layer is like:
MTD
------------------------
spi-nor
------------------------
m25p80
------------------------
spi bus driver
------------------------
SPI NOR chip
With the spi-nor controller driver(Freescale Quadspi), it looks like:
MTD
------------------------
spi-nor
------------------------
fsl-quadspi
------------------------
SPI NOR chip
New APIs:
spi_nor_scan: used to scan a spi-nor flash.
Signed-off-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
[Brian: rebased to include additional m25p_ids[] entry]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/spi-nor.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 3a3c3872c8cd..16d8409abcdc 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h | |||
@@ -162,4 +162,24 @@ struct spi_nor { | |||
162 | 162 | ||
163 | void *priv; | 163 | void *priv; |
164 | }; | 164 | }; |
165 | |||
166 | /** | ||
167 | * spi_nor_scan() - scan the SPI NOR | ||
168 | * @nor: the spi_nor structure | ||
169 | * @id: the spi_device_id provided by the driver | ||
170 | * @mode: the read mode supported by the driver | ||
171 | * | ||
172 | * The drivers can use this fuction to scan the SPI NOR. | ||
173 | * In the scanning, it will try to get all the necessary information to | ||
174 | * fill the mtd_info{} and the spi_nor{}. | ||
175 | * | ||
176 | * The board may assigns a spi_device_id with @id which be used to compared with | ||
177 | * the spi_device_id detected by the scanning. | ||
178 | * | ||
179 | * Return: 0 for success, others for failure. | ||
180 | */ | ||
181 | int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | ||
182 | enum read_mode mode); | ||
183 | extern const struct spi_device_id spi_nor_ids[]; | ||
184 | |||
165 | #endif | 185 | #endif |