From patchwork Tue Jun 29 13:49:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grazvydas Ignotas X-Patchwork-Id: 108630 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o5TDi2bj017060 for ; Tue, 29 Jun 2010 13:55:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755999Ab0F2Ntf (ORCPT ); Tue, 29 Jun 2010 09:49:35 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:40737 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755754Ab0F2Nte (ORCPT ); Tue, 29 Jun 2010 09:49:34 -0400 Received: by wyb38 with SMTP id 38so2714778wyb.19 for ; Tue, 29 Jun 2010 06:49:32 -0700 (PDT) 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=hYGM/lLGR5RxaPljXlPNGbPSzG4XhgbWhzhjLDAElKk=; b=CBHJZPMh8PyrOkcoqKPyoESNIKRAo1C7fKRLwhkbKylObzoo6XD5ALg6AnzlIlVEX9 yIysRvRL7jWdjODTK6+yryjzUdvb2JtH4K/Wod2byctBQZkQ5zx6xZ86EOqWyUNZQMzl FdUMhk68y6u7f6vOND1Nf+WCL0pjNU+l/oQdU= 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=w8dBiUZGMINQJ0sgN2jCsRBaT9CSIPIxDWhUFbE0ORHazCh1vUdyVJEUqfJfB3wcTo c9vCwh91nTLENgUVSropDUtJ2+QrIR9KBXyBnCgwHbHErNBuJ5OuCG0n2FPqK3lER4OR LLwg0yBRjyycfV+l5TFlfItZS7l08INEH5gzU= Received: by 10.216.85.143 with SMTP id u15mr9515147wee.113.1277819372545; Tue, 29 Jun 2010 06:49:32 -0700 (PDT) Received: from localhost.localdomain (ip-88-119-226-136.static.b4net.lt [88.119.226.136]) by mx.google.com with ESMTPS id n52sm3181251wee.31.2010.06.29.06.49.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 29 Jun 2010 06:49:31 -0700 (PDT) From: Grazvydas Ignotas To: linux-mmc@vger.kernel.org Cc: linux-omap@vger.kernel.org, Andrew Morton , Adrian Hunter , Tony Lindgren , Bob Copeland , Kalle Valo , Grazvydas Ignotas Subject: [PATCH 1/3] sdio: allow non-standard SDIO cards Date: Tue, 29 Jun 2010 16:49:23 +0300 Message-Id: <1277819365-2761-2-git-send-email-notasas@gmail.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1277819365-2761-1-git-send-email-notasas@gmail.com> References: <1277819365-2761-1-git-send-email-notasas@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 29 Jun 2010 13:55:55 +0000 (UTC) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index b9dee28..cb66833 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -62,13 +62,19 @@ static int sdio_init_func(struct mmc_card *card, unsigned int fn) func->num = fn; - ret = sdio_read_fbr(func); - if (ret) - goto fail; + if (!(card->quirks & MMC_QUIRK_NONSTD_SDIO)) { + ret = sdio_read_fbr(func); + if (ret) + goto fail; - ret = sdio_read_func_cis(func); - if (ret) - goto fail; + ret = sdio_read_func_cis(func); + if (ret) + goto fail; + } else { + func->vendor = func->card->cis.vendor; + func->device = func->card->cis.device; + func->max_blksize = func->card->cis.blksize; + } card->sdio_func[fn - 1] = func; @@ -321,6 +327,23 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, goto remove; } + if (card->quirks & MMC_QUIRK_NONSTD_SDIO) { + /* + * This is non-standard SDIO device, meaning it doesn't + * have any CIA (Common I/O area) registers present. + * It's host's responsibility to fill cccr and cis + * structures in init_card(). + */ + mmc_set_clock(host, card->cis.max_dtr); + + if (card->cccr.high_speed) { + mmc_card_set_highspeed(card); + mmc_set_timing(card->host, MMC_TIMING_SD_HS); + } + + goto finish; + } + /* * Read the common registers. */ @@ -376,6 +399,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, if (err) goto remove; +finish: if (!oldcard) host->card = card; return 0; diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index d02d2c6..cbc745c 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -101,6 +101,8 @@ struct mmc_card { #define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ #define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ /* for byte mode */ +#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ + /* (missing CIA registers) */ u32 raw_cid[4]; /* raw card CID */ u32 raw_csd[4]; /* raw card CSD */