From patchwork Thu Mar 27 00:04:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 27163 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9314B20369 for ; Thu, 27 Mar 2014 00:08:11 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lj1sf6609180pab.1 for ; Wed, 26 Mar 2014 17:08:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=wJG6nH0v3yJ+JhvHad7uK/iz9GGrOenqS3tH86n0zIc=; b=eF/k/AU8Ko8hN1nKB29ZQ8FoFjIRzCrwYvftJMY32GsLvSnNUQZZGjQtndkidW81xA cLwLWs4TtZZPqXTJ3cRYvQeIQcM/HCJ/m5SVxWRTvKA380xHvgulFPknP3alCaf2pMT8 Sz9po0iDRWtYfYPZjw1zcLzMQRXjfAWiwnm/H+OWtVwnt/AoAmMBABxWILXVGGb/p74j qfvidv57yNsc06Zd1XKcQ6tn1t/Pfx28GP51eEYtbwxmBldTnxKe8zFwNa8Ue7ea+v05 iHFRGPikL9zRgtqdRuP5FD2MdyLq8rJGoJWjmm4teAn98sAVqbmvP5hFH2+nW38USPjk 0UJA== X-Gm-Message-State: ALoCoQmggo7z1mqUsGIlu6ie7Dp+157SNA+AyWlF/IIjJ3wWl8/gcUEHRw13HAxWEymb/Z1SlcEY X-Received: by 10.67.2.101 with SMTP id bn5mr2792534pad.29.1395878890669; Wed, 26 Mar 2014 17:08:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.229 with SMTP id j92ls347726qgf.78.gmail; Wed, 26 Mar 2014 17:08:10 -0700 (PDT) X-Received: by 10.220.147.16 with SMTP id j16mr35209990vcv.14.1395878890508; Wed, 26 Mar 2014 17:08:10 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id kp12si72138veb.66.2014.03.26.17.08.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 17:08:10 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id db12so3219943veb.24 for ; Wed, 26 Mar 2014 17:08:10 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr34346863vcb.2.1395878890427; Wed, 26 Mar 2014 17:08:10 -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.78.9 with SMTP id i9csp85939vck; Wed, 26 Mar 2014 17:08:10 -0700 (PDT) X-Received: by 10.68.202.230 with SMTP id kl6mr89531398pbc.55.1395878889581; Wed, 26 Mar 2014 17:08:09 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mu18si117901pab.395.2014.03.26.17.08.07; Wed, 26 Mar 2014 17:08:07 -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 S1756710AbaC0AHE (ORCPT + 26 others); Wed, 26 Mar 2014 20:07:04 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:55020 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756684AbaC0AG6 (ORCPT ); Wed, 26 Mar 2014 20:06:58 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2R06nKN028576; Wed, 26 Mar 2014 19:06:49 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2R06n1m031054; Wed, 26 Mar 2014 19:06:49 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Wed, 26 Mar 2014 19:06:49 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2R06mjk029668; Wed, 26 Mar 2014 19:06:49 -0500 From: Felipe Balbi To: Balaji T K CC: , , , Linux OMAP Mailing List , Linux Kernel Mailing List , Felipe Balbi Subject: [PATCH 5/5] mmc: host: omap_hsmmc: set max_blk_size correctly Date: Wed, 26 Mar 2014 19:04:50 -0500 Message-ID: <1395878690-9650-6-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.9.1.286.g5172cb3 In-Reply-To: <1395878690-9650-1-git-send-email-balbi@ti.com> References: <1395878690-9650-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 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: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 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: , now that we can finally read the new registers for new versions of the mmc IP, we can set max_blk_size correctly depending on the version of the IP we're running on. Signed-off-by: Felipe Balbi --- drivers/mmc/host/omap_hsmmc.c | 45 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index d32f6ac..ae5583e 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -62,6 +62,18 @@ #define OMAP_HSMMC_AC12 0x013C #define OMAP_HSMMC_CAPA 0x0140 +/* OMAP HSMMC Host Controller Register (NEW) + * + * NOTE: DO NOT READ THESE WITH OFFSET + */ +#define OMAP_HSMMC_HL_REV 0x0000 +#define OMAP_HSMMC_HL_HWINFO 0x0004 +# define OMAP_HSMMC_HL_HWINFO_MADMA_EN (1 << 0) +# define OMAP_HSMMC_HL_HWINFO_MERGE_MEM (1 << 1) +# define OMAP_HSMMC_HL_HWINFO_MEM_SIZE(x) (((x) & (0x0f << 2)) >> 2) +# define OMAP_HSMMC_HL_HWINFO_RETMODE (1 << 6) +#define OMAP_HSMMC_HL_SYSCONFIG 0x0010 + #define VS18 (1 << 26) #define VS30 (1 << 25) #define HSS (1 << 21) @@ -1867,6 +1879,37 @@ static inline struct omap_mmc_platform_data } #endif +static void omap_hsmmc_set_max_blk_size(struct omap_hsmmc_host *host) +{ + struct mmc_host *mmc = host->mmc; + + if (of_device_is_compatible(host->dev->of_node, "ti,omap4-hsmmc")) { + u32 mem; + u32 reg; + + reg = omap_hsmmc_read_no_offset(host, OMAP_HSMMC_HL_HWINFO); + mem = OMAP_HSMMC_HL_HWINFO_MEM_SIZE(reg); + + switch (mem) { + case 1: + mmc->max_blk_size = 512; + break; + case 2: + mmc->max_blk_size = 1024; + break; + case 4: + /* FALLTHROUGH */ + case 8: + /* FALLTHROUGH */ + default: + mmc->max_blk_size = 2048; + break; + } + } else { + mmc->max_blk_size = 512; /* Block Length at max can be 1024 */ + } +} + static int omap_hsmmc_probe(struct platform_device *pdev) { struct omap_mmc_platform_data *pdata = pdev->dev.platform_data; @@ -1986,7 +2029,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) * as we want. */ mmc->max_segs = 1024; - mmc->max_blk_size = 512; /* Block Length at max can be 1024 */ + omap_hsmmc_set_max_blk_size(host); mmc->max_blk_count = 0xFFFF; /* No. of Blocks is 16 bits */ mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; mmc->max_seg_size = mmc->max_req_size;