From patchwork Fri Sep 4 15:32:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 7124161 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1E8AF9F1D5 for ; Fri, 4 Sep 2015 15:37:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38E792083E for ; Fri, 4 Sep 2015 15:37:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 43AD720836 for ; Fri, 4 Sep 2015 15:37:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXt1m-0002rL-DN; Fri, 04 Sep 2015 15:35:46 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXt1Q-0001DM-4A for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2015 15:35:25 +0000 Received: by pacfv12 with SMTP id fv12so28001804pac.2 for ; Fri, 04 Sep 2015 08:35:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JQQNEcFbBWj7gRFbrpmr168VMKLlpyWEfwQ+i4BifyE=; b=aInjpcPd6BD876ljym4c57N652yqqYPmrxfRP31C81sHdOMOq6ftw3/a32eZH4fZNQ 0m8NAmPveilW7bb6t6TuwcwVo2G5LHzID4Dkvp5YpQcHBoavFMK2y/qRu2anoaHiH0pc I0fsFlJ0UmoqOORRWq6DX8tNrPy385xpieGl9yOgVI5MzxsDBuaJGvCkECWjbAsHxoxJ zykwFoDDwX4m0S21+8IOOe02IiT0l6J/LAroH44oxssySF/RmJzUpyhMbQP/rhVXDcQ2 RE+yW4YfBL5QTEW306sT69irqFJlE0vrJueygBYAkAI5eRTnmHGFfFCCHHM3Kwy1rXdR xdvw== X-Gm-Message-State: ALoCoQl7DLv+5nu6eCBoBpSIYKncPucJ8b0ZtWYxr13jOI4LPlNWrE4Erlw89zQL4oJHTkQzGZrv X-Received: by 10.66.90.166 with SMTP id bx6mr9283420pab.133.1441380901755; Fri, 04 Sep 2015 08:35:01 -0700 (PDT) Received: from localhost.localdomain ([202.62.93.137]) by smtp.gmail.com with ESMTPSA id gs2sm2920151pbc.15.2015.09.04.08.34.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Sep 2015 08:35:00 -0700 (PDT) From: Vaibhav Hiremath To: linux-mmc@vger.kernel.org Subject: [PATCH 5/5] mmc: sdhci: add new quirk for setting BUS_POWER & BUS_VLT fields Date: Fri, 4 Sep 2015 21:02:21 +0530 Message-Id: <1441380741-13115-6-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441380741-13115-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1441380741-13115-1-git-send-email-vaibhav.hiremath@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150904_083524_230937_8504D895 X-CRM114-Status: GOOD ( 15.85 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vaibhav Hiremath , ulf.hansson@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kliu5@marvell.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP IN case of Marvell 1928 family of devices, the SD_BUS_POWER and SD_BUS_VLT bits are used internally to gate the clocks, so we have to set these fields. Pasting Spec words here, The and fields should be configured to correct values. These actually do not do the voltage selection or switch power to the SD card. However these fields are used internally to gate the clock. So if these fields are set incorrectly, SD module will not function. And during my development, I have seen that SD card wouldn't function without right configuration into these fields. So this patch adds new quirk (SDHCI_QUIRK2_MUST_SET_SDHCI_BUS_POWER), which make sure that ->set_power() sets these fields. Signed-off-by: Vaibhav Hiremath --- drivers/mmc/host/sdhci-pltfm.c | 3 +++ drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index a207f5a..0872da0 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -101,6 +101,9 @@ void sdhci_get_of_property(struct platform_device *pdev) of_device_is_compatible(np, "fsl,mpc8536-esdhc")) host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; + if (of_device_is_compatible(np, "marvell,pxav3-988-sdhci")) + host->quirks2 |= SDHCI_QUIRK2_MUST_SET_SDHCI_BUS_POWER; + clk = of_get_property(np, "clock-frequency", &size); if (clk && size == sizeof(*clk) && *clk) pltfm_host->clock = be32_to_cpup(clk); diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 2d58b31..418f381 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1265,7 +1265,8 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, else sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); - return; + if (!(host->quirks2 | SDHCI_QUIRK2_MUST_SET_SDHCI_BUS_POWER)) + return; } if (mode != MMC_POWER_OFF) { diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 9b0e2a8..8802a0c 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -409,6 +409,8 @@ struct sdhci_host { #define SDHCI_QUIRK2_SUPPORT_SINGLE (1<<13) /* Controller broken with using ACMD23 */ #define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14) +/* Voltage capabilities of Controller must be set */ +#define SDHCI_QUIRK2_MUST_SET_SDHCI_BUS_POWER (1<<15) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */