From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752972AbbIKNRi (ORCPT ); Fri, 11 Sep 2015 09:17:38 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:57727 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752794AbbIKNRg (ORCPT ); Fri, 11 Sep 2015 09:17:36 -0400 Message-ID: <55F2D466.30806@ti.com> Date: Fri, 11 Sep 2015 18:47:26 +0530 From: Kishon Vijay Abraham I User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Ulf Hansson CC: linux-mmc , "linux-kernel@vger.kernel.org" , Sekhar Nori , Adrian Hunter , Neil Brown , "Fu, Zhonghui" , Andreas Fenkart Subject: Re: [RFC PATCH 2/2] mmc: core: sdio: claim host before power up or power off References: <1440411317-8813-1-git-send-email-kishon@ti.com> <1440411317-8813-2-git-send-email-kishon@ti.com> In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Friday 11 September 2015 06:15 PM, Ulf Hansson wrote: > On 24 August 2015 at 12:15, Kishon Vijay Abraham I wrote: >> mmc_sdio_runtime_resume and mmc_sdio_runtime_suspend does power up and >> power off respectively but does so without claiming the host. Among other >> things mmc_claim_host inovkes pm_runtime_get_sync to enable the clocks. >> Invoke mmc_claim_host before mmc_power_up and mmc_power_off in >> mmc_sdio_runtime_resume and mmc_sdio_runtime_suspend respectively. >> >> This is required since certain platforms (like TI SoCs) access >> the controller registers during power up. > > I realize the issue. Actually I have been working on similar patch > which take a bit wider approach. That's because there are more cases > where the host needs to be claimed, when it isn't. > > I just posted a patch, please have a look and see if it makes sense to > you, you are on cc. > "[PATCH] mmc: core: Keep host claimed while invoking mmc_power_off|up()" Sure Uffe. -Kishon > > Kind regards > Uffe > >> >> Signed-off-by: Kishon Vijay Abraham I >> --- >> drivers/mmc/core/sdio.c | 10 +++++++++- >> 1 file changed, 9 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c >> index 0cbbfb8..40795b2 100644 >> --- a/drivers/mmc/core/sdio.c >> +++ b/drivers/mmc/core/sdio.c >> @@ -1023,16 +1023,24 @@ static int mmc_sdio_power_restore(struct mmc_host *host) >> >> static int mmc_sdio_runtime_suspend(struct mmc_host *host) >> { >> + mmc_claim_host(host); >> /* No references to the card, cut the power to it. */ >> mmc_power_off(host); >> + mmc_release_host(host); >> return 0; >> } >> >> static int mmc_sdio_runtime_resume(struct mmc_host *host) >> { >> + int ret; >> + >> + mmc_claim_host(host); >> /* Restore power and re-initialize. */ >> mmc_power_up(host, host->card->ocr); >> - return mmc_sdio_power_restore(host); >> + ret = _mmc_sdio_power_restore(host); >> + mmc_release_host(host); >> + >> + return ret; >> } >> >> static int mmc_sdio_reset(struct mmc_host *host) >> -- >> 1.7.9.5 >>