From patchwork Tue Oct 21 09:26:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 5112221 Return-Path: X-Original-To: patchwork-linux-mmc@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 26C829F349 for ; Tue, 21 Oct 2014 09:27:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61FBA200F4 for ; Tue, 21 Oct 2014 09:27:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6072820138 for ; Tue, 21 Oct 2014 09:27:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752306AbaJUJ1z (ORCPT ); Tue, 21 Oct 2014 05:27:55 -0400 Received: from mga09.intel.com ([134.134.136.24]:44625 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751091AbaJUJ1y (ORCPT ); Tue, 21 Oct 2014 05:27:54 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 21 Oct 2014 02:21:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,760,1406617200"; d="scan'208";a="592986849" Received: from ahunter-desktop.fi.intel.com ([10.237.72.97]) by orsmga001.jf.intel.com with ESMTP; 21 Oct 2014 02:27:52 -0700 From: Adrian Hunter To: Ulf Hansson , Chris Ball Cc: linux-mmc Subject: [PATCH 01/15] mmc: sdhci: Fix incorrect ADMA2 descriptor table size Date: Tue, 21 Oct 2014 12:26:11 +0300 Message-Id: <1413883585-16299-2-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413883585-16299-1-git-send-email-adrian.hunter@intel.com> References: <1413883585-16299-1-git-send-email-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The ADMA2 descriptor table size was being calculated incorrectly Fix it. Note that it has been wrong for a long time and likely has not caused any problems because of a combination of 1) not needing alignment descriptors for block operations 2) more memory being allocated than was requested 3) the use of SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC which does not use an extra descriptor for the end marker. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ada1a3e..c409e87 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -44,7 +44,13 @@ #define MAX_TUNING_LOOP 40 -#define ADMA_SIZE ((128 * 2 + 1) * 4) +/* + * The ADMA2 descriptor table size is calculated as the maximum number of + * segments (128), times 2 to allow for an alignment descriptor for each + * segment, plus 1 for a nop end descriptor, all multipled by the 32-bit + * descriptor size (8). + */ +#define ADMA_SIZE ((128 * 2 + 1) * 8) static unsigned int debug_quirks = 0; static unsigned int debug_quirks2;