From patchwork Thu Jan 3 13:19:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Rudholm X-Patchwork-Id: 1927641 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1E66F3FC33 for ; Thu, 3 Jan 2013 13:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753355Ab3ACNVi (ORCPT ); Thu, 3 Jan 2013 08:21:38 -0500 Received: from eu1sys200aog110.obsmtp.com ([207.126.144.129]:32825 "EHLO eu1sys200aog110.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331Ab3ACNVi (ORCPT ); Thu, 3 Jan 2013 08:21:38 -0500 Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob110.postini.com ([207.126.147.11]) with SMTP ID DSNKUOWFzNCYnG5UL0Fd2rHGmrmsVOT5l838@postini.com; Thu, 03 Jan 2013 13:21:37 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id E81633D; Thu, 3 Jan 2013 13:19:01 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 4669368; Thu, 3 Jan 2013 07:52:36 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 5197DA8083; Thu, 3 Jan 2013 14:19:36 +0100 (CET) Received: from steludxu1610.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 3 Jan 2013 14:19:40 +0100 From: Johan Rudholm To: , Chris Ball Cc: Per Forlin , Ulf Hansson , Fredrik Soderstedt , Kevin Liu , Philip Rakity , Daniel Drake , Aaron , Subhash Jadavani , Johan Rudholm Subject: [PATCH v3 1/3] mmc: core: Add mmc_power_cycle Date: Thu, 3 Jan 2013 14:19:34 +0100 Message-ID: <1357219176-21892-2-git-send-email-johan.rudholm@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1357219176-21892-1-git-send-email-johan.rudholm@stericsson.com> References: <1357219176-21892-1-git-send-email-johan.rudholm@stericsson.com> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add mmc_power_cycle which can be used to power cycle for instance SD-cards. Signed-off-by: Johan Rudholm --- drivers/mmc/core/core.c | 8 ++++++++ drivers/mmc/core/core.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index aaed768..285f064 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1372,6 +1372,14 @@ void mmc_power_off(struct mmc_host *host) mmc_host_clk_release(host); } +void mmc_power_cycle(struct mmc_host *host) +{ + mmc_power_off(host); + /* Wait at least 1 ms according to SD spec */ + mmc_delay(1); + mmc_power_up(host); +} + /* * Cleanup when the last reference to the bus operator is dropped. */ diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 3bdafbc..4a90067 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -45,6 +45,7 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, void mmc_set_timing(struct mmc_host *host, unsigned int timing); void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); void mmc_power_off(struct mmc_host *host); +void mmc_power_cycle(struct mmc_host *host); static inline void mmc_delay(unsigned int ms) {