From patchwork Mon Nov 10 17:13:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Shchislowski X-Patchwork-Id: 5267601 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8F3FFC11AC for ; Mon, 10 Nov 2014 17:14:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8974E2010C for ; Mon, 10 Nov 2014 17:14:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80A3C200F3 for ; Mon, 10 Nov 2014 17:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752886AbaKJROY (ORCPT ); Mon, 10 Nov 2014 12:14:24 -0500 Received: from mail-bn1on0057.outbound.protection.outlook.com ([157.56.110.57]:57182 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752856AbaKJROX (ORCPT ); Mon, 10 Nov 2014 12:14:23 -0500 Received: from BLUPR02CA033.namprd02.prod.outlook.com (25.160.23.151) by CO1PR02MB127.namprd02.prod.outlook.com (10.242.163.153) with Microsoft SMTP Server (TLS) id 15.1.16.15; Mon, 10 Nov 2014 17:14:16 +0000 Received: from BY2FFO11FD036.protection.gbl (2a01:111:f400:7c0c::116) by BLUPR02CA033.outlook.office365.com (2a01:111:e400:8ad::23) with Microsoft SMTP Server (TLS) id 15.1.16.15 via Frontend Transport; Mon, 10 Nov 2014 17:14:15 +0000 Received: from milsmgep11.sandisk.com (63.163.107.172) by BY2FFO11FD036.mail.protection.outlook.com (10.1.14.221) with Microsoft SMTP Server id 15.1.6.13 via Frontend Transport; Mon, 10 Nov 2014 17:14:15 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id FC.D7.06562.662F0645; Mon, 10 Nov 2014 09:14:14 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.195.1; Mon, 10 Nov 2014 09:14:12 -0800 X-AuditID: ac160a68-f79d16d0000019a2-40-5460f2665ef0 Received: from KFAC110926.sdcorp.global.sandisk.com ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id 8D.6B.10458.462F0645; Mon, 10 Nov 2014 09:14:14 -0800 (PST) From: Avi Shchislowski To: CC: , , , , , Alex Lemberg , open list Subject: [PATCH 1/3] mmc: Support FFU for eMMC v5.0 Date: Mon, 10 Nov 2014 19:13:49 +0200 Message-ID: <1415639632-878-1-git-send-email-avi.shchislowski@sandisk.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKLMWRmVeSWpSXmKPExsWyRoxnkW7ap4QQg6+nlC22v97IZnF35wRG i8u75rBZHPnfz2hxfG24A6vHgk2lHoeurGX0uHNtD5vH501yASxRXDYpqTmZZalF+nYJXBnL F/1lK1ggVnHi7VSmBsZvgl2MnBwSAiYSW368YoOwxSQu3FsPZHNxCAmcYJS41/ACytnBKHHh 7nRGmI7HzdNYIRInGSUm3uxnB0mwCZhKzGxbytTFyMEhIiAj0XjAGKSGWeAOo8Saa/fAmoUF jCX+TT/KDGKzCKhKTO36BhbnFfCSeLRgBlivhICCxJxJNiBhTgEBie2nLzCB2EIC/BJtm/sY QWZKCCxildg99zo7RK+gxMmZT1hAbGYBCYmDL14wQzRoSpxcuJxtAqPwLCRls5CULWBkWsUo lpuZU5ybnlpgaKhXnJiXklmcrZecn7uJERz4XBk7GLdOMj/EKMDBqMTD6/A2PkSINbGsuDL3 EKMEB7OSCG/mw4QQId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rz287L8hQTSE0tSs1NTC1KLYLJM HJxSDYx9ad+0VgcfsJDyk/1bX7SHYbqs/IeiVvnj16/rPp5851vBroYzK+7oHSx7eaLsF5Or c+7yohf57Z5zN7A0JgWYPUntnOGY/rqKtUZxgcDtK4XPlu+srWzdfpf777pzYbNyJhsefivW rn//mZ2fv8hT0SqhKSr7Hqcfrgl8rh8fo/ejP5uV21iJpTgj0VCLuag4EQDw9PnfeAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJMWRmVeSWpSXmKPExsXCtZEjRTftU0KIQcsdcYubD36wWezcu47J YvvrjWwWd3dOYLS4vGsOm8WR//2MFsfXhjuweyzYVOpx6MpaRo871/aweUxbc57J4/MmuQDW KC6blNSczLLUIn27BK6M5Yv+shUsEKs48XYqUwPjN8EuRk4OCQETicfN01ghbDGJC/fWs3Ux cnEICRxnlOif0coGkmATMJWY2baUCcQWEZCS6HnazAxSxCxwg1Gib/snsG5hAWOJf9OPMoPY LAKqElO7vjGC2LwCXhLfV34EquEA2qAgMWeSDUiYU0BAYvvpC2AzhQT4Jdo29zFOYORZwMiw ilEsNzOnODc9s8DQUK84MS8lszhbLzk/dxMjOHQ4I3cwPp1ofoiRiYNTqoHR7DfXlt7ySdsv Hrkr8HCV0JTl8ryPnVTSYzoYTp5x7j/+hmPd15oY05TeO12rlr34cO7D3ebW3VOPpma1RMld CX3x/rmndiF30i2lE5/26E30L2CXerws8srDu73JE2w+8M6z2bzT8ILcve8dMjr/9Hal27ur mknOb17AItM5/VF4XOLVSedWK7EUZyQaajEXFScCAEIs3QnNAQAA MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(199003)(189002)(92726001)(4396001)(21056001)(50226001)(33646002)(92566001)(48376002)(97736003)(76176999)(95666004)(86362001)(11926002)(84676001)(102836001)(36756003)(50986999)(62966003)(50466002)(31966008)(77156002)(107046002)(46102003)(229853001)(87286001)(44976005)(47776003)(19580395003)(20776003)(87936001)(2351001)(64706001)(69596002)(68736004)(106466001)(81156004)(19580405001)(88136002)(110136001)(89996001)(120916001)(99396003)(104166001); DIR:OUT; SFP:1101; SCL:1; SRVR:CO1PR02MB127; H:milsmgep11.sandisk.com; FPR:; MLV:sfv; PTR:ErrorRetry; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB127; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA: BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB127; X-Forefront-PRVS: 039178EF4A Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.172 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.172; helo=milsmgep11.sandisk.com; Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=Avi.Shchislowski@sandisk.com; X-Exchange-Antispam-Report-CFA: BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB127; X-OriginatorOrg: sandisk.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add eMMC5.0 ffu ext_csd fields Signed-off-by: Avi Shchislowski Signed-off-by: Alex Lemberg diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 1eda8dd..3b86ed3 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -603,6 +603,15 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) card->ext_csd.data_sector_size = 512; } + /* eMMC v5 or later */ + if (card->ext_csd.rev >= 7) { + card->ext_csd.ffu_capable = + ((ext_csd[EXT_CSD_SUPPORTED_MODE] & 0x1) == 0x1) && + ((ext_csd[EXT_CSD_FW_CONFIG] & 0x1) == 0x0); + card->ext_csd.ffu_mode_op = ext_csd[EXT_CSD_FFU_FEATURES]; + } else { + card->ext_csd.ffu_capable = false; + } out: return err; } diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index d424b9d..dd01efe 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -81,6 +81,8 @@ struct mmc_ext_csd { bool hpi_en; /* HPI enablebit */ bool hpi; /* HPI support bit */ unsigned int hpi_cmd; /* cmd used as HPI */ + bool ffu_capable; /* FFU support */ + bool ffu_mode_op; /* FFU mode operation */ bool bkops; /* background support bit */ bool bkops_en; /* background enable bit */ unsigned int data_sector_size; /* 512 bytes or 4KB */ diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 64ec963..787787b 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -272,6 +272,9 @@ struct _mmc_csd { * EXT_CSD fields */ +#define EXT_CSD_FFU_STATUS 26 /* R */ +#define EXT_CSD_MODE_OPERATION_CODES 29 /* W */ +#define EXT_CSD_MODE_CONFIG 30 /* R/W */ #define EXT_CSD_FLUSH_CACHE 32 /* W */ #define EXT_CSD_CACHE_CTRL 33 /* R/W */ #define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ @@ -290,6 +293,7 @@ struct _mmc_csd { #define EXT_CSD_SANITIZE_START 165 /* W */ #define EXT_CSD_WR_REL_PARAM 166 /* RO */ #define EXT_CSD_RPMB_MULT 168 /* RO */ +#define EXT_CSD_FW_CONFIG 169 /* R/W */ #define EXT_CSD_BOOT_WP 173 /* R/W */ #define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ #define EXT_CSD_PART_CONFIG 179 /* R/W */ @@ -326,6 +330,11 @@ struct _mmc_csd { #define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ #define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ #define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */ +#define EXT_CSD_NUM_OF_FW_SEC_PROG 302 /* RO, 4 bytes */ +#define EXT_CSD_FFU_ARG 487 /* RO, 4 bytes */ +#define EXT_CSD_OPERATION_CODE_TIMEOUT 491 /* RO */ +#define EXT_CSD_FFU_FEATURES 492 /* RO */ +#define EXT_CSD_SUPPORTED_MODE 493 /* RO */ #define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ #define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ #define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */