From patchwork Mon Jan 28 14:08:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Rudholm X-Patchwork-Id: 14305 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 16ABD23F8C for ; Mon, 28 Jan 2013 14:09:13 +0000 (UTC) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by fiordland.canonical.com (Postfix) with ESMTP id B3E94A1981C for ; Mon, 28 Jan 2013 14:09:12 +0000 (UTC) Received: by mail-ve0-f174.google.com with SMTP id c13so1330633vea.33 for ; Mon, 28 Jan 2013 06:09:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:mime-version:content-type:x-gm-message-state; bh=sk13+vKA1HMs9ZO1KWqodLymyH2ZAcgQnoNsGrfciJQ=; b=jymNdLERZLx3aNf8TYFNolwDO+rnx9/ojufmYCI044sEhRd9dydXJzpFtxo2g9wUux 1U7RlTTJ7xLCG9zuvRovglDg2n84RMw9mG9bK9BOhpXEHOFwXBp3Q3Sm26TlklKVvn60 bS8Rgyj3cRaS9FcYL4P1bUoWgXsl79huT6I4h5hy5DzYW7oyU+FgrQXX7506qFLpbqnw z/BB9Cr4yCbUuEmpfVRLC19ZZR+q14DhQvQb0+yODktPLEtB5YwubvPvYIPzESAZA7sg +Qqbmho/QZIPYcCWuQAdT1fAQsrgCKtjPBnLDKk5GHffC+pYnqQITO3wlNa1e1MWLlC7 Bmbg== X-Received: by 10.220.218.197 with SMTP id hr5mr14737303vcb.8.1359382152168; Mon, 28 Jan 2013 06:09:12 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp86521veb; Mon, 28 Jan 2013 06:09:11 -0800 (PST) X-Received: by 10.194.75.197 with SMTP id e5mr14677348wjw.55.1359382150432; Mon, 28 Jan 2013 06:09:10 -0800 (PST) Received: from eu1sys200aog113.obsmtp.com (eu1sys200aog113.obsmtp.com [207.126.144.135]) by mx.google.com with SMTP id h7si16669033eei.251.2013.01.28.06.09.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Jan 2013 06:09:10 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of johan.rudholm@stericsson.com) client-ip=207.126.144.135; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of johan.rudholm@stericsson.com) smtp.mail=johan.rudholm@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob113.postini.com ([207.126.147.11]) with SMTP ID DSNKUQaGbo7OiXNZox831CMx2rPoMiIeV1bt@postini.com; Mon, 28 Jan 2013 14:09:10 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 72F17BA; Mon, 28 Jan 2013 14:00:33 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 1861A17C2; Mon, 28 Jan 2013 14:08:42 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 4651424C307; Mon, 28 Jan 2013 15:08:34 +0100 (CET) Received: from steludxu1610.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 28 Jan 2013 15:08:40 +0100 From: Johan Rudholm To: , Chris Ball Cc: Per Forlin , Ulf Hansson , Fredrik Soderstedt , Kevin Liu , Philip Rakity , Daniel Drake , Aaron , Subhash Jadavani , Sujit Reddy Thumma , Wei WANG , Johan Rudholm Subject: [PATCH v6 2/5] mmc: core: Add mmc_power_cycle Date: Mon, 28 Jan 2013 15:08:25 +0100 Message-ID: <1359382108-958-3-git-send-email-johan.rudholm@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1359382108-958-1-git-send-email-johan.rudholm@stericsson.com> References: <1359382108-958-1-git-send-email-johan.rudholm@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkUKaIkgx5Epr89OfU2Xeq1gG/gk2RuhfSLYCjCv+JMKPH9+bpsf/+hg2doNT5nBExr/623 Add mmc_power_cycle which can be used to power cycle for instance SD-cards. Signed-off-by: Johan Rudholm Acked-by: Ulf Hansson Tested-by: Wei WANG --- 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 8b3a122..304c97c 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1470,6 +1470,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 0272b32..9007de7 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) {