From patchwork Sun May 17 22:29:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11554417 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4AAE7618 for ; Sun, 17 May 2020 22:29: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 2837420671 for ; Sun, 17 May 2020 22:29: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="peK+Kmgt"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="my4ubcsy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2837420671 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=N+6aR9UE1ajmkA+NVVqBQx5V0TfLm68P/WiS1msucZg=; b=peK+KmgtgTTalr y9rkwQiwhaEIUSm4QevoD8lufBoukran3ppAChNIf/5xq9KbYJjoDvJyLIsxNWALkMlZNwzj9YI9p XZkqwbRqnkL7jAOuUIu8GmiTaIPVjUSNnSzz5Iq64dO1UDHZp8QJijORvCZnNaBOKCistsQFFLlnk r7fjB+wwra3EH83hgyAMrGn/ZL0ADiLzqWFJFkhQppuxkXG1ay/jTByreRcC9H7kI0S3vL8pb7K6i +AbqFMeqOxS2DpMo3UGUxytBY1d0uaeMkaQslwwwSosDJqlBpd09t2dTBT61iqt8Gkz+J9YwRTm3u m/eBfQQ+zWwNLvtbGy4A==; 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 1jaRmt-0003Kb-AP; Sun, 17 May 2020 22:29:39 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jaRmp-0003Ih-PY; Sun, 17 May 2020 22:29:37 +0000 Received: by mail-wm1-x341.google.com with SMTP id g14so21039891wme.1; Sun, 17 May 2020 15:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3zBbpyoelvZMQi2sOj6TWYdOKOApt3dyMAzoTjYhpAc=; b=my4ubcsyz+v4QpyWlb/muucdIIfwEzKHPRDj65Ud1hff5Sw5+RL6mtJJ0tg7ZXtjaK eXo0Brwj/Yy+L+TQFkLy9eYTRBoFsPP9KlmatvE/StbtXirjWl591t5qIcPlJkCkXiFo qeTMbSv8ou2Y45QB7rOKtwrYCVaQPvhSJxs8xhlHThodFsT9SiVZ8eiYKOo3w6OeuEmk jb3K6S5ieYl8cvL24CcQmU3bjyzuHa+4rAVRHYg5viauNa6XwTNnk7g+1/SOdtJuQ6HN ZO3aoPP1UekJUSm62JwmAf3Y1icer6CxzCAmfLBclIWZG4uv+ybf4wjj9uUvket80ljP 4g/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3zBbpyoelvZMQi2sOj6TWYdOKOApt3dyMAzoTjYhpAc=; b=Ga/E+G6EWDvWhBRqOu1a8Pslg5bwW6LRz6nBVkfnApKK1OLuV+KDZpJm7GWyIo8t0H TiuL3rfS+Zm2S8yL2jWMh8e6CZwLSTC8TUwl5OqJ/cXEo0D78uKv0Lj+38AUgc7P7d09 d4s7ZAbFWcC9BZiLJPyu9mA0ycRQBOT9S106QLwvgp/I6r4DSBJiQq/W0dpx8NoNktZE zrSQqFmGrrlZv0eyHUm3jcmHHhjjRZ4CewQO9UH3DJi3ZDfgTHqtQUAT3QVacAJG9ija 7+XOSNoR28gsiD3l+2OomTepONbCjdTHdeYYKJ5vNKQSsFIrYbQz8Fsk3X05fNF6IVGa I7nw== X-Gm-Message-State: AOAM530ua4ah9zpx8Wq2RmnWt3lsX7G0fQm9NnyDkmghVu9cLV6W4WDz HYgF2g2j08RdwqgszMBwPz8= X-Google-Smtp-Source: ABdhPJzt6T58mlmoPDLD8v56EY1rb+viEArjc61WgheODN7BSzGKeU9Rf3irgi2uWOLZsMpm1KOpcg== X-Received: by 2002:a7b:cd04:: with SMTP id f4mr15304085wmj.3.1589754573183; Sun, 17 May 2020 15:29:33 -0700 (PDT) Received: from localhost.localdomain (p200300f137132e00428d5cfffeb99db8.dip0.t-ipconnect.de. [2003:f1:3713:2e00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id b65sm14624702wmc.30.2020.05.17.15.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 15:29:32 -0700 (PDT) From: Martin Blumenstingl To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 1/2] mmc: host: meson-mx-sdhc: fix manual RX FIFO flushing Date: Mon, 18 May 2020 00:29:06 +0200 Message-Id: <20200517222907.1277787-1-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200517_152935_854089_80343581 X-CRM114-Status: GOOD ( 14.22 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [martin.blumenstingl[at]googlemail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Martin Blumenstingl , Thomas Graichen , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 --- 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); } From patchwork Sun May 17 22:29:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11554421 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86978618 for ; Sun, 17 May 2020 22:29:54 +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 64A49207E8 for ; Sun, 17 May 2020 22:29:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B/Us5aKw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="nLfxDJx+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64A49207E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cF9rLWWzu8bCF8bXiFzQsOjeG+y7pK1ou2ovcTXSN3A=; b=B/Us5aKwsU3U9R O6DiqMEBApfofu6YnORZGGac/m+mUM1T4rrEpcsWqiKEkVOhW7wW0mZE8axECISvLXtKsPjynHk3y eU/+v52U5zYb4ORsLk6enNgxsmGPApw4eUz/IYj15GDukT2SxL+3xvzNbMnqDWjjFq6KZPcJGATAV um0yz3AlBIK7TNC10HusBu3yupO4WiJAKGfS9OxeDQ2mEzCBruIsTmtfmxfWOQnDe+06OAkYfuT1v va55uQs23lwz9XKdrOfU1ZmvgitMWbhTuuTQ8lXXsFn5XyHIqTQn9DvW6U756sLEbGyckeN/EQjl+ /Q6b+KjmK3Q7teNfPjOQ==; 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 1jaRn5-0003XO-0R; Sun, 17 May 2020 22:29:51 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jaRms-0003Iv-DJ; Sun, 17 May 2020 22:29:39 +0000 Received: by mail-wr1-x443.google.com with SMTP id l17so9652167wrr.4; Sun, 17 May 2020 15:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5kskdNCXUeU43PRE2xrrGH3HyGgk8uIcHaWhxllvRd4=; b=nLfxDJx+McTvhZWta20rfp1gsNlKL/qrEtiIceLWUA74Rs9+LRa/hv6if9WC7mCf1p 9n9iH/m6woofKoeuzmj0tKBQkJLZTltyYraj9gJ5gFQuzfNbe8AfmezC/FOgB7+WhfKS XGLCX8Ecyv8FtdiyUb2F8czQCswT6asp2UQbxT2eJQX8k7Hbu738aXMJtWuSmw9Wxf5y Meitus7Nuo8x7kY3/NEmneV6vM08w5Ess6hB2Bg12J0TXVJATeEfCSeqLAijuO+Czzfh WxEhcm8Dky86RODxr1ph1IcFRlq/hS8+EzVCmSEOf7MMAeB2XbsBXs9Wyi0BkMiKTG3E pH6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5kskdNCXUeU43PRE2xrrGH3HyGgk8uIcHaWhxllvRd4=; b=WiC6m6LUDtZx8sy8rPWUbZ8HNzyKDo67VIDwUuAyabeHnnP0steMPUbEbilsloUFeR 1DzLnn7i9rm8w11fUXfGyXMPkek2saNr5/K0ZlFYqRjcpV5OZoYs3ln0e4nhVt+scjY6 4DnD7L1Qeq7cBU041e+ocRM3k5swDFJ4E7R1DZqHx/fuNHD9ycuk2ZAVklBD8KaABfED R+e3kb6WkSwVpH961CQm2n5cyTj9ylIt5/iSQE2eHD6KGg/ZDTf2YFB7cPDzJNMY8CTr rHNxClfi4iqaqe7XA+U69BnN22HkNGBpmEr5p84Gi9hr9IEAPi9l1BRbTH4sJRCVkzHF hKsA== X-Gm-Message-State: AOAM532U0piMm2FuWEnZTF4TBGMTRxq+YLF4Rv8iG0xzHOS/9grqZKjG PuQb3gcVu02errtgNunh4/k= X-Google-Smtp-Source: ABdhPJz2xthLfydkI05LOcHzz87pllggKjXjXyzZrAp1wsvEsDqdObOgExqdVKlsqRay7E0U3pCAwA== X-Received: by 2002:a05:6000:12c2:: with SMTP id l2mr15529375wrx.133.1589754574317; Sun, 17 May 2020 15:29:34 -0700 (PDT) Received: from localhost.localdomain (p200300f137132e00428d5cfffeb99db8.dip0.t-ipconnect.de. [2003:f1:3713:2e00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id b65sm14624702wmc.30.2020.05.17.15.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 15:29:33 -0700 (PDT) From: Martin Blumenstingl To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 2/2] mmc: host: meson-mx-sdhc: don't use literal 0 to initialize structs Date: Mon, 18 May 2020 00:29:07 +0200 Message-Id: <20200517222907.1277787-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200517222907.1277787-1-martin.blumenstingl@googlemail.com> References: <20200517222907.1277787-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200517_152938_448365_0A37AA49 X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [martin.blumenstingl[at]googlemail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Martin Blumenstingl , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kbuild test robot Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Kbuild test robot reports the following warning in lines 56 and 87 of drivers/mmc/host/meson-mx-sdhc-clkc.c: Using plain integer as NULL pointer Drop the integer value from the struct initialization to fix that warning. This will still ensure that the compiler will zero out the struct so it's in a well-defined state. Fixes: 53ded1b676d199 ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host") Reported-by: kbuild test robot Signed-off-by: Martin Blumenstingl --- drivers/mmc/host/meson-mx-sdhc-clkc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c index ab0d6c68a078..e1f29b279123 100644 --- a/drivers/mmc/host/meson-mx-sdhc-clkc.c +++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c @@ -53,7 +53,7 @@ static int meson_mx_sdhc_clk_hw_register(struct device *dev, const struct clk_ops *ops, struct clk_hw *hw) { - struct clk_init_data init = { 0 }; + struct clk_init_data init = { }; char clk_name[32]; snprintf(clk_name, sizeof(clk_name), "%s#%s", dev_name(dev), @@ -84,7 +84,7 @@ static int meson_mx_sdhc_gate_clk_hw_register(struct device *dev, int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base, struct clk_bulk_data *clk_bulk_data) { - struct clk_parent_data div_parent = { 0 }; + struct clk_parent_data div_parent = { }; struct meson_mx_sdhc_clkc *clkc_data; int ret;