From patchwork Mon Sep 7 11:18:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 7133741 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 CEAC59F314 for ; Mon, 7 Sep 2015 11:24:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED5CA20678 for ; Mon, 7 Sep 2015 11:24:19 +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 11F6B2041B for ; Mon, 7 Sep 2015 11:24:19 +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 1ZYuVF-0003pd-AL; Mon, 07 Sep 2015 11:22:25 +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 1ZYuUa-000343-QU for linux-arm-kernel@lists.infradead.org; Mon, 07 Sep 2015 11:21:45 +0000 Received: by pacfv12 with SMTP id fv12so97089525pac.2 for ; Mon, 07 Sep 2015 04:21:23 -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=HB2ZHkViqr7kneByP772146f+edVs6hH7XtaywVfWwU=; b=A3k5rpPpPCnSdU3wyiu1zFpFtMPQMkE2JtNEW36mJvkhK05EIbzYwG0HQiDHGZA3Eh M4CM/0z8rJVP/xtO9gNRAfPCfPfy61TlzSpGukvO16arQsno4MCQcGSh2f00ETlhirzi RFh5Ez2CnBVBSJzAfyR6IvxpCw2XPaqv+998YPTUxS3SZuBevAcLHD3CoVIMxiaFSmBs UAL7xw7pZ7NNATkjoBezdaXIMlzWuykWh5+ZcyXVYSsj5Xte9trVogGPJx0N3ZqgvX3A UmJapbjOlGqhekda3FOfnE9rcfznqa+LblUB8CkUa0VSVwrja2Wyt9cQZ9GmrlCtFk4q 01ww== X-Gm-Message-State: ALoCoQlKrvR/jU8bH89ZSj4sViircLiwkULSqNJ0z3ZqnM+RpQInGpgSsFGQYa2B9tlGzUw+ce4R X-Received: by 10.67.5.10 with SMTP id ci10mr45327973pad.157.1441624883472; Mon, 07 Sep 2015 04:21:23 -0700 (PDT) Received: from localhost.localdomain ([202.62.93.139]) by smtp.gmail.com with ESMTPSA id fm5sm11654737pbb.60.2015.09.07.04.21.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Sep 2015 04:21:22 -0700 (PDT) From: Vaibhav Hiremath To: linux-mmc@vger.kernel.org Subject: [PATCH-v2 6/7] mmc: sdhci: add new quirk for setting BUS_POWER & BUS_VLT fields Date: Mon, 7 Sep 2015 16:48:40 +0530 Message-Id: <1441624721-15612-7-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441624721-15612-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1441624721-15612-1-git-send-email-vaibhav.hiremath@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150907_042144_976932_BB3E69EF X-CRM114-Status: GOOD ( 15.80 ) 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: devicetree@vger.kernel.org, ulf.hansson@linaro.org, linux-kernel@vger.kernel.org, Vaibhav Hiremath , robh+dt@kernel.org, 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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..5788a8c 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-1928-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 */