Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp107711ybg; Mon, 8 Jun 2020 17:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFbwFE1lKJ+JIYJgYGvuv0nLRl+PIyNa8T5VHNobP4mqHxBsGexdBwiXxH5aeXsUQopnsz X-Received: by 2002:a17:906:7083:: with SMTP id b3mr22404966ejk.57.1591663714939; Mon, 08 Jun 2020 17:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591663714; cv=none; d=google.com; s=arc-20160816; b=tMh6LjaIJ0hNX7oUMuRnQPilCW0qutbbuRixCX0iINcvrdGwgzTbhFh1uzzAv2Godg SrNZeHV3xoHCS5YZe8EZI9Y7OAcjvBAj3DZ5R3JNRRqj/9SScvThiLk68k/zLv1sb2EP aIX4NDrd1lJvA03DINA2fyIajdgO5MtYBHfwV3qoBoQfDgwQ9B+s9XwhjL/PVLiH5Iwz vHf7mItpTaCW5mFeUx9PtYpxuxWH0vUOblsX4k2SFmKFRUiYZkcmVydyovoye8uviLM7 E4QKwFQ/boQrcXMfEfRBOA2HlLocLt6aOZtfPs74MvIz3H5lBwmLlw/1X7POsRHeJyvE zT9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VWv1dpgyxhuQXdv+ttgQVZHAMEjs66gt9XxXVIbu1bw=; b=iZP0lhyH3PecnODWgUJD9+M4vBOepC0iAe++gqrWezWv3WfYcpwmzReHHlaRp0tXRM jw2xge9Tu6lFkr+wlGXHLklbqkq5G9CYTfzyEGKPOtY1XRIPn0oQ8HDrGFtJi07ML2mF NM8VicsbAcR9Q0nnCrWy7QXV1CFtoON89JxYaPM/+lI8QMuvmC7nB+X5IpnqjeCOvhTQ FAkZmLw6q6sXJigwbJX2hTknAEh8j5PbCRlvIY8RYlsxaFIt7FECTfATQaiVJ7vmHl+e w9NPKd+z/eyrhWqFmRD7NqgbtRAz+sgzYSDdQgWSQtKJVP3FQE7czZBoJQgKdLLb6P2a 9yuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hBr+QauR; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si9547325ejx.530.2020.06.08.17.48.11; Mon, 08 Jun 2020 17:48:34 -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=@kernel.org header.s=default header.b=hBr+QauR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729657AbgFIAqc (ORCPT + 99 others); Mon, 8 Jun 2020 20:46:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:58540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728923AbgFHXLg (ORCPT ); Mon, 8 Jun 2020 19:11:36 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 19995208C7; Mon, 8 Jun 2020 23:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657895; bh=fE+F2MIP8scEjfPsKRccOUjhiCq/HM5JqCR7gNnlWr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hBr+QauRZzy/vQk08leVj3G3rLae2SBYhTHgkzsq+HLRtGgtxwjqjX0EAlAru7RnU T3Ryhr57MwjUSwZ1BNP2PIa4Un+m8o6MA6ndA/AmIvEZF+2d/cezGkRlbFZgXhR+A6 neiCObI0mbwOiM9VfUagboK146GW6wF48lJFxVzA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Angelo Dureghello , Adrian Hunter , Ulf Hansson , Sasha Levin , linux-mmc@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 250/274] mmc: sdhci: add quirks for be to le byte swapping Date: Mon, 8 Jun 2020 19:05:43 -0400 Message-Id: <20200608230607.3361041-250-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Angelo Dureghello [ Upstream commit e93577ecde8f3cbd12a2eaa0522d5c85e0dbdd53 ] Some controller as the ColdFire eshdc may require an endianness byte swap, because DMA read endianness is not configurable. Facilitate using the bounce buffer for this by adding ->copy_to_bounce_buffer(). Signed-off-by: Angelo Dureghello Acked-by: Adrian Hunter Link: https://lore.kernel.org/r/20200518191742.1251440-2-angelo.dureghello@timesys.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci.c | 10 +++++++--- drivers/mmc/host/sdhci.h | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index e368f2dabf20..5dcdda5918cb 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -634,9 +634,13 @@ static int sdhci_pre_dma_transfer(struct sdhci_host *host, } if (mmc_get_dma_dir(data) == DMA_TO_DEVICE) { /* Copy the data to the bounce buffer */ - sg_copy_to_buffer(data->sg, data->sg_len, - host->bounce_buffer, - length); + if (host->ops->copy_to_bounce_buffer) { + host->ops->copy_to_bounce_buffer(host, + data, length); + } else { + sg_copy_to_buffer(data->sg, data->sg_len, + host->bounce_buffer, length); + } } /* Switch ownership to the DMA */ dma_sync_single_for_device(host->mmc->parent, diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 79dffbb731d3..1bf4f1d91951 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -653,6 +653,9 @@ struct sdhci_ops { void (*voltage_switch)(struct sdhci_host *host); void (*adma_write_desc)(struct sdhci_host *host, void **desc, dma_addr_t addr, int len, unsigned int cmd); + void (*copy_to_bounce_buffer)(struct sdhci_host *host, + struct mmc_data *data, + unsigned int length); void (*request_done)(struct sdhci_host *host, struct mmc_request *mrq); }; -- 2.25.1