From patchwork Sun Jan 2 21:08:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Tardy X-Patchwork-Id: 446561 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 p02LCS47010373 for ; Sun, 2 Jan 2011 21:12:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750989Ab1ABVMI (ORCPT ); Sun, 2 Jan 2011 16:12:08 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:33985 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750730Ab1ABVMH (ORCPT ); Sun, 2 Jan 2011 16:12:07 -0500 Received: by wwa36 with SMTP id 36so13675894wwa.1 for ; Sun, 02 Jan 2011 13:12:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=at4diudacjNadbevdoHFbME/YYYCndfHfJ9S40YWnwA=; b=dkKIhIUum2m5bzCMoJ0JvSHNwamzOQ8ikY2fJm7Rvo+AjksTZmqQtckS+6gJgTr54u J1ECdMSy9v4eak6jIk3SVTI1jz8nMlw3KLdjpIsShvSTvLFctrunG5UOadToYsTps3y+ 7ODfkfXodcFJFJyZCbq7WnA/ooMGdMDEHjWV4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=iqvFzgba2bUh9dSJ0BV/cykJQm3+Hl5/lB2u6RAYCDwkCLaIPYisOCrL9eRK9Kxyz9 TWskVyddCcYqaEAsLcitK0xUGFuYntu6MRyKUQYs791KwFXxGIqA4WmVcyR1Ok5FTjKv q0DPPQCDFy5QlKZBdhcMVTXwhKm/Fm1Fs3XHI= Received: by 10.216.239.9 with SMTP id b9mr2976784wer.24.1294002726177; Sun, 02 Jan 2011 13:12:06 -0800 (PST) Received: from localhost.localdomain ([82.240.198.215]) by mx.google.com with ESMTPS id n18sm9471961wee.16.2011.01.02.13.12.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 02 Jan 2011 13:12:05 -0800 (PST) From: Pierre Tardy To: Linus Walleij , "Gao, Yunpeng" , Pierre Tardy , "Yuan, Hang" , "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Chris Ball , Andrew Morton , Alan Cox , Takashi Iwai , Maxim Levitsky , Ohad Ben-Cohen Cc: Pierre Tardy Subject: [PATCH] mmc: add MMC_QUIRK_BROKEN_CLK_GATING Date: Sun, 2 Jan 2011 22:08:30 +0100 Message-Id: <1294002510-2324-1-git-send-email-tardyp@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: 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.3 (demeter1.kernel.org [140.211.167.41]); Sun, 02 Jan 2011 21:12:29 +0000 (UTC) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 92e3370..54cc461 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -160,10 +160,7 @@ static bool mmc_host_may_gate_card(struct mmc_card *card) * gate the clock, because there is somebody out there that may still * be using it. */ - if (mmc_card_sdio(card)) - return false; - - return true; + return !(card->quirks & MMC_QUIRK_BROKEN_CLK_GATING); } /** diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 82f4b90..6df1ead 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -785,6 +785,12 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr) mmc_release_host(host); + /* + * see comments in mmc_host_may_gate_card() + * this can be overidden by function drivers if they know that + * their sdio card works with clock gating + */ + card->quirks |= MMC_QUIRK_BROKEN_CLK_GATING; /* * First add the card to the driver model... */ diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 8ce0827..5071eb1 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -121,6 +121,7 @@ struct mmc_card { /* for byte mode */ #define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ /* (missing CIA registers) */ +#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */ unsigned int erase_size; /* erase size in sectors */ unsigned int erase_shift; /* if erase unit is power 2 */