From patchwork Thu Oct 18 19:14:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pawe=C5=82_Jarosz?= X-Patchwork-Id: 986180 X-Patchwork-Delegate: van.freenix@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GtLfXl4j"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42bdyN5hdKz9sB7 for ; Fri, 19 Oct 2018 06:14:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AFC21C21D4A; Thu, 18 Oct 2018 19:14:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 392FDC21C27; Thu, 18 Oct 2018 19:14:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EA8AFC21C27; Thu, 18 Oct 2018 19:14:07 +0000 (UTC) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by lists.denx.de (Postfix) with ESMTPS id 8DB8CC21BE5 for ; Thu, 18 Oct 2018 19:14:07 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id o14-v6so28764528ljj.2 for ; Thu, 18 Oct 2018 12:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Sx+CPqw6hNKYK+8n5/Fst62OBarjWPSyevKd+JooGK0=; b=GtLfXl4jl0yiHnAhdQyE9vnQxEdK9HzaM0QinDsqmZtKze+9P0OtvRam9bik6vdQqs Hig6aKHiouawTjOZ+BJDv2KzHEKP14NoeetQZGP7Ul9YRWxgrIL/sreTqkUm+AMIH+AX zSpiI6Q6IGZVdqxxQfzWOGTDXFJRyz1R0ee6v5gf/0BumTZ2jCxDtfGLwkKLhHzh5FXu wDPDvohkDqVTxXV441aQCAx3M0lezrxpFHEbLg50FecLV3RK02tKqkkp6bxFMfGxz6fk WVKuPwtlA0gqy095jBGAlDbGwcfOLTyKLvMwMCeYyQvxuoD+73XQ+yi5SC+gN1wAV7oJ nPLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Sx+CPqw6hNKYK+8n5/Fst62OBarjWPSyevKd+JooGK0=; b=JgKKjc2FpIk+yPijgkt/jQuaCNLpudmz2r0yT01tt4r6+e5C56eWjKyW5p94Ckm1mf sD2BNzfPZc7poyBDSDW2Au5Cmt9sM5SzUmLWqU6jaVNrlZSKIa8vWuqP5kPLNlKceHPV Zz0mPk7byEsKGQcO7+d8GIMx+31TjLwb75ptmywaU2GsFlx1YdToehoa8ThZRyJRLojg FfHn7jAH4pfDoq5sD0r2CSANHC40GJs84SPahCxauBq3++YTpKaIZgYx7ohHHiIsKNPf sSkvkows7U/CL7OuSQVwssp3xZDCi3DJSGlBhjN7FJJm48T650MUy4JG0CSYkRvBxzrC vJsA== X-Gm-Message-State: ABuFfojmKwyIRov6hhQIyNHIeCSGmrinR6t4irme30FjWbLrYyoAuyC/ dVPm/fZZVOdrGkcG3ZCfEQo= X-Google-Smtp-Source: ACcGV61T/c9gbdjCXNDPLtsmbmzwodQ2J8sdK9K2jT4yMvuoBnEWNtNMALOCLwH2N8VATFo1ZoL9bA== X-Received: by 2002:a2e:7f14:: with SMTP id a20-v6mr20352922ljd.148.1539890046950; Thu, 18 Oct 2018 12:14:06 -0700 (PDT) Received: from localhost.localdomain ([2a00:f41:588b:923b:1827:93a7:838:9aa4]) by smtp.gmail.com with ESMTPSA id p11-v6sm4920958lji.87.2018.10.18.12.14.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 12:14:06 -0700 (PDT) From: paweljarosz3691@gmail.com To: paweljarosz3691@gmail.com, u-boot@lists.denx.de Date: Thu, 18 Oct 2018 21:14:02 +0200 Message-Id: <20181018191402.1864-1-paweljarosz3691@gmail.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [U-Boot] [PATCH] mmc: dw_mmc: fix dwmci_data_transfer not filling data buffer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Paweł Jarosz In current version of the driver when data size is low (observed with 2 bytes or 16 bytes) like in case when mmc tries to read card capabilities or switch card mode, data buffer in function dwmci_data_transfer not being filled. The reason is that interrupt Receive FIFO Data Request (RXDR) not being fired but instead Data Transfer Over (DTO) fires. This results in card not being properly detected (i.e. SD version 1.0 instead of 3.0, buswidth 1 instead 4). So fix this by checking both interrupts status before reading data. Signed-off-by: Paweł Jarosz --- drivers/mmc/dw_mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 3b601b0e43..f1736c7abf 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -138,7 +138,8 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) if (host->fifo_mode && size) { len = 0; if (data->flags == MMC_DATA_READ && - (mask & DWMCI_INTMSK_RXDR)) { + (mask & DWMCI_INTMSK_RXDR || + mask & DWMCI_INTMSK_DTO)) { while (size) { ret = dwmci_fifo_ready(host, DWMCI_FIFO_EMPTY,