From patchwork Mon Apr 21 21:48:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 28740 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B26362032B for ; Mon, 21 Apr 2014 21:49:24 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf17264851obc.1 for ; Mon, 21 Apr 2014 14:49:24 -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=MQZPPxcmF6m0AF4SpW83NJ2w4EAH4lC0Nn6cjftMtto=; b=QjpAEsCV3+OKEtyLrNsdfAbhNT+Iziri+FPQ4jUE9q6snXmeaxu/spRJt+3tlmCBgC bmuDOSDsJIx+gsyQMWBTLIiFMTfaNUp5dnQgr2WuWSflSF41/GhIG3m8c8odSwvtXIcm LATxy9wbCPE0rKXcKiQZZJA254SXaFX+J0/43oKHyCzAQlh6LK/HpjQiCXnWdvkfoqn3 pWefXEUQS/YVeIIAsO8g/L1n0v11XC98HScm3+R78J+TMXi4fIJ0oNN3y4EVoWCCC+GW 2FNeqVOoWOF3twty9yKKPr+1q3miGUXaQtDRXetF+6cBr6T8TUsDn9fw2X4wBRrAl5VD rVIg== X-Gm-Message-State: ALoCoQk0QxVFnZhwHE4ixygC+lgwfYOWqZJUMv26ALFJdvQ1B4or3sFf/x7fcxO02i/nZx0ClGWa X-Received: by 10.182.219.226 with SMTP id pr2mr20113388obc.44.1398116964164; Mon, 21 Apr 2014 14:49:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.114 with SMTP id m105ls891546qgd.87.gmail; Mon, 21 Apr 2014 14:49:24 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr27974849vdb.20.1398116964066; Mon, 21 Apr 2014 14:49:24 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id ol2si6467592vcb.197.2014.04.21.14.49.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 14:49:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id ib6so1593844vcb.41 for ; Mon, 21 Apr 2014 14:49:24 -0700 (PDT) X-Received: by 10.220.147.16 with SMTP id j16mr33205649vcv.14.1398116963977; Mon, 21 Apr 2014 14:49:23 -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.220.221.72 with SMTP id ib8csp320818vcb; Mon, 21 Apr 2014 14:49:23 -0700 (PDT) X-Received: by 10.69.0.198 with SMTP id ba6mr40864402pbd.16.1398116963270; Mon, 21 Apr 2014 14:49:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si21532204pad.268.2014.04.21.14.49.22; Mon, 21 Apr 2014 14:49:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 S1754945AbaDUVtJ (ORCPT + 26 others); Mon, 21 Apr 2014 17:49:09 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:55963 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754916AbaDUVtC (ORCPT ); Mon, 21 Apr 2014 17:49:02 -0400 Received: by mail-wi0-f174.google.com with SMTP id d1so2362735wiv.7 for ; Mon, 21 Apr 2014 14:49:01 -0700 (PDT) X-Received: by 10.194.188.41 with SMTP id fx9mr3719089wjc.56.1398116941299; Mon, 21 Apr 2014 14:49:01 -0700 (PDT) Received: from srinivas-Inspiron-N5050.dlink.com (host-78-149-8-254.as13285.net. [78.149.8.254]) by mx.google.com with ESMTPSA id r4sm58826075wjz.28.2014.04.21.14.49.00 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 14:49:00 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: linux-mmc@vger.kernel.org Cc: Russell King , Chris Ball , Ulf Hansson , linux-kernel@vger.kernel.org, agross@quicinc.com, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH RFC 09/12] mmc: mmci: Qcom fix MCICLK register settings. Date: Mon, 21 Apr 2014 22:48:54 +0100 Message-Id: <1398116934-31596-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398116624-31052-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1398116624-31052-1-git-send-email-srinivas.kandagatla@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: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , From: Srinivas Kandagatla MCICLK register layout is bit different to the standard pl180 register layout. Qcom SDCC controller some setup in MCICLK register to get it going. So this patch adds new setup and makes it specific to Qcom hw designer. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/mmci.c | 36 ++++++++++++++++++++++++++++++------ drivers/mmc/host/mmci.h | 21 +++++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 179abfb..f465eb5 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -327,13 +327,37 @@ static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired) /* Set actual clock for debug */ host->mmc->actual_clock = host->cclk; - if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) - clk |= MCI_4BIT_BUS; - if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_8) - clk |= MCI_ST_8BIT_BUS; + if (host->hw_designer == AMBA_VENDOR_QCOM) { + clk |= MCI_CLK_QCOM_FLOWENA; + clk |= (MCI_CLK_QCOM_SEL_FEEDBACK_CLK << + MCI_CLK_QCOM_SEL_IN_SHIFT); /* feedback clk */ + if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_8) + clk |= MCI_CLK_QCOM_WIDEBUS_8; + else if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) + clk |= MCI_CLK_QCOM_WIDEBUS_4; + else + clk |= MCI_CLK_QCOM_WIDEBUS_1; + + if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50) { + /* clear SELECT_IN field */ + clk &= ~(MCI_CLK_QCOM_SEL_MASK << + MCI_CLK_QCOM_SEL_IN_SHIFT); + /* set DDR timing mode */ + clk |= (MCI_CLK_QCOM_SEL_DDR_MODE << + MCI_CLK_QCOM_SEL_IN_SHIFT); + } + clk |= (MCI_CLK_SDC4_MCLK_SEL_MCLK << + MCI_CLK_SDC4_MCLK_SEL_SHIFT); - if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50) - clk |= MCI_ST_UX500_NEG_EDGE; + } else { + if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) + clk |= MCI_4BIT_BUS; + if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_8) + clk |= MCI_ST_8BIT_BUS; + + if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50) + clk |= MCI_ST_UX500_NEG_EDGE; + } mmci_write_clkreg(host, clk); } diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 58b1b88..0a6de1c 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -31,6 +31,27 @@ /* Modified PL180 on Versatile Express platform */ #define MCI_ARM_HWFCEN (1 << 12) +/* Modified on Qualcomm Integrations */ +#define MCI_CLK_QCOM_WIDEBUS_1 (0 << 10) +#define MCI_CLK_QCOM_WIDEBUS_4 (2 << 10) +#define MCI_CLK_QCOM_WIDEBUS_8 (3 << 10) +#define MCI_CLK_QCOM_FLOWENA (1 << 12) +#define MCI_CLK_QCOM_INVERTOUT (1 << 13) + +/* select in latch data and command */ +#define MCI_CLK_QCOM_SEL_IN_SHIFT (14) +#define MCI_CLK_QCOM_SEL_MASK (0x3) +#define MCI_CLK_QCOM_SEL_RISING_EDGE (1) +#define MCI_CLK_QCOM_SEL_FEEDBACK_CLK (2) +#define MCI_CLK_QCOM_SEL_DDR_MODE (3) + +/* mclk selection */ +#define MCI_CLK_SDC4_MCLK_SEL_SHIFT (23) +#define MCI_CLK_SDC4_MCLK_SEL_MASK (0x3) +#define MCI_CLK_SDC4_MCLK_SEL_FB_CLK (1) +#define MCI_CLK_SDC4_MCLK_SEL_MCLK (2) + + #define MMCIARGUMENT 0x008 #define MMCICOMMAND 0x00c #define MCI_CPSM_RESPONSE (1 << 6)