From patchwork Sun Feb 14 20:48:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 582560 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 0CC1F140321 for ; Mon, 15 Feb 2016 07:52:05 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C6E56A7629; Sun, 14 Feb 2016 21:51:15 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 71BTJldCCqzY; Sun, 14 Feb 2016 21:51:15 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 273DBA7606; Sun, 14 Feb 2016 21:51:01 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 156D7A760E for ; Sun, 14 Feb 2016 21:50:58 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u1pw25G6G4pS for ; Sun, 14 Feb 2016 21:50:58 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by theia.denx.de (Postfix) with ESMTPS id 09608A75F0 for ; Sun, 14 Feb 2016 21:50:47 +0100 (CET) Received: by mail-pf0-f177.google.com with SMTP id c10so77177143pfc.2 for ; Sun, 14 Feb 2016 12:50:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JKF4+vOP3fH8zBcxzVU67O+lAKN+0VykXIA8OtM2dec=; b=Vq7FnEIozIhYX00n+2VKtBq2KA15iLTAx15hzgdu7VZfOtRWC4CL2H6yCKYaB+oxN2 vSKC7tMjG5ab6dhbDnKpbakI3eIB3cimIRwZjLQwILJ7ePWiyIBM9hSuqw89QN+TmAHL zwx0R1mwUufKjQh8+lQjSYHorG35G9WvnvlrvFATQjbUnB8OudVmk7p9/2YT2k54JTIV IamAS0vJ1r4OjjV/2a5nEpgUqhRASL7+srqhk9xSLuNmshIGbKEPv5JxdSvLhdX8Cb/J oZJtpgH8hsR2gNO++z8cm7NXht/dj0zkkA0I19QKaWJO+Mkiz5BcfxsAeYd0o6X2meL1 HoGg== X-Gm-Message-State: AG10YORvYpT9sGAYqi2XCR5OpcQz/KSqDY7mBdgjiJ0Izz0g6IIKXgI0XKvxcwfMZbxVSw== X-Received: by 10.98.70.80 with SMTP id t77mr18375542pfa.107.1455483046176; Sun, 14 Feb 2016 12:50:46 -0800 (PST) Received: from localhost.localdomain ([123.236.183.254]) by smtp.gmail.com with ESMTPSA id cq9sm11423890pac.26.2016.02.14.12.50.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Feb 2016 12:50:44 -0800 (PST) From: Jagan Teki To: u-boot@lists.denx.de Date: Mon, 15 Feb 2016 02:18:10 +0530 Message-Id: <1455482955-19053-11-git-send-email-jteki@openedev.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455482955-19053-1-git-send-email-jteki@openedev.com> References: <1455482955-19053-1-git-send-email-jteki@openedev.com> Cc: Michal Simek , Siva Durga Prasad Paladugu , Jagan Teki Subject: [U-Boot] [PATCH v6 11/76] mtd: spi-nor: Add spi_flash_free for mtd-dm-spi-nor X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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@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 {