Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp702302imm; Wed, 4 Jul 2018 04:35:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdQjPD2EfbduowXAq5Z7zJHvX9FfNZlu+y6PboJtahAQGXTuMxhVawxTyv18LQwUHc+kZQf X-Received: by 2002:a17:902:b08d:: with SMTP id p13-v6mr1748997plr.344.1530704138229; Wed, 04 Jul 2018 04:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530704138; cv=none; d=google.com; s=arc-20160816; b=vNCh+MQq5Evi1kpfu3ErleeGsWZGPE/sPwW6+VGxElNAB2e6wbMrfykwOuET/ouD39 Cmnv5zxDc/xmCgOH4Lajin+SkjyhR9NCXzjWyeJPkzhuoZjIZ0OJMoTbnzcWzhe5kj+Z h1klvnmH9gRjlE5Ze9jw9PsNngWewthXt/DsAdEnmMopyNAiGWymwbx34GRrWATQLT4+ pQiRb2PwpDpB0WtOcygEqDzOih6tkU2tAxUSa7JLuu8yCGxeX47ZWD/2I3rK4zvR/LCi Ig8wU4dF2vuVDqvfmKT/yrT3SAHaIaAWQPlxLmMstH7GJJDZmnyN7sz3CfacORAPnLKg dO0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=tVjsEP1iOXlEK7I2cEIJydR+JNYxE6KIGN05T4u3AMU=; b=gp3zieaz6bzzIAZbJjPJATPoQgxR2OYy1QY/0gmmX5/BvJ1Y7HsG7bvNYBcqgEwTzL 9836n9Z/SyBLOCpbshycsPIsMt6tZEBrHQpeX+xWiWij0SuQ0hCx7mY/QQWmoqZd90Yf qcWegQeUXblcfb4umnuC/I9sNerP9jGugzOdPByKAklEnREEKbvddv14Y3ehz7FERD7C Y5qlcQNf0iXULtMTnWeMS7cHo1erASE6S6iTEq0hxhwEoQLVEDM+5Pf+AoG45NNvCzn3 zF2QfTXwrFACdghfbf1X7VVZBfA7xtrNvWQFkQ8O7BbuIogs9eHUz4NAILEx5S+oYRBM SHUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b135-v6si2780683pga.51.2018.07.04.04.35.23; Wed, 04 Jul 2018 04:35:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934659AbeGDLeb (ORCPT + 99 others); Wed, 4 Jul 2018 07:34:31 -0400 Received: from inva020.nxp.com ([92.121.34.13]:34580 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932732AbeGDLe3 (ORCPT ); Wed, 4 Jul 2018 07:34:29 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8379E1A0025; Wed, 4 Jul 2018 13:34:27 +0200 (CEST) Received: from smtp.na-rdc02.nxp.com (inv1260.us-phx01.nxp.com [134.27.49.11]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 4A88C1A0006; Wed, 4 Jul 2018 13:34:27 +0200 (CEST) Received: from az84smr01.freescale.net (az84smr01.freescale.net [10.64.34.197]) by inv1260.na-rdc02.nxp.com (Postfix) with ESMTP id B588C40A6F; Wed, 4 Jul 2018 04:34:26 -0700 (MST) Received: from fsr-ub1864-101.ea.freescale.net (fsr-fed1964-102.ea.freescale.net [10.171.82.97]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id w64BYOqD024066; Wed, 4 Jul 2018 04:34:24 -0700 From: Laurentiu Tudor To: adrian.hunter@intel.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yangbo.lu@nxp.com, Laurentiu Tudor Subject: [PATCH v2] mmc: sdhci-of-esdhc: set proper dma mask for ls104x chips Date: Wed, 4 Jul 2018 14:34:20 +0300 Message-Id: <20180704113420.22204-1-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SDHCI controller in ls1043a and ls1046a generate 40-bit wide addresses when doing DMA. Make sure that the corresponding dma mask is correctly configured. Context: when enabling smmu on these chips the following problem is encountered: the smmu input address size is 48 bits so the dma mappings for sdhci end up 48-bit wide. However, on these chips sdhci only use 40-bits of that address size when doing dma. So you end up with a 48-bit address translation in smmu but the device generates transactions with clipped 40-bit addresses, thus smmu context faults are triggered. Setting up the correct dma mask fixes this situation. Signed-off-by: Laurentiu Tudor --- Changes in v2: - updated commit log with some context drivers/mmc/host/sdhci-of-esdhc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 4ffa6b173a21..8332f56e6c0d 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "sdhci-pltfm.h" #include "sdhci-esdhc.h" @@ -427,6 +428,11 @@ static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask) static int esdhc_of_enable_dma(struct sdhci_host *host) { u32 value; + struct device *dev = mmc_dev(host->mmc); + + if (of_device_is_compatible(dev->of_node, "fsl,ls1043a-esdhc") || + of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); value = sdhci_readl(host, ESDHC_DMA_SYSCTL); value |= ESDHC_DMA_SNOOP; -- 2.17.1