From patchwork Tue Dec 23 09:50:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Santa Cruz X-Patchwork-Id: 423615 X-Patchwork-Delegate: panto@antoniou-consulting.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 BB39F140082 for ; Tue, 23 Dec 2014 20:51:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 310834B6D5; Tue, 23 Dec 2014 10:51:48 +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 vkVwYOeVvX3Z; Tue, 23 Dec 2014 10:51:47 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 262FD4B654; Tue, 23 Dec 2014 10:51:27 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5307E4B627 for ; Tue, 23 Dec 2014 10:51:14 +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 sJvAH8IP2q9K for ; Tue, 23 Dec 2014 10:51:14 +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 emea01-db3-obe.outbound.protection.outlook.com (mail-db3on0097.outbound.protection.outlook.com [157.55.234.97]) by theia.denx.de (Postfix) with ESMTPS id B2BA54B608 for ; Tue, 23 Dec 2014 10:51:13 +0100 (CET) Received: from DB4PR01MB125.eurprd01.prod.exchangelabs.com (10.242.156.12) by DB4PR01MB176.eurprd01.prod.exchangelabs.com (10.242.157.24) with Microsoft SMTP Server (TLS) id 15.1.49.12; Tue, 23 Dec 2014 09:51:12 +0000 Received: from prefix.spinetix.local (212.147.27.179) by DB4PR01MB125.eurprd01.prod.exchangelabs.com (10.242.156.12) with Microsoft SMTP Server (TLS) id 15.1.49.12; Tue, 23 Dec 2014 09:51:10 +0000 From: Diego Santa Cruz To: Date: Tue, 23 Dec 2014 10:50:25 +0100 Message-ID: <1419328233-6977-11-git-send-email-Diego.SantaCruz@spinetix.com> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1419328233-6977-1-git-send-email-Diego.SantaCruz@spinetix.com> References: <1419328233-6977-1-git-send-email-Diego.SantaCruz@spinetix.com> MIME-Version: 1.0 X-Originating-IP: [212.147.27.179] X-ClientProxiedBy: DB4PR04CA0041.eurprd04.prod.outlook.com (25.160.41.51) To DB4PR01MB125.eurprd01.prod.exchangelabs.com (10.242.156.12) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Diego.SantaCruz@spinetix.com; X-Microsoft-Antispam: UriScan:;UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DB4PR01MB125; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:DB4PR01MB125; X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(76176999)(77156002)(110136001)(101416001)(68736005)(62966003)(31966008)(40100003)(21056001)(50986999)(122386002)(92566001)(99396003)(48376002)(2950100001)(86362001)(77096005)(87976001)(66066001)(2351001)(20776003)(107046002)(89996001)(97736003)(229853001)(4396001)(46102003)(120916001)(36756003)(64706001)(50466002)(106356001)(105586002)(19580395003)(19580405001)(50226001)(42186005)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR01MB125; H:prefix.spinetix.local; FPR:; SPF:None; MLV:sfv; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: spinetix.com does not designate permitted sender hosts) X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:DB4PR01MB125; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2014 09:51:10.8211 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR01MB125 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DB4PR01MB176; X-OriginatorOrg: spinetix.com Cc: panto@antoniou-consulting.com Subject: [U-Boot] [PATCH v4 10/18] mmc: read the high capacity WP group size for eMMC X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 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 Read the eMMC high capacity write protect group size at mmc device initialization. This is useful to correctly partition an eMMC device, as partitions need to be aligned to this size. Signed-off-by: Diego Santa Cruz --- drivers/mmc/mmc.c | 6 ++++++ include/mmc.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index be21101..16a7a90 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1065,7 +1065,9 @@ static int mmc_startup(struct mmc *mmc) return err; else ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1; + } + if (ext_csd[EXT_CSD_ERASE_GROUP_DEF] & 0x01) { /* Read out group size from ext_csd */ mmc->erase_grp_size = ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] * 1024; @@ -1092,6 +1094,10 @@ static int mmc_startup(struct mmc *mmc) mmc->erase_grp_size = (erase_gsz + 1) * (erase_gmul + 1); } + + mmc->hc_wp_grp_size = 1024 + * ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] + * ext_csd[EXT_CSD_HC_WP_GRP_SIZE]; } err = mmc_set_capacity(mmc, mmc->part_num); diff --git a/include/mmc.h b/include/mmc.h index 6c8bbfc..bcaf9f0 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -316,6 +316,7 @@ struct mmc { uint read_bl_len; uint write_bl_len; uint erase_grp_size; /* in 512-byte sectors */ + uint hc_wp_grp_size; /* in 512-byte sectors */ u64 capacity; u64 capacity_user; u64 capacity_boot;