From patchwork Wed Aug 8 02:43:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Ball X-Patchwork-Id: 1292101 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E9B553FC23 for ; Wed, 8 Aug 2012 02:43:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753587Ab2HHCnP (ORCPT ); Tue, 7 Aug 2012 22:43:15 -0400 Received: from void.printf.net ([89.145.121.20]:42096 "EHLO void.printf.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970Ab2HHCnO (ORCPT ); Tue, 7 Aug 2012 22:43:14 -0400 Received: from c-76-24-28-220.hsd1.ma.comcast.net ([76.24.28.220] helo=octavius.laptop.org) by void.printf.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1SywEq-0003hD-EG; Wed, 08 Aug 2012 03:43:12 +0100 From: Chris Ball To: philipspatches@gmail.com Cc: linux-mmc@vger.kernel.org, Philip Rakity Subject: Re: [PATCH] sdhci: Add regulator support for vccq (voltage regualor) References: <1343084183-6070-1-git-send-email-prakity@marvell.com> Date: Tue, 07 Aug 2012 22:43:09 -0400 In-Reply-To: <1343084183-6070-1-git-send-email-prakity@marvell.com> (philipspatches@gmail.com's message of "Mon, 23 Jul 2012 15:56:23 -0700") Message-ID: <87txwexfwi.fsf@octavius.laptop.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Hi Philip, On Mon, Jul 23 2012, philipspatches@gmail.com wrote: > From: Philip Rakity > > On some systems the host controller does not support vccq > signaling. This is supplied by a dedicated regulator (vqmmc). > > Add support for this regulator. > > Signed-off-by: Philip Rakity I've folded in this trivial cleanup patch, let me know if there's anything in there you disagree with: diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ac50d35..828ac6c 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1607,11 +1607,10 @@ static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host, sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); if (host->vqmmc) { - ret = regulator_set_voltage(host->vqmmc, - 3300000, 3300000); + ret = regulator_set_voltage(host->vqmmc, 3300000, 3300000); if (ret) { - pr_info(DRIVER_NAME ": Switching to 3.3V " - "signalling voltage failed\n"); + pr_warning("%s: Switching to 3.3V signalling voltage " + " failed\n", mmc_hostname(host->mmc)); return -EIO; } } @@ -1623,7 +1622,9 @@ static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host, if (!(ctrl & SDHCI_CTRL_VDD_180)) return 0; - pr_info(DRIVER_NAME ": Switching to 3.3V signalling voltage failed\n"); + pr_warning("%s: 3.3V regulator output did not became stable\n", + mmc_hostname(host->mmc)); + return -EIO; } @@ -1700,8 +1701,9 @@ static int sdhci_do_1_8v_signal_voltage_switch(struct sdhci_host *host, if (host->vmmc) regulator_enable(host->vmmc); - pr_info(DRIVER_NAME ": Switching to 1.8V signalling " - "voltage failed, retrying with S18R set to 0\n"); + pr_warning("%s: Switching to 1.8V signalling voltage failed, " + "retrying with S18R set to 0\n", mmc_hostname(host->mmc)); + return -EAGAIN; } @@ -2834,15 +2836,13 @@ int sdhci_add_host(struct sdhci_host *host) !(host->mmc->caps & MMC_CAP_NONREMOVABLE)) mmc->caps |= MMC_CAP_NEEDS_POLL; - /* if vqmmc regulator and no 1.8V signaling no UHS */ - + /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */ host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc"); if (IS_ERR(host->vqmmc)) { - pr_info("%s: no vqmmc regulator found\n", - mmc_hostname(mmc)); + pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc)); host->vqmmc = NULL; - } else if (regulator_is_supported_voltage(host->vqmmc, - 1800000, 1800000)) + } + else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000)) regulator_enable(host->vqmmc); else caps[1] &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |