From patchwork Fri Feb 14 05:41:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 1237853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.a=rsa-sha256 header.s=dec2015msa header.b=S5G6Nj6B; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Jj2C3RZtz9sRl for ; Fri, 14 Feb 2020 16:42:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B99F381257; Fri, 14 Feb 2020 06:42:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="S5G6Nj6B"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 487658125D; Fri, 14 Feb 2020 06:42:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from conuserg-11.nifty.com (conuserg-11.nifty.com [210.131.2.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 12C6D8124A for ; Fri, 14 Feb 2020 06:42:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=yamada.masahiro@socionext.com Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id 01E5fpBV001312; Fri, 14 Feb 2020 14:41:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 01E5fpBV001312 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1581658911; bh=5QmcG4AVQNa4MYmwUtIQZTNHTrAM6DQ6FD0gJzQpm6g=; h=From:To:Cc:Subject:Date:From; b=S5G6Nj6B0oRw+jOgcVQjLYgqwgxZ9s9kTNQ0wEEoNpg+6ton3G1Dqdi9Gq7XZoDtg 0XFr3ixk3MXcZTSvjw/hQalLRn0+TAsItFz65+tBP6rid41MzyGV//XF7mfnFCul/c jBR3sT9C8PYPxsjJuI/0qQeJ+X9/ZDFXCzUPoP/0wlbFks7cxIxDMg4SHE2szjyOug +pp7rAxct1htGEQ2kuHFwhFnkTD6+lHXosa9bWlsLDUGwlSK0y7/krPF9y3wjChoTx P0Ab19Pcp4VrVmETXU/AFa7RZemBKib5HFJt6IgUOIiPJ5hvdLffu5sMlO/TgDL2+Z 451GK125xrFJQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Cc: Peng Fan , Masahiro Yamada Subject: [PATCH v2 00/11] mmc: sdhci: code clean-up and fix cache coherency problem Date: Fri, 14 Feb 2020 14:41:33 +0900 Message-Id: <20200214054144.18315-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean My main motivation of this series is the last patch "mmc: sdhci: fix missing cache invalidation after reading by DMA". Currently, read data are occasionally corrupted due to the missing cache invalidation. To fix it nicely (adds dma_unmap_single(), which follows the Linux coding style), I did some cleaups first. Patch 01-04 tidies up the DMA helpers. Patch 05-10 are code clean-ups. Patch 11 fixes the bug. Masahiro Yamada (11): dma-mapping: fix the prototype of dma_map_single() dma-mapping: fix the prototype of dma_unmap_single() dma-mapping: move dma_map_(un)single() to dma-mapping: add for all architectures mmc: sdhci: put the aligned buffer pointer to struct sdhci_host mmc: sdhci: reduce code duplication for aligned buffer mmc: sdhci: use lower_32_bit2() and upper_32_bits() for setting adma_addr mmc: sdhci: remove unneeded casts mmc: add mmc_get_dma_dir() helper mmc: sdhci: use dma_map_single() instead of flush_cache() before DMA mmc: sdhci: fix missing cache invalidation after reading by DMA arch/arc/include/asm/dma-mapping.h | 1 + arch/arm/include/asm/dma-mapping.h | 29 +------ arch/m68k/include/asm/dma-mapping.h | 1 + arch/microblaze/include/asm/dma-mapping.h | 1 + arch/mips/include/asm/dma-mapping.h | 1 + arch/nds32/include/asm/dma-mapping.h | 27 +------ arch/nios2/include/asm/dma-mapping.h | 25 +----- arch/powerpc/include/asm/dma-mapping.h | 1 + arch/riscv/include/asm/dma-mapping.h | 29 +------ arch/sandbox/include/asm/dma-mapping.h | 1 + arch/sh/include/asm/dma-mapping.h | 1 + arch/x86/include/asm/dma-mapping.h | 29 +------ arch/xtensa/include/asm/dma-mapping.h | 1 + drivers/dma/ti/k3-udma.c | 2 +- drivers/mmc/sdhci.c | 96 +++++++++++------------ drivers/mmc/tmio-common.c | 5 +- drivers/mtd/nand/raw/denali.c | 5 +- drivers/net/altera_tse.c | 2 +- drivers/net/ftmac110.c | 2 +- drivers/net/macb.c | 4 +- drivers/soc/ti/k3-navss-ringacc.c | 2 +- drivers/ufs/ufs.c | 2 +- drivers/usb/cdns3/gadget.c | 2 +- drivers/usb/dwc3/core.c | 8 +- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/gadget/udc/udc-core.c | 4 +- include/linux/dma-mapping.h | 63 +++++++++++++++ include/mmc.h | 6 ++ include/sdhci.h | 3 + 29 files changed, 150 insertions(+), 205 deletions(-) create mode 100644 arch/arc/include/asm/dma-mapping.h create mode 100644 arch/m68k/include/asm/dma-mapping.h create mode 100644 arch/microblaze/include/asm/dma-mapping.h create mode 100644 arch/mips/include/asm/dma-mapping.h create mode 100644 arch/powerpc/include/asm/dma-mapping.h create mode 100644 arch/sandbox/include/asm/dma-mapping.h create mode 100644 arch/sh/include/asm/dma-mapping.h create mode 100644 arch/xtensa/include/asm/dma-mapping.h create mode 100644 include/linux/dma-mapping.h