From patchwork Fri Feb 14 07:40:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 1237908 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=85.214.62.61; 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=yNHGSb9C; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 48Jlh56j9jz9s29 for ; Fri, 14 Feb 2020 18:41:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6977E8127F; Fri, 14 Feb 2020 08:41:11 +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="yNHGSb9C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF32E81251; Fri, 14 Feb 2020 08:40:59 +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-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) (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 59A6181254 for ; Fri, 14 Feb 2020 08:40:48 +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-08.nifty.com with ESMTP id 01E7eUJc020527; Fri, 14 Feb 2020 16:40:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 01E7eUJc020527 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1581666030; bh=jx1lXbXJrQ243t7YaRLlIuAMs2sEP+y5ycIoVXRV2yg=; h=From:To:Cc:Subject:Date:From; b=yNHGSb9CpDwfwPs1CX08vRgCIAV0GPY2hBqbMgz9zM0LDGsSJhB3lLeERvSsxGTFw mwHF3PUYz5fgGjR1FmOejEiYzxcgglXpVlpq9bnhLZIm6+otkzn2fyMZalFcPyYmfU opFz+uEVx5SAg3UFxI6WnkJ9lujDvAwYYa0ih5BTDILM4OiESQjRqXm1fTEHCd0DGN 4HmaNo0SuoLBbGuHaZzbtuqfFd5blNx/auFoMFpqsaGFAdJJ5k9Dyday05KxphF4U3 2Vn0lRtMRc5mW/19smaF8TTmTyRfvYZi5Vuqip3z5cYBUStxq1FZfxwYVPukSCicfY 94i5SVuJGHi1Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Cc: Peng Fan , Masahiro Yamada Subject: [PATCH v3 00/11] mmc: sdhci: code clean-up and fix cache coherency problem Date: Fri, 14 Feb 2020 16:40:16 +0900 Message-Id: <20200214074027.19824-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