From patchwork Thu Nov 6 15:42:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Shchislowski X-Patchwork-Id: 5244681 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B7C5C9F2F1 for ; Thu, 6 Nov 2014 15:57:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5E0F200F4 for ; Thu, 6 Nov 2014 15:57:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DEDBE200F3 for ; Thu, 6 Nov 2014 15:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751311AbaKFP54 (ORCPT ); Thu, 6 Nov 2014 10:57:56 -0500 Received: from mail-bn1bon0099.outbound.protection.outlook.com ([157.56.111.99]:27584 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750998AbaKFP5z convert rfc822-to-8bit (ORCPT ); Thu, 6 Nov 2014 10:57:55 -0500 X-Greylist: delayed 930 seconds by postgrey-1.27 at vger.kernel.org; Thu, 06 Nov 2014 10:57:55 EST Received: from BY2PR02CA0033.namprd02.prod.outlook.com (10.141.216.23) by BLUPR02MB114.namprd02.prod.outlook.com (10.242.187.23) with Microsoft SMTP Server (TLS) id 15.1.11.14; Thu, 6 Nov 2014 15:42:23 +0000 Received: from BY2FFO11FD018.protection.gbl (2a01:111:f400:7c0c::183) by BY2PR02CA0033.outlook.office365.com (2a01:111:e400:2c40::23) with Microsoft SMTP Server (TLS) id 15.1.16.15 via Frontend Transport; Thu, 6 Nov 2014 15:42:22 +0000 Received: from sacsmgep11.sandisk.com (74.221.232.162) by BY2FFO11FD018.mail.protection.outlook.com (10.1.14.106) with Microsoft SMTP Server id 15.1.6.13 via Frontend Transport; Thu, 6 Nov 2014 15:42:22 +0000 X-AuditID: ac1c210e-f79a26d000002892-8b-545b96de4ae9 Received: from SACHUBIP02.sdcorp.global.sandisk.com ( [172.28.1.254]) by sacsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id DA.B2.10386.ED69B545; Thu, 6 Nov 2014 07:42:22 -0800 (PST) Received: from SACMBXIP02.sdcorp.global.sandisk.com ([fe80::6420:780c:fa4c:c1e7]) by SACHUBIP02.sdcorp.global.sandisk.com ([10.181.10.104]) with mapi id 14.03.0195.001; Thu, 6 Nov 2014 07:42:22 -0800 From: Avi Shchislowski To: "linux-mmc@vger.kernel.org" , "'cjb@laptop.org'" CC: Alex Lemberg , Gwendal Grignou Subject: [PATCH 1/3]mmc: Support-FFU-for-eMMC-v5.0 Thread-Topic: [PATCH 1/3]mmc: Support-FFU-for-eMMC-v5.0 Thread-Index: Ac/52DuwZswDgNFIR5mIJPfzoFXgyA== Date: Thu, 6 Nov 2014 15:42:20 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.181.8.64] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCLMWRmVeSWpSXmKPExsWyRobxn+69adEhBi+fcVhsf72RzeLuzgmM Fkf+9zM6MHss2FTqcejKWkaPz5vkApijuGxSUnMyy1KL9O0SuDJaf59gL1grVtH6YyF7A2On UBcjB4eEgInEuT15XYycQKaYxIV769m6GLk4hASOM0qcnbwPyjnNKHFt8QU2kCo2AVOJdd+f MIE0iwgkSZy/EwISZhYIlti+cBojiC0sYCyxsm0HO0SJhUTTNB0IU0+ifaceiMkioCJxqLcS pJhXIFpi/6w/YLMZgS74fmoNE8RAcYlbT+YzQVwmILFkz3lmCFtU4uXjf6wQx8tLXD9tB1Gu I7Fg9yc2CFtbYtnC18wQ4wUlTs58wjKBUWQWkqmzkLTMQtIyC0nLAkaWVYxixYnJxbnpqQWG hnrFiXkpmcXZesn5uZsYwXGhyLeDcd8U80OMAhyMSjy8AieiQoRYE8uKK3MPMUpwMCuJ8Fb3 RIcI8aYkVlalFuXHF5XmpBYfYpTmYFES513qNitYSCA9sSQ1OzW1ILUIJsvEwSnVwMjs2KIu vfl3Z+DCx53VorWfdXed2Cq9QTuKfcqqHfJZL55vO7LrrybL9kuv+9L/b56zLLM0P/p/xunw 8Kv/d2zqbnvoIza9aNsvwyN/xIv+tO+cbbooQCO4+dCSHVlzhKYKLrqX/Onz8tP7deZJ7v7A 8mLSwa056c/WLYuytzu6oebYDye/G8mBSizFGYmGWsxFxYkAHnI3socCAAA= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:74.221.232.162; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(189002)(199003)(4396001)(77096003)(21056001)(81156004)(16796002)(31966008)(230783001)(106466001)(97736003)(229853001)(47776003)(23726002)(62966003)(19580405001)(64706001)(20776003)(107046002)(99396003)(55846006)(46406003)(120916001)(86362001)(84676001)(87936001)(69596002)(2656002)(68736004)(77156002)(50986999)(95666004)(54356999)(33656002)(97756001)(92726001)(44976005)(50466002)(92566001)(46102003)(19580395003)(7099017)(491001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB114; H:sacsmgep11.sandisk.com; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB114; X-Exchange-Antispam-Report-Test: UriScan:; X-Forefront-PRVS: 0387D64A71 Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 74.221.232.162 as permitted sender) receiver=protection.outlook.com; client-ip=74.221.232.162; helo=sacsmgep11.sandisk.com; Authentication-Results: spf=pass (sender IP is 74.221.232.162) smtp.mailfrom=Avi.Shchislowski@sandisk.com; 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 --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 */