Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2640906ybk; Mon, 18 May 2020 04:26:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCkHEtuv1yd3ybmmnfpuc91JZJstRHmPI70i3X9UunkdoG0DDYEKdGatRJFLNX5CSFhjwQ X-Received: by 2002:a17:906:6a18:: with SMTP id o24mr14806070ejr.66.1589801197663; Mon, 18 May 2020 04:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589801197; cv=none; d=google.com; s=arc-20160816; b=JWVzmkRjAyVVgzOs8u6t7GQm/vHTwDG0d9mV8tBYUJayKcXB6k4JmoxwUn8nMnoket 37BkAkO5XEM9vYaP2WAhvlUWqwcn88hbxb9NB1QKpNlslWge1lzQDdmeExhhVgb0Ylqm 6MJWOhzOxsVDZmFd1M9U/LP82cedpHmcKpLttTcj8VYs+40GBegQ8GkkTpFuj1ApJ7OA BPCW2cOmwoyP251Aa21n+KnEPf7gri5acWNqIFzpIbmn4GHPGw8d1RIEpCcwT1SjURgU jsKqgbYFru2grX9MjqlBybi/seGcIwS+WrpxmKU/0dWRyh+P7VJrMQRP/mZEtLp1UGuj FkZQ== 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=ihMF09VKlBBB7iEtXLgDNsN0VO2GK4psKZHbEHcxX9g=; b=PMelOJeFPl2++CUhqh6H9UXxbqbczvFgxK0Shi1g+dynnUan3D63eGmkYYtVedUXQi eccwFIbKu/i9/m1lNFVEjFm4V64UmTqTjcCq8NAFUTN13LyrqT5cV3DU8UpofonZeWcI e0vmSJgUHq12qj4Wh8fnUzThCgE1ioXZOUukvIcfkONBz6NbCHZDZEqs3vqpi3BeD3I1 +rcGtSlWQzN4PShc6hTC8sk/Ac7qebZyWRtQ4loSfS5mBKLp5VkL+SgmRiQujDlEpVZw wI3sU5ba0El3y6z3Mf75OZ3kT389VRWMZYsNr3HpBeVt8c7fgQTXq+R6HAnvRI8Ic6L5 ZDAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Eh9JoMBp; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w15si5497632edv.188.2020.05.18.04.26.14; Mon, 18 May 2020 04:26:37 -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=@linaro.org header.s=google header.b=Eh9JoMBp; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727796AbgERLYH (ORCPT + 99 others); Mon, 18 May 2020 07:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgERLYF (ORCPT ); Mon, 18 May 2020 07:24:05 -0400 Received: from mail-ua1-x943.google.com (mail-ua1-x943.google.com [IPv6:2607:f8b0:4864:20::943]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DCE9C061A0C for ; Mon, 18 May 2020 04:24:05 -0700 (PDT) Received: by mail-ua1-x943.google.com with SMTP id 14so1722700uaq.11 for ; Mon, 18 May 2020 04:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ihMF09VKlBBB7iEtXLgDNsN0VO2GK4psKZHbEHcxX9g=; b=Eh9JoMBpJXKyoYlldxMoq+oa5N0QUU44CzjatEv5ykrL04Hx5F3KLswZvR+mwI6tGn sqW0qwPrUIjW/XDQALITZaezfbEaf5jzx+IPgpbaresFLqcZqLa2/ppIs7evyGAbpAbS +4f8/kZY0fOaZcqMeuxtkxaiJ/GSDTzAhRdcWQlAXsRf7JPWWGZVDn02l+hgdc+eLYwS +y1p5y+Lkn5J4RSvu1fx+o4dhhehOOU8fDFZdriugaS3b7IPihJ+PRdYw9P2xACcj/a3 JcUQN7TfaPAs3sD6rvI9bRopSXsMIBYEnV9fC9CBDXK6mSNKZDeyqc9+8wbYMhGjALfT wi4w== 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=ihMF09VKlBBB7iEtXLgDNsN0VO2GK4psKZHbEHcxX9g=; b=NlL6BeL8EH+QOMnNQ2rsIjzujGlnqBQIsTP+FQSInNyb0WTM85fxyCVsWing1m3Dxk FYd3drHCQ+dfmvfNWTsm7ty4CVLIcHUB5qVyMBb726ib35aKOwwKhg/SjPCgJNXDGNMk cf0CmIzaek2kLPTKf4IEZtPUH/OJiXdrwORJISNyNBkK3z9zan52d7B2YsWf7Q45Roll 95tp5s5vHo+h/kJooAKwoUtsDx0LPxGnAgODSn+3eeFao98F9JSfO0GtXd2qmOJmNTuc xz4JXwTCy2BP2uBQsrv+UtRfzwlwVR1U0Epq3IoP26Dq6u2bwf/mKy1LpL83uvdWcG8+ argw== X-Gm-Message-State: AOAM5319NawByY5eLTaSJsesPjIIvYqf1pzaF9VqAmnkN/GwS5uUm1PQ WUd3PTFytk5jm3C0BVMv6DJcbl78eXSdT6wPcIXLAw== X-Received: by 2002:ab0:7293:: with SMTP id w19mr10613493uao.129.1589801044397; Mon, 18 May 2020 04:24:04 -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: Ulf Hansson Date: Mon, 18 May 2020 13:23:27 +0200 Message-ID: Subject: Re: [PATCH 1/2] mmc: host: meson-mx-sdhc: fix manual RX FIFO flushing To: Martin Blumenstingl Cc: "linux-mmc@vger.kernel.org" , "open list:ARM/Amlogic Meson..." , Linux ARM , Linux Kernel Mailing List , Thomas Graichen 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, 18 May 2020 at 00:29, 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 Applied for next, thanks! Kind regards Uffe > --- > 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 >