From patchwork Sat Mar 5 12:15:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 612161 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p25CGQAW021352 for ; Sat, 5 Mar 2011 12:16:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752749Ab1CEMQZ (ORCPT ); Sat, 5 Mar 2011 07:16:25 -0500 Received: from eu1sys200aog105.obsmtp.com ([207.126.144.119]:36933 "EHLO eu1sys200aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752692Ab1CEMQZ (ORCPT ); Sat, 5 Mar 2011 07:16:25 -0500 Received: from source ([138.198.100.35]) (using TLSv1) by eu1sys200aob105.postini.com ([207.126.147.11]) with SMTP ID DSNKTXIpipmuSS4rwjUcBJ5kgrVDed7AAJTv@postini.com; Sat, 05 Mar 2011 12:16:24 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 98381FB; Sat, 5 Mar 2011 12:15:52 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 481F85EF; Sat, 5 Mar 2011 12:15:52 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id D23C3A8065; Sat, 5 Mar 2011 13:15:46 +0100 (CET) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.2.254.0; Sat, 5 Mar 2011 13:15:51 +0100 From: Linus Walleij To: , Chris Ball Cc: Lee Jones , Linus Walleij , Gary King , Ulf Hansson , Linus Walleij Subject: [PATCH] mmc: subtract boot sectors from disk size for eMMC 4.3+ devices Date: Sat, 5 Mar 2011 13:15:44 +0100 Message-ID: <1299327344-12462-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 05 Mar 2011 12:16:37 +0000 (UTC) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 14e95f3..03c3283 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -255,6 +255,13 @@ static int mmc_read_ext_csd(struct mmc_card *card) /* Cards with density > 2GiB are sector addressed */ if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512) mmc_card_set_blockaddr(card); + + if (card->ext_csd.sectors) { + unsigned boot_sectors; + /* size is in 256K chunks, i.e. 512 sectors each */ + boot_sectors = ext_csd[EXT_CSD_BOOT_SIZE_MULTI] * 512; + card->ext_csd.sectors -= boot_sectors; + } } switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) { diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 264ba54..4516fc1 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -267,6 +267,7 @@ struct _mmc_csd { #define EXT_CSD_HC_WP_GRP_SIZE 221 /* RO */ #define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */ #define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */ +#define EXT_CSD_BOOT_SIZE_MULTI 226 /* RO */ #define EXT_CSD_SEC_TRIM_MULT 229 /* RO */ #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */