From patchwork Mon Mar 6 14:17:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 9606335 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 2DA66601D2 for ; Mon, 6 Mar 2017 14:18:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20BA326D05 for ; Mon, 6 Mar 2017 14:18:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 158FA26E77; Mon, 6 Mar 2017 14:18:42 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=unavailable 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 C47DF26D05 for ; Mon, 6 Mar 2017 14:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qyj8HjkTpI4LZ2Ac0jITgBudG1RqhOCx06m7DWhSwQA=; b=s99SMEa0m4q0ln+BfKqnpoi7J9 OjEoY23e1iG57NgkENUexxXpN61O3OKj6rTqceJUhFVvP1oSTq3Y49Po8hto+ZwOOBsxNStmkHiQU RJC/X8WYKylbxUKsxb4djrGhMqcv+bqLXYgxtJHQfgQqLRu9P27UPaEnOM++Zeo0t2DsZgUZ/fkpi kPFHwtjVd3GqbJlVqQqMDxyg4oLimsHhvSa8W98zzdotPDpIWTDrvF8CQN9QfjRxk8PibYQOb7pDV vpw50PqmhTv2CTS9Al2LDcMVDTIlRkSiFSEela+mclsYDq/JiGnD1QHE3j9IBZC9hMvOLj+LMvF4J bLzPppgQ==; 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 1cktT3-0002A2-1B; Mon, 06 Mar 2017 14:18:29 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cktSb-00025o-PV; Mon, 06 Mar 2017 14:18:05 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: rperier) with ESMTPSA id 3FB3D26A87A From: Romain Perier To: Ulf Hansson Subject: [PATCH v2 1/4] mmc: core: Add post_ios_power_on callback for power sequences Date: Mon, 6 Mar 2017 15:17:13 +0100 Message-Id: <20170306141716.19120-2-romain.perier@collabora.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170306141716.19120-1-romain.perier@collabora.com> References: <20170306141716.19120-1-romain.perier@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170306_061802_187149_9B612FF0 X-CRM114-Status: GOOD ( 10.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Sjoerd Simons , Romain Perier , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, ->pre_power_on() callback is called at the beginning of the mmc_power_up() function before MMC_POWER_UP and MMC_POWER_ON sequences. The callback ->post_power_on() is called at the end of the mmc_power_up() function. Some SDIO Chipsets require to gate the clock after than the vqmmc supply is powered on and then toggle the reset line. Currently, there is no way for doing this. This commit introduces a new callback ->post_ios_power_on(), that is called at the end of the mmc_power_up() function after the mmc_set_ios() operation. In this way the entire power sequences can be done from this function after the enablement of the power supply. Signed-off-by: Romain Perier --- Changes in v2: - Added missing declaration for mmc_pwrseq_post_ios_power_on when CONFIG_OF is disabled. drivers/mmc/core/core.c | 1 + drivers/mmc/core/pwrseq.c | 8 ++++++++ drivers/mmc/core/pwrseq.h | 3 +++ 3 files changed, 12 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 1076b9d..d73a050 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1831,6 +1831,7 @@ void mmc_power_up(struct mmc_host *host, u32 ocr) * time required to reach a stable voltage. */ mmc_delay(10); + mmc_pwrseq_post_ios_power_on(host); } void mmc_power_off(struct mmc_host *host) diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c index 9386c47..98f50b7 100644 --- a/drivers/mmc/core/pwrseq.c +++ b/drivers/mmc/core/pwrseq.c @@ -68,6 +68,14 @@ void mmc_pwrseq_post_power_on(struct mmc_host *host) pwrseq->ops->post_power_on(host); } +void mmc_pwrseq_post_ios_power_on(struct mmc_host *host) +{ + struct mmc_pwrseq *pwrseq = host->pwrseq; + + if (pwrseq && pwrseq->ops->post_ios_power_on) + pwrseq->ops->post_ios_power_on(host); +} + void mmc_pwrseq_power_off(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 d69e751..ad6e3af 100644 --- a/drivers/mmc/core/pwrseq.h +++ b/drivers/mmc/core/pwrseq.h @@ -13,6 +13,7 @@ struct mmc_pwrseq_ops { void (*pre_power_on)(struct mmc_host *host); void (*post_power_on)(struct mmc_host *host); + void (*post_ios_power_on)(struct mmc_host *host); void (*power_off)(struct mmc_host *host); }; @@ -31,6 +32,7 @@ void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq); 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_post_ios_power_on(struct mmc_host *host); void mmc_pwrseq_power_off(struct mmc_host *host); void mmc_pwrseq_free(struct mmc_host *host); @@ -44,6 +46,7 @@ static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {} 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_post_ios_power_on(struct mmc_host *host) {} static inline void mmc_pwrseq_power_off(struct mmc_host *host) {} static inline void mmc_pwrseq_free(struct mmc_host *host) {}