From patchwork Wed Feb 8 21:48:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9563529 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0190B6020F for ; Wed, 8 Feb 2017 21:51:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED367284F6 for ; Wed, 8 Feb 2017 21:51:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E033928533; Wed, 8 Feb 2017 21:51:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C107284F6 for ; Wed, 8 Feb 2017 21:51:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cba8p-00075Z-Dm; Wed, 08 Feb 2017 21:51:07 +0000 Received: from mail-wr0-f194.google.com ([209.85.128.194]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cba8j-0006p4-Nt for linux-amlogic@lists.infradead.org; Wed, 08 Feb 2017 21:51:05 +0000 Received: by mail-wr0-f194.google.com with SMTP id i10so10022253wrb.0 for ; Wed, 08 Feb 2017 13:50:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=85kBbhT6VYwsNHvdRmfw5zYW7YH4t/vfi8uR9XFS+4s=; b=ixqdwBrMgMelFfP37XWmihjTfcdMEqDq7W0MDSxeoG0F59dUUBfDjwskLGVA+JU9bw ojH7hLMtpI6M2i140veAIIRHH/0thjDipqbR5gyDBjEyTum/4DsmzvvrxyVnhbPEpeeS yME8+vruwHxWo2FK77vux9C0eDX1v+icoIisOmkz3yEp/XMcXt0Liscwkuz6PBdml6JE iviLTItdXw+k9SAGgY/aBllI9B4eENWQpDWruclEd9N+kz2vyZeoOtGWeYewUpcNiLhB iWecz0o4hb6GVGA2pZcUa2HKiHxwQ7Vr35YqP0BSKPOlMXgy7flDodUSk98QT+HePiyY zTpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=85kBbhT6VYwsNHvdRmfw5zYW7YH4t/vfi8uR9XFS+4s=; b=KnRmhuQ7vWGUWv9wV7wAD69IbdMWVspQvnBG3cMPMZIwPyeo5OwUu9uFk4yl2JKaow rYanjNFa1nItUGbfVXkAmjih4xSH+qmX3fw1oD5Rq+sKCGP7l97TvF8zJFYE733UmcBY 1lUEwsZ9UpFXI7BgnNsMmY5TKFgWqafjOT6lj++XdU/77qhY2qLxka9KMXsM9Z3UQz8S NH9MNVGB1NfeXbN14ZKq8E8j92kevlOpYFbkemcbDAiH6KiI6MzPXxpaC+bfV+zuUXbK kXEMzqvbXN+p0pTTuTXE4UNKTwxPuqCipWep0xeYK8jDzVJqe5MEcB87eFc14jML6vUM p/mA== X-Gm-Message-State: AIkVDXL9oCwTOOGHqgaQhpUUWjZhkrxCq6Dc4kGdlodinoxHG/MV576au1j4RkFjTIxJow== X-Received: by 10.223.169.115 with SMTP id u106mr21254927wrc.54.1486590580334; Wed, 08 Feb 2017 13:49:40 -0800 (PST) Received: from ?IPv6:2003:c6:ebce:1e00:8056:b008:ad9a:cf83? (p200300C6EBCE1E008056B008AD9ACF83.dip0.t-ipconnect.de. [2003:c6:ebce:1e00:8056:b008:ad9a:cf83]) by smtp.googlemail.com with ESMTPSA id i73sm5482319wmd.11.2017.02.08.13.49.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Feb 2017 13:49:39 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 1/4] mmc: pwrseq: add op reset to struct mmc_pwrseq_ops To: Ulf Hansson , Kevin Hilman References: <75ad5eac-412b-fe73-ff53-3d8b975937e4@gmail.com> Message-ID: Date: Wed, 8 Feb 2017 22:48:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <75ad5eac-412b-fe73-ff53-3d8b975937e4@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170208_135101_952561_5D19C2FD X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, "linux-mmc@vger.kernel.org" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add an operation reset to struct mmc_pwrseq_ops and related wrappers. Don't expose the pwrseq-internal reset function directly to kernel users but just to the mmc core. Signed-off-by: Heiner Kallweit --- drivers/mmc/core/core.c | 6 ++++++ drivers/mmc/core/pwrseq.c | 8 ++++++++ drivers/mmc/core/pwrseq.h | 3 +++ include/linux/mmc/core.h | 1 + 4 files changed, 18 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 926e0fde..5d5fe591 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1869,6 +1869,12 @@ void mmc_power_cycle(struct mmc_host *host, u32 ocr) mmc_power_up(host, ocr); } +void mmc_hw_reset_pwrseq(struct mmc_host *host) +{ + mmc_pwrseq_reset(host); +} +EXPORT_SYMBOL(mmc_hw_reset_pwrseq); + /* * Cleanup when the last reference to the bus operator is dropped. */ diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c index 9386c477..e3ad30fa 100644 --- a/drivers/mmc/core/pwrseq.c +++ b/drivers/mmc/core/pwrseq.c @@ -76,6 +76,14 @@ void mmc_pwrseq_power_off(struct mmc_host *host) pwrseq->ops->power_off(host); } +void mmc_pwrseq_reset(struct mmc_host *host) +{ + struct mmc_pwrseq *pwrseq = host->pwrseq; + + if (pwrseq && pwrseq->ops->reset) + pwrseq->ops->reset(host); +} + void mmc_pwrseq_free(struct mmc_host *host) { struct mmc_pwrseq *pwrseq = host->pwrseq; diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h index 39c911aa..819386f4 100644 --- a/drivers/mmc/core/pwrseq.h +++ b/drivers/mmc/core/pwrseq.h @@ -18,6 +18,7 @@ struct mmc_pwrseq_ops { void (*pre_power_on)(struct mmc_host *host); void (*post_power_on)(struct mmc_host *host); void (*power_off)(struct mmc_host *host); + void (*reset)(struct mmc_host *host); }; struct mmc_pwrseq { @@ -36,6 +37,7 @@ int mmc_pwrseq_alloc(struct mmc_host *host); void mmc_pwrseq_pre_power_on(struct mmc_host *host); void mmc_pwrseq_post_power_on(struct mmc_host *host); void mmc_pwrseq_power_off(struct mmc_host *host); +void mmc_pwrseq_reset(struct mmc_host *host); void mmc_pwrseq_free(struct mmc_host *host); #else @@ -49,6 +51,7 @@ static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; } static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {} static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {} static inline void mmc_pwrseq_power_off(struct mmc_host *host) {} +static inline void mmc_pwrseq_reset(struct mmc_host *host) {} static inline void mmc_pwrseq_free(struct mmc_host *host) {} #endif diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index a0c63ea2..8dbbd7a1 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -166,6 +166,7 @@ int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries); int mmc_hw_reset(struct mmc_host *host); +void mmc_hw_reset_pwrseq(struct mmc_host *host); void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card); #endif /* LINUX_MMC_CORE_H */