From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jagan Teki Date: Mon, 15 Feb 2016 02:18:10 +0530 Subject: [U-Boot] [PATCH v6 11/76] mtd: spi-nor: Add spi_flash_free for mtd-dm-spi-nor In-Reply-To: <1455482955-19053-1-git-send-email-jteki@openedev.com> References: <1455482955-19053-1-git-send-email-jteki@openedev.com> Message-ID: <1455482955-19053-11-git-send-email-jteki@openedev.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de env_sf need to free the flash while read error, so add the flash probe code in spi-nor-probe.c Cc: Simon Glass Cc: Bin Meng Cc: Mugunthan V N Cc: Michal Simek Cc: Siva Durga Prasad Paladugu Signed-off-by: Jagan Teki --- drivers/mtd/spi-nor/spi-nor-probe.c | 7 +++++++ include/spi_flash.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/drivers/mtd/spi-nor/spi-nor-probe.c b/drivers/mtd/spi-nor/spi-nor-probe.c index 9bc61ea..ccc3b6c 100644 --- a/drivers/mtd/spi-nor/spi-nor-probe.c +++ b/drivers/mtd/spi-nor/spi-nor-probe.c @@ -9,6 +9,8 @@ #include #include +#include + /* * TODO(sjg at chromium.org): This is an old-style function. We should remove * it when all SPI flash drivers use dm @@ -24,6 +26,11 @@ spi_flash_t *spi_flash_probe(unsigned int bus, unsigned int cs, return dev_get_uclass_priv(dev); } +void spi_flash_free(spi_flash_t *flash) +{ + device_remove(flash->dev); +} + int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs, unsigned int max_hz, unsigned int spi_mode, struct udevice **devp) diff --git a/include/spi_flash.h b/include/spi_flash.h index 45fda7a..e76ea11 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -120,6 +120,9 @@ int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs, spi_flash_t *spi_flash_probe(unsigned int bus, unsigned int cs, unsigned int max_hz, unsigned int spi_mode); +/* Compatibility function - this is the old U-Boot API */ +void spi_flash_free(spi_flash_t *flash); + #endif struct dm_spi_flash_ops { -- 1.9.1