From patchwork Mon Dec 7 14:50:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 553419 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 55150140273 for ; Tue, 8 Dec 2015 01:50:23 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 164194B73A; Mon, 7 Dec 2015 15:50:21 +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 WEWKRB-_TvXO; Mon, 7 Dec 2015 15:50:20 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A1EC84B723; Mon, 7 Dec 2015 15:50:20 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0DE3E4B723 for ; Mon, 7 Dec 2015 15:50:17 +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 RjqjZkYG19k3 for ; Mon, 7 Dec 2015 15:50:16 +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 fed1rmfepo203.cox.net (fed1rmfepo203.cox.net [68.230.241.148]) by theia.denx.de (Postfix) with ESMTP id 634A24B721 for ; Mon, 7 Dec 2015 15:50:11 +0100 (CET) Received: from fed1rmimpo305 ([68.230.241.173]) by fed1rmfepo203.cox.net (InterMail vM.8.01.05.15 201-2260-151-145-20131218) with ESMTP id <20151207145010.QWBM26406.fed1rmfepo203.cox.net@fed1rmimpo305> for ; Mon, 7 Dec 2015 09:50:10 -0500 Received: from localhost.localdomain ([98.165.107.234]) by fed1rmimpo305 with cox id qeq81r00H53Tyga01eq9ly; Mon, 07 Dec 2015 09:50:10 -0500 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020205.56659CA2.0051,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=f8aW8pOM c=1 sm=1 a=mmedTQiI2PtWY+RDxZIZmw==:17 a=9_1hYV8uAAAA:8 a=Mpps2-cZAAAA:8 a=3iqLFfv8AAAA:8 a=6ohNodAXAAAA:8 a=UihtYy-prLAUH1hsJXsA:9 a=mmedTQiI2PtWY+RDxZIZmw==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (CRAM-MD5) smtp.auth=eric.a.nelson@cox.net From: Eric Nelson To: u-boot@lists.denx.de, panto@antoniou-consulting.com Date: Mon, 7 Dec 2015 07:50:01 -0700 Message-Id: <1449499801-3900-1-git-send-email-eric@nelint.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <5661C454.5030706@nelint.com> References: <5661C454.5030706@nelint.com> Cc: cliff.brust@defengcorp.com, andrew_gabbasov@mentor.com, otavio@ossystems.com.br, leiwen@marvell.com, jh80.chung@samsung.com, Hector.Palacios@digi.com, Markus.Niebel@tq-group.com Subject: [U-Boot] [PATCH] mmc: update MMC_ERASE argument to match Linux kernel. 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" Table 41 of the JEDEC standard for eMMC says that bit 31 of the command argument is obsolete when issuing the ERASE command (CMD38) on page 115 of this document: http://www.jedec.org/sites/default/files/docs/jesd84-B45.pdf The SD Card Association Physical Layer Simplified Specification also makes no mention of the use of bit 31. https://www.sdcard.org/downloads/pls/part1_410.pdf The Linux kernel distinguishes between secure (bit 31 set) and non-secure erase, and this patch copies the macro names from include/linux/mmc/core.h. Tested-by: Fabio Estevam Signed-off-by: Eric Nelson Tested-by: Hector Palacios --- drivers/mmc/mmc_write.c | 2 +- include/mmc.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c index 7aea7e9..221bf30 100644 --- a/drivers/mmc/mmc_write.c +++ b/drivers/mmc/mmc_write.c @@ -51,7 +51,7 @@ static ulong mmc_erase_t(struct mmc *mmc, ulong start, lbaint_t blkcnt) goto err_out; cmd.cmdidx = MMC_CMD_ERASE; - cmd.cmdarg = SECURE_ERASE; + cmd.cmdarg = MMC_ERASE_ARG; cmd.resp_type = MMC_RSP_R1b; err = mmc_send_cmd(mmc, &cmd, NULL); diff --git a/include/mmc.h b/include/mmc.h index cda9a19..b89962a 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -121,7 +121,12 @@ #define OCR_VOLTAGE_MASK 0x007FFF80 #define OCR_ACCESS_MODE 0x60000000 -#define SECURE_ERASE 0x80000000 +#define MMC_ERASE_ARG 0x00000000 +#define MMC_SECURE_ERASE_ARG 0x80000000 +#define MMC_TRIM_ARG 0x00000001 +#define MMC_DISCARD_ARG 0x00000003 +#define MMC_SECURE_TRIM1_ARG 0x80000001 +#define MMC_SECURE_TRIM2_ARG 0x80008000 #define MMC_STATUS_MASK (~0x0206BF7F) #define MMC_STATUS_SWITCH_ERROR (1 << 7)