From patchwork Mon Apr 30 08:34:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Vadot X-Patchwork-Id: 906574 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=freebsd.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40ZJH52cTyz9s0W for ; Mon, 30 Apr 2018 18:53:37 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 14734C21F01; Mon, 30 Apr 2018 08:46:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1FAC1C21F7D; Mon, 30 Apr 2018 08:36:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E499AC21EF1; Mon, 30 Apr 2018 08:34:48 +0000 (UTC) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by lists.denx.de (Postfix) with ESMTPS id 0F509C21EF7 for ; Mon, 30 Apr 2018 08:34:45 +0000 (UTC) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 369f7873 for ; Mon, 30 Apr 2018 10:34:44 +0200 (CEST) Received: from wopr.blih.net (62-210-199-19.rev.poneytelecom.eu [62.210.199.19]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 19223515 TLS version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO for ; Mon, 30 Apr 2018 10:34:33 +0200 (CEST) Received: from elbarto (uid 1001) (envelope-from manu@bidouilliste.com) id 7c9a4 by wopr.blih.net (DragonFly Mail Agent v0.11); Mon, 30 Apr 2018 10:34:32 +0200 From: Emmanuel Vadot To: sjg@chromium.org, bmeng.cn@gmail.com, andriy.shevchenko@linux.intel.com, rick@andestech.com, philipp.tomsich@theobroma-systems.com, albert.u.boot@aribaud.net, xypron.glpk@gmx.de Date: Mon, 30 Apr 2018 10:34:31 +0200 Message-Id: <20180430083431.72606-1-manu@freebsd.org> X-Mailer: git-send-email 2.16.3 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 3/5] api: Flush cache when closing api X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Signed-off-by: Emmanuel Vadot --- api/api.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/api.c b/api/api.c index 7eee2fc083..7d1608b520 100644 --- a/api/api.c +++ b/api/api.c @@ -290,6 +290,17 @@ static int API_dev_close(va_list ap) if (!err) di->state = DEV_STA_CLOSED; +#if defined(CONFIG_SYS_HAVE_DCACHE_MAINTENANCE) && \ + !defined(CONFIG_SYS_DCACHE_OFF) + if (dcache_status()) + flush_dcache_all(); +#endif +#if defined(CONFIG_SYS_HAVE_ICACHE_MAINTENANCE) && \ + !defined(CONFIG_SYS_ICACHE_OFF) + if (icache_status()) + invalidate_icache_all(); +#endif + return err; }