From patchwork Thu Feb 26 13:10:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 45167 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AC4D52043C for ; Thu, 26 Feb 2015 13:11:17 +0000 (UTC) Received: by lams18 with SMTP id s18sf8069670lam.1 for ; Thu, 26 Feb 2015 05:11:16 -0800 (PST) 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=0PQ9smOyPl2EiNfpfrVCFsesHFWWJRaWkFtc2eiiVAY=; b=mW4/48pBnvQXoVs8RFJmiFZoxNdRS9i9Qpdm1ZrpRIePlO2fyp5+XjMmly11rEi8aE HV6h0Wq5DwRUOTePHSOgNbgPtoqV2TpJ4+t/zCNbGVssw4j/umbWe14p1yHLiDH+xpTH 7WTM5UDIFc/sjCbRawyO3VpcOHoaKlr+3MLOXsDri83GIS301TFdCSzYpUZNXDpibV4I Y00dvc8MHCSUW4mZnZzpQd35IT8ySFaQdvW6QCYNkf1IJwEsH3ZCrHdYjXjmoieAk1hZ sqLhVtWZZGthNFw+j4SZ/FGxG/QRf7U4KQQJnYW7vRHLjX3OHFMNZ5mxs/B4oNSwqlAL JKSg== X-Gm-Message-State: ALoCoQlf4ghA2mDs+sKamoQqzn0IRNicXUPReciaSqz+1WI+FILdBdQEGWmh1dSJZz09Pz8vdmJn X-Received: by 10.180.182.201 with SMTP id eg9mr1318514wic.3.1424956276714; Thu, 26 Feb 2015 05:11:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.139 with SMTP id dg11ls32006lac.62.gmail; Thu, 26 Feb 2015 05:11:16 -0800 (PST) X-Received: by 10.152.184.39 with SMTP id er7mr7382540lac.116.1424956276449; Thu, 26 Feb 2015 05:11:16 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id lv13si628672lbb.11.2015.02.26.05.11.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Feb 2015 05:11:16 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbiw7 with SMTP id w7so10649464lbi.9 for ; Thu, 26 Feb 2015 05:11:16 -0800 (PST) X-Received: by 10.112.181.41 with SMTP id dt9mr7666854lbc.56.1424956276318; Thu, 26 Feb 2015 05:11:16 -0800 (PST) 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.35.133 with SMTP id h5csp3289116lbj; Thu, 26 Feb 2015 05:11:15 -0800 (PST) X-Received: by 10.70.0.176 with SMTP id 16mr15044409pdf.78.1424956272869; Thu, 26 Feb 2015 05:11:12 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si1070240pap.109.2015.02.26.05.11.11; Thu, 26 Feb 2015 05:11:12 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932304AbbBZNKr (ORCPT + 28 others); Thu, 26 Feb 2015 08:10:47 -0500 Received: from mail-wg0-f52.google.com ([74.125.82.52]:39424 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932260AbbBZNKo (ORCPT ); Thu, 26 Feb 2015 08:10:44 -0500 Received: by wggx12 with SMTP id x12so10560409wgg.6 for ; Thu, 26 Feb 2015 05:10:43 -0800 (PST) X-Received: by 10.180.86.201 with SMTP id r9mr41922495wiz.56.1424956243544; Thu, 26 Feb 2015 05:10:43 -0800 (PST) Received: from localhost.localdomain (cpc14-aztw22-2-0-cust189.18-1.cable.virginm.net. [82.45.1.190]) by mx.google.com with ESMTPSA id dz6sm23075747wib.0.2015.02.26.05.10.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Feb 2015 05:10:42 -0800 (PST) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, maxime.coquelin@st.com, patrice.chotard@st.com, srinivas.kandagatla@gmail.com, chris@printf.net, ulf.hansson@linaro.org Cc: peter.griffin@linaro.org, lee.jones@linaro.org, devicetree@vger.kernel.org, linux-mmc@vger.kernel.org, peppe.cavallaro@st.com Subject: [PATCH v2 5/8] mmc: sdhci-st: Add sdhci_st_set_uhs_signaling function. Date: Thu, 26 Feb 2015 13:10:24 +0000 Message-Id: <1424956227-18258-6-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424956227-18258-1-git-send-email-peter.griffin@linaro.org> References: <1424956227-18258-1-git-send-email-peter.griffin@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.griffin@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.217.171 as permitted sender) smtp.mail=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: , To allow UHS modes to work properly we need to provide the st specific set_uhs_signaling callback function. This function differs from the generic sdhci_set_uhs_signaling callback in that we need to configure the correct delay depending on the UHS mode, and also set the V18_EN bit. Signed-off-by: Peter Griffin Signed-off-by: Giuseppe Cavallaro --- drivers/mmc/host/sdhci-st.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c index 11cf4e2..d53bc82 100644 --- a/drivers/mmc/host/sdhci-st.c +++ b/drivers/mmc/host/sdhci-st.c @@ -260,6 +260,55 @@ static int sdhci_st_set_dll_for_clock(struct sdhci_host *host) return ret; } +static void sdhci_st_set_uhs_signaling(struct sdhci_host *host, + unsigned int uhs) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct st_mmc_platform_data *pdata = pltfm_host->priv; + u16 ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + int ret = 0; + + /* Select Bus Speed Mode for host */ + ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; + switch (uhs) { + /* + * Set V18_EN -- UHS modes do not work without this. + * does not change signaling voltage + */ + + case MMC_TIMING_UHS_SDR12: + st_mmcss_set_static_delay(pdata->top_ioaddr); + ctrl_2 |= SDHCI_CTRL_UHS_SDR12 | SDHCI_CTRL_VDD_180; + break; + case MMC_TIMING_UHS_SDR25: + st_mmcss_set_static_delay(pdata->top_ioaddr); + ctrl_2 |= SDHCI_CTRL_UHS_SDR25 | SDHCI_CTRL_VDD_180; + break; + case MMC_TIMING_UHS_SDR50: + st_mmcss_set_static_delay(pdata->top_ioaddr); + ctrl_2 |= SDHCI_CTRL_UHS_SDR50 | SDHCI_CTRL_VDD_180; + ret = sdhci_st_set_dll_for_clock(host); + break; + case MMC_TIMING_UHS_SDR104: + case MMC_TIMING_MMC_HS200: + st_mmcss_set_static_delay(pdata->top_ioaddr); + ctrl_2 |= SDHCI_CTRL_UHS_SDR104 | SDHCI_CTRL_VDD_180; + ret = sdhci_st_set_dll_for_clock(host); + break; + case MMC_TIMING_UHS_DDR50: + case MMC_TIMING_MMC_DDR52: + st_mmcss_set_static_delay(pdata->top_ioaddr); + ctrl_2 |= SDHCI_CTRL_UHS_DDR50 | SDHCI_CTRL_VDD_180; + break; + } + + if (ret) + dev_warn(mmc_dev(host->mmc), "Error setting dll for clock\n"); + + dev_dbg(mmc_dev(host->mmc), "uhs %d, ctrl_2 %04X\n", uhs, ctrl_2); + + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); +} static u32 sdhci_st_readl(struct sdhci_host *host, int reg) { @@ -283,6 +332,7 @@ static const struct sdhci_ops sdhci_st_ops = { .set_bus_width = sdhci_set_bus_width, .read_l = sdhci_st_readl, .reset = sdhci_reset, + .set_uhs_signaling = sdhci_st_set_uhs_signaling, }; static const struct sdhci_pltfm_data sdhci_st_pdata = {