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: 53223 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id AF61622B05 for ; Mon, 7 Sep 2015 11:21:36 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf25500917wic.2 for ; Mon, 07 Sep 2015 04:21:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=DP2mbXZUwe72NaASmH96/iDTNhwMNsHJIF0Vb/1OgS0=; b=beiTjrrHqAQLZ71mtFwzJZZaQR48ICbl1Ro2uuKizjm32dIykTcSnvb/D0HFsOjpTk 2AREENYbHhm4r6eYrCSv50i1JNJtj6emepRSONbdL+ZABAij5Uejb3z6VAh97Q/YHg5e q+PFtq6obWFfU5DP1rYX5ecLbU2AcSPPCh4V+yPDX/S9HH7F+Sg05l9q22bsEIAfHY5g 4/iAoN+KkSEejwryz7dmyX/y7mt5T5m1ozbbumP+9ucbhe4dQwz0vb9JqrRLUMftB7WM yZfcoZRQO8+Q2FTPei4TXgHCOcIw7H0ZUVG3/9CubJifIG7Bb0qa6v6h7mfDjDeqDl7E hx/w== X-Gm-Message-State: ALoCoQlakXiEYYxU0kELKlCVZQH2+NlLAX1vOr7pCD4Y9arXllGe0RkLcz3j2EFt/rvwuy+/stg7 X-Received: by 10.112.202.165 with SMTP id kj5mr4784966lbc.5.1441624895989; Mon, 07 Sep 2015 04:21:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.39 with SMTP id p7ls554978lap.104.gmail; Mon, 07 Sep 2015 04:21:35 -0700 (PDT) X-Received: by 10.152.120.101 with SMTP id lb5mr11992051lab.58.1441624895706; Mon, 07 Sep 2015 04:21:35 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id am8si10146219lac.135.2015.09.07.04.21.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 04:21:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by laeb10 with SMTP id b10so50611084lae.1 for ; Mon, 07 Sep 2015 04:21:35 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr16533373lbb.36.1441624895602; Mon, 07 Sep 2015 04:21:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp316238lbq; Mon, 7 Sep 2015 04:21:34 -0700 (PDT) X-Received: by 10.66.144.165 with SMTP id sn5mr45732635pab.122.1441624892826; Mon, 07 Sep 2015 04:21:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vy5si10600385pac.2.2015.09.07.04.21.32; Mon, 07 Sep 2015 04:21:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751680AbbIGLV0 (ORCPT + 2 others); Mon, 7 Sep 2015 07:21:26 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36325 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbbIGLVX (ORCPT ); Mon, 7 Sep 2015 07:21:23 -0400 Received: by padhk3 with SMTP id hk3so10024544pad.3 for ; Mon, 07 Sep 2015 04:21:23 -0700 (PDT) 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 Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, robh+dt@kernel.org, ulf.hansson@linaro.org, Vaibhav Hiremath 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vaibhav.hiremath@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 */