From patchwork Fri Jul 10 12:40:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 34980 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6ACckHG013622 for ; Fri, 10 Jul 2009 12:38:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752098AbZGJMhg (ORCPT ); Fri, 10 Jul 2009 08:37:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752226AbZGJMhf (ORCPT ); Fri, 10 Jul 2009 08:37:35 -0400 Received: from smtp.nokia.com ([192.100.122.233]:34864 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754001AbZGJMh3 (ORCPT ); Fri, 10 Jul 2009 08:37:29 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n6ACbECf024359; Fri, 10 Jul 2009 15:37:17 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 10 Jul 2009 15:37:21 +0300 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 10 Jul 2009 15:37:20 +0300 Received: from [127.0.1.1] (esdhcp042131.research.nokia.com [172.21.42.131]) by mgw-da01.ext.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n6ACbEPT003001; Fri, 10 Jul 2009 15:37:14 +0300 From: Adrian Hunter To: Pierre Ossman Cc: Jarkko Lavinen , Denis Karpov , Adrian Hunter , linux-omap Mailing List , lkml Date: Fri, 10 Jul 2009 15:40:54 +0300 Message-Id: <20090710124054.1262.18902.sendpatchset@ahunter-tower> In-Reply-To: <20090710124004.1262.10422.sendpatchset@ahunter-tower> References: <20090710124004.1262.10422.sendpatchset@ahunter-tower> Subject: [PATCH 7/32] mmc: add host capabilities for SD only and MMC only X-OriginalArrivalTime: 10 Jul 2009 12:37:20.0659 (UTC) FILETIME=[2AE20E30:01CA015B] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From 27ed1443884c0e46855485cfc2190e1d80a0f568 Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Tue, 7 Jul 2009 12:20:48 +0300 Subject: [PATCH] mmc: add host capabilities for SD only and MMC only Some hosts can accept only certain types of cards. For example, an eMMC is MMC only and a uSD slot may be SD only. However the MMC card scanning logic checks for all card types one by one. Add host capabilities to specify which card types cannot be used, and amend the card scanning logic to skip scanning for those types. Signed-off-by: Adrian Hunter --- drivers/mmc/core/core.c | 16 +++++++++++++++- include/linux/mmc/host.h | 7 +++++++ 2 files changed, 22 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index c5a7857..db43a1d 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1066,7 +1066,11 @@ void mmc_rescan(struct work_struct *work) mmc_power_up(host); mmc_go_idle(host); - mmc_send_if_cond(host, host->ocr_avail); + if (!(host->caps & MMC_CAP_NOT_SDIO) || !(host->caps & MMC_CAP_NOT_SD)) + mmc_send_if_cond(host, host->ocr_avail); + + if (host->caps & MMC_CAP_NOT_SDIO) + goto not_sdio; /* * First we search for SDIO... @@ -1078,6 +1082,10 @@ void mmc_rescan(struct work_struct *work) goto out; } +not_sdio: + if (host->caps & MMC_CAP_NOT_SD) + goto not_sd; + /* * ...then normal SD... */ @@ -1088,6 +1096,10 @@ void mmc_rescan(struct work_struct *work) goto out; } +not_sd: + if (host->caps & MMC_CAP_NOT_MMC) + goto not_mmc; + /* * ...and finally MMC. */ @@ -1098,6 +1110,8 @@ void mmc_rescan(struct work_struct *work) goto out; } +not_mmc: + mmc_release_host(host); mmc_power_off(host); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 0a60b02..e996967 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -150,6 +150,13 @@ struct mmc_host { #define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ +#define MMC_CAP_NOT_SDIO (1 << 10) /* Card cannot be SDIO */ +#define MMC_CAP_NOT_SD (1 << 11) /* Card cannot be SD */ +#define MMC_CAP_NOT_MMC (1 << 12) /* Card cannot be MMC */ + +#define MMC_CAP_SDIO_ONLY (MMC_CAP_NOT_SD | MMC_CAP_NOT_MMC) +#define MMC_CAP_SD_ONLY (MMC_CAP_NOT_SDIO | MMC_CAP_NOT_MMC) +#define MMC_CAP_MMC_ONLY (MMC_CAP_NOT_SDIO | MMC_CAP_NOT_SD) /* host specific block data */ unsigned int max_seg_size; /* see blk_queue_max_segment_size */