[U-Boot] [PATCH v5 13/32] spi_flash: Use mtd_info operation for non-dm

Jagan Teki jteki at openedev.com
Wed Feb 10 20:08:08 CET 2016


Since non-dm code in m25p80 handling spi_nor along with
mtd, hence use the mtd_info operation from user commands
instead of legacy spi_flash{} ops.

Cc: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Cc: Mugunthan V N <mugunthanvnm at ti.com>
Cc: Michal Simek <michal.simek at xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
Signed-off-by: Jagan Teki <jteki at openedev.com>
---
 include/spi_flash.h | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/include/spi_flash.h b/include/spi_flash.h
index 719a6e3..77939bd 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -191,7 +191,9 @@ int sandbox_sf_bind_emul(struct sandbox_state *state, int busnum, int cs,
 
 void sandbox_sf_unbind_emul(struct sandbox_state *state, int busnum, int cs);
 
-#elif CONFIG_MTD_DM_SPI_NOR
+#endif
+
+#ifdef CONFIG_MTD_DM_SPI_NOR
 
 typedef struct mtd_info spi_flash_t;
 
@@ -254,24 +256,7 @@ struct spi_flash *spi_flash_probe_fdt(const void *blob, int slave_node,
 
 void spi_flash_free(struct spi_flash *flash);
 
-static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
-		size_t len, void *buf)
-{
-	return flash->read(flash, offset, len, buf);
-}
-
-static inline int spi_flash_write(struct spi_flash *flash, u32 offset,
-		size_t len, const void *buf)
-{
-	return flash->write(flash, offset, len, buf);
-}
-
-static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,
-		size_t len)
-{
-	return flash->erase(flash, offset, len);
-}
-#endif
+#endif /* CONFIG_MTD_DM_SPI_NOR */
 
 void spi_boot(void) __noreturn;
 void spi_spl_load_image(uint32_t offs, unsigned int size, void *vdst);
-- 
1.9.1



More information about the U-Boot mailing list