From patchwork Fri Aug 7 03:49:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phaneendra kumar X-Patchwork-Id: 39758 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n773ohQk008539 for ; Fri, 7 Aug 2009 03:50:43 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n773obgZ000750 for ; Thu, 6 Aug 2009 22:50:42 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n773obpQ025623 for ; Thu, 6 Aug 2009 22:50:37 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 082D580800 for ; Thu, 6 Aug 2009 22:50:13 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 4726C80626 for ; Thu, 6 Aug 2009 22:49:56 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id n773ntMB002362 for ; Thu, 6 Aug 2009 22:49:55 -0500 (CDT) Received: from mail193-va3-R.bigfish.com (mail-va3.bigfish.com [216.32.180.114]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id n773no1c006430 for ; Thu, 6 Aug 2009 22:49:55 -0500 Received: from mail193-va3 (localhost.localdomain [127.0.0.1]) by mail193-va3-R.bigfish.com (Postfix) with ESMTP id 6570A88834B for ; Fri, 7 Aug 2009 03:49:50 +0000 (UTC) X-SpamScore: 16 X-BigFish: vps16(zzzz1202hzzz30ih6bh65h) X-Spam-TCS-SCL: 4:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 64.71.235.11; Service: EHS Received: by mail193-va3 (MessageSwitch) id 1249616982452734_11744; Fri, 7 Aug 2009 03:49:42 +0000 (UCT) Received: from mail10.myhsphere.biz (smtp13.myhsphere.biz [64.71.235.11]) by mail193-va3.bigfish.com (Postfix) with ESMTP id 559BE1378051 for ; Fri, 7 Aug 2009 03:49:42 +0000 (UTC) Received: (qmail 11065 invoked by uid 399); 7 Aug 2009 03:49:40 -0000 Received: from mail-pz0-f178.google.com (phani@embwise.com@209.85.222.178) by mail10.myhsphere.biz with ESMTPAM; 7 Aug 2009 03:49:40 -0000 X-Originating-IP: 209.85.222.178 X-Sender: phani@embwise.com Received: by pzk8 with SMTP id 8so1432322pzk.31 for ; Thu, 06 Aug 2009 20:49:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.146.2 with SMTP id t2mr943836wad.177.1249616978135; Thu, 06 Aug 2009 20:49:38 -0700 (PDT) From: PhaneendraKumar A Date: Fri, 7 Aug 2009 09:19:18 +0530 Message-ID: <54d94f230908062049u722bce51j53847830cecb3995@mail.gmail.com> To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH] MMC: SDIO reset functionality to the existing MMC frame work X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Observed some issues during the initialization of SDIO cards. The initialization sequence for SDIO card is not according to the SDIO specification. Hence the card is not getting initialized during module reload with card always present in the slot. This patch fixes the issue. Signed-off-by: phani@embwise.com --- drivers/mmc/core/core.c | 1 + drivers/mmc/core/sdio_ops.c | 22 ++++++++++++++++++++++ drivers/mmc/core/sdio_ops.h | 1 + 3 files changed, 24 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index d84c880..5ec7e75 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -890,6 +890,7 @@ void mmc_rescan(struct work_struct *work) mmc_claim_host(host); mmc_power_up(host); + mmc_reset_sdio(host); mmc_go_idle(host); mmc_send_if_cond(host, host->ocr_avail); diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c index 4eb7825..2e77ab8 100644 --- a/drivers/mmc/core/sdio_ops.c +++ b/drivers/mmc/core/sdio_ops.c @@ -19,6 +19,28 @@ #include "core.h" #include "sdio_ops.h" +int mmc_reset_sdio(struct mmc_host *host) +{ + struct mmc_command cmd; + int err = 0; + + BUG_ON(!host); + + memset(&cmd, 0, sizeof(struct mmc_command)); + + cmd.opcode = SD_IO_RW_DIRECT; + cmd.arg = 0x80000000; + cmd.arg |= (SDIO_CCCR_ABORT) << 9; + cmd.arg |= (1<<3); + cmd.flags = MMC_RSP_R5 | MMC_CMD_AC; + + err = mmc_wait_for_cmd(host, &cmd, 0); + if (err) + return err; + + return 0; +} + int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) { struct mmc_command cmd; diff --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h index e2e74b0..2ef70b8 100644 --- a/drivers/mmc/core/sdio_ops.h +++ b/drivers/mmc/core/sdio_ops.h @@ -17,6 +17,7 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn, unsigned addr, u8 in, u8* out); int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz); +int mmc_reset_sdio(struct mmc_host *host); #endif