From patchwork Thu Sep 1 11:46:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 9308937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24D89607D6 for ; Thu, 1 Sep 2016 11:46:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 188E529310 for ; Thu, 1 Sep 2016 11:46:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D32D29313; Thu, 1 Sep 2016 11:46:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5E8A29310 for ; Thu, 1 Sep 2016 11:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933616AbcIALqY (ORCPT ); Thu, 1 Sep 2016 07:46:24 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35475 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933352AbcIALqV (ORCPT ); Thu, 1 Sep 2016 07:46:21 -0400 Received: by mail-wm0-f68.google.com with SMTP id c133so3385438wmd.2; Thu, 01 Sep 2016 04:46:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=wODzBW597j3Ohmy5JD/OscrRwL8fmKJ6iu7LgiE3gaA=; b=U/hZFoSSoGfHIzG9MfMLuWRyxk3TGQCvh4oadmqdsTi4nbGqzzp0lupkEn6TuF/M6b qha55Rwtgd77HISC6GuSBVXZWRppGEIajZ0zSwOkjhOsFMbtPREzN3hh9Am+usGA3VhO siwfTOYvS5LjCqKduxBKTBJ1Hfy+bAQWmyTUTTlUwDCCV1MoF3CGjPoGaZCudxxbMvZm yBxWDyGLk51s1eqDtj6wf5JNz04hQFw3vzXKTKwWF7X07aauIzrk+aOlqHwT6+9AXNHP 9zwVIl+/1tdt0R/12FYyXjF5I3sAXPb3kvzD6ZUoEEcpQljR6zKzWKBzFTH5ciuwptOW l4Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wODzBW597j3Ohmy5JD/OscrRwL8fmKJ6iu7LgiE3gaA=; b=EpsRGc419Wi2iDTrMw5FYL2pmmLi07L6VUdLQuPF/GA4C4XI7Ulc5bNkt0v4BOOVx+ /M4ARMYafrslkqS8O+1o7sby59dVbI9jP4WMViVvw5jNyw7B9fM+U62BftP3wLAbXBce KU8LujEq+cSzoBLa+I1C+tSzrLxyJGCBbQHtABPgEL4xXNtdmL6dKkLHd40iwMLDBip1 mge7dGgbD5xfv1gWp8urYFbylSxW7ySC9ZhvS1LCrx4oIA0J6FLY9iCX4c7v3Pu8t45O BXugUd2MV57rZhRoPSuOwU5/3djl5NbxJok0VxK68iqQHdh1hU+ioYxh18bwZ5/2q2G5 Tm1w== X-Gm-Message-State: AE9vXwMdoyAGcV2xrv7dyLmNPARLbubNmsLtRj9Njk+0ZJqgxJXtwJLU/rAgKnjUYTs2cw== X-Received: by 10.194.171.131 with SMTP id au3mr13837748wjc.125.1472730380056; Thu, 01 Sep 2016 04:46:20 -0700 (PDT) Received: from localhost (port-54533.pppoe.wtnet.de. [46.59.213.179]) by smtp.gmail.com with ESMTPSA id d62sm14028628wmd.7.2016.09.01.04.46.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Sep 2016 04:46:18 -0700 (PDT) From: Thierry Reding To: Adrian Hunter , Ulf Hansson Cc: Paul Kocialkowski , linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2] mmc: tegra: Mark 64-bit DMA broken on Tegra124 Date: Thu, 1 Sep 2016 13:46:17 +0200 Message-Id: <20160901114617.19416-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.9.3 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding According to the TRM, the SD/MMC controller on Tegra124 supports 34-bit addressing, but testing shows that this doesn't work. On a device which has more than 2 GiB of RAM and LPAE enabled, buffer allocations can use addresses above the 32-bit boundary. One way to work around this would be to enable IOMMU physical to virtual address translations for the SD/MMC controllers, but that's not easy to implement without breaking existing use-cases. It's also not obvious why 34-bit addressing doesn't work as advertised. In order to fix this for existing users, add the SDHCI_QUIRK2_BROKEN_64_BIT_DMA quirk for now. Reported-by: Paul Kocialkowski Acked-by: Stephen Warren Acked-by: Arnd Bergmann Acked-by: Adrian Hunter Signed-off-by: Thierry Reding --- Changes in v2: - add comment with rationale for the quirk - add various Acked-bys drivers/mmc/host/sdhci-tegra.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 1e93dc4e303e..20b6ff5b4af1 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -391,6 +391,31 @@ static const struct sdhci_tegra_soc_data soc_data_tegra114 = { .pdata = &sdhci_tegra114_pdata, }; +static const struct sdhci_pltfm_data sdhci_tegra124_pdata = { + .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | + SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | + SDHCI_QUIRK_SINGLE_POWER_WRITE | + SDHCI_QUIRK_NO_HISPD_BIT | + SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + /* + * The TRM states that the SD/MMC controller found on + * Tegra124 can address 34 bits (the maximum supported by + * the Tegra memory controller), but tests show that DMA + * to or from above 4 GiB doesn't work. This is possibly + * caused by missing programming, though it's not obvious + * what sequence is required. Mark 64-bit DMA broken for + * now to fix this for existing users (e.g. Nyan boards). + */ + SDHCI_QUIRK2_BROKEN_64_BIT_DMA, + .ops = &tegra114_sdhci_ops, +}; + +static const struct sdhci_tegra_soc_data soc_data_tegra124 = { + .pdata = &sdhci_tegra124_pdata, +}; + static const struct sdhci_pltfm_data sdhci_tegra210_pdata = { .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | @@ -408,7 +433,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra210 = { static const struct of_device_id sdhci_tegra_dt_match[] = { { .compatible = "nvidia,tegra210-sdhci", .data = &soc_data_tegra210 }, - { .compatible = "nvidia,tegra124-sdhci", .data = &soc_data_tegra114 }, + { .compatible = "nvidia,tegra124-sdhci", .data = &soc_data_tegra124 }, { .compatible = "nvidia,tegra114-sdhci", .data = &soc_data_tegra114 }, { .compatible = "nvidia,tegra30-sdhci", .data = &soc_data_tegra30 }, { .compatible = "nvidia,tegra20-sdhci", .data = &soc_data_tegra20 },