From patchwork Thu Jan 27 21:00:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Rakity X-Patchwork-Id: 513191 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 p0RL0v60019413 for ; Thu, 27 Jan 2011 21:00:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753844Ab1A0VA4 (ORCPT ); Thu, 27 Jan 2011 16:00:56 -0500 Received: from na3sys009aog110.obsmtp.com ([74.125.149.203]:48220 "EHLO na3sys009aog110.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753783Ab1A0VA4 convert rfc822-to-8bit (ORCPT ); Thu, 27 Jan 2011 16:00:56 -0500 Received: from source ([65.219.4.129]) (using TLSv1) by na3sys009aob110.postini.com ([74.125.148.12]) with SMTP ID DSNKTUHdBEx903h6UddcDOwOd2jELTYTd8RW@postini.com; Thu, 27 Jan 2011 13:00:56 PST Received: from SC-vEXCH3.marvell.com ([10.93.76.133]) by SC-OWA01.marvell.com ([10.93.76.21]) with mapi; Thu, 27 Jan 2011 13:00:51 -0800 From: Philip Rakity To: Hanumath Prasad , "linux-mmc@vger.kernel.org" Date: Thu, 27 Jan 2011 13:00:51 -0800 Subject: [PATCH]mmc: check if mmc cards < 2GB do sector addressing Thread-Topic: [PATCH]mmc: check if mmc cards < 2GB do sector addressing Thread-Index: Acu+ZUeMkXtVjvqpTpewJ42X6LndSA== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US 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]); Thu, 27 Jan 2011 21:00:58 +0000 (UTC) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index c139a5e..9303a57 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -378,6 +378,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, int err, ddr = 0; u32 cid[4]; unsigned int max_dtr; + u32 rocr; BUG_ON(!host); WARN_ON(!host->claimed); @@ -391,7 +392,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, mmc_go_idle(host); /* The extra bit indicates that we support high capacity */ - err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); + err = mmc_send_op_cond(host, ocr | (1 << 30), &rocr); if (err) goto err; @@ -479,6 +480,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_read_ext_csd(card); if (err) goto free_card; + + /* if doing byte addressing check if required to do sector */ + /* addressing. Handle case of cards < 2GB needing sector */ + /* addressing. See section 8.1 JEDEC Standard JED84-A441 */ + /* ocr register has bit 30 set for sector addressing */ + if (!(mmc_card_blockaddr(card)) && (rocr & (1<<30))) + mmc_card_set_blockaddr(card); /* Erase size depends on CSD and Extended CSD */ mmc_set_erase_size(card); }