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: 9563541 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 3DEA76020F for ; Wed, 8 Feb 2017 21:52:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34AAA2845B for ; Wed, 8 Feb 2017 21:52:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 292822852C; Wed, 8 Feb 2017 21:52:16 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C473C284F6 for ; Wed, 8 Feb 2017 21:52:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751429AbdBHVvP (ORCPT ); Wed, 8 Feb 2017 16:51:15 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36061 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbdBHVvK (ORCPT ); Wed, 8 Feb 2017 16:51:10 -0500 Received: by mail-wr0-f195.google.com with SMTP id k90so9979263wrc.3 for ; Wed, 08 Feb 2017 13:49:51 -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=Ug3nxWRU8trEnYDKX1QaN/y0QfZyTind9GXyHruYcM5Bl5jHrcsZv1Ljazyy+fli/3 rr2fuMjUGeyV3gZZxI92BppQwpFHCkUnaj2NR04KffXbNiYOW8baH0crTwTh7xUgsKfv E3ZwcmB4gy8WT0wUrMCDod4zGUnJq6WYkp4vxv5/bd5IT/ZjnaGPHO1B6xKOYxaVKH4j /yDoCl9HVIUQlkn/AynBS8MIx4hZAPJbjXJGxzY/5bJb4gdvaEWpGTDsDcd8ofwZCZK0 P8CqRDLSjdn1NHSytX7gHf4NhxDBZlu5w6EKPFhTpEI51LESuA91xMZ8V7MvhnF0LVHH iIWQ== X-Gm-Message-State: AIkVDXI9jHmdZTER/HKqi3miVVQsxz4G6o9BuGtWrc2CVx5kGgl4qWOGMJCCZ7o5+106Rw== 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> Cc: "linux-mmc@vger.kernel.org" , linux-amlogic@lists.infradead.org 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.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 */