Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp870197ybs; Mon, 25 May 2020 00:58:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbkS7b/OB9xUdFBa6FbLW3wu7y0lDLCLVzqCASNtXtzaR8XRTP7FVcdUNoNyI63Vd1NvSK X-Received: by 2002:a05:6402:17a3:: with SMTP id j3mr14510545edy.137.1590393483316; Mon, 25 May 2020 00:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590393483; cv=none; d=google.com; s=arc-20160816; b=Puf0xhXOXez5j5Sn9zth5GeL73w61LtF4GUgaoyraQcQwJetSPyLOXGAzDjDxN1iz/ gwtXdROugjTLddXLkkwqUvSTJx+N14JnbEpHbVG+qEdG/1Lr2xLG/wXTzw9ERlpaOz5/ 0ENyTsGe789rv+9qsZBSbb0SjSTqlCJBGDWCNYTrD4lg+QL/j0bz9cGKSBoNMSaOS301 ZhZamAAJtmgORubu+D9nbDAt3yzBaZ3jstjPovbY7blgdLg0PXM8f9DRyngibsry/AX1 FuF3Qor+76k9vSGOyUV98pHXSD5aZ+ur0Bt6Kz4QF1EcGXsFuhyv5/Q0C/EYb0wx0S/O 2egg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xxPp1YhKBxMDmxPDlgA3r6L4BPVtYqrACCbiDdkf2HU=; b=hekSEFJxCfD+qqz0DV40TjyOXAOB4T8HqsSE2WeEzkdAGBWwipJs5CGvszc+HdiEZA e9usiBXVZbkuQAJwcMuxN1E8ihvb3T0oqnnZzGnxHHbuxWGvFwE8Zxvr47rcuhunI4pm HhTGb2F1QkJTUXEL0XwOs0gJVlfGOO+IgTujp5j7aHf0sQarfKT5so9/tWcScX8ATm2W Kw+l3+fAdrKbsiPCnqQ5f9eHeQBH8f8+duu7WtPtGmUYF7OVAMi7QrhIJcIrqvPrZU8Z Xga4bkDqtajdSC9eVTmY1Ecvpw/ORYauYRQFtCauCbf28yyJDfGlwKoNyOWf7FEA2Hec Tryg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b="oH0jGp/2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si8893213eda.549.2020.05.25.00.57.39; Mon, 25 May 2020 00:58:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b="oH0jGp/2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730205AbgEYGOi (ORCPT + 99 others); Mon, 25 May 2020 02:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729125AbgEYGOh (ORCPT ); Mon, 25 May 2020 02:14:37 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6348FC061A0E; Sun, 24 May 2020 23:14:37 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id k5so19435094lji.11; Sun, 24 May 2020 23:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xxPp1YhKBxMDmxPDlgA3r6L4BPVtYqrACCbiDdkf2HU=; b=oH0jGp/2CUEdGLq6EDmu5s+PiAb/IDEiXKtMl/yTpb3Y3fg51+Iq4kgQCw95Q9cV6e DTYwCy/OywCcfPMYn5cyMejV3EqYTyRuZhqXotrPwKh3AWq/xRhhzrrRgwdJBeITWTHp spvmnFufI/vuLUzULK9+q3fPphWeh6BPVRV0qBbZaUn1BZxFRO+aUi/Za0m/FqFKkQma v379pALdXZRKuwU3JFSw2RZVsKj0VyGXKElz5a+wMKXOfo1gARzxdVps067fQh/WdOhG WXSshs0r4TkX8K7MBUeYGLKpvju5PvJJmcIFKpd8DKvuZLs6dAsjuINXeFIyMnVM0Mfa 5iYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xxPp1YhKBxMDmxPDlgA3r6L4BPVtYqrACCbiDdkf2HU=; b=PIdWB5zCeMhDwqcimL4YVAX7KmkC4oncnZKcadKKrsDFr0dyCccTCxmj5yBMYLZYVl N2T+2/Nb7MxCFQKwhD8+22+u5b6JouRQqorch0Pu1e9Z91wIGKHpaHK5PDkJZftHlkqy 746G/NpiN8wjECzmNceIRe5URMvkregozzcVU86FIuSJA7pR006AC9gfbLtaPQ75T0nq 6w+FFC7Vhb1EfT9AQcdJ6Mi7YO2gMAbD5qdhiIc0DcLP1vK+Sq8ElpuP06H7/7dmPLOK ZpRPyePNRcCnqBh8+prF8KVmHC+KIBhlDDbWV16geaQGxbIImZuj5qYqf1sgyW1F309H u+2g== X-Gm-Message-State: AOAM530fL3p2RMVAR5kINSEMu7xraBHX/A3Y6h43oiscts5jAzgomM+Z aJapJNWyigZhFnZO0jJysBD5wqSNoPVSp4VuOdc= X-Received: by 2002:a2e:d1a:: with SMTP id 26mr13109692ljn.160.1590387275853; Sun, 24 May 2020 23:14:35 -0700 (PDT) MIME-Version: 1.0 References: <20200517222907.1277787-1-martin.blumenstingl@googlemail.com> In-Reply-To: <20200517222907.1277787-1-martin.blumenstingl@googlemail.com> From: Thomas Graichen Date: Mon, 25 May 2020 08:14:24 +0200 Message-ID: Subject: Re: [PATCH 1/2] mmc: host: meson-mx-sdhc: fix manual RX FIFO flushing To: Martin Blumenstingl Cc: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 18, 2020 at 12:29 AM Martin Blumenstingl wrote: > > For Meson8 and Meson8b SoCs the vendor driver follows the following > pattern: > - for eMMC and SD cards in .set_pdma it sets: > pdma->rxfifo_manual_flush = 1; > - for SDIO cards in .set_pdma it sets: > pdma->rxfifo_manual_flush = 0; > - before syncing the DMA read buffer is sets: > pdma->rxfifo_manual_flush |= 0x02; > > Set the second bit of MESON_SDHC_PDMA_RXFIFO_MANUAL_FLUSH without > clearing the first bit before syncing the DMA read buffer. This fixes a > problem where Meson8 and Meson8b SoCs would read random garbage from SD > cards. It is not clear why it worked for eMMC cards. This manifested in > the following errors when plugging in an SD card: > unrecognised SCR structure version > > Fixes: 53ded1b676d199 ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host") > Cc: Thomas Graichen > Signed-off-by: Martin Blumenstingl Tested-by: thomas graichen BEFORE: on my meson8 based mxiii i got the above error and the sd card was not useable AFTER: no more error and sd cards works fine > --- > drivers/mmc/host/meson-mx-sdhc.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/host/meson-mx-sdhc.c b/drivers/mmc/host/meson-mx-sdhc.c > index 5c00958d7754..53e3f6a4245a 100644 > --- a/drivers/mmc/host/meson-mx-sdhc.c > +++ b/drivers/mmc/host/meson-mx-sdhc.c > @@ -586,10 +586,17 @@ static irqreturn_t meson_mx_sdhc_irq_thread(int irq, void *irq_data) > cmd->data->flags & MMC_DATA_READ) { > meson_mx_sdhc_wait_cmd_ready(host->mmc); > > + /* > + * If MESON_SDHC_PDMA_RXFIFO_MANUAL_FLUSH was > + * previously 0x1 then it has to be set to 0x3. If it > + * was 0x0 before then it has to be set to 0x2. Without > + * this reading SD cards sometimes transfers garbage, > + * which results in cards not being detected due to: > + * unrecognised SCR structure version > + */ > val = FIELD_PREP(MESON_SDHC_PDMA_RXFIFO_MANUAL_FLUSH, > 2); > - regmap_update_bits(host->regmap, MESON_SDHC_PDMA, > - MESON_SDHC_PDMA_RXFIFO_MANUAL_FLUSH, > + regmap_update_bits(host->regmap, MESON_SDHC_PDMA, val, > val); > } > > -- > 2.26.2 >