From patchwork Fri Apr 10 08:58:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 47003 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C5BEF21416 for ; Fri, 10 Apr 2015 09:00:46 +0000 (UTC) Received: by lbbrr5 with SMTP id rr5sf2590593lbb.3 for ; Fri, 10 Apr 2015 02:00:45 -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=QOxBXu3D/ClLVr/khz3BB+UQ9l5WgKQ3xLUIRAe0XF8=; b=GvzPTIl362h/VwW12mWDjmW4We/XQ35DMhtsELmMoxcrZgXIiarw9Yh34oe7AdrI5G sApHmfzygdUPX0fO7RreIeJILIEWOsqwkFHBkjAhdAHAL32unVd5TF6keseGPzjUn5Sv eg/PCor/di4LnOOENtJkSKl0cuFTYF0kdfbuRK6/aai87exyed3rjALXalVRVVC4sg0g JH2usn+CQCxlqTAfNsgXUPDcFJUMjaHQ8yh010fWaaN624oWUgbbqTWiZdqjUsojjHVi OE8qe6YDx11eYDUkRyskB8xTNxuapvXZ9kW4wEaz8GIexBDAhSeyBfsL7cLGv8NCY3U1 y1Nw== X-Gm-Message-State: ALoCoQmLts2eMCevgDjGFyJKpb/DQCDAw7WDLhPhNcBvyS+HXPcfqU7y0Z0wbjg0XuOpCfIM6/ET X-Received: by 10.112.181.166 with SMTP id dx6mr110905lbc.17.1428656445820; Fri, 10 Apr 2015 02:00:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.33 with SMTP id ld1ls434264lac.11.gmail; Fri, 10 Apr 2015 02:00:45 -0700 (PDT) X-Received: by 10.112.188.227 with SMTP id gd3mr536549lbc.0.1428656445679; Fri, 10 Apr 2015 02:00:45 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id az1si955872lbc.121.2015.04.10.02.00.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Apr 2015 02:00:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbcga7 with SMTP id ga7so8859469lbc.1 for ; Fri, 10 Apr 2015 02:00:45 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr91072lbb.36.1428656445551; Fri, 10 Apr 2015 02:00:45 -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.67.65 with SMTP id l1csp959505lbt; Fri, 10 Apr 2015 02:00:44 -0700 (PDT) X-Received: by 10.70.62.97 with SMTP id x1mr908832pdr.41.1428656443517; Fri, 10 Apr 2015 02:00:43 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ng3si2035307pbc.96.2015.04.10.02.00.42; Fri, 10 Apr 2015 02:00:43 -0700 (PDT) Received-SPF: none (google.com: devicetree-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 S1754660AbbDJI66 (ORCPT + 5 others); Fri, 10 Apr 2015 04:58:58 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:35303 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754811AbbDJI6z (ORCPT ); Fri, 10 Apr 2015 04:58:55 -0400 Received: by wgyo15 with SMTP id o15so11124182wgy.2 for ; Fri, 10 Apr 2015 01:58:54 -0700 (PDT) X-Received: by 10.180.102.228 with SMTP id fr4mr3006937wib.4.1428656334021; Fri, 10 Apr 2015 01:58:54 -0700 (PDT) Received: from localhost.localdomain ([31.105.225.148]) by mx.google.com with ESMTPSA id ew5sm23844403wic.14.2015.04.10.01.58.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Apr 2015 01:58:53 -0700 (PDT) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, maxime.coquelin@st.com, patrice.chotard@st.com, srinivas.kandagatla@gmail.com Cc: peter.griffin@linaro.org, lee.jones@linaro.org, devicetree@vger.kernel.org, linux-mmc@vger.kernel.org, peppe.cavallaro@st.com Subject: [PATCH v4 5/9] mmc: sdhci-st: Add sdhci_st_set_uhs_signaling function. Date: Fri, 10 Apr 2015 09:58:27 +0100 Message-Id: <1428656311-2605-6-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428656311-2605-1-git-send-email-peter.griffin@linaro.org> References: <1428656311-2605-1-git-send-email-peter.griffin@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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.179 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 821be34..2ce842b 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 = {