From patchwork Mon Mar 30 14:39:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 46521 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5BB2B2159A for ; Mon, 30 Mar 2015 14:42:39 +0000 (UTC) Received: by qgfa8 with SMTP id a8sf143800011qgf.1 for ; Mon, 30 Mar 2015 07:42:39 -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=+cPdPCvIzIuhKRjhUg/qKNrVg4ijVLLIcgKDE5fEsP4=; b=PVMvo5/i0pq1Uav7sBxE/g9qm8EJeig40aRVBNoxg5EmAFX8MAsOemU0UIjBr4kIIo GDNjV9Ip1N4DCa6/FbY/ZhiaDscNQqoFZCAJEk4NC29Nmnl0Bp7/j16MEzZwKc61h2l8 j//UbUZJpgDujql7RNqFmfdIq5bgKzEm5ANndRLJ6FfDP95HenEwL/JesgYLyRKH/SZX c/saIcw9fpxu5YlYLKLAN8gQiU9aLOQqylpbpxdJ+eiu6roF8iErFVNBFZ5dLZqu1k1E Z7NoQPsqZlfQJmjgWPW4pWR1IsIsECjUBoqIwP8947yazv8yjz4J84FD4xUm3YTThD4A Sskg== X-Gm-Message-State: ALoCoQkdsA4AiSSn5dt2276fOWqh59inee0BpXNhGaDHMjwWUtzlHBsd1UQuYuUVrAwpCJRRhGNX X-Received: by 10.52.5.169 with SMTP id t9mr38359885vdt.7.1427726559212; Mon, 30 Mar 2015 07:42:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.97 with SMTP id d88ls2435177qga.26.gmail; Mon, 30 Mar 2015 07:42:39 -0700 (PDT) X-Received: by 10.55.55.82 with SMTP id e79mr7547153qka.74.1427726559110; Mon, 30 Mar 2015 07:42:39 -0700 (PDT) Received: from mail-qg0-f41.google.com (mail-qg0-f41.google.com. [209.85.192.41]) by mx.google.com with ESMTPS id y5si10575501qcf.20.2015.03.30.07.42.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Mar 2015 07:42:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.192.41 as permitted sender) client-ip=209.85.192.41; Received: by qgf60 with SMTP id 60so171786776qgf.3 for ; Mon, 30 Mar 2015 07:42:39 -0700 (PDT) X-Received: by 10.140.148.147 with SMTP id 141mr18604016qhu.45.1427726558957; Mon, 30 Mar 2015 07:42:38 -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.96.155.231 with SMTP id vz7csp1521057qdb; Mon, 30 Mar 2015 07:42:38 -0700 (PDT) X-Received: by 10.68.230.34 with SMTP id sv2mr58885281pbc.157.1427726557677; Mon, 30 Mar 2015 07:42:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nh13si5510913pdb.1.2015.03.30.07.42.36; Mon, 30 Mar 2015 07:42:37 -0700 (PDT) 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 S1753493AbbC3Omb (ORCPT + 27 others); Mon, 30 Mar 2015 10:42:31 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:34196 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752709AbbC3OkU (ORCPT ); Mon, 30 Mar 2015 10:40:20 -0400 Received: by wibg7 with SMTP id g7so93539057wib.1 for ; Mon, 30 Mar 2015 07:40:18 -0700 (PDT) X-Received: by 10.180.187.12 with SMTP id fo12mr23271298wic.29.1427726418675; Mon, 30 Mar 2015 07:40:18 -0700 (PDT) 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 cf12sm16037489wjb.10.2015.03.30.07.40.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Mar 2015 07:40:17 -0700 (PDT) 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 v3 5/9] mmc: sdhci-st: Add sdhci_st_set_uhs_signaling function. Date: Mon, 30 Mar 2015 15:39:58 +0100 Message-Id: <1427726402-7513-6-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427726402-7513-1-git-send-email-peter.griffin@linaro.org> References: <1427726402-7513-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.192.41 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 Acked-by: Maxime Coquelin --- drivers/mmc/host/sdhci-st.c | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c index 1ce5a01..fc9565f 100644 --- a/drivers/mmc/host/sdhci-st.c +++ b/drivers/mmc/host/sdhci-st.c @@ -261,6 +261,56 @@ 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 " + "(uhs %d)\n", uhs); + + 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) { @@ -284,6 +334,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 = {