From patchwork Tue Oct 30 15:54:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martin X-Patchwork-Id: 1670651 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 09FED3FD2B for ; Tue, 30 Oct 2012 15:54:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933810Ab2J3PyV (ORCPT ); Tue, 30 Oct 2012 11:54:21 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:43337 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932368Ab2J3PyU (ORCPT ); Tue, 30 Oct 2012 11:54:20 -0400 Received: by mail-we0-f174.google.com with SMTP id t9so195034wey.19 for ; Tue, 30 Oct 2012 08:54:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=v7HT9UI4v7f4KCus/QQv3QzaRskoKasFo5kzn35FiJQ=; b=D1NqFwso8MkdsspiXyeb6DKUaIQuh5EkF/3JH9qWgeSk8nmsYOws9JjcaeaNiVsXgm EbXSwU9aSXIgbZqqlVzFxA/E0oqaUKQ0KrCnpbn3U8m2UUKb1Do94G93Uy67LIN1Hgqx 3B0kY6qYg2LSd6QVNpVv2fliyBhyjR4iEc5g4bF8dtmM5+O1SZf4FYIserB4YsQthsUo R7qNyFG3xkshDwEHH+NVIr7pJQlUDLP+TeS2+3oSiuXYGWB2hAZCu435hBtPJ9zveXnB Tsy3zRg5+M9es2l1ODc/xTILV1PRZs0bXWHz++VTooZ3tovURPbM3053j0pILjDBMRzn WKXA== Received: by 10.180.79.103 with SMTP id i7mr3717886wix.13.1351612458412; Tue, 30 Oct 2012 08:54:18 -0700 (PDT) Received: from piscis.vsilicon.net (149.93.18.95.dynamic.jazztel.es. [95.18.93.149]) by mx.google.com with ESMTPS id p4sm1794253wix.0.2012.10.30.08.54.16 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 08:54:17 -0700 (PDT) From: Javier Martin To: linux-mmc@vger.kernel.org Cc: viresh.linux@gmail.com, g.liakhovetski@gmx.de, vinod.koul@linux.intel.com, s.hauer@pengutronix.de, cjb@laptop.org, Javier Martin Subject: [PATCH v2] mmc: mxcmmc: fix SD cards not being detected sometimes. Date: Tue, 30 Oct 2012 16:54:07 +0100 Message-Id: <1351612447-18982-1-git-send-email-javier.martin@vista-silicon.com> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkUN1S072RyDaSV+na9Ey7lkS6GRUD2k5zlasG+1cQHiCf04/O7dui59yzSlHfqvFAH7G59 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org When a SD card is initialized some data transfers of 64 and 8 bytes are issued. It seems the DMA has some problems dealing with these kind of "short" transfers, leading sometimes to the SD card not being detected. In order to solve this problem, do not use DMA for transfer sizes lower than the sector size. Signed-off-by: Javier Martin Acked-by: Sascha Hauer --- Changes since v1: - Do not remove the check "sg->length & 3". --- drivers/mmc/host/mxcmmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index fc42a2e..a09637f 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c @@ -240,7 +240,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) return 0; for_each_sg(data->sg, sg, data->sg_len, i) { - if (sg->offset & 3 || sg->length & 3) { + if (sg->offset & 3 || sg->length & 3 || sg->length < 512) { host->do_dma = 0; return 0; }