From patchwork Fri Nov 24 16:24:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119618 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2448449qgn; Fri, 24 Nov 2017 08:31:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMZLmny1aQ3GTuKIivJWmwTakFWEtnVpXeDnJK7GjBsbeCHd0i6E0djF+8Qzn3zT+eO6P1Lg X-Received: by 10.98.89.220 with SMTP id k89mr27864877pfj.36.1511541098035; Fri, 24 Nov 2017 08:31:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511541098; cv=none; d=google.com; s=arc-20160816; b=xIYA3sL0hlzinBhECIK/dGXG9Ez2A4u38w97vOakoh94JmMLFg8Wq41OXpieti69fQ QAoaIzr6BUy3Lg+0Vn8fhCyzjzqPYiL/7zQErca9VX+Vex5K5IJKalKj/B9cQv5ZFUqc 44nBlTFAi4RCjsNVzdITsuNLq1ZX/1PmLuHPVSPjCHwpwRMGhW8YHpFiw6vnZeb2/aMg POCMFLvBT5QjCvl5givgSpfYyWT6qoZnjBoEWAh74rqv/EvSA11f2uguqM6PcZDMjDr9 wLbZ5EwygzqJd5/7MfXYpUxq5tZObo0pL+TXR/hDKkJIDO3aHms8UQbmpKqEDdz1Fcgd aZ6Q== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=E+VSlDOPtB5N7WPuRtcdaoCZ1kINQI40NTX/+NzE/pM=; b=z6K4fMcQ7P4YyFTHKLJllDy9mZGrdtCeoOaDIaueiN5zkB98XC0qzYx7SxkirUX0+o cGP6T3DWt58JR9kW6yQJD1pLOXw3jy+HAOzCGFYuuIELHqAppRZUR22BPNzFc19FywmO ePHQU7BRRGdy7utzKNTqVW+2EAq6QhZvPXtriL3QaPNjBUKCRgCMtFTIbP96+sbMBgNz /w/CaUSLzuTEVKC0t6urFzgY1e7WNIKxhc3WYi7LfmxeieDpPXFcj/2ASLvkaXguVSqb HbHoII1bbM+5vUidnUBs80rRA7v3YW2514jr+74jHLBfh6us/tdASFv9oB51/N9Q+w9r A32g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vQmk1sRO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z7si18108736pgp.129.2017.11.24.08.31.37; Fri, 24 Nov 2017 08:31:38 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vQmk1sRO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754054AbdKXQbX (ORCPT + 28 others); Fri, 24 Nov 2017 11:31:23 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61432 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753613AbdKXQZ6 (ORCPT ); Fri, 24 Nov 2017 11:25:58 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9Vl007100; Sat, 25 Nov 2017 01:25:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9Vl007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540710; bh=E+VSlDOPtB5N7WPuRtcdaoCZ1kINQI40NTX/+NzE/pM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vQmk1sROsVXSI9JqMCOqvk92Qr/sebKVDiORi6z61yjF7VOD8m0e4lDtkH0EJzlP1 +aoll8HcTwm/052aTwyYN56W0HT49p3KlmmpiySJip7YWrtxpPeuC02S2umTyN+01N AAMpVxseGNV9FpqLHyZOX28X8pidF8fRosXLfHfdk5zvCs7IcgTvvC0alAzVtoWEfD 21TUYZJT8s2PB0FuEpEhv9K/zXNXlRPom28evOb+PKu3fe3PPFpzvny/jt647rpZ4P zGla3fqtQ8Y7Igzk/4b1capejn8l4RsPWj4zlqOlLs9A9iTM/cZawkeHb0sDCfqHXj UgBjGZ68pbtuQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 01/22] mmc: renesas_sdhi: consolidate DMAC CONFIG options Date: Sat, 25 Nov 2017 01:24:36 +0900 Message-Id: <1511540697-27387-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The description in the Makefile is odd. Fix the CONFIG selection in a cleaner way. Signed-off-by: Masahiro Yamada Acked-by: Wolfram Sang --- Changes in v2: - Fix a typo consilidate -> consolidate drivers/mmc/host/Kconfig | 4 ++-- drivers/mmc/host/Makefile | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 567028c..1932188 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -598,8 +598,6 @@ config MMC_SDHI depends on SUPERH || ARM || ARM64 depends on SUPERH || ARCH_RENESAS || COMPILE_TEST select MMC_TMIO_CORE - select MMC_SDHI_SYS_DMAC if (SUPERH || ARM) - select MMC_SDHI_INTERNAL_DMAC if ARM64 help This provides support for the SDHI SD/SDIO controller found in Renesas SuperH, ARM and ARM64 based SoCs @@ -607,6 +605,7 @@ config MMC_SDHI config MMC_SDHI_SYS_DMAC tristate "DMA for SDHI SD/SDIO controllers using SYS-DMAC" depends on MMC_SDHI + default MMC_SDHI if (SUPERH || ARM) help This provides DMA support for SDHI SD/SDIO controllers using SYS-DMAC via DMA Engine. This supports the controllers @@ -616,6 +615,7 @@ config MMC_SDHI_INTERNAL_DMAC tristate "DMA for SDHI SD/SDIO controllers using on-chip bus mastering" depends on ARM64 || COMPILE_TEST depends on MMC_SDHI + default MMC_SDHI if ARM64 help This provides DMA support for SDHI SD/SDIO controllers using on-chip bus mastering. This supports the controllers diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index a43cf0d..559bd9e 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -39,12 +39,8 @@ obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o obj-$(CONFIG_MMC_TMIO_CORE) += tmio_mmc_core.o obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_core.o -ifeq ($(subst m,y,$(CONFIG_MMC_SDHI_SYS_DMAC)),y) -obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_sys_dmac.o -endif -ifeq ($(subst m,y,$(CONFIG_MMC_SDHI_INTERNAL_DMAC)),y) -obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_internal_dmac.o -endif +obj-$(CONFIG_MMC_SDHI_SYS_DMAC) += renesas_sdhi_sys_dmac.o +obj-$(CONFIG_MMC_SDHI_INTERNAL_DMAC) += renesas_sdhi_internal_dmac.o obj-$(CONFIG_MMC_CB710) += cb710-mmc.o obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o From patchwork Fri Nov 24 16:24:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119621 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2449384qgn; Fri, 24 Nov 2017 08:32:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMaxQ616fKl+YmDlIDGizcdA9244/2Y1KKOknQEdnQoRKaFXZ41zIh09XfB53r44lxD1N7Ek X-Received: by 10.101.101.73 with SMTP id a9mr18123436pgw.148.1511541141934; Fri, 24 Nov 2017 08:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511541141; cv=none; d=google.com; s=arc-20160816; b=tBQe4+vkf7ga7VxkjpQfIXrTi8SufDpRdz7l9XhAD7d7hkQeawozwPK/7lO2Pvg6cx giItk0e91TSTyAZkGdGeIUrcTXfd8ncSAcTLPIbVdqihR6JxbDO6cUGbUIreEFG+mlMd X0FvIw56Os7nHj9McLDbE0RUWZLzZ5Jifd2JNpmJ4FRs9zB31JNSU8a0j+dlYWnkCiE5 1DzS12cjVHbYhCiuMHD1at6tu5R52a6TbmK66nfAQjqd+SaBx5oEYNXpBczfjPdmWesn E8JZb428dUOW6D7mjeCaJefmBBSjQhV19QH26G5pzGv/X1+nF4oRdwUvZ5JND1wGlXVr CqJA== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=EJ8GPUuhEdOIzyF4x9eibU8kBVeAPEXIu45X6eaDxRA=; b=YDcgRxuu9twE2MYnssolI0ptz/2CzxUmavx/QviA4hzqBvkHutiD6BRCHzUESypiyD i7oK7tVugT4DNTbJAGhzoqmsrm4e6I9geGrPNfi2r1pYyfvOIGKf7JTYTnRKwmeQik6f JdNT0wikeoaL34G/JJJKwQyr9dnMtw9tZBXkrd7xhZxkp8artbzfFm6I7z6NUI8uK1/r oLwkh2E4ZKIAccblFHnvWgI6kFhks21ZIiKej/Et1BPrMU5+6QDY/aiN+Ots+1R6KwtA qb0I7JgmzxP35OGoTf6WlJbxbysnzowKiCTnfBmCC4P03xFjltoc5r4DqzEMafthtvEF PoNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zsYtOr2K; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si18986453pgo.721.2017.11.24.08.32.21; Fri, 24 Nov 2017 08:32:21 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zsYtOr2K; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753940AbdKXQcT (ORCPT + 28 others); Fri, 24 Nov 2017 11:32:19 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61403 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753538AbdKXQZ6 (ORCPT ); Fri, 24 Nov 2017 11:25:58 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9Vn007100; Sat, 25 Nov 2017 01:25:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9Vn007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540712; bh=EJ8GPUuhEdOIzyF4x9eibU8kBVeAPEXIu45X6eaDxRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zsYtOr2K+0pqWrOAX1mEoF+N7wLrkQxVX4lnvJYcHfu0ly+pfFSfKjfmEF/WxMGCw PsAYH0RuxPjWicfjBeya3rzv81d7r00J1waDyW4qeMEMswOiW3ulhlf1xeEGfbvHzK 04cHEFF6HPfRRdqPMQnIqswkYk1RhXJzbD2q4rlyzKteGWBSvl1v0a0I6Ud/TLcDDb 1PtshoyH8jCixprUi1UbRCUBPmpshzWPVxSSlybhU5Niuc5cU2yvi0jhPP/wz3tFG5 dN21bo6U5/AxyPTVJWRY9LO5om+UsVNZI6Yl7pP0WVgKaDJktblFPMxiHrMA8Iy1EP FKfiicQz68HOA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 03/22] mmc: renesas_sdhi: remove eprobe jump label Date: Sat, 25 Nov 2017 01:24:38 +0900 Message-Id: <1511540697-27387-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "goto eprobe" does nothing. Return directly. Signed-off-by: Masahiro Yamada --- Changes in v2: - Fix a typo : renesas_sdhc -> renesas_sdhi - Restore the "ret" printout for devm_clk_get() drivers/mmc/host/renesas_sdhi_core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index fcf7235..0590ae0 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -497,7 +497,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (IS_ERR(priv->clk)) { ret = PTR_ERR(priv->clk); dev_err(&pdev->dev, "cannot get clock: %d\n", ret); - goto eprobe; + return ret; } /* @@ -524,10 +524,8 @@ int renesas_sdhi_probe(struct platform_device *pdev, } host = tmio_mmc_host_alloc(pdev); - if (!host) { - ret = -ENOMEM; - goto eprobe; - } + if (!host) + return -ENOMEM; if (of_data) { mmc_data->flags |= of_data->tmio_flags; @@ -652,7 +650,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, tmio_mmc_host_remove(host); efree: tmio_mmc_host_free(host); -eprobe: + return ret; } EXPORT_SYMBOL_GPL(renesas_sdhi_probe); From patchwork Fri Nov 24 16:24:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119613 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2447239qgn; Fri, 24 Nov 2017 08:30:41 -0800 (PST) X-Google-Smtp-Source: AGs4zMYJ2aILKDrtsrEcUt4qID6BudhWFHoZoWaUXgLaWXtSy5auLgDpojh1746OCvafb35GgfHH X-Received: by 10.84.217.2 with SMTP id o2mr29356407pli.338.1511541041768; Fri, 24 Nov 2017 08:30:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511541041; cv=none; d=google.com; s=arc-20160816; b=N1a3uEkgLBoPDkGOOj7QDDeEizW0qA4KOVixMZ2nPDI4KY2g1xi9RdNbu2gIGi+KyV BeIWyHX1YsLjjsOEOvXnEWpdWlyjZuU2TQeczcp2gwxjrPXtMeriWKMRQd+Hr/c3UnSj S+WHdjw9I2zNvc3+md4JiDvSQHdPz7LIeyHn/7rjurFbyXXLbPcGoihIepSaRO4TFOP1 07mZE6briU63Z6G34fUCWcA4q49MHoxdZqSwK5cOd+mcezamYwhlKsakw1f5lHVKpim6 OrdjtUij6JJNo+0ikAzfrIH4X0c8EsHjR5rqUX6SN3M4IX0RAFcYZxvBV2SyBU3G7Y13 qiEA== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=/E6/PZuAK/B1YhoA74t3FXm2eN+o/w6GynzTGbcmx4g=; b=UVL4N2LJ9Ip6jqM6JV0FUcEufEQSSa0c5HgX6CBHxQz7r69BsKzS7jTqanfYixhZ2o J7MjSXo3yImampr6/Pm7335l8ZqLnJNN0VFE/42FQmxYfzgxwTr9J/sUcbOcOJEbp9yD 4SLR9GDHX+grNwMNGLTUpMGYkXgDiJBWug10mtaygvo86AOis2bi0wZGypWaqLKemclL B6s9aXw4+2ZHBQbceP0NcZZ2+Z6gqQhazd11seZ/5cyoaQ2TrNHV3QwgM/LyAihIgs30 AEoyaBQ09fMKUseyoiAYhDFMcwZGTQDYlg5l5/udqDpm3RZKYPZCXxXuZAmCA13MtIex gY2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=0Bs2vydU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si18330057pgv.530.2017.11.24.08.30.41; Fri, 24 Nov 2017 08:30:41 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=0Bs2vydU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753973AbdKXQak (ORCPT + 28 others); Fri, 24 Nov 2017 11:30:40 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61481 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753751AbdKXQ0B (ORCPT ); Fri, 24 Nov 2017 11:26:01 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9Vq007100; Sat, 25 Nov 2017 01:25:14 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9Vq007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540715; bh=/E6/PZuAK/B1YhoA74t3FXm2eN+o/w6GynzTGbcmx4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Bs2vydUc85TzVr8HjSBz4nCu8PRX+tKf+/KW59pqmfoTWZoG4fUqw3omdcAWAf+K i2uDrw05sqzZOayauvw86ZyL2posU9BeVunsP1Yn3fBJq/ZmPIVXqKyPQKqLRn+a0S 4W6jvBE8EPeuasdVHANhBXJqLmxhcLAB0oTHMgsDuRU2eIfDQIdbN7Eu6S7yMC8fpE w9VMyeqCRZOVjDOQG6d+ogdTD9L+F9oBjbaP0Wsj1Y5Kmb/d6y3BrqcaJ/CIMhBAHB rdzoSwBrkluPRY0+69v58Ly74ruEjTDZFdcS7mz2EMPZAaIZnz6T5GNFMPeQn/UtGB yzWDjqeUOsXdg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 06/22] mmc: tmio: move mmc_host_ops to struct tmio_mmc_host from static data Date: Sat, 25 Nov 2017 01:24:41 +0900 Message-Id: <1511540697-27387-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, tmio_mmc_ops is static data and tmio_mmc_host_probe() updates some hooks in the static data. This is a problem when two or more instances call tmio_mmc_host_probe() and each of them requests to use its own card_busy/start_signal_voltage_switch. We can borrow a solution from sdhci_alloc_host(). Copy the whole ops structure to host->mmc_host_ops, then override the hooks in malloc'ed data. Constify tmio_mmc_ops since it is now a template ops used by default. Signed-off-by: Masahiro Yamada Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang --- Changes in v2: - Rename "mmc_host_ops" to "ops" per Wolfram Sang drivers/mmc/host/tmio_mmc.h | 1 + drivers/mmc/host/tmio_mmc_core.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 3e6ff89..4fdb51b 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -134,6 +134,7 @@ struct tmio_mmc_host { struct mmc_request *mrq; struct mmc_data *data; struct mmc_host *mmc; + struct mmc_host_ops ops; /* Callbacks for clock / power control */ void (*set_pwr)(struct platform_device *host, int state); diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index d3b7af9..af9ed6a 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1098,7 +1098,7 @@ static int tmio_multi_io_quirk(struct mmc_card *card, return blk_size; } -static struct mmc_host_ops tmio_mmc_ops = { +static const struct mmc_host_ops tmio_mmc_ops = { .request = tmio_mmc_request, .set_ios = tmio_mmc_set_ios, .get_ro = tmio_mmc_get_ro, @@ -1158,6 +1158,8 @@ tmio_mmc_host_alloc(struct platform_device *pdev) host = mmc_priv(mmc); host->mmc = mmc; host->pdev = pdev; + host->ops = tmio_mmc_ops; + mmc->ops = &host->ops; return host; } @@ -1203,10 +1205,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, if (ret < 0) return ret; - tmio_mmc_ops.card_busy = _host->card_busy; - tmio_mmc_ops.start_signal_voltage_switch = + _host->ops.card_busy = _host->card_busy; + _host->ops.start_signal_voltage_switch = _host->start_signal_voltage_switch; - mmc->ops = &tmio_mmc_ops; mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; mmc->caps2 |= pdata->capabilities2; From patchwork Fri Nov 24 16:24:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119622 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2449917qgn; Fri, 24 Nov 2017 08:32:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMbMIdJTgGlH4mY821GsT1LzGjf5+C1UmArLCeHl5O579GsUJ1YsZU1DrFQ7IwDeSfS8nJf5 X-Received: by 10.159.234.138 with SMTP id d10mr29647860plr.280.1511541168805; Fri, 24 Nov 2017 08:32:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511541168; cv=none; d=google.com; s=arc-20160816; b=lIwufTjyeI+ivB7Xt2pdA1xFaXPAmSfWhAA81TZo+8u9cbXF1DUG95+UJPTJWeEbnn 0jTBKPXbN9Y9B6237626shCCKSDsDvimWqNDU5o2qd5oFCfRdUds0iKtK1+1tikltoFd YrCQK/qVQdqCBOmM6WdN8uyxSzbegYhojuJDsOu2YbXNrVi1c6xFkCz/AjFSebbRFqKW fqkHASOMAJnooyUjlk18fIHv1x256vguuMb7zA09mjmvkSMbWNlN39c8iHfuOa9JC5eW I9tze91lCoq3x3FIr83+r9SRLBwVQh8T9DeFRiisKTfwgxQZf3rM+3wP61pY3CN70mEJ 6BOw== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=2RTbPG2ItqgPMQrEg9T+mEl11xyWEDboAkNQblfT+Ak=; b=uU1IJKF5r4m5/Y4TBRd8bxNyqNz1cU4YngTyOmLvVggpiVzsXWnpDBy+mYnDPFTNOy 5pOBuhqHkgYjh+pLqmkxQeWjoaqTs7ufxqjqPnP39q8ANkO3w6okvm+5yAGgjXKk0mf8 YyopNZxTCa4Zw1DsqXwEcQvnXVm7BgzSJudGwRSHS/oy+97cpAkERkg+ByjpokMYVClS Bjv9uxr9G5AFRSnQsi7TcardkwwA5GfGJg62dyVUytiAkv8h/BuNI5MAVQY1yZcY99Rg ENp8mRPky8Vsm7+1TdupczsUjJJvsykK2VcmsLjQhcgUlXiIs5OxVsx2JrHz+uzgaZ2e 9lyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=wcQDp8SH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si18891264pli.734.2017.11.24.08.32.48; Fri, 24 Nov 2017 08:32:48 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=wcQDp8SH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753922AbdKXQcr (ORCPT + 28 others); Fri, 24 Nov 2017 11:32:47 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61400 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753533AbdKXQZ6 (ORCPT ); Fri, 24 Nov 2017 11:25:58 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9Vr007100; Sat, 25 Nov 2017 01:25:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9Vr007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540716; bh=2RTbPG2ItqgPMQrEg9T+mEl11xyWEDboAkNQblfT+Ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wcQDp8SHrTMnazYCboEM1kv2AuPtc1Qwtz2dxlIr9eu3g0yRVr/UPPmKvV44+j8aX WhmbdUI+xOHtq41i7kSs6h/0vBgWYZrzoh0epy9ssI1633J/lZHPeffIoAjt3xC6V3 Im13WaslKtWb46aAHk6BJ3tmFSm/A4a5OVv6WMWMxu1PQyHlqqX6h19nbXt5FfIzXk u5uDhiiDhhMMFxoy/GvEa/lH2iwpH4jP+ghy4kaC/jJc4vCCtW9/aJ96IVSx0BlrHq qyS9g8DMuOqz8+e/uZTWvW6VhAmraa70Rx4BYI+6BwsbJ/Ixk17/1Jr/g4gw/OHXoB yd3SRiqbR8L1A== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 07/22] mmc: tmio, renesas_sdhi: set mmc_host_ops hooks directly Date: Sat, 25 Nov 2017 01:24:42 +0900 Message-Id: <1511540697-27387-8-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drivers can set any mmc_host_ops hooks between tmio_mmc_host_alloc() and tmio_mmc_host_probe(). Remove duplicated hooks in tmio_mmc_host. Signed-off-by: Masahiro Yamada Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang --- Changes in v2: - Rename "mmc_host_ops" to "ops" per Wolfram Sang drivers/mmc/host/renesas_sdhi_core.c | 4 ++-- drivers/mmc/host/tmio_mmc.h | 3 --- drivers/mmc/host/tmio_mmc_core.c | 4 ---- 3 files changed, 2 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 9baf4d1..267e2e0 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -549,8 +549,8 @@ int renesas_sdhi_probe(struct platform_device *pdev, /* SDR speeds are only available on Gen2+ */ if (mmc_data->flags & TMIO_MMC_MIN_RCAR2) { /* card_busy caused issues on r8a73a4 (pre-Gen2) CD-less SDHI */ - host->card_busy = renesas_sdhi_card_busy; - host->start_signal_voltage_switch = + host->ops.card_busy = renesas_sdhi_card_busy; + host->ops.start_signal_voltage_switch = renesas_sdhi_start_signal_voltage_switch; } diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 4fdb51b..37409c5 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -186,9 +186,6 @@ struct tmio_mmc_host { void (*clk_disable)(struct tmio_mmc_host *host); int (*multi_io_quirk)(struct mmc_card *card, unsigned int direction, int blk_size); - int (*card_busy)(struct mmc_host *mmc); - int (*start_signal_voltage_switch)(struct mmc_host *mmc, - struct mmc_ios *ios); int (*write16_hook)(struct tmio_mmc_host *host, int addr); void (*hw_reset)(struct tmio_mmc_host *host); void (*prepare_tuning)(struct tmio_mmc_host *host, unsigned long tap); diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index af9ed6a..46f77c3 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1205,10 +1205,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, if (ret < 0) return ret; - _host->ops.card_busy = _host->card_busy; - _host->ops.start_signal_voltage_switch = - _host->start_signal_voltage_switch; - mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; mmc->caps2 |= pdata->capabilities2; mmc->max_segs = pdata->max_segs ? : 32; From patchwork Fri Nov 24 16:24:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119623 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2450249qgn; Fri, 24 Nov 2017 08:33:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMYTvY2GZCE11TGp9naCYTiUIiX8dkWcWazCs24pr/pHNUyZ1JJwo/th/4rlHVeq1ZidQeKE X-Received: by 10.98.99.68 with SMTP id x65mr10635205pfb.56.1511541183680; Fri, 24 Nov 2017 08:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511541183; cv=none; d=google.com; s=arc-20160816; b=YvOcz582oFfsTToD6sM++uLsULqVoIy28U6QUwlR0GdAjUIgoVMuVelMFbMamJUrTn mGyR1XfgoJkWAk8GZzSzJ/PVuL5FtzrwMmO3rkGgmjZD1D4BxcUjn/pnC433U1qZMPgs wZKa6k0T1xo+uZa4xjEjQorzpPKdRtnni0DLnQx9Y16nwdCKjme+/mchvxWXX6lofwel BPyNlYrPJP0ZOTZIlfdnYZtE0X7dkXLUKlRU3LG1vh03FtyrxKJFAgToZWxPmvgj6TPP unGMOxR0+p4Uxuk61NB1LPoKb/pTh3dG+/iFkuUdVTBW4i0gSti/RygNWK6SEQ3+3tpx XD6w== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=yOXj3yJ7cLaZ56m/x0qKE3PkK/y+Tkhu04xxPeqNqwk=; b=FeYNVa88BCVnCohwLvOSYw/HQDh1AcZILx5+aJVcBavNJLv3gscF76PyrGqYzbxvD0 GvhU2IAe+rTX/spUY2j41rpXwDrkxtNM9UQNt4yVYdgNKYFsd6ctSmGaI4kNRTHaZPZB OlyQX4RtVPyuvpGwFrsvxLRiBwFzQs6q0X4sT4K5ViSmwcWnvDlUwfC5JkA9XoLRgefN mGQPR+GZMqnFoV5C9y2dyHcHK/ot0yvwS3wuXB8gnMK/KL8ujK+YdzfkyADTzmKVSojE 922aH12iJt68pa0N7K2dJV6wMzQxqXA88JOziQSESAX4DSX1VvtbVDDJR6qWVd+D4Y2K lwLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=JV46Bktq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h61si19111593pld.330.2017.11.24.08.33.03; Fri, 24 Nov 2017 08:33:03 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=JV46Bktq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753812AbdKXQcq (ORCPT + 28 others); Fri, 24 Nov 2017 11:32:46 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61401 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753560AbdKXQZ6 (ORCPT ); Fri, 24 Nov 2017 11:25:58 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9Vs007100; Sat, 25 Nov 2017 01:25:16 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9Vs007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540717; bh=yOXj3yJ7cLaZ56m/x0qKE3PkK/y+Tkhu04xxPeqNqwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JV46Bktq+Q7N/bDBIj7vsEOICuRe1HY9KidNQJ65YHuM/60VDexSe7RFMt+nrBBuV bLDlipvNcpnUqf/nCS2yFFw6M6SmTXrEZGG/wzpEUr19fgBWBBc1CstbCnlot05BSh hYJjfsABcVfS78a02ewhVk1vdbaI7M0sfGx6Rjkbwi97ZdiNDwS4gJwYPPzVBbn4M9 8JqlfG67nIZ3zBghKyZtVhUTcTrPmU5kYbrTQ6gTvLV6gNSWsRa7qgM7moTsCv6jQR njHTxyVk/QblzXH5EoYKNesAVIyw5OhLquENq3kG44elVf5jjQePJjdgFb0e2Wehbb L5QVMQUpx3oig== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 08/22] mmc: tmio: move mmc_gpio_request_cd() before mmc_add_host() Date: Sat, 25 Nov 2017 01:24:43 +0900 Message-Id: <1511540697-27387-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drivers do not need to call mmc_gpiod_request_cd_irq() explicitly because mmc_start_host() calls it. To make it work, cd_gpio must be set before mmc_add_host(). Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mmc/host/tmio_mmc_core.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 46f77c3..efffb04 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1205,6 +1205,12 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, if (ret < 0) return ret; + if (pdata->flags & TMIO_MMC_USE_GPIO_CD) { + ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0); + if (ret) + return ret; + } + mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; mmc->caps2 |= pdata->capabilities2; mmc->max_segs = pdata->max_segs ? : 32; @@ -1300,14 +1306,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, dev_pm_qos_expose_latency_limit(&pdev->dev, 100); - if (pdata->flags & TMIO_MMC_USE_GPIO_CD) { - ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0); - if (ret) - goto remove_host; - - mmc_gpiod_request_cd_irq(mmc); - } - return 0; remove_host: From patchwork Fri Nov 24 16:24:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119614 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2447281qgn; Fri, 24 Nov 2017 08:30:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMYELmALq2xGtCt711IHzd6HtOMQRA0hVqobLva3WPQaokVnHZ5IuxVrI6zALCImAr4sB84F X-Received: by 10.84.133.162 with SMTP id f31mr30147422plf.304.1511541043713; Fri, 24 Nov 2017 08:30:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511541043; cv=none; d=google.com; s=arc-20160816; b=kx7jBl1eZ9wemXpqvEeXuSOXu+UeP6GzU+hPFC+u+wmhluF2S2l8D/23CL8NzE3NLL +yJzIEYRtbFS+ZWSOmGWPW5a8qSplZlSNhsn6sLpysTC0ZCgLCyJKzS9Zpa6mld3Kfpr AGgTlwT3O/zJhX+/8zT2fDd30TEcX7U7msQzNQRLbBLIO9buiSfXg1mAPBwyjfvgLhMC qZbr6pBWgv+Imjrh5Ctym7IIMMce8vhfdslbeoQ6eHfDDtY7agyw+9mtoqXj5Ps3BXIm j1nRz49VCB/msi4UDAePEBOQlErnswOzd9eQViwdwC04C1ZWe6ftJOefhnpeho9QwAgy zVxQ== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=GtCSagOYTLDjcvugNilsQdnv0e7zKp2rAYr3MOAfurE=; b=N0cRr7NA8tsHE0I7AcenhGBuhFdXtMOt+dwjYUmPZsbxJpIFHl7r0+tppnrOo9RZgV opU1nVt19BTb1k1Tcl+BVi6e7fQeDQybYNJftDdO6xJNenM8r2u9LonIZ/cDvLZVUnRh MfQouqyXaUOZdy78B+7NFnRnHXpysWpq/OjD/JhKb6ccfotLaQzQzcgAMV7LEt646Aqb kHbh32UFxmz+izzNWew6qO4WoD+RlBSHmol4wK5ekd1X3J8ki+vQHpV4ldr6wR3mUgqy 3mAs7QX7xQdCfgT3uRv/MYzqk324L6dkYnN4bWRrJFckObSMzVqlgHcp5ZSBr+NuTF/i 2xBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=2r6O99qv; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si18810273plc.450.2017.11.24.08.30.43; Fri, 24 Nov 2017 08:30:43 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=2r6O99qv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753988AbdKXQal (ORCPT + 28 others); Fri, 24 Nov 2017 11:30:41 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61468 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753643AbdKXQ0A (ORCPT ); Fri, 24 Nov 2017 11:26:00 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9Vv007100; Sat, 25 Nov 2017 01:25:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9Vv007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540719; bh=GtCSagOYTLDjcvugNilsQdnv0e7zKp2rAYr3MOAfurE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2r6O99qvQTuH4kHvK6JBkGKXzn0D7BYrWnTTqNhehQEXKiRTLOS0Y1ps9aL/Zed96 HGozp1BVCICEXMoyur4Oeg3TzocDOUYNSr5jqzXkyg9iB+l4JTVd3JR0o8SrgvlNUA 4F8tLcUHp2JkBTWVAKyWFlQ7icqBGus+aQRYxAGq6Cr7yQYcT14eeSZU59LBd0V5IU Ps4kSvUwz0LScgGYckCbr2QmXNR7bYBjh3JSdXXz4Grc/xLRQ2er9S5/fFfOn0DPNT HuMHhr3+6qAX6MwukQhnsOFn8yXfmlcWhhFvD33UAlhFVtNphQXAHTU7UhZ5fImM32 6zykTGG2I6Iuw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 11/22] mmc: renesas_sdhi: remove always false condition Date: Sat, 25 Nov 2017 01:24:46 +0900 Message-Id: <1511540697-27387-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org renesas_sdhi_probe() always sets host->dma as follows: host->dma = dma_priv; !host->dma is always false. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/renesas_sdhi_sys_dmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c index 9ab1043..e210644 100644 --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c @@ -360,8 +360,8 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata) { /* We can only either use DMA for both Tx and Rx or not use it at all */ - if (!host->dma || (!host->pdev->dev.of_node && - (!pdata->chan_priv_tx || !pdata->chan_priv_rx))) + if (!host->pdev->dev.of_node && + (!pdata->chan_priv_tx || !pdata->chan_priv_rx)) return; if (!host->chan_tx && !host->chan_rx) { From patchwork Fri Nov 24 16:24:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119603 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2442772qgn; Fri, 24 Nov 2017 08:26:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMZZtNnMwQycZZFOl1pahcWPFXd8hpm67LgL9YO/La/xAk3Ghsz09irxwdNVYQaQ9rAkGIVo X-Received: by 10.99.103.5 with SMTP id b5mr29029158pgc.447.1511540793344; Fri, 24 Nov 2017 08:26:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540793; cv=none; d=google.com; s=arc-20160816; b=L28E+DnV38VlrP/4tyC6hD6oNnETwtAFKrW7ah4NDT1xCdKCLdJtlEvNVNGp17S/yo +KMVBOuYGrPrH+SJ9XrrrFWRpAkrLrRCFVy0oGOvXH5Dp8t0vS8vJJ3nxyBBUGPIt/0t t3PAPpqz8q5td/qiOuEXPAx3Mv70JGLNTJ4imGqIuqdbuUaAtXENtlSHk8UXXwloTpHk vIaZ46uwyegV4D/2t6l/fqBOgMLVaB+5WAfJHvcmj1t4I8IGznJ7Oyg3IrSpRtJ9TUcS oQCgtnIggFkylFf2lG+bgdSSqyD371L/g07JKtQ+pGmdQ6QHPkgPCZFhDkxe+q4ky4Ab 1WPQ== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=c+EHMWt8wkl77BtVml3MCDlk+lxr4N53V7b+o2/VmWU=; b=EawUG0LOuq6D4bJ0YU9wkol0ZRdy96XiwyAnZ0apS/YBfbXnvbp48u9sotVLolOQ9g wzfsLRL1waoawyEtIyOMrVFRGL/JcI+m29LdW8DyHdEzGJF0LBd70U0g/rbNsOQyeVGC A/f4ewiL5j2QDHrdN/wPhtPy+X5tEy+PLcnb+P942XK/VOdLuwv8Wp18CWcB0L/2Powr mxpynkeoFVImL/+jbpK8qAInvdcBfPhF3EcnTg2BBdLbKyUfkuxIuBmvuSMdzo7tVPEc hD2QxJqZoL3oGLa2/ttjmXaSz9hVh7AMNZrnsiQyypc3upDF/wKOktCY3g5zPWhBxPAo FSzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=DizQJPbW; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f30si18709741plf.535.2017.11.24.08.26.33; Fri, 24 Nov 2017 08:26:33 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=DizQJPbW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753873AbdKXQ0P (ORCPT + 28 others); Fri, 24 Nov 2017 11:26:15 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61638 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753780AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9Vw007100; Sat, 25 Nov 2017 01:25:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9Vw007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540720; bh=c+EHMWt8wkl77BtVml3MCDlk+lxr4N53V7b+o2/VmWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DizQJPbWUqTkBStHdUWlxZzxRKlyw1ANlWG/EuKXv+TOVRvTEIayRYUjTN67WG9t+ 16/iGjpsQDL+iMv0qfCcZYKxZl4c3i+IpdJESUePEZHODLa7Ux+xV4d14bQvirwYC8 IzdefrrGI7oLgvf7tvbxZu04rGZiNXdCBgDC5d9Sbcl9j7CuXFOzzege+aEaADu3y7 sFmoggSZnaNILVOQdAw7CRwEz4V8xI2WBqxEBdMdZ0XEdPMt6vIYQ70r2kjcHCp/uP uqnu4ntiBayWenu5H5hgA+qOUM1x+gGfRSeKs+KyLr6c2/oD29J8xGh2Irlqf7RZgo cSWsqbDDWHl+A== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 12/22] mmc: tmio, renesas_sdhi: move struct tmio_mmc_dma to renesas_sdhi.h Date: Sat, 25 Nov 2017 01:24:47 +0900 Message-Id: <1511540697-27387-13-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org struct tmio_mmc_dma looks like TMIO core data, but in fact, Renesas private data. Move it to renesas_sdhi.h (probably, it is better to rename it to renesas_sdhi_dma, or squash it into struct renesas_sdhi). I also moved struct renesas_sdhi and host_to_priv() to that header because they are necessary to convert the tmio_mmc_host pointer into the renesas_sdhi pointer. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/renesas_sdhi.h | 19 +++++++++++++++++++ drivers/mmc/host/renesas_sdhi_core.c | 14 -------------- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 6 ++++-- drivers/mmc/host/renesas_sdhi_sys_dmac.c | 16 ++++++++++------ drivers/mmc/host/tmio_mmc.h | 7 ------- 5 files changed, 33 insertions(+), 29 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h index b9dfea5..9a507b3 100644 --- a/drivers/mmc/host/renesas_sdhi.h +++ b/drivers/mmc/host/renesas_sdhi.h @@ -35,6 +35,25 @@ struct renesas_sdhi_of_data { unsigned short max_segs; }; +struct tmio_mmc_dma { + enum dma_slave_buswidth dma_buswidth; + bool (*filter)(struct dma_chan *chan, void *arg); + void (*enable)(struct tmio_mmc_host *host, bool enable); +}; + +struct renesas_sdhi { + struct clk *clk; + struct clk *clk_cd; + struct tmio_mmc_data mmc_data; + struct tmio_mmc_dma dma_priv; + struct pinctrl *pinctrl; + struct pinctrl_state *pins_default, *pins_uhs; + void __iomem *scc_ctl; +}; + +#define host_to_priv(host) \ + container_of((host)->pdata, struct renesas_sdhi, mmc_data) + int renesas_sdhi_probe(struct platform_device *pdev, const struct tmio_mmc_dma_ops *dma_ops); int renesas_sdhi_remove(struct platform_device *pdev); diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 267e2e0..34fd194 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -46,19 +46,6 @@ #define SDHI_VER_GEN3_SD 0xcc10 #define SDHI_VER_GEN3_SDMMC 0xcd10 -#define host_to_priv(host) \ - container_of((host)->pdata, struct renesas_sdhi, mmc_data) - -struct renesas_sdhi { - struct clk *clk; - struct clk *clk_cd; - struct tmio_mmc_data mmc_data; - struct tmio_mmc_dma dma_priv; - struct pinctrl *pinctrl; - struct pinctrl_state *pins_default, *pins_uhs; - void __iomem *scc_ctl; -}; - static void renesas_sdhi_sdbuf_width(struct tmio_mmc_host *host, int width) { u32 val; @@ -539,7 +526,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, host->bus_shift = of_data->bus_shift; } - host->dma = dma_priv; host->write16_hook = renesas_sdhi_write16_hook; host->clk_enable = renesas_sdhi_clk_enable; host->clk_update = renesas_sdhi_clk_update; diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c index 41cbe84..691a99f 100644 --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c @@ -103,6 +103,8 @@ renesas_sdhi_internal_dmac_dm_write(struct tmio_mmc_host *host, static void renesas_sdhi_internal_dmac_enable_dma(struct tmio_mmc_host *host, bool enable) { + struct renesas_sdhi *priv = host_to_priv(host); + if (!host->chan_tx || !host->chan_rx) return; @@ -110,8 +112,8 @@ renesas_sdhi_internal_dmac_enable_dma(struct tmio_mmc_host *host, bool enable) renesas_sdhi_internal_dmac_dm_write(host, DM_CM_INFO1, INFO1_CLEAR); - if (host->dma->enable) - host->dma->enable(host, enable); + if (priv->dma_priv.enable) + priv->dma_priv.enable(host, enable); } static void diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c index e210644..aeb3838 100644 --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c @@ -117,11 +117,13 @@ MODULE_DEVICE_TABLE(of, renesas_sdhi_sys_dmac_of_match); static void renesas_sdhi_sys_dmac_enable_dma(struct tmio_mmc_host *host, bool enable) { + struct renesas_sdhi *priv = host_to_priv(host); + if (!host->chan_tx || !host->chan_rx) return; - if (host->dma->enable) - host->dma->enable(host, enable); + if (priv->dma_priv.enable) + priv->dma_priv.enable(host, enable); } static void renesas_sdhi_sys_dmac_abort_dma(struct tmio_mmc_host *host) @@ -359,6 +361,8 @@ static void renesas_sdhi_sys_dmac_issue_tasklet_fn(unsigned long priv) static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata) { + struct renesas_sdhi *priv = host_to_priv(host); + /* We can only either use DMA for both Tx and Rx or not use it at all */ if (!host->pdev->dev.of_node && (!pdata->chan_priv_tx || !pdata->chan_priv_rx)) @@ -378,7 +382,7 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host, dma_cap_set(DMA_SLAVE, mask); host->chan_tx = dma_request_slave_channel_compat(mask, - host->dma->filter, pdata->chan_priv_tx, + priv->dma_priv.filter, pdata->chan_priv_tx, &host->pdev->dev, "tx"); dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__, host->chan_tx); @@ -389,7 +393,7 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host, cfg.direction = DMA_MEM_TO_DEV; cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift); - cfg.dst_addr_width = host->dma->dma_buswidth; + cfg.dst_addr_width = priv->dma_priv.dma_buswidth; if (!cfg.dst_addr_width) cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; cfg.src_addr = 0; @@ -398,7 +402,7 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host, goto ecfgtx; host->chan_rx = dma_request_slave_channel_compat(mask, - host->dma->filter, pdata->chan_priv_rx, + priv->dma_priv.filter, pdata->chan_priv_rx, &host->pdev->dev, "rx"); dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__, host->chan_rx); @@ -408,7 +412,7 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host, cfg.direction = DMA_DEV_TO_MEM; cfg.src_addr = cfg.dst_addr + host->pdata->dma_rx_offset; - cfg.src_addr_width = host->dma->dma_buswidth; + cfg.src_addr_width = priv->dma_priv.dma_buswidth; if (!cfg.src_addr_width) cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; cfg.dst_addr = 0; diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 37409c5..dc470d3 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -112,12 +112,6 @@ struct tmio_mmc_data; struct tmio_mmc_host; -struct tmio_mmc_dma { - enum dma_slave_buswidth dma_buswidth; - bool (*filter)(struct dma_chan *chan, void *arg); - void (*enable)(struct tmio_mmc_host *host, bool enable); -}; - struct tmio_mmc_dma_ops { void (*start)(struct tmio_mmc_host *host, struct mmc_data *data); void (*enable)(struct tmio_mmc_host *host, bool enable); @@ -149,7 +143,6 @@ struct tmio_mmc_host { struct platform_device *pdev; struct tmio_mmc_data *pdata; - struct tmio_mmc_dma *dma; /* DMA support */ bool force_pio; From patchwork Fri Nov 24 16:24:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119612 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2446811qgn; Fri, 24 Nov 2017 08:30:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMZn8vHJ3JcFZWr+IJCOGcQhVmpFMSYdmEabrrVBGV7glIk0klGF3JEiaWcXgOKSqL6NPt/8 X-Received: by 10.99.95.143 with SMTP id t137mr29288389pgb.442.1511541021993; Fri, 24 Nov 2017 08:30:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511541021; cv=none; d=google.com; s=arc-20160816; b=tlizCn0m+oIWo/AD30NEi13mRkow9S47fFPcukiiLuXV7Rm7L7wEpXpcI/Vb6mo7xu rFf6s00in+GxfLbV3n+TzbN0pVJDYwwyWKhmhHw0s/CxjN9Nw1NIwfVK2skVbX9RfRoH +RPZ498LI9bzit3Ek3yshhcQerjyr7yw+t3AohjNg5C1uHH1JInIUt18N1myi8+WsDev zYkAc+BMuIYXqdBIWxMR8XI7x+FLrFAn7Ca+EPIBkKgns9s8npjOWUpZBCd9cRPd3qoy uJRBP3mSwvawngzvClWp1qQmnpHoUOfX90Yb2726HXXt/iDVG4NNr3t7ZIcE6+1WsxzK i0eg== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=FlEXhhcQ6J2gJ5nRcOt9qRfxuBFF8AR8yuAxbA9Vn4E=; b=ozQdFyK+ziKEKi0BrohchZNWRDUv9Z0reH3B63VpBq3Nk9iNxvgKn6ZBP6Ez50r8zG 6DngWpS/+/oahjpWRDz0zimN9ufo6o4vuR5Ha+tvue8wgcspvlVE1SGZ4uvBubU5T2Pb JDZXpm0ESusSYlgU7ReMkPWcsRqWUvtUGxNUzYGAND46Un7Y+ErY2YJboXtNA/EQ+QNd OgbCKYL/unnpwRZJmiJgUawTuSoQUB2de6aIe5lUvclh2s6NjqX7axMSTWHICqoztGWf ul4QynLVlqiZMIRMx6lQ2YUxZNBc5PlRvNLOJ+r24rnmEMbUId+MtBshKmhyFaucztcp eZDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=q16YfPZ8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si18330057pgv.530.2017.11.24.08.30.21; Fri, 24 Nov 2017 08:30:21 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=q16YfPZ8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753876AbdKXQaU (ORCPT + 28 others); Fri, 24 Nov 2017 11:30:20 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61629 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752554AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W0007100; Sat, 25 Nov 2017 01:25:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W0007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540721; bh=FlEXhhcQ6J2gJ5nRcOt9qRfxuBFF8AR8yuAxbA9Vn4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q16YfPZ8F4kkFXfy8uPvx8DpTj/XJY1qIEbmoLVF8FHK8kZ3HrdTaTE4HMJGkz9tR iZ+QzV2kvoT81RISIfQ++xuF7e7NfLoLmqrjVnRKIGalKo6WInZohrumfCjHwgfR+b SGJNW4ff2I3JDXOlMo72PoBIVwyB4W5Pw7wNmCOIiZN8Iyw+4aXgv+6fjIn3Fw2wa/ sU0AQSPLlYIVRB4Josz2vEZX3H3MjNx7vMot9wYH6biqbPdz2SV3V8CTiiNqLwilfl OwyOfH7hIiVONFu8qkaVEmUx5m34LVJ+WJU1AEU6dd+N1XJD3GS7dcUwPAceTT6gFw /tgxU21e5cl0A== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 14/22] mmc: tmio, renesas_sdhi: move ssc_tappos to renesas_sdhi.h Date: Sat, 25 Nov 2017 01:24:49 +0900 Message-Id: <1511540697-27387-15-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org struct tmio_mmc_host has "scc_tappos", but in fact, it is Renesas private data. Move it to renesas_sdhi.h Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/renesas_sdhi.h | 1 + drivers/mmc/host/renesas_sdhi_core.c | 4 ++-- drivers/mmc/host/tmio_mmc.h | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 Reviewed-by: Wolfram Sang diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h index 3250dbe..f13f798 100644 --- a/drivers/mmc/host/renesas_sdhi.h +++ b/drivers/mmc/host/renesas_sdhi.h @@ -51,6 +51,7 @@ struct renesas_sdhi { struct pinctrl *pinctrl; struct pinctrl_state *pins_default, *pins_uhs; void __iomem *scc_ctl; + u32 scc_tappos; }; #define host_to_priv(host) \ diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 34fd194..e78dca7 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -267,7 +267,7 @@ static unsigned int renesas_sdhi_init_tuning(struct tmio_mmc_host *host) ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN & sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL)); - sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DT2FF, host->scc_tappos); + sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DT2FF, priv->scc_tappos); /* Read TAPNUM */ return (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_DTCNTL) >> @@ -590,7 +590,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, for (i = 0; i < of_data->taps_num; i++) { if (taps[i].clk_rate == 0 || taps[i].clk_rate == host->mmc->f_max) { - host->scc_tappos = taps->tap; + priv->scc_tappos = taps->tap; hit = true; break; } diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 8b169a0..9f083dc 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -166,7 +166,6 @@ struct tmio_mmc_host { struct mutex ios_lock; /* protect set_ios() context */ bool native_hotplug; bool sdio_irq_enabled; - u32 scc_tappos; /* Mandatory callback */ int (*clk_enable)(struct tmio_mmc_host *host); From patchwork Fri Nov 24 16:24:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119602 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2442515qgn; Fri, 24 Nov 2017 08:26:18 -0800 (PST) X-Google-Smtp-Source: AGs4zMZOqQmMZOZQl4iIyYKlBCCauF77ujX1oszy8YchyOGGB3p8/yObmMEKzbrTYQkR9Ir5OqlO X-Received: by 10.101.93.140 with SMTP id f12mr28420126pgt.60.1511540778658; Fri, 24 Nov 2017 08:26:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540778; cv=none; d=google.com; s=arc-20160816; b=KyO2HK54PUIXgxybP+N04Sqs71jdVGHYWBBDfMDzXa+E7po9hd91Y4W/OhGcSCch03 Ej72guPmh16z4m5ST2WU1pXuezXOcTGjS8bBhQO++H+M2cR1iNr68FRjXxT15n9PMxwO nHuan8fCwED09yU7xTlmudUxOr9AkyQ98uUF2LddkgooTSnGixrz1vW4XgF8ab4LBdCH Vdzjpfm7DWiWF7aMMcyphRUl14euJ4Xy4RwXgO8O4QqGwgxdI3eXdNpYz4y1PZWFGNGy DnF7BwGFX8mHszHTIDn7MAPd3uoQAZ0Wbbdnr3jQMisP21dJlSTSG4MdwxVHbUwc9pnr Yz7g== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=KxJCULfaePQ0b9jAZU9JrwTY6NQ4JOim8NjtlGjJYxQ=; b=f8UQonf+6g6UY2XBdQLxQ0p9SQdjPYDJtKLhzEFv3vIvlKmsf3aUGd2sCJanuhA2bo sk6vL8EzgQnLB24lWbRKWMjqIM4dug4SUmCO50QBu4DVbXFgwL4OY0FngBrnKVFlQyau otZsQAHOCJ6Z2pqdEm7WcKFhL5pG933/y6WtWvNr1826E3QL+DO084WnxJAg6eNR2NoF yYLAJpZ2lkOvPzkfDM5dTlrz4L5Fud7dGYUgOcefwcgmVNhC2Cxq0aSCDvhL6mBQM0wO clhNPI2+0HweABeL0vPxwRxz4jlOflnwB41rsGxMIfPBmcWlF+yoHeFniMj4t8SB9pdh G9kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=JjED77N0; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si20126912pfx.6.2017.11.24.08.26.18; Fri, 24 Nov 2017 08:26:18 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=JjED77N0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753889AbdKXQ0Q (ORCPT + 28 others); Fri, 24 Nov 2017 11:26:16 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61645 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753797AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W1007100; Sat, 25 Nov 2017 01:25:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W1007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540722; bh=KxJCULfaePQ0b9jAZU9JrwTY6NQ4JOim8NjtlGjJYxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JjED77N0azLnm3BjOtdTlBc6DaclM6nGNQ/ck10GnsJi0FgqyevBAfTML9jLIbFGO Q4bQ/61mbDLZhq1row4jGKSj0+uyJ+uhkbKzZ91RIeMqqkG2ppQqfoK/siMV3c5I0H xwZmm/IY3ZstlZnfvuYpAQb9hD3WKrS7V2++HNQszTS2qZ10o/WNcEKR3bmWMyY7g5 fYPf8i5v36IHOx/N99HNQzM7OmsZdH5vdEt/DmboFfeO4XqNGa13TT/t+u9HPekGix XpNGpXcRoOX903xp234FyB4H4aDyLkkGxf6Jo8OLHkoziv03OHuKn3IqQBr+HKgsmR lILAu0h9VkJAw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 15/22] mmc: tmio: change bus_shift to unsigned int Date: Sat, 25 Nov 2017 01:24:50 +0900 Message-Id: <1511540697-27387-16-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sane values for bus_shift are: 0 - for 16 bit bus 1 - for 32 bit bus 2 - for 64 bit bus "unsigned long" is too much. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/tmio_mmc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 Reviewed-by: Wolfram Sang diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 9f083dc..27894474 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -139,7 +139,7 @@ struct tmio_mmc_host { struct scatterlist *sg_orig; unsigned int sg_len; unsigned int sg_off; - unsigned long bus_shift; + unsigned int bus_shift; struct platform_device *pdev; struct tmio_mmc_data *pdata; From patchwork Fri Nov 24 16:24:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119604 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2442948qgn; Fri, 24 Nov 2017 08:26:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMYXqBSAqZw0VSZT3bHBnxZZGqrOeDOjwyNDQWNMan65nSn+Oo21xiu3uZ76Dsrqn8ksWjc5 X-Received: by 10.159.194.14 with SMTP id x14mr7939661pln.86.1511540803656; Fri, 24 Nov 2017 08:26:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540803; cv=none; d=google.com; s=arc-20160816; b=FNKFaCKVczKOQZrHhNlhPpE8l62NSvt5MXsoF2tI0yqRalI1amDI6D7waV7VDUgfLc 207YPufNKOs2POUa/mcpIWTP7bIOn/ygiSVOC/7xAnrQOkwKD8yau8zSNYfuFRkIMzi+ yAGpufAU014ixKXw3wdsDWDjYScI/zGEPXlRj8nTe6gJtet6vrvxsowgi9ITv14StB3s gyE1pUO5VBQUmCoRIji35gKOdD/pa6rqQxN6ikUO2Q+yca7EnY8jhbMqu7AntjwbJuZS W5VUaSYBvIljF5v5ioz+q8u+GTBnr9qlg5NecJvZRc0kb1WBkhG/ddDVPlgZe+5c0UyM kMhA== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=NXBakLUMP5QARemfOoyjhHvmfGedly+ClC9qg78sKUI=; b=c3J7TayGHREDkLOsarfmWO/EW7jt3YimlWLBCj0wqSp7wmOTszaSsAgQYFRQ50ukGZ GJo4IDmFV4UMsQPVMI+ZrDHqzQnc5OtiZ3C3cWnsi0HOITmINJogx7M4ZAc+9CcLhBfC cHA6FgXph0gakt1vu8jDYs82pTQCQ5bQwRf4H3SCnFihPDLEHNeqp01F3RmV+YcnlE/U 5mQF9TPXlooPedX8j1gle6tKnSEnOlZ8Rw2LlnDTpnJBS9qTBsk4ka4s851tWQE57Zij zjCYTyg3x6xtXNGObmK4plc96uVlIMGh6z76FoY7uBoDj6s1a58oMd3UOLFbrv9jfnuk 3VSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=AMqD0SK+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si19621426plt.229.2017.11.24.08.26.43; Fri, 24 Nov 2017 08:26:43 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=AMqD0SK+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753846AbdKXQ0N (ORCPT + 28 others); Fri, 24 Nov 2017 11:26:13 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61633 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752304AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W2007100; Sat, 25 Nov 2017 01:25:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W2007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540723; bh=NXBakLUMP5QARemfOoyjhHvmfGedly+ClC9qg78sKUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AMqD0SK+gfpeM5z5pGlj0jU3JKn1czF7LnWHGuJSqmmLUvBuZgOu0ZkZ+B6LMAT9b haSdWykuY0Omb5INKxoA5Q6mrCWbl5t2GK4xeZfBrRQ2pGqf2290/PN+m9dtR9YCqV 98D/+6leZAMVtcMFPgvwdVZbfkigCbWLTah0n42cukwl1tS0VSPYT8LYo3xoR7d8J8 y3tyhMNTA7TGrk2/pQGPsYNi60nNbfCt6nhJuho4AnWn03lz5nzfvCrcetKFf+6wex 8yybqiJy2zfsKeE2byrd4GH3DK8Budo7bQo7EMvA9TUWO1p1xkBP9KEElAYSmsDMo9 pzyqaM6GmGCgA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 16/22] mmc: tmio: fix never-detected card insertion bug Date: Sat, 25 Nov 2017 01:24:51 +0900 Message-Id: <1511540697-27387-17-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The TMIO mmc cannot detect the card insertion in native_hotplug mode if the driver is probed without a card inserted. The reason is obvious; all IRQs are disabled by tmio_mmc_host_probe(), as follows: tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL); The IRQs are first enabled by tmio_mmc_start_command() as follows: if (!host->native_hotplug) irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); tmio_mmc_enable_mmc_irqs(host, irq_mask); If the driver is probed without a card, tmio_mmc_start_command() is never called in the first place. So, the card is never detected. The card event IRQs must be enabled in probe/resume functions. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index b51bb06..7d169ed 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -350,8 +350,6 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, c |= TRANSFER_READ; } - if (!host->native_hotplug) - irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); tmio_mmc_enable_mmc_irqs(host, irq_mask); /* Fire off the command */ @@ -1292,11 +1290,13 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, irq_mask |= TMIO_MASK_READOP; if (!_host->chan_tx) irq_mask |= TMIO_MASK_WRITEOP; - if (!_host->native_hotplug) - irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); _host->sdcard_irq_mask &= ~irq_mask; + if (_host->native_hotplug) + tmio_mmc_enable_mmc_irqs(_host, + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); + spin_lock_init(&_host->lock); mutex_init(&_host->ios_lock); @@ -1383,6 +1383,10 @@ int tmio_mmc_host_runtime_resume(struct device *dev) if (host->clk_cache) tmio_mmc_set_clock(host, host->clk_cache); + if (host->native_hotplug) + tmio_mmc_enable_mmc_irqs(host, + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); + tmio_mmc_enable_dma(host, true); if (tmio_mmc_can_retune(host) && host->select_tuning(host)) From patchwork Fri Nov 24 16:24:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119605 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2443112qgn; Fri, 24 Nov 2017 08:26:53 -0800 (PST) X-Google-Smtp-Source: AGs4zMbHb92cHzLyOQ03HBM/mOLI2OShP5Bd3B/tBmcM2qWiagE2LKPdNthgo83/4Jn64mTHY4mu X-Received: by 10.99.39.198 with SMTP id n189mr27630563pgn.78.1511540813501; Fri, 24 Nov 2017 08:26:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540813; cv=none; d=google.com; s=arc-20160816; b=zsFjMFreCxoj/nwAHG+RTPNElcjh/KNnm1FfyOimKtk3MxLnpP0Re0JiZAW/hjQ8gt 05vO2DIpKOp7emg8xrt+9GM0NuUIYH6srgDwimPdtEn5ZpPJkJyv2/VWlbrOlIIxie3p hEIDz+SX0oaxSlmP91USy3FbOF5Td/x7o6QOVGUgiT3tRDhzmMFMoL+4J5ooo27/ij6l IwpemTDrIMgeBi8Ob4Dc8p/vM4rz5Sp38inwQiBsyMWURRtxmYB6dTRHLTurMZwKzD6Z q4ZxqwhzgZ1EGFQMHZKwFRPfjw4hNrWtXuMhM6OtmpBXyRuhUgmei0AXCq3HVuIyQpGn GNIQ== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=8C+zOhnbQeTYvpea7T5tGqAWNkgTREME6b/JsxyFNTQ=; b=R7+pPolVrLhNMFhelE2Px6wGO0tttZiwCatVpsEMtGLGLWLI5N0meypcw3UrWD/cEi dL2+4nd0rBArylTkAKNAOX9gNIDkCCnhm3//5lAjb6+EFlgLAPa8xQTk4L6GDGjjrWwN lalvnjtwDOibdb70XBOnsduWx7ymccpbMnkmmA4e9OLpmyB9VNqQdafh64i5+vtFvcs7 GEnOmbE+mVcjENzz5dqvMIUn8R0FMGz9ZB23yyISACdc+aJxAFe1bz4ZpunKAAB496CU +j5MfNoxj/nodd0c1oLIHsbVHCdZT8XDgSs9MUcPNUXFfw/49CJh51oIRwFYa0GrBLev Yvrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=u4TGr6fs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si19621426plt.229.2017.11.24.08.26.53; Fri, 24 Nov 2017 08:26:53 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=u4TGr6fs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753830AbdKXQ0L (ORCPT + 28 others); Fri, 24 Nov 2017 11:26:11 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61628 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W3007100; Sat, 25 Nov 2017 01:25:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W3007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540724; bh=8C+zOhnbQeTYvpea7T5tGqAWNkgTREME6b/JsxyFNTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u4TGr6fsJMVEyzotJiclYDMGgsBO+Y+XliUbzzw62IY0HaiqQT8U98Kzo1FVYxLtQ cB/Sepjy2QY0MZLjImYze58W7R8QmJwopqy6Zf7sAr3zWyoL042a3LLa1dw8lXQnY4 xrisL1AxVD97aNVqHJnUsQFLko8+3odjfIf8RNr69GYBkKOv8KKpAMDvHoOk42NXiN D7loL091kESR85dwAt3Cs7MSQUkHztSXbZI1H2Su1FmcD8UKb6j2zUI4G/3RU5xSIU bljgPMpi00nWRuYt3NnOL4Dunk+QwaIjEK3kjxF22rFBAr6AMtmzwoYbZREPXOD10+ CodV/apTPGgkA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 17/22] mmc: tmio: move TMIO_MASK_{READOP, WRITEOP} handling to correct place Date: Sat, 25 Nov 2017 01:24:52 +0900 Message-Id: <1511540697-27387-18-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This driver was largely extended by Renesas, but actually used by several SoC vendors. The current code does not work for UniPhier SoCs at least. The DMA mode for UniPhier SoCs failed with the following error message: PIO IRQ in DMA mode! For UniPhier SoCs, the TMIO_MASK_{READOP,WRITEOP} are asserted in the DMA mode as well. In fact, the code is very strange. The TMIO_MASK_{READOP,WRITEOP} IRQs are set as follows: /* Unmask the IRQs we want to know about */ if (!_host->chan_rx) irq_mask |= TMIO_MASK_READOP; if (!_host->chan_tx) irq_mask |= TMIO_MASK_WRITEOP; At this point, _host->{chan_rx,chan_tx} are _always_ NULL because tmio_mmc_request_dma() is called after this code. Consequently, TMIO_MASK_{READOP,WRITEOP} are set whether DMA is used or not. tmio_mmc_cmd_irq() enables TMIO_MASK_{READOP,WRITEOP}, but never disables them. This does not take care of a case where ->force_pio is set, but unset later. After all, the correct place to handle those flags is just before starting the data transfer. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 7d169ed..345e379 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -621,15 +621,19 @@ static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host, unsigned int stat) */ if (host->data && (!cmd->error || cmd->error == -EILSEQ)) { if (host->data->flags & MMC_DATA_READ) { - if (host->force_pio || !host->chan_rx) + if (host->force_pio || !host->chan_rx) { tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_READOP); - else + } else { + tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_READOP); tasklet_schedule(&host->dma_issue); + } } else { - if (host->force_pio || !host->chan_tx) + if (host->force_pio || !host->chan_tx) { tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_WRITEOP); - else + } else { + tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_WRITEOP); tasklet_schedule(&host->dma_issue); + } } } else { schedule_work(&host->done); @@ -1285,12 +1289,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK); tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL); - /* Unmask the IRQs we want to know about */ - if (!_host->chan_rx) - irq_mask |= TMIO_MASK_READOP; - if (!_host->chan_tx) - irq_mask |= TMIO_MASK_WRITEOP; - _host->sdcard_irq_mask &= ~irq_mask; if (_host->native_hotplug) From patchwork Fri Nov 24 16:24:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119606 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2443280qgn; Fri, 24 Nov 2017 08:27:05 -0800 (PST) X-Google-Smtp-Source: AGs4zMa7M9ZUVRMU6qyuxbQ9o9h+WS6uFMBN6xCgrbQWdTFnmUc6UuRgCM5zpgYwixAGTZJ0dlKG X-Received: by 10.99.111.67 with SMTP id k64mr28384306pgc.234.1511540825648; Fri, 24 Nov 2017 08:27:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540825; cv=none; d=google.com; s=arc-20160816; b=ElVeGDyImnAlxWua6/teVgqr7FMzhmaeQSmcSZWN+54VMKz6AAHxQdDOGnYEmbV+mf O2w/qyGfeRWlGEkXdXCAi1oUtKswquFUJBzP7aTa8FjaP5IFL3jRv1/rw0bBCzPE7vql j3wSNfkV37Knm6OR5xByF8307UIMz6i0XG1dtKj9nmQSqmbQ630Z30sbKKk1sJCLnZO5 ZAUPtV8uqhwoRuTGwcA1M6qEDQI1Yu42xv2zN5W2imxii4CLGvdrCEYpTRUD7hC1vnkJ g0SrvoDIQ43i8Wc5j4SYaLukqTTfpGDoEm5C+sAXvajoZOVXjTFx8Ayw9nHGF6sk67Y8 wbWg== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=Z9AmOyayl4c1S87/wp/oI9oZDCFOvZwprDL24YdjVf4=; b=Os0iYnNE7P0tL2GfZiT/qiJDLMqvh19p4zfnpqOnmURjK7vqv5whOyX7RROVdkMp3c 9WvE34VSXv9Ca6RVUzbIqpBX/HOpI1D1aH32Ek1h4K8fykKl0xFL5hl7DJ8O734gOM4Y JYSmMnjtAl0cq4w0Idd2EGzanebqqYTkSO/wbamt4ce0T3nacnS3Lah73l9R544N/E97 RKHQ4yGWL7fABo1MiaAiqqBXn6Q26hthiyxAKeD32SFolTtzJvr3ycp5aYTfcdy6o2GM sR3Th6vCR5cFbyVzOpXvKr0VQRwb2vKn0eDB+yUGpV1LPTnE6N2FqxJGFeX4nP4G0WsZ pqPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=jI8ytPDf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si18314354pgp.418.2017.11.24.08.27.05; Fri, 24 Nov 2017 08:27:05 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=jI8ytPDf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753747AbdKXQ1D (ORCPT + 28 others); Fri, 24 Nov 2017 11:27:03 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61697 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753806AbdKXQ0K (ORCPT ); Fri, 24 Nov 2017 11:26:10 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W4007100; Sat, 25 Nov 2017 01:25:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W4007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540725; bh=Z9AmOyayl4c1S87/wp/oI9oZDCFOvZwprDL24YdjVf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jI8ytPDfb/8AfbJyoJKWhAw9jkVsg+hl937MMf4hqiheFApjsfgGr+LdcjmxprEdD 89eAQKggbFXPwHbQ+6+ibCZbU2jvou64AV9NKORRhhi/2ddw5iIcC+nJL+v9GHxxpn BuGP2d5bxGk4UiQCEnZpOpmxD7FyfGeG5rQvkUN1FTcjro/KqyoTf9y/uxCc6JLZI9 bThYOHiepNfeWwWjtY6728E9q+abPNSA6tl3gCL1IssReHt8J5N1FDiG3hJNAWaJLH 5qBNaly8wcyGe8RnoXz+TotYZARilAF8vy68Vhpd619g1B4Vdh5SkG3aQ8de8D47Aj FqC+Zd2EZSENQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 18/22] mmc: tmio: remove useless TMIO_MASK_CMD handling in tmio_mmc_host_probe() Date: Sat, 25 Nov 2017 01:24:53 +0900 Message-Id: <1511540697-27387-19-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org TMIO_MASK_CMD is properly enabled in tmio_mmc_start_command(). We have no reason to set it up in tmio_mmc_host_probe(). (If we really wanted to set it in the probe, we would have to do likewise when resuming.) Even worse, the following code is extremely confusing: _host->sdcard_irq_mask &= ~irq_mask; The logic is opposite between "->sdcard_irq_mask" and "irq_mask". The intention is not clear at a glance. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 3 --- 1 file changed, 3 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 345e379..f5b11b8 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1194,7 +1194,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, struct mmc_host *mmc = _host->mmc; struct resource *res_ctl; int ret; - u32 irq_mask = TMIO_MASK_CMD; tmio_mmc_of_parse(pdev, pdata); @@ -1289,8 +1288,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK); tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL); - _host->sdcard_irq_mask &= ~irq_mask; - if (_host->native_hotplug) tmio_mmc_enable_mmc_irqs(_host, TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); From patchwork Fri Nov 24 16:24:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119611 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2446232qgn; Fri, 24 Nov 2017 08:29:52 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ+nmEq2Io+cs9wXYDxyCGSrbBhjYtaJDnAhM7yti8KChu5qyWwd3b9M/i25wcMFG6sWk9i X-Received: by 10.84.232.8 with SMTP id h8mr22939884plk.274.1511540991912; Fri, 24 Nov 2017 08:29:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540991; cv=none; d=google.com; s=arc-20160816; b=0ybcEvWsHKJoyg70Y4Vxj8oMbNbWqWTbk9zD/N7JNAqWp1DywH+6UHK15Js6/6BsVN 7W9c1JYcezhmIzC6bsS6azsPyxeMM9N2bSqDsr82SXp+MMMp4kRCIEFHjUwm5h3fEBVX iQfD6kl1a4NaUN1S8KPDYS0dF8vLJm02Lbw2IP/YMhQh7fmZCsi+adWvAJdgJ+yJvYDV WJLazid09uv8ihjt/PvKPkZdHfYGfP+NTZ9cmUcH92xKJ15avqTtU5DID9jnWL/SqLEa tfcTSJHYl1K8NforeJUgmGhw30mxGkMBVtauR0ozvTd8pWjLxI01prfhxgYpqoO0zLoZ Zp4g== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=ApQOJB4Q/RVkBLUEaPdtl9pL2Yu6plA669hQat+GFwo=; b=QY1NP2ocpWudgLKcXwhbMYY2KTVBzSRBSi1cUE7B+i2ILBtb2tZhL4JEnVj8MkxJpD rdDql+8oY8/WQG8KGnBJcxR3/avj82W5g3aGY6xPQQsxjgo3f4M98mhx5SeTsQNhJAtm 8keVUxVbT/sKeLUynMdpy9JEkAQSMMZjphj4TEmKmFmswhv0r9vROfVcCOS3cBYmIIiK ZA/ZfkDNvzQahC/EhzEMH5KoVl4kvbCovfENN6fOWHjgYuXArm66T6A9Tdyg6Xzx1HWe 9R0W52BwLDNbIvkEgKexC/d95IUPFBCHJ52FfoLIx6qjH09MkuTBR10wJacgbN1oGkq8 IWPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=jU0R+xty; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si15602742pgf.431.2017.11.24.08.29.51; Fri, 24 Nov 2017 08:29:51 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=jU0R+xty; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753930AbdKXQ1W (ORCPT + 28 others); Fri, 24 Nov 2017 11:27:22 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61680 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753801AbdKXQ0J (ORCPT ); Fri, 24 Nov 2017 11:26:09 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W5007100; Sat, 25 Nov 2017 01:25:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W5007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540726; bh=ApQOJB4Q/RVkBLUEaPdtl9pL2Yu6plA669hQat+GFwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jU0R+xtyc1u8sz+c4SOYOcIwiziiKiNw60zmZf2P2Mz7mA4AnNfzBBCMpOc3Lt/wG n/7zshtpcEWFBsXLcheOct6OOgxJNgSro+9pEbNDu/2Lntg4Z0tyACB0ppASryZdNs 2IrsRTXQMUVbd4Ei5jqJVNVAUQjmshB1iDbHw+URT7MCS/QC9u247qtgRKRd5qkrRn Kuw7rB6aoQqmq4Ow/TNdp9JLAC6KkTppJl9O1oYhe86iaEtoj9P/M1VJv/bS+lb21R Gdo6lIpJM9SvR4MfFWlqbsfTITEFnWwhqPp1CE8iDosz3HXnh+ZUWXKelWrI9XFxF3 t/NOLx7S1NFlg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 19/22] mmc: tmio: ioremap memory resource in tmio_mmc_host_alloc() Date: Sat, 25 Nov 2017 01:24:54 +0900 Message-Id: <1511540697-27387-20-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The register region is ioremap'ed in the tmio_mmc_host_probe(), i.e. drivers cannot get access to the hardware before mmc_add_host(). Actually, renesas_sdhi_core.c reads out the CTL_VERSION register to complete the platform-specific settings. However, at this point, the MMC host is already running. Move the register ioremap to tmio_mmc_host_alloc() so that drivers can perform platform-specific settings between tmio_mmc_host_alloc() and tmio_mmc_host_probe(). I changed tmio_mmc_host_alloc() to return an error pointer to propagate the return code from devm_ioremap_resource(). Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/renesas_sdhi_core.c | 4 ++-- drivers/mmc/host/tmio_mmc.c | 4 +++- drivers/mmc/host/tmio_mmc_core.c | 16 +++++++++------- 3 files changed, 14 insertions(+), 10 deletions(-) -- 2.7.4 Reviewed-by: Wolfram Sang diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index e78dca7..446ff54 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -511,8 +511,8 @@ int renesas_sdhi_probe(struct platform_device *pdev, } host = tmio_mmc_host_alloc(pdev); - if (!host) - return -ENOMEM; + if (IS_ERR(host)) + return PTR_ERR(host); if (of_data) { mmc_data->flags |= of_data->tmio_flags; diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index ccfbc15..d660816 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -93,8 +93,10 @@ static int tmio_mmc_probe(struct platform_device *pdev) pdata->flags |= TMIO_MMC_HAVE_HIGH_REG; host = tmio_mmc_host_alloc(pdev); - if (!host) + if (IS_ERR(host)) { + ret = PTR_ERR(host); goto cell_disable; + } /* SD control register space size is 0x200, 0x400 for bus_shift=1 */ host->bus_shift = resource_size(res) >> 10; diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index f5b11b8..c392694 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1165,12 +1165,20 @@ tmio_mmc_host_alloc(struct platform_device *pdev) { struct tmio_mmc_host *host; struct mmc_host *mmc; + struct resource *res; + void __iomem *ctl; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + ctl = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(ctl)) + return ERR_CAST(ctl); mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev); if (!mmc) - return NULL; + return ERR_PTR(-ENOMEM); host = mmc_priv(mmc); + host->ctl = ctl; host->mmc = mmc; host->pdev = pdev; host->ops = tmio_mmc_ops; @@ -1192,7 +1200,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, { struct platform_device *pdev = _host->pdev; struct mmc_host *mmc = _host->mmc; - struct resource *res_ctl; int ret; tmio_mmc_of_parse(pdev, pdata); @@ -1200,11 +1207,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT)) _host->write16_hook = NULL; - res_ctl = platform_get_resource(pdev, IORESOURCE_MEM, 0); - _host->ctl = devm_ioremap_resource(&pdev->dev, res_ctl); - if (IS_ERR(_host->ctl)) - return PTR_ERR(_host->ctl); - ret = mmc_of_parse(mmc); if (ret < 0) return ret; From patchwork Fri Nov 24 16:24:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119610 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2446067qgn; Fri, 24 Nov 2017 08:29:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMZiDTju0xwa9cl1izP7kXanH5fRosZuk690eiMpNaHw9Bm9R/n9LnJMZp/lPrtP+ekMIFwD X-Received: by 10.99.95.143 with SMTP id t137mr29286509pgb.442.1511540980849; Fri, 24 Nov 2017 08:29:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540980; cv=none; d=google.com; s=arc-20160816; b=pkwtml0gXvma9j5X1n6ivyBZLTI+zxeJ8puA08JfFK6UhT/Z5w8KJ1Nu+gY9hyOqWe /rjBI4trANL99c+6XNADUf258Rf0gCyCM6uZQRcv2k22kBFywLG0Gn/f8Iz6RuX1A1g7 YgWry21fnZS1VphMwxYdX/3jzHm3/XRlLs+myGE46nhHsbmMjIJ1VDmmZfM2cPEE8qow eJoX/PqwA3HYuC28XAA69fXttPknRDK9tis+mCI7donhKIp+LC9QvCZEEB+s/wXQDPl5 vQfrcEPSW28rHQL65porSaCECwrUE4sCqNL5FSrtkknrvRKKRxqcyIWIb7izhoteP7c2 Zt8g== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=S91wHNY7h8tN6mbrQvs6YthdvnXB1YVWEjXFovXOE3I=; b=DgivLbeLoZWcVPOvli9WIWCefjYN7qpOhq7M7lbs2y7nDGXxA6EoZCe/y0RlAr5Eib 7+jDScCmftP8lj1Ypck/LWfJelUFEgzG4R5z275nDkXJJx+6h/DzgPFV6VFWnciv9LVK iy+7RQ8u/jJhR3+Q5gIEEWj4Ce7dEjuvF12/jicXtM0Bt3LGetxkwnL6o8Aotz+dy+Y6 YWKWk9t6WLkggrs7hGSXcZqEhAiQ3iRb+Ed6u8Z9Am85Nez9KJ05XleDcSBhuVvnVE8J VVahd5oN0REbLPrXm/xucD+pvP3jnUWAgJjN0UsnbqO7ojnZBL5zboHqK5NKoiZgYNy8 2byA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w8gcsusj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j185si18459893pgd.620.2017.11.24.08.29.40; Fri, 24 Nov 2017 08:29:40 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w8gcsusj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753948AbdKXQ1Y (ORCPT + 28 others); Fri, 24 Nov 2017 11:27:24 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61642 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753796AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W6007100; Sat, 25 Nov 2017 01:25:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W6007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540726; bh=S91wHNY7h8tN6mbrQvs6YthdvnXB1YVWEjXFovXOE3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w8gcsusjn0XBMns1bfNCXVZHjIdCn9OEfgVwvWjptOAdcioQgzpJv3QlfEJrOsjIk PLGs0Z0q+9QXOkh+eOlWss0rlwnGz19enYuBQSaEAUi+b21A0lihNeyTye10NfgOcb c4fHHOS7G841c0AnV7BF8Am2QrAfwuJ+wtOVW10AHwhBYykobMDZZbYQjn8yLP4Ylv kvuCHMumo0Zv9x8nMlfhAwhKwF9xNB7DXAcb/12rZEvEK13VDltHCxQ2uCQ2Cfz5GZ soj+7eCDl6Ak+/QoZZMSu37UydvWrYVWovcQhWYWHALF5TWeJ9tQ338Z7w9MY+fx70 8d5ZvyVYrVkjw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 20/22] mmc: tmio: move clk_enable/disable out of tmio_mmc_host_probe() Date: Sat, 25 Nov 2017 01:24:55 +0900 Message-Id: <1511540697-27387-21-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The clock is enabled in the tmio_mmc_host_probe(). It also prevents drivers from performing platform-specific settings before mmc_add_host() because the register access generally requires a clock. Enable/disable the clock in drivers' probe/remove. Also, I passed tmio_mmc_data to tmio_mmc_host_alloc() because renesas_sdhi_clk_enable() needs it to get the private data from tmio_mmc_host. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/renesas_sdhi_core.c | 13 ++++++++++--- drivers/mmc/host/tmio_mmc.c | 7 +++++-- drivers/mmc/host/tmio_mmc.h | 4 ++-- drivers/mmc/host/tmio_mmc_core.c | 33 +++++++++++++-------------------- 4 files changed, 30 insertions(+), 27 deletions(-) -- 2.7.4 Reviewed-by: Wolfram Sang diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 446ff54..a5749d7 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -510,7 +510,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, "state_uhs"); } - host = tmio_mmc_host_alloc(pdev); + host = tmio_mmc_host_alloc(pdev, mmc_data); if (IS_ERR(host)) return PTR_ERR(host); @@ -570,10 +570,14 @@ int renesas_sdhi_probe(struct platform_device *pdev, /* All SDHI have SDIO status bits which must be 1 */ mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS; - ret = tmio_mmc_host_probe(host, mmc_data, dma_ops); - if (ret < 0) + ret = renesas_sdhi_clk_enable(host); + if (ret) goto efree; + ret = tmio_mmc_host_probe(host, dma_ops); + if (ret < 0) + goto edisclk; + /* One Gen2 SDHI incarnation does NOT have a CBSY bit */ if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN2_SDR50) mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY; @@ -634,6 +638,8 @@ int renesas_sdhi_probe(struct platform_device *pdev, eirq: tmio_mmc_host_remove(host); +edisclk: + renesas_sdhi_clk_disable(host); efree: tmio_mmc_host_free(host); @@ -646,6 +652,7 @@ int renesas_sdhi_remove(struct platform_device *pdev) struct tmio_mmc_host *host = platform_get_drvdata(pdev); tmio_mmc_host_remove(host); + renesas_sdhi_clk_disable(host); return 0; } diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index d660816..11b87ce 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -92,7 +92,7 @@ static int tmio_mmc_probe(struct platform_device *pdev) pdata->flags |= TMIO_MMC_HAVE_HIGH_REG; - host = tmio_mmc_host_alloc(pdev); + host = tmio_mmc_host_alloc(pdev, pdata); if (IS_ERR(host)) { ret = PTR_ERR(host); goto cell_disable; @@ -101,7 +101,10 @@ static int tmio_mmc_probe(struct platform_device *pdev) /* SD control register space size is 0x200, 0x400 for bus_shift=1 */ host->bus_shift = resource_size(res) >> 10; - ret = tmio_mmc_host_probe(host, pdata, NULL); + host->mmc->f_max = pdata->hclk; + host->mmc->f_min = pdata->hclk / 512; + + ret = tmio_mmc_host_probe(host, NULL); if (ret) goto host_free; diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 27894474..f46d282 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -195,10 +195,10 @@ struct tmio_mmc_host { const struct tmio_mmc_dma_ops *dma_ops; }; -struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev); +struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, + struct tmio_mmc_data *pdata); void tmio_mmc_host_free(struct tmio_mmc_host *host); int tmio_mmc_host_probe(struct tmio_mmc_host *host, - struct tmio_mmc_data *pdata, const struct tmio_mmc_dma_ops *dma_ops); void tmio_mmc_host_remove(struct tmio_mmc_host *host); void tmio_mmc_do_data_irq(struct tmio_mmc_host *host); diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index c392694..b51486d 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1160,8 +1160,8 @@ static void tmio_mmc_of_parse(struct platform_device *pdev, pdata->flags |= TMIO_MMC_WRPROTECT_DISABLE; } -struct tmio_mmc_host* -tmio_mmc_host_alloc(struct platform_device *pdev) +struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, + struct tmio_mmc_data *pdata) { struct tmio_mmc_host *host; struct mmc_host *mmc; @@ -1181,9 +1181,12 @@ tmio_mmc_host_alloc(struct platform_device *pdev) host->ctl = ctl; host->mmc = mmc; host->pdev = pdev; + host->pdata = pdata; host->ops = tmio_mmc_ops; mmc->ops = &host->ops; + platform_set_drvdata(pdev, host); + return host; } EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc); @@ -1195,13 +1198,20 @@ void tmio_mmc_host_free(struct tmio_mmc_host *host) EXPORT_SYMBOL_GPL(tmio_mmc_host_free); int tmio_mmc_host_probe(struct tmio_mmc_host *_host, - struct tmio_mmc_data *pdata, const struct tmio_mmc_dma_ops *dma_ops) { struct platform_device *pdev = _host->pdev; + struct tmio_mmc_data *pdata = _host->pdata; struct mmc_host *mmc = _host->mmc; int ret; + /* + * Check the sanity of mmc->f_min to prevent tmio_mmc_set_clock() from + * looping forever... + */ + if (mmc->f_min == 0) + return -EINVAL; + tmio_mmc_of_parse(pdev, pdata); if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT)) @@ -1211,9 +1221,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, if (ret < 0) return ret; - _host->pdata = pdata; - platform_set_drvdata(pdev, _host); - _host->set_pwr = pdata->set_pwr; _host->set_clk_div = pdata->set_clk_div; @@ -1261,18 +1268,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, if (pdata->flags & TMIO_MMC_MIN_RCAR2) _host->native_hotplug = true; - if (tmio_mmc_clk_enable(_host) < 0) { - mmc->f_max = pdata->hclk; - mmc->f_min = mmc->f_max / 512; - } - - /* - * Check the sanity of mmc->f_min to prevent tmio_mmc_set_clock() from - * looping forever... - */ - if (mmc->f_min == 0) - return -EINVAL; - /* * While using internal tmio hardware logic for card detection, we need * to ensure it stays powered for it to work. @@ -1344,8 +1339,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host) pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - - tmio_mmc_clk_disable(host); } EXPORT_SYMBOL_GPL(tmio_mmc_host_remove); From patchwork Fri Nov 24 16:24:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119609 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2443662qgn; Fri, 24 Nov 2017 08:27:27 -0800 (PST) X-Google-Smtp-Source: AGs4zMYGYqG/Mcl+H5RA3/q1AAeCYfQPthvXGlJUKu8pXQTsjBzFGJ3CJ5P2GM2Y8Y4YR2lRGRUP X-Received: by 10.84.132.46 with SMTP id 43mr30146471ple.126.1511540847442; Fri, 24 Nov 2017 08:27:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540847; cv=none; d=google.com; s=arc-20160816; b=y5WQDRsZaebOiVETGIfcQuYbZSwSvBDlM4/0lj39VM5AZwZxWWtulAnuYEMn2gXI/X 80zmRC0CqjxkB3g8KvZ+RyohDm7sPoh+0/I7+hvzwegDBc9JTCOVGgIyzMiwj3wWwQfF N7gVjEiyjc5e17NoeMN1sdG6hOjCQZ7UPIKzRSUlzZbvqwdvydxvRscO4gF1/lvFeFjd Alk/EUUJZMzAvNn2TtwirwxAuJ7xHUz32xbdCPeXEglC2v6dTfFdCX7FG0fZtHwGG6Ee J4M9GEBXpUvI/Y+nU7VPo6SWowr1w73bcft4TDa67VM2oTlDop+0dpGf/A+6R7gMukEL RdAQ== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=1cIUv9KdMSPzrljWce2XbD8cpoUY8AkwpXJ4QKnkkpI=; b=oDA4AMRemYjIY6puJVGIrNdsu1RR/u7HXs2R2XNRRRGNSQM0b/56x3k7q23lCVBXHk XJDdEaf1hzOeFSGxnm3SGpGWQBiyQKDEvo25/CxGU7lL/xt062CFS4cEIcOsT7vnlXzJ YvIGaVePN/+IcV70vv8GlLkhp7NNty8ZeqeI7D+RmITrDcLZiOoj8EjfLCW2ZejQ3zDk kuagU5/l8izSgAz2K/TkBH/jmUJOt5UWrUnIGl+XT3ES/Qlx8d2LOzf9wbZg1zUsyXUc EmALsoVGDJcBXs9/g41WKst0iGeAh5GAC3/3mg+j+kicmGEpMBknusslcZWxpFQ6e/OL LX8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Y1RRwF0V; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg3si15390634plb.167.2017.11.24.08.27.27; Fri, 24 Nov 2017 08:27:27 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Y1RRwF0V; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753982AbdKXQ10 (ORCPT + 28 others); Fri, 24 Nov 2017 11:27:26 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61634 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753600AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W7007100; Sat, 25 Nov 2017 01:25:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W7007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540727; bh=1cIUv9KdMSPzrljWce2XbD8cpoUY8AkwpXJ4QKnkkpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1RRwF0Vks4MY1188t9V/cw7hlO1iuudi3CPN9b0hbC3n5Y8Otx9PC0eTmxZz8/JY PsOhz/WTIEwfNP/ZTuFSVlTV9XlpSdmGQPli1le665pWBlXuQ519/m68IqpirOaWNB uyCDMkaKFeLDw1yfDXIs/3ybYOFyRb9xJI3jh1CpC5z3LHI4HpEZ4EN80CJrkZ13SG S1pKdUQ5E/JZ8LQjlaCP5qhlxCP0cLpmhvjZD4Wjsv/A0OanAZ90VxC9Is4viHmhXZ vn/SHO/nqU4w+EoXPQsiXgfhZOeHXgjEq+6H2wWrruObHTtm9bdkkS7Uoe48OvPgZh K514U9dqg/xog== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 21/22] mmc: tmio: move {tmio_}mmc_of_parse() to tmio_mmc_host_alloc() Date: Sat, 25 Nov 2017 01:24:56 +0900 Message-Id: <1511540697-27387-22-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mmc_of_parse() parses various DT properties and sets capability flags accordingly. However, drivers have no chance to run platform init code depending on such flags because mmc_of_parse() is called from tmio_mmc_host_probe(). Move mmc_of_parse() to tmio_mmc_host_alloc() so that drivers can handle capabilities before mmc_add_host(). Move tmio_mmc_of_parse() likewise. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.7.4 Reviewed-by: Wolfram Sang diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index b51486d..02e1438 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1167,6 +1167,7 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, struct mmc_host *mmc; struct resource *res; void __iomem *ctl; + int ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctl = devm_ioremap_resource(&pdev->dev, res); @@ -1185,9 +1186,21 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, host->ops = tmio_mmc_ops; mmc->ops = &host->ops; + ret = mmc_of_parse(host->mmc); + if (ret) { + host = ERR_PTR(ret); + goto free; + } + + tmio_mmc_of_parse(pdev, pdata); + platform_set_drvdata(pdev, host); return host; +free: + mmc_free_host(mmc); + + return host; } EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc); @@ -1212,15 +1225,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, if (mmc->f_min == 0) return -EINVAL; - tmio_mmc_of_parse(pdev, pdata); - if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT)) _host->write16_hook = NULL; - ret = mmc_of_parse(mmc); - if (ret < 0) - return ret; - _host->set_pwr = pdata->set_pwr; _host->set_clk_div = pdata->set_clk_div;