From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA49CC433DF for ; Mon, 18 May 2020 11:24:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 92CBF20873 for ; Mon, 18 May 2020 11:24:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Eh9JoMBp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727815AbgERLYI (ORCPT ); Mon, 18 May 2020 07:24:08 -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-Google-Smtp-Source: ABdhPJwfQemLZ5bSu1/RpXBNHLL2sZZwNovu7aJRq0AKFUvPo6qhbafYRw9Ww3WxjuGOapLj5C0yWDsAsoMK4LMdr7Q= 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E496EC433DF for ; Mon, 18 May 2020 11:24:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2287206D4 for ; Mon, 18 May 2020 11:24:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="E8pweD5b"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Eh9JoMBp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2287206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RjaO+V6KP4M+sxJUcrG1LMJ94pW4TASC9A95i+qv7k8=; b=E8pweD5bW6INth oJzMVKhjAHCIEARsCnLJ+3EGomzuFpMeh1RICO8+h8zmGyEiGpHaec6hOhsdsveYOw72h9UH7wZlX 8U9GZ6JAHzjm6TXMrwggHCXuFUy4wDq9wZEqO50F1A+Nu7vLEmLiyzaKaASCRQ0Oq0tI3Havr5LLr TLLUCsN2P/8HUzKjAALhvCUEO8so0W8fRRjyCo7obQDwFTdeV9YOYopw7Qh7UeqipzL81GWTIiO3s Ye295uW0YTd9nf3FI1v7qys2UlboSOpEJe2Uc37+hNDbhcLbUqf8i4SVvD2bxlxEc/lBvp6k+mvS5 ZoknJGr5ixUhusFcAVOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jadsv-0002iS-Gn; Mon, 18 May 2020 11:24:41 +0000 Received: from mail-ua1-x942.google.com ([2607:f8b0:4864:20::942]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jadsM-0001jt-01 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 11:24:07 +0000 Received: by mail-ua1-x942.google.com with SMTP id s5so3313402uad.4 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=NX/8YysAQn7PoNKmDIy5W6+nWy6FTa9OcTrTzAMQNwWFBZTsLQVWyVTLbK1S2o4AYr cbxdTx71OEPfCa9o0qz0B41SAMuegYQs5EWPRlZZ6Tgb9YO3/n6D+5ngGjRUqKCt2+MS L8iuQCjZnydysD7kiDwABhLxHOPi14FSD0brNPavuWCAN9D0ENTS6LwsdqGXG4ROLTJZ I795qcn/6c8EO3kX/WX2JFb5B0h945NNPZ7FQlWeuqS/L7jRah8pX30hq/H1hK0JLhWT komL0Rql5gvyT2xB4o6fCK8su0RO8ybcB11tqu4oM6ozkTl9I+hlvQdLI2GjvYo5NwKs kPkQ== X-Gm-Message-State: AOAM5330yHTpFiAVLsgl99xr0ESauSSg9+f4xEKr9OV7bhm3NZcLWmpj ZlGfDbct+1f9SB8xyepKaYy/OKssDlk0j90XDV36kg== X-Google-Smtp-Source: ABdhPJwfQemLZ5bSu1/RpXBNHLL2sZZwNovu7aJRq0AKFUvPo6qhbafYRw9Ww3WxjuGOapLj5C0yWDsAsoMK4LMdr7Q= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_042406_090990_6E4F8DA2 X-CRM114-Status: GOOD ( 21.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:ARM/Amlogic Meson..." , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , Linux ARM , Thomas Graichen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B8A3C433E0 for ; Mon, 18 May 2020 11:24:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 596EF206D4 for ; Mon, 18 May 2020 11:24:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dsZh2pGO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Eh9JoMBp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 596EF206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AY5DN8gL+Gj0+J5zXQZLtOIN/m5dshX4J8IRy3xjmDs=; b=dsZh2pGOj8gF2h ydA2MPLORv+aIeneo0AOucBw0Kbd5AbeoMXdZODBtJW5YYupouhSXfvX7aENybyefteOOD0ptv3LK zZ/Ieo9m18BKlISUQ+TaL4eUDALLej0faBJYryi559g1A+5hLjT+qX+xMCN+umh79ZLY8C4ehUXmt YzOWOnauYk5vq0RQQ0Nb+wP6N9hYukJNqkJh8UWc3rsreMnzoxHKDKfxK9yT6W49Fo4twf8VWyebA QAJYUpoIMspG5hUeavfmSTsiL9QpfN9FLy3aWkxH+1kuxTIrsUtowy5jEr4U6v/BbBrZzH2G+E3G/ CKats+D/wplgixSsedhw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jadss-0002WY-EI; Mon, 18 May 2020 11:24:38 +0000 Received: from mail-ua1-x943.google.com ([2607:f8b0:4864:20::943]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jadsM-0001js-5M for linux-amlogic@lists.infradead.org; Mon, 18 May 2020 11:24:08 +0000 Received: by mail-ua1-x943.google.com with SMTP id f9so1151691uaq.2 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=Bc184Pj21OR49JlVk96k7omjggsXa3hqYz4oLH9vSlYyL/Dv3XR9qZYiek8gDtNiEI 9UD2nmqCNCVreoJGahchltMKNNVEe5gTDhJxh4lPXL36qASSQoElUYd+pLj27AGVkoRO qwaM3FHdnuISWGg0qgLNdaoRmNqheVIyhobwXUVXTRZ4ee0HZm2nl7q56JYHG6pXreTl AMVAMLaO2ez5UsoDDDo0Ly0g1tyqarUNmlerBCuK1P3+WKutXh9MS40uIp5Sqclbzhtq K977xyHKXfZR+e07RfUJ5PHqff8+pNYN/HNFYWGmruoFmb2MXRucVPl8X9fYmUl6g4e6 p0AQ== X-Gm-Message-State: AOAM533r3kzAncngq5v+32qu/Wiw6uGehyuv9ySW4TTbXMRPyg5O47WL b/EtgpJBjoMiEdrTbvU+B/4Zk0+R/djR313wWx4vnQ== X-Google-Smtp-Source: ABdhPJwfQemLZ5bSu1/RpXBNHLL2sZZwNovu7aJRq0AKFUvPo6qhbafYRw9Ww3WxjuGOapLj5C0yWDsAsoMK4LMdr7Q= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_042406_245386_60D4D41B X-CRM114-Status: GOOD ( 20.31 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:ARM/Amlogic Meson..." , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , Linux ARM , Thomas Graichen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.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 > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic