From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751509AbbCTSAl (ORCPT ); Fri, 20 Mar 2015 14:00:41 -0400 Received: from mail-ie0-f176.google.com ([209.85.223.176]:35300 "EHLO mail-ie0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750999AbbCTSAi (ORCPT ); Fri, 20 Mar 2015 14:00:38 -0400 From: Doug Anderson To: Jaehoon Chung , Seungwon Jeon , Ulf Hansson Cc: Alim Akhtar , Sonny Rao , Andrew Bresticker , Heiko Stuebner , Addy Ke , Alexandru Stan , javier.martinez@collabora.co.uk, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Doug Anderson , chris@printf.net, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: dw_mmc: Don't send clock off command if power is off Date: Fri, 20 Mar 2015 11:00:20 -0700 Message-Id: <1426874420-25103-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We've already seen that it causes failures if we try to send the "SDMMC_CMD_UPD_CLK" command when power is off to the system. Here's another case where we were doing it: we were sending an SDMMC_CMD_UPD_CLK to set the clock to 0 when the card was already powered off and the clock was already at 0. Let's avoid that command and avoid problems. Signed-off-by: Doug Anderson --- drivers/mmc/host/dw_mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 47dfd0e..aeec698 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1172,8 +1172,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) break; case MMC_POWER_OFF: - /* Turn clock off before power goes down */ - dw_mci_setup_bus(slot, false); + /* Turn clock off before power goes down; only if powered */ + if (slot->host->vqmmc_enabled) + dw_mci_setup_bus(slot, false); if (!IS_ERR(mmc->supply.vmmc)) mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); -- 2.2.0.rc0.207.ga3a616c