From patchwork Mon Mar 24 03:53:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuvaraj CD X-Patchwork-Id: 3881091 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9AD219F334 for ; Mon, 24 Mar 2014 03:54:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA92C2022F for ; Mon, 24 Mar 2014 03:54:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8994620127 for ; Mon, 24 Mar 2014 03:54:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751000AbaCXDxx (ORCPT ); Sun, 23 Mar 2014 23:53:53 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:47610 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750900AbaCXDxw (ORCPT ); Sun, 23 Mar 2014 23:53:52 -0400 Received: by mail-pd0-f174.google.com with SMTP id y13so4735954pdi.19 for ; Sun, 23 Mar 2014 20:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=F5vm6mzFDEu5+drOiAIth6ZzyygCDpX5e10yIiBST50=; b=SiYPLKtjDhht62CEXs+eXcCjxZSNcpD5IAqddhegUZ+EJR7p6bTwMMBHHuDERIPoQo Uik629X9Lal/3cDieCHNgIUkXd4suPaZNsINaWgLqZjJ8e12zgpXOgpoFOtATEY2OK1M SyCPM22/JDQkbsRQYxC9M1yWDtW6SvmCyRA1hmpJmE70VFCOBrS1tr7H+rLI4yQMjCcD eR2UyQnEFoPfyZ4KgxPOyU2DsEQ0kgcpPsNnruXjfu0Mdzn2KcwNs6zoVpt7P9tgVRIM ZRpce071DUo8y9dliPwfqchKbeIJpkacjnvM1WWDBveIwXE0kTN47GNauJVNdO+DLC+E 68Hw== X-Received: by 10.68.170.131 with SMTP id am3mr7440444pbc.97.1395633231493; Sun, 23 Mar 2014 20:53:51 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id ky8sm30274180pbc.64.2014.03.23.20.53.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Mar 2014 20:53:50 -0700 (PDT) From: Yuvaraj Kumar C D To: grundler@chromium.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jh80.chung@samsung.com, cjb@laptop.org, tgih.jun@samsung.com, linux-mmc@vger.kernel.org, sonnyrao@chromium.org, kgene.kim@samsung.com, joshi@samsung.com Cc: t.figa@samsung.com, Alim Akhtar , Yuvaraj Kumar C D Subject: [PATCH] mmc: dw_mmc: Fix the max_blk_count in IDMAC Date: Mon, 24 Mar 2014 09:23:38 +0530 Message-Id: <1395633218-23766-1-git-send-email-yuvaraj.cd@samsung.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alim Akhtar max_blk_count is currently set incorrectly, and the correct value can be determined by looking at the maximum number of bytes which can be transferred and the block size. We use the maximum block size to determine the minimum number of blocks that the controller should support. It could probably do more with a smaller block size but this value should be sufficient for good performance. This improves sequential performance by 82% on write and 6% read on one particular device. TEST= with this patch time dd if=/dev/zero of=/usr/local/100 bs=1M count=100 conv=fdatasync 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 2.62541 s, 39.9 MB/s real 0m2.638s user 0m0.000s sys 0m0.645s without this patch: time dd if=/dev/zero of=/usr/local/100 bs=1M count=100 conv=fdatasync 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 3.25873 s, 32.2 MB/s real 0m3.265s user 0m0.005s sys 0m0.690s Signed-off-by: Seungwon Jeon Signed-off-by: Alim Akhtar Signed-off-by: Sonny Rao Signed-off-by: Yuvaraj Kumar C D --- drivers/mmc/host/dw_mmc.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 0c56faa..2fc4030 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2213,10 +2213,24 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) /* Useful defaults if platform data is unset. */ #ifdef CONFIG_MMC_DW_IDMAC mmc->max_segs = host->ring_size; + + /* the BLKSIZ register is 16-bits wide */ mmc->max_blk_size = 65536; - mmc->max_blk_count = host->ring_size; + + /* + * This value is calculated by taking the size of the + * 32-bit BYTCNT (byte count) register and dividing by the + * BLKSIZ (block size) register. This is the minimum number + * of blocks which could be handled. + */ + mmc->max_blk_count = 0xFFFF; mmc->max_seg_size = 0x1000; - mmc->max_req_size = mmc->max_seg_size * mmc->max_blk_count; + /* + * Maximum request size should be total number of descriptors + * times the maximum amount of data each can reference + */ + + mmc->max_req_size = mmc->max_seg_size * mmc->max_segs; #else mmc->max_segs = 64; mmc->max_blk_size = 65536; /* BLKSIZ is 16 bits */