From patchwork Fri Apr 5 20:50:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: York Sun X-Patchwork-Id: 234285 X-Patchwork-Delegate: trini@ti.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 8D1E62C0103 for ; Sat, 6 Apr 2013 07:51:17 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A71614A1E4; Fri, 5 Apr 2013 22:51:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 OudobBRLyz6O; Fri, 5 Apr 2013 22:51:15 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 13F3F4A1E5; Fri, 5 Apr 2013 22:51:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5D2F84A1E5 for ; Fri, 5 Apr 2013 22:51:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 qCFbDllPvXQn for ; Fri, 5 Apr 2013 22:51:11 +0200 (CEST) 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 ch1outboundpool.messaging.microsoft.com (ch1ehsobe002.messaging.microsoft.com [216.32.181.182]) by theia.denx.de (Postfix) with ESMTPS id 3466F4A1E4 for ; Fri, 5 Apr 2013 22:51:09 +0200 (CEST) Received: from mail217-ch1-R.bigfish.com (10.43.68.252) by CH1EHSOBE015.bigfish.com (10.43.70.65) with Microsoft SMTP Server id 14.1.225.23; Fri, 5 Apr 2013 20:51:08 +0000 Received: from mail217-ch1 (localhost [127.0.0.1]) by mail217-ch1-R.bigfish.com (Postfix) with ESMTP id 29057160120; Fri, 5 Apr 2013 20:51:08 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zz853kzz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1155h) Received: from mail217-ch1 (localhost.localdomain [127.0.0.1]) by mail217-ch1 (MessageSwitch) id 1365195066799456_14356; Fri, 5 Apr 2013 20:51:06 +0000 (UTC) Received: from CH1EHSMHS024.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.230]) by mail217-ch1.bigfish.com (Postfix) with ESMTP id BF7D14A0075; Fri, 5 Apr 2013 20:51:06 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS024.bigfish.com (10.43.70.24) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 5 Apr 2013 20:51:02 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.2.328.11; Fri, 5 Apr 2013 20:51:01 +0000 Received: from oslab-l1.am.freescale.net ([10.214.83.36]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r35Kou7B028906; Fri, 5 Apr 2013 13:51:00 -0700 From: York Sun To: Date: Fri, 5 Apr 2013 13:50:56 -0700 Message-ID: <1365195056-20188-1-git-send-email-yorksun@freescale.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Cc: scottwood@freescale.com, u-boot@lists.denx.de Subject: [U-Boot] [v3] command/cache: Add flush command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When we copy code/data to the main memory, we may need to flush the cache if required by architecture. It uses the existing function flush_cache. Syntax is flush The addr and size are given in hexadecimal. Like memory command, there is no sanity check for the parameters. Signed-off-by: York Sun --- Change since v2: rename flush_cache to flush README | 5 ++++- common/cmd_cache.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README b/README index dc6b0b3..b2f80d6 100644 --- a/README +++ b/README @@ -809,6 +809,7 @@ The following options need to be configured: CONFIG_CMD_BSP * Board specific commands CONFIG_CMD_BOOTD bootd CONFIG_CMD_CACHE * icache, dcache + CONFIG_CMD_CACHE_FLUSH * flush cache by the address and range CONFIG_CMD_CONSOLE coninfo CONFIG_CMD_CRC32 * crc32 CONFIG_CMD_DATE * support for RTC, date/time... @@ -912,7 +913,9 @@ The following options need to be configured: 8260 (where accesses to the IMMR region must be uncached), and it cannot be disabled on all other systems where we (mis-) use the data cache to hold an - initial stack and some data. + initial stack and some data. The CONFIG_CMD_CACHE_FLUSH + macro enables flushing cache by the address and range to + maintain coherency if required by architecture. XXX - this list needs to get updated! diff --git a/common/cmd_cache.c b/common/cmd_cache.c index 5512f92..c228e0c 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -120,3 +120,29 @@ U_BOOT_CMD( "[on, off, flush]\n" " - enable, disable, or flush data (writethrough) cache" ); + +#ifdef CONFIG_CMD_CACHE_FLUSH +int do_flush_cache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + ulong addr, size; + + switch (argc) { + case 3: + addr = simple_strtoul(argv[1], NULL, 16); + size = simple_strtoul(argv[2], NULL, 16); + flush_cache(addr, size); + break; + default: + return cmd_usage(cmdtp); + } + return 0; + +} + +U_BOOT_CMD( + flush, 3, 0, do_flush_cache, + "flush cache for a range", + " \n" + " - flush cache for specificed range" +); +#endif