From patchwork Wed Jan 17 16:28:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124858 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp108099lja; Wed, 17 Jan 2018 08:43:14 -0800 (PST) X-Google-Smtp-Source: ACJfBoslrW/H012M9j/Pgy45NNe5ls2VJdW7w03j6sgSo0MZxuWirCLDdO4FgLexhTy0eY6zqaKl X-Received: by 10.159.218.144 with SMTP id w16mr32805692plp.237.1516207394619; Wed, 17 Jan 2018 08:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207394; cv=none; d=google.com; s=arc-20160816; b=NSmWq8jpe8P0Uq5YRNJ0gkdB0ZNc9ekH5nki6MKO0x3ZAfsRN/1aIHLVQbIz5IRqyY anVDWoA+bQJ40J93ZUkhqSozBY4iaEmEPrONyQa/UEJKIku/k+DVoGZDxrNjyoj1z8mY LPRYwK9hmNANRNeYc2TS5psLLRyvX2AXMm/drbajJi3I60iHgLJFhU/AtF7iV5YpCg7E RsveTE8Jz44cTyEcv7lkK+8bIaH6TXxmXjXTJQMMZzHdM5QFvZb86sht84UVOn4F/mhG K506Fr7xUvI5tUvzMiVspb7qgZq3D7r3BgCGcQrIQprTr6Xcr67J+ztD561yxlHBI3y6 QOxw== 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=8ZKN06Tx6Un4pYaU/SYoEBgmcA2aNqX3LW/g+/BsHSc=; b=xT0ABp2ZvG/6Enxgd/e9vt7glUgUOes48usEf+vC0Hrfv/9Rm4ASEYZgHdAPBHkEJs WYQkpBesP3EUrV0p0EZBGIry9tYe4gAex/XZUdyJUdeZbCCIVIh43AR4kp4WZCcChZB/ le1NW7Lc8rplCQQ8hxZ4RlHNe/PHcrU+IKrKgQL4LjrSqUQRrsk/i0fYTDYQuKEa9u7u ZzLVi9NLZ5YGvbc8MIHqe011ckZnzi1ftER6VgySIMGy9BXXQyY84EPYWdSI32GMy3Dm C1AC69ipTFEtfj6aYmUWvDumRq+65b67At9BEZG/35lkcQ4+EcG8Jj/VCZ3CzbFR6c7J UM3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=iaXxa4/X; 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 s15si4153362pgf.99.2018.01.17.08.43.14; Wed, 17 Jan 2018 08:43:14 -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=iaXxa4/X; 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 S932113AbeAQQmf (ORCPT + 28 others); Wed, 17 Jan 2018 11:42:35 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36683 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753810AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKl014790; Thu, 18 Jan 2018 01:28:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKl014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206501; bh=8ZKN06Tx6Un4pYaU/SYoEBgmcA2aNqX3LW/g+/BsHSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iaXxa4/X9TZlZWG8R9cGAmaGJt+9/9aEm3uVAIHe0leiYmGiJTIQQBlI1NsZwNF8v tcRUT3bARY4DCPqpc8+CCz5N1pIfurOcQfD1ygXzOO/H9wuH+LR4Aa/6ggDKEitu68 fi9xitetosMLiRkPU/lOA+VNWWl9R9kW8Tms3zpHHT0eS95gHkEq0ELLce26QOhCS7 bJ822Wwy6pDj26KzNXh4cPxJ97e0+DRit6VtegpONIJVN+8y77Dn64tD/3QgfrAgWv /L9LVhNEAhfq0A+NHLxreOTEDuZrFQT5lzYsxuJWjZyHNCke8usK/ODDo2WlSYL64c BMKFrT46DZ56A== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 01/16] mmc: tmio: ioremap memory resource in tmio_mmc_host_alloc() Date: Thu, 18 Jan 2018 01:28:01 +0900 Message-Id: <1516206496-16612-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 Reviewed-by: Wolfram Sang --- Changes in v3: None Changes in v2: None 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 diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 6a2988b..ccdde27 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -512,8 +512,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 610f26f..5f0f12a 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1150,12 +1150,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; @@ -1177,7 +1185,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; u32 irq_mask = TMIO_MASK_CMD; @@ -1186,11 +1193,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 Wed Jan 17 16:28:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124852 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp107511lja; Wed, 17 Jan 2018 08:41:27 -0800 (PST) X-Google-Smtp-Source: ACJfBotnWXfqQNypEv4OKvMg7xqpSQiU8VlFylDGp2QE82UF9YzGmsADle02jJbTHisZd+1zqG95 X-Received: by 10.159.253.68 with SMTP id b4mr44046446plx.220.1516207287426; Wed, 17 Jan 2018 08:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207287; cv=none; d=google.com; s=arc-20160816; b=d14ltNpi3LfoyxwmgSnz6i3W3M1tCmHZGNfztIqSJmLn+2IlMAmPy1DyPVb3/eoHHZ +OUZecmsKuvYuP20yrb9fUkaMyF7ZJn5YXZThO0NV3neGzXp/4pjNtl/A9ROPJijvdK/ u/oWyOGreve6f1orTZIOM0JHUQ0RXims4c+i3uESgleWTlBb4Ub3CUv8nBnm3BRObqPF kBKpItXN6KDdrZZr6QmqLdTqjN12aUnurvvV1A8fgMYgA0YarQDCUU0iKJPGoiw2CQVe zndCN+ewdLJv4rt7Z+q9G9bA6+iKElDgPuKRoZz0+MPWlTp4svY9Q1mYFBQijZWN2EbJ dkjQ== 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=8nzk6tRvMUc2im6t6Zshc7yaBP831kVjkiZyzNYtBjQ=; b=PFkj43ZDLXBrmP0IHlrFBFFn5peOUOj8MZFw4+pWrmtD8FoQF29Y/VT8c4ela41H1K xiFv/gOQEWLtO+b+iDgeJUlFExhM8kJ4C5YzqtXqrRi/qNtscxiOB5w0YhEginf43xXV IwjpfI1LIVbhvj8DwbOu7/T5k7o7BCCk7gpRK9UxwnumlcvoJzMZBTUUO8dDkcnAW/dh Jh4u67PitaOCyk8l4PtseVqqUFZvTdsyDxrwp2qwjXX4b3IHMv1R3EuDcGRW+UMo4iG3 kdO2vd4/IG8m2byLTxrZbFk6WHilObtnKB5/yKzXDgXzMxd3p292dYNYBB3DhCeDzHyD DWyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=tk/pJ0No; 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 l22si4686060pfb.353.2018.01.17.08.41.27; Wed, 17 Jan 2018 08:41: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=tk/pJ0No; 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 S1754447AbeAQQlZ (ORCPT + 28 others); Wed, 17 Jan 2018 11:41:25 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36690 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753834AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKn014790; Thu, 18 Jan 2018 01:28:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKn014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206502; bh=8nzk6tRvMUc2im6t6Zshc7yaBP831kVjkiZyzNYtBjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tk/pJ0NoX1WlAmtZDYwi4y9bvqsM1GHip5geR/74P4rxwspQ0CFQnfYEdcUaRlplf lQd7XxhCF0Gf1F7DiSEWHuoIxoKqh/+Ri/G+WXbbIxfGwd2ic1MCsY4F6Kfxr0k/6L rF2Lbv4V63IcVDTLmg9Kq+kRpOw6EI4Acg1WeUEHsmKOLh+apbDtuuwy9Y/I2nEQL8 NA8v1X5VKsn8S4DLdIblTRhCktG3CxxpTB7YAxS1oPYcwQnClztMs5ZAeHJ7M7LlJa dJXnExZCFcySOeLlwjAuXk+/HSYYUP5V2fAU11VShxS6rDTdE2T8inQrYMfEwmpOgX ClNSSPLd82ZKg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 03/16] mmc: tmio: move {tmio_}mmc_of_parse() to tmio_mmc_host_alloc() Date: Thu, 18 Jan 2018 01:28:03 +0900 Message-Id: <1516206496-16612-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 Reviewed-by: Wolfram Sang --- Changes in v3: None Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 55442ed..fc9b28d 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1152,6 +1152,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); @@ -1170,9 +1171,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); @@ -1198,15 +1211,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; From patchwork Wed Jan 17 16:28:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124833 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp103409lja; Wed, 17 Jan 2018 08:29:40 -0800 (PST) X-Google-Smtp-Source: ACJfBosw5aKdrVL0l0+pfh+iL6fzWlrSSxBgQOdptAeCzc5DrEw20pSaw/sYOWFJUiX9ucBWzUOt X-Received: by 10.84.242.69 with SMTP id c5mr34973995pll.358.1516206580508; Wed, 17 Jan 2018 08:29:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516206580; cv=none; d=google.com; s=arc-20160816; b=dPQb/CXcJ+FCgRS7fFJ5+YozW0ueCr0KY5lGQQ1rrbqAAQKAQCwmO9/j2qtOlLAhLC rvboJsEZDM79dos/pN3vmmtidb1GL8hWnfH2d5piBlZIgBKR1CXFY4iqP2xMPBW8/N7c hrkVRQn3GxbZC6CsNij1plBIQElzebguCTeEg66HE5BJOAu37XcJkTSzHA6eJoTy7njY NAPltMKk18h3We2tUJd5g63OtlC0U1Qh85Pj18fRgo+Cp3LZNO9h9dqOFnk6K9VefSvi nhgvGtZp/J6w6XkcvsTjVxYBk3gtuCRgfNkz+Llkc3L1U2KLX3adLS21+HxcI46c8MkT ue3A== 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=xqFU6F7Jecy8/7Pro/S+HEUnnMh7H5gX2lu10hVBtHo=; b=Q94ajZHCp1H+09uP9OZxXNd46Bgje1vywANCm6QJNQ/0iAZtdBmcnn57wOH31zYd3P 6HPLR8jNLoaM6lWIc9hCugvc+abxcZ69Y8vOTpvgeuzsOU0osIBCuWi25afaEylDfowe +Sjoi8k1b33kLLghTwrv2sJbS9cET3oqdjntooeTpWW3jf6s2AqlSyOK8+deeEout7ys mxCPFMy3m79PZ9mXkLcd6V9XeKLTG+WOP7mUyzNnmj4nuTHz3iVoaBxvFS3G/PYCt2bX 1uOInrKXxObOWOUMnVEq/Wv+iOuaIIFj3bfTfrLifm18FpXz5BIfIYn2z+0Ma5+5x6/x BKFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=kBBcEvDN; 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 b3si4562356plb.293.2018.01.17.08.29.40; Wed, 17 Jan 2018 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=kBBcEvDN; 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 S1754070AbeAQQ3i (ORCPT + 28 others); Wed, 17 Jan 2018 11:29:38 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36663 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753787AbeAQQ3b (ORCPT ); Wed, 17 Jan 2018 11:29:31 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKo014790; Thu, 18 Jan 2018 01:28:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKo014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206503; bh=xqFU6F7Jecy8/7Pro/S+HEUnnMh7H5gX2lu10hVBtHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kBBcEvDN07OKdN1NgPxWThPuwqPUE3c+Oz9XuURtSWHxLi9lscZqe9VG5b6Spm3aT k5qSiv4AVTeyHGSHdea0lN6YDc/2CsMUolRdU4X/Q+j4yQk47FFgMej62/atbZkvEN Rv4lb0n22VZVDaVxC27HdIkp4gvHqGG3JYHVitxPUjAnKFakUAUsplqXitJIGIawIh j3c57A1HhyDhdB1ASwHI8POyppMj85ZjxIc6TWQUvkMKLPkakyXyE2Uh4FnhRNhOiF GmNU83hcdV2KP8BS1K5S3WMX/3nPQ012/h4RkGNK9ZfTuO9gXss9RwIm9JkBvxl2Xl 5M3ou6J/hmGlg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 04/16] mmc: tmio: remove dma_ops from tmio_mmc_host_probe() argument Date: Thu, 18 Jan 2018 01:28:04 +0900 Message-Id: <1516206496-16612-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 need to set up various struct members for tmio_mmc_host before calling tmio_mmc_host_probe(). Do likewise for host->dma_ops instead of passing it as a function argument. Signed-off-by: Masahiro Yamada Reviewed-by: Wolfram Sang --- Changes in v3: None Changes in v2: None drivers/mmc/host/renesas_sdhi_core.c | 3 ++- drivers/mmc/host/tmio_mmc.c | 2 +- drivers/mmc/host/tmio_mmc.h | 3 +-- drivers/mmc/host/tmio_mmc_core.c | 4 +--- 4 files changed, 5 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index e18a1c5..80943fa 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -532,6 +532,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, host->clk_update = renesas_sdhi_clk_update; host->clk_disable = renesas_sdhi_clk_disable; host->multi_io_quirk = renesas_sdhi_multi_io_quirk; + host->dma_ops = dma_ops; /* SDR speeds are only available on Gen2+ */ if (mmc_data->flags & TMIO_MMC_MIN_RCAR2) { @@ -575,7 +576,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (ret) goto efree; - ret = tmio_mmc_host_probe(host, dma_ops); + ret = tmio_mmc_host_probe(host); if (ret < 0) goto edisclk; diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index 11b87ce..43a2ea5 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -104,7 +104,7 @@ static int tmio_mmc_probe(struct platform_device *pdev) host->mmc->f_max = pdata->hclk; host->mmc->f_min = pdata->hclk / 512; - ret = tmio_mmc_host_probe(host, NULL); + ret = tmio_mmc_host_probe(host); if (ret) goto host_free; diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index f46d282..7609434 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -198,8 +198,7 @@ struct tmio_mmc_host { 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, - const struct tmio_mmc_dma_ops *dma_ops); +int tmio_mmc_host_probe(struct tmio_mmc_host *host); 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 fc9b28d..d092b0f 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1195,8 +1195,7 @@ 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, - const struct tmio_mmc_dma_ops *dma_ops) +int tmio_mmc_host_probe(struct tmio_mmc_host *_host) { struct platform_device *pdev = _host->pdev; struct tmio_mmc_data *pdata = _host->pdata; @@ -1296,7 +1295,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, INIT_WORK(&_host->done, tmio_mmc_done_work); /* See if we also get DMA */ - _host->dma_ops = dma_ops; tmio_mmc_request_dma(_host, pdata); pm_runtime_set_active(&pdev->dev); From patchwork Wed Jan 17 16:28:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124857 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp108091lja; Wed, 17 Jan 2018 08:43:13 -0800 (PST) X-Google-Smtp-Source: ACJfBov2tFzybDSJP1nbOJ40C0iY/n8pAIyvoihSZhbPNEPqfINWWATfvRMn6qXd0uYURfXcvmSC X-Received: by 10.84.164.199 with SMTP id l7mr9153138plg.268.1516207393699; Wed, 17 Jan 2018 08:43:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207393; cv=none; d=google.com; s=arc-20160816; b=mHzF40TGfRcS4D+i+X/kF6duUbffXO+TNYD6a0/ygPURqZlcM8AV6uLQvs5FtsFt2L J9lDIOK5iIft2bIpCrKPM/QAxzvlPrxp9N1kCpuDeqB1kjV/2haEbqNMnNwWFD6YaETb sXo3ii5Xzk+cvof0gp1eHlF2seTGx7qzMQRJKSZbW5xIZXFJPtNZrfrBlAcCkgYmAFUM 6tz91aB1QiiXU2znIHju4IwEik6RYwCSbYD7pjAgetcM1SCiHmdv4oX9uUtnkOs0ZCzU TvnAF4c9y8aEwPfz5iQkq1txJ/x83qxoXXLfo8S8L2xwMB4kL7JaUepp2JJe6M+btRb6 Wd2Q== 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=Ezad6ThRqzRJnQ+xDo36qS+fesboIPKG/bSZMu5uCHg=; b=eMQR5cNP8xRCm4BsLxtO9DHu4f9J1/9odQjHmo0BqemFz5sjIkxjCpOAcsRnlXXuO8 pItyg61M2L0QT6PgY8NXm6tsO0lySlA/Me/kaU1LKwQiy6BPdq0jUBOSZHSAI4QSyPug 8ZdrqO20JEdXd67MWC5uA7GfyNQhftc9O4i1dJxifbBfx39ch682cZM/cTfeXMZJeuKl 4ZEIgE+tAJsH3TolLXUbgwpFdrDqBEsnpRRI4PfwVPeCYBrrFbgs1k2jb8wVdxFtIysY v79vhuDeEwXqV8Bq7s2mVAZPkNiOwgH7Dss/xSdvlcP68nbuHF+jRnOgDnmIfpAPPPfM mT2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=TUh3V9vV; 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 s15si4153362pgf.99.2018.01.17.08.42.59; Wed, 17 Jan 2018 08:43:13 -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=TUh3V9vV; 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 S932218AbeAQQmh (ORCPT + 28 others); Wed, 17 Jan 2018 11:42:37 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36682 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753794AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKp014790; Thu, 18 Jan 2018 01:28:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKp014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206504; bh=Ezad6ThRqzRJnQ+xDo36qS+fesboIPKG/bSZMu5uCHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TUh3V9vV8dy968IvVvSxIIKpo5J+eNu+iu6ftbugq82PqQNLBKuyIRklvGNHRaaNK v1/WMEkWva1T7L5hURQWIIddQkotLJlaxMESZerPMKbgXbTOhLNwWYN1CSkFSniTi0 MlxGq4/dEyqQN+C1i4S+MiSErsX1PB3/8rR/TorFGyutJlBDjX1Y/7hlXTYEhifJy0 YJhVvWmRfUBvZvehv2IR+lSteB4/+rmJdeWb2jI9mj8q0pFBNdTJZStoocPzVEwWUH 3FTDHhn/75sJSUMBreuY1O4Qo6TN8RDfKBoPtWavBBWa5Dp3w2VV8YUXNPt+z3PInd hwBDPVrgkXGtA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 05/16] mmc: slot-gpio: add a helper to check capability of GPIO WP detection Date: Thu, 18 Jan 2018 01:28:05 +0900 Message-Id: <1516206496-16612-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 Like mmc_can_gpio_cd(), mmc_can_gpio_ro() will also be useful for host drivers to know whether GPIO write-protect detection is supported. Signed-off-by: Masahiro Yamada --- Changes in v3: - newly added Changes in v2: None drivers/mmc/core/slot-gpio.c | 8 ++++++++ include/linux/mmc/slot-gpio.h | 1 + 2 files changed, 9 insertions(+) -- 2.7.4 Reviewed-by: Wolfram Sang diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index f7c6e05..3698b05 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -305,3 +305,11 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, return 0; } EXPORT_SYMBOL(mmc_gpiod_request_ro); + +bool mmc_can_gpio_ro(struct mmc_host *host) +{ + struct mmc_gpio *ctx = host->slot.handler_priv; + + return ctx->ro_gpio ? true : false; +} +EXPORT_SYMBOL(mmc_can_gpio_ro); diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h index 82f0d28..91f1ba0 100644 --- a/include/linux/mmc/slot-gpio.h +++ b/include/linux/mmc/slot-gpio.h @@ -33,5 +33,6 @@ void mmc_gpio_set_cd_isr(struct mmc_host *host, irqreturn_t (*isr)(int irq, void *dev_id)); void mmc_gpiod_request_cd_irq(struct mmc_host *host); bool mmc_can_gpio_cd(struct mmc_host *host); +bool mmc_can_gpio_ro(struct mmc_host *host); #endif From patchwork Wed Jan 17 16:28:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124853 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp107586lja; Wed, 17 Jan 2018 08:41:40 -0800 (PST) X-Google-Smtp-Source: ACJfBovYkZ2UdRawBVveWwWasAWpX+Bxzj2ihxpioHbSR8OurWJfIva3S+XCAgyXp4bPtO6x+U4Z X-Received: by 10.99.96.210 with SMTP id u201mr32896844pgb.248.1516207300781; Wed, 17 Jan 2018 08:41:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207300; cv=none; d=google.com; s=arc-20160816; b=maGGWqDlmzmOdZpyOXLj7KZT8EqQkaBvR/dwF3Ovcr7buF0GQICVJ5v4fhaoLBhJ0T YFsvn3frdypj0LQji5Nx2ra+2kCDiPlmNGXVfd80zaou2V/XRPobrd++n+Zphew72Z4t BhNCZjtpqNziKdLwsLK7U/KrCv+w9yJgJk+nrYVVWQPKiCCueCN/tC+kJ/PASPCmWyS1 UpMJmFwvW/jgzUXj8Vl8T6pRYCKMhCd+bRGxGHypEp3ci3zLM6Vh3IhgsSmlSi1AGvfk FiaqH5uV7wE0Q8IlPLFrY9492li2ryFq/SqXRPfr8ef+Q8U2pVge8GGfNivouM6wMZNx 1Wug== 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=wH/PHfL4hb/LgN7K8zg1Hwzn9h5eS6SMZaKfIThz8M8=; b=BNNNoOHdI4R49fZjtnOeYoA9dqTK93Ag1NRJtMex21MXVlj1wCsfvMIp/opgL3B5T4 Ai4a4vl7EDFza9TS2ZLVB4iKtEzX1pdHEZQw56qrI+1GtbM+eBIRtO/XnY4WixO4Isjt 6ISbfd4aOe5USLtZ05CufnKF8AKJrUFTfAo/RuMjb8Xr/wd5ZyCfLocNKKrD3kviMOf8 8yZ3JWxuSdzKDnxao3CyG0WNhCCZMW1PD/LXiddvxOYyxSp4BTcKFbBzJ4zXLRD63H9P nxwCFdFLQdo/cX7E+dHOb0s73G2lNBYKC8ESnO0F0jQlcFTklrs5gOKyKo4/0S95mVHF z4Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=K7l0hANE; 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 l22si4686060pfb.353.2018.01.17.08.41.40; Wed, 17 Jan 2018 08:41: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=K7l0hANE; 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 S1754393AbeAQQlY (ORCPT + 28 others); Wed, 17 Jan 2018 11:41:24 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36689 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753839AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKq014790; Thu, 18 Jan 2018 01:28:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKq014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206505; bh=wH/PHfL4hb/LgN7K8zg1Hwzn9h5eS6SMZaKfIThz8M8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7l0hANEXhXajSrSu+PZyRkCSngaYuQC3UgloMXZ8EP8HOGeGcQlu6xYCHbO3i6R9 LyNsFQCzls6E3YOR26D8xUw0S45TbPUi4dSo0f2UxzFlS34tlRlOJ8lvTRYzSQbLNI VJKjgWSf7Er3/jmIUXEsNjowZ3ch2l8v5zWH9YfuDDPH5CtAbXibcG0ySfdgDbMl4+ DsCqCc5fS7xkrcSMrtGvhE1LmSpPzO5C52K6O2IaWbs9MZXduV2Xnby3h8bHNJBAMX xddpBBV80zeovs1ZmOkxeJq4AG3iVQmL8Vs/nmRwHnQsNFeGmkDppAr4WCg0ipVBEb 8H5ALEOORh5Ug== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 06/16] mmc: tmio: refactor .get_ro hook Date: Thu, 18 Jan 2018 01:28:06 +0900 Message-Id: <1516206496-16612-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 IP provides the write protect signal level in the status register, but it is also possible to use GPIO for WP. They are exclusive, so it is not efficient to call mmc_gpio_get_ro() every time from tmio_mmc_get_ro() if we know gpio_ro is not used. Check the capability of gpio_ro just once in the probe function, then set mmc_gpio_get_ro to .get_ro if it is the case. Signed-off-by: Masahiro Yamada --- Changes in v3: - newly added Changes in v2: None drivers/mmc/host/tmio_mmc_core.c | 13 +++++-------- 1 file changed, 5 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 d092b0f..0032707 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1076,15 +1076,9 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) { struct tmio_mmc_host *host = mmc_priv(mmc); struct tmio_mmc_data *pdata = host->pdata; - int ret = mmc_gpio_get_ro(mmc); - if (ret >= 0) - return ret; - - ret = !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) || - (sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); - - return ret; + return !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) || + (sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); } static int tmio_multi_io_quirk(struct mmc_card *card, @@ -1247,6 +1241,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) } mmc->max_seg_size = mmc->max_req_size; + if (mmc_can_gpio_ro(mmc)) + _host->ops.get_ro = mmc_gpio_get_ro; + _host->native_hotplug = !(mmc_can_gpio_cd(mmc) || mmc->caps & MMC_CAP_NEEDS_POLL || !mmc_card_is_removable(mmc)); From patchwork Wed Jan 17 16:28:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124846 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp106833lja; Wed, 17 Jan 2018 08:39:31 -0800 (PST) X-Google-Smtp-Source: ACJfBosZ6jAnep5348FLwn4ctVaLBVDuZvUUlNu7UzHPtGwCSwN8ZpcC8Q08e+1mmMF22wj0sNsJ X-Received: by 10.84.196.131 with SMTP id l3mr8451476pld.382.1516207170965; Wed, 17 Jan 2018 08:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207170; cv=none; d=google.com; s=arc-20160816; b=oq00WxjdNodEzPjG1LjC05kMQXaejAflvLyzE22Z4/Uf0XsxTvkXGa4LL5fRucbI9t kxUk+EUAdpg4Yeny8Tj1xjGcD4sO8/H+Vw0qriWhCMbDDvtKbXbDioupOiRcc5HP8C2x 8W8izTsC/zkU364iClGpO/pjfu7STO5NrX+OU8h2Bpzgo+9zaZ7Xjl0tu6JuBP0hkRd4 Mt62Q3atUKZjwy842C4AZYR6T2vgaqB5UfuCFRhmlnihYb5i7HAs9aqcKe9jUrJ8kXi7 VthGx8FH98FlX+fCbAGLaelGLBvtQ6IqlazXETc7z2lnDdi29hHhmbcKGtH6E/SKe0Lv ICMA== 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=lPTU6SyAcJ6Jm+4pQS3P7yGMXNesMRfvtAEaltWy+Is=; b=MAnemAtQ5aKjlAbh5W2hxpeg6+OQJ0IKe0TGbxFenOmsPMjjdTOFcmCaFkhhWwMm0O b/QVlZx5cCByVh87SDpcq9ghcsEhzrGLdp80cGUHsekHR3e+ra07axsAAUbr2W4OuHub 8XitdQkupCgDFASSZYZeY4AvstLHvZtbVG5eA56g3wtrnK27UD/EY242Wy2+eHD5lw0E JlVM8/qbfKenp70cH1Rb50PUDXKRnqMQ7B3urrSlAKnBuV7Hc7Bkkck6SW2kBjQYtCtJ cY3s5ZiF3BHFTUvptvSiexQ1YFJ8/+PVhlkgCgrwkSfDG6TXGc5//ymEtg3WdQ2UI558 meFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Cbr0SyTy; 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 i2si4582395plk.291.2018.01.17.08.39.30; Wed, 17 Jan 2018 08:39:30 -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=Cbr0SyTy; 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 S1754384AbeAQQj3 (ORCPT + 28 others); Wed, 17 Jan 2018 11:39:29 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36725 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753875AbeAQQ3e (ORCPT ); Wed, 17 Jan 2018 11:29:34 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKs014790; Thu, 18 Jan 2018 01:28:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKs014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206506; bh=lPTU6SyAcJ6Jm+4pQS3P7yGMXNesMRfvtAEaltWy+Is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cbr0SyTykBF/fd+t7acHZp+BMH+ZUozsfGsnAqD7YAFYsy8+NLipyifZwc3HnPbDb /b82qbmKIsDAgHK8MMSd2LS7cvDBKi/YmLkAJH49XWBJdJLw2JqeK5WRJLuorLdzPS R8r9ZmYgSx3Ce+sS1Yt0eVcC4y7yGlcoaLbGRtS3nfShfWymJrsD2ZKWETX/b7U/C6 hON7iUdsfUz01RyzoXANDG/EBzJO6DuADikkOkuVnJ6dvpfXt4MKczku3spYPRUbRC 2Ak/684fvdqaD54UETAjR1HX/b0oir6ZjYiwWLV5FrhC+uryRnp4bK4robyR6GQLNf ZTO8YsQzAsGIg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , Yoshinori Sato , Rich Felker , linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org Subject: [PATCH v3 08/16] sh: kfr2r09: use MMC_CAP2_NO_WRITE_PROTECT instead of TMIO own flag Date: Thu, 18 Jan 2018 01:28:08 +0900 Message-Id: <1516206496-16612-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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_MMC_WRPROTECT_DISABLE is equivalent to MMC_CAP2_NO_WRITE_PROTECT. The flag is propagated as follows: tmio_mmc_data::capabilities2 -> mmc_host::caps2 Only the difference is the TMIO_... makes tmio_mmc_get_ro() return 0 (i.e. it does not affect mmc_gpio_get_ro() at all), while MMC_CAP2_... returns 0 before calling ->get_ro() hook (i.e. it affects both IP own logic and GPIO detection). The TMIO MMC drivers do not set-up gpio_ro by themselves, so gpio_ro is obviously unused by legacy boards like this. So, this conversion should be safe. Signed-off-by: Masahiro Yamada --- Changes in v3: - newly added Changes in v2: None arch/sh/boards/mach-kfr2r09/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index 5deb2d8..6af7777 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c @@ -375,8 +375,8 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = { static struct tmio_mmc_data sh7724_sdhi0_data = { .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX, .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX, - .flags = TMIO_MMC_WRPROTECT_DISABLE, .capabilities = MMC_CAP_SDIO_IRQ, + .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT, }; static struct platform_device kfr2r09_sh_sdhi0_device = { From patchwork Wed Jan 17 16:28:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124854 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp107707lja; Wed, 17 Jan 2018 08:42:03 -0800 (PST) X-Google-Smtp-Source: ACJfBotgnzq4UCn0uRt/Ri9cqr0e3V9ZQVXyaSr1BgDrjzyDEKgDb8xOzkbmHDBQsJmD47PUwr7X X-Received: by 10.124.25.5 with SMTP id c5mr37089496plz.225.1516207323100; Wed, 17 Jan 2018 08:42:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207323; cv=none; d=google.com; s=arc-20160816; b=v5d/f1q4w5+qVo15Oo4uwG8bDo7Viv2tomoZtVXafKvhXY3zSn+zG7FPqBCmJ+Z8XG R/DSAdPEy4G7JtSAEkIIL8hdKdG19kIBW7FRQDf/XNGJpq97q6pdjV99gU+AlkbdeuEG kYPgB7RU3xDQUM/14f7ZULLsYpf6T+RzDEA+t3U/wuBXAq2ZAVnJljvO6q3F2oZmMTTp SSzCiefeZnQbn+3Uf9HxBy9wSZqRYu7sMpo6ArZHQtUlUvkNbcRdhbHFmLn9tcOEbljY pvkklja/P6wga4pkhRnebU9XejD+nvuMP52xvsA8AetKjuZap5kRFlOeIkpnDA8/aEv/ e6Cw== 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=XD57mYxuSxd6HYj2QZ1odMq4C5kRYWfk150yxr1/TDI=; b=O73Wa/ha97ApZcYTEGrXqSriKvoEzVSaGeZQjYJ6SzOK3ET1GMc8fsiP1NT9RLdTZ+ /gfA69gnRcCbMMkBe2mN7vtliMhfEGLmnAWYgQQHoCXBKuka5TxLi5oIor7UcgW77wPy OVfznrLOZoOj65ULfEEV7hiRgJd3pt9KVko83IKmiGeW/Zdsr39y7TYzznC2QnNMHNZa 2FyRm2qX7dvBPGrft9nQIM4wvdHo8ZtGRyxW+kw6IjovudH2nui/8vfE4/ezSGsYYOG1 9qFXUJ6Vh1ycK3FgTijref2W6myXRsFZaxp0A7jF8CQHLthHVfIiv0otcp9AJWY1LkAm qBAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ncRoUacs; 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 d25si4187059pge.729.2018.01.17.08.42.02; Wed, 17 Jan 2018 08:42: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=ncRoUacs; 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 S1754322AbeAQQlV (ORCPT + 28 others); Wed, 17 Jan 2018 11:41:21 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36691 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753845AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKu014790; Thu, 18 Jan 2018 01:28:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKu014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206508; bh=XD57mYxuSxd6HYj2QZ1odMq4C5kRYWfk150yxr1/TDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ncRoUacsZLpJhENQV2QElE+k/du97CMD6jbOnyfQG8qKFcpLrkwNLwUzyFyuV83p1 Ne3cqlYQpnawtghs+obTcreCQOiAJ+FnrbrlNTx90FlJuHlF0m5ye7jpAab8u7uz9E 5ny+6QcKrWrkoF3cIIxSMhI+Af4JRv0LUMlBMVeu8P0+1o1Pve2zxuD7r+C8esUyOW B6Co6DgI2bqPMwCI4RP62FA0h5e+zgvnVMfbcqjcO0s6s91L9MCYB9Jszr7tJ2FNSf 09o5dlTRSsGF0kghhUM+zVK9F7WVPB8JepzcRJa7KsuOlyC3qrkn56xncXsZIR3TVJ VM2Y8ys6pV6VQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , Lee Jones , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 10/16] mmc: tmio: remove TMIO_MMC_WRPROTECT_DISABLE Date: Thu, 18 Jan 2018 01:28:10 +0900 Message-Id: <1516206496-16612-11-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 use of this flag has been replaced with MMC_CAP2_NO_WRITE_PROTECT. No platform defines this flag any more. Remove. Signed-off-by: Masahiro Yamada --- Changes in v3: - newly added Changes in v2: None drivers/mmc/host/tmio_mmc_core.c | 5 ++--- include/linux/mfd/tmio.h | 1 - 2 files changed, 2 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 bdbff2d..7ad3433c 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1075,10 +1075,9 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) static int tmio_mmc_get_ro(struct mmc_host *mmc) { struct tmio_mmc_host *host = mmc_priv(mmc); - struct tmio_mmc_data *pdata = host->pdata; - return !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) || - (sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); + return !(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) & + TMIO_STAT_WRPROTECT); } static int tmio_multi_io_quirk(struct mmc_card *card, diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 396a103c..91f9221 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -36,7 +36,6 @@ } while (0) /* tmio MMC platform flags */ -#define TMIO_MMC_WRPROTECT_DISABLE BIT(0) /* * Some controllers can support a 2-byte block size when the bus width * is configured in 4-bit mode. From patchwork Wed Jan 17 16:28:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124866 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp108310lja; Wed, 17 Jan 2018 08:43:53 -0800 (PST) X-Google-Smtp-Source: ACJfBoue4qHebrshMdNftIfvrPROCNI9wY5/RUudGwJzKjpwTidACih/R7E4qRXmgvdk11befdae X-Received: by 10.101.74.208 with SMTP id c16mr16202811pgu.34.1516207433754; Wed, 17 Jan 2018 08:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207433; cv=none; d=google.com; s=arc-20160816; b=tzSrYyR19cKVBpyr449qkui6GSdsqS4ADkgmPaMnJFcrpPt/dkOSM9Jp8jpOYF73rb cEp5xh0FHQs4ETI6nLm6NEUuZPmclRi0KjbWLvADP15PnWyDNU9JqEhRhSXeU5b+SMdJ vHu3qruLuvYOlsxKUtgOQV6me3roH/G8TiQliSgiTGS/yLVkoeNOo646qQU6rOrg9cLb l7ngkokVQE9zSs851LnSp3DIottTYBItDirVrxQUfA4ZtV5ehSsI7NinqnM/S5sQrzr8 65+jxkszevNe8JnogMFfeEpe2OF2bxIx8JSGxYLTfnXFIH0smvIlyVKJqlNldW+k1K9o 6tHw== 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=eqOkqCtxoVK2uGn9ADPn/eYRAT5VvVc8Mkd4icKgVVw=; b=ogYvgYC0z0nbWOV53aFzHO/CWU429MQgAyVEXlVgNSaM+nuHlrpzw9ywkpCOTxlKF6 xWhn9aaxOuw/QDsW6GFB5I00dyOxn4gey5DvAwZQWUcZkLM56jhEQIe7TPa7xQUTMXjT EP+TYGf9fKXPVaVV4nvaD4gSNuFU/D6q48MrryV7ZtjcUqySkX1i8kF4/4AoclIBQsu6 kYahScYb56MDnlgiINyLAUcq7xiucs7hdgI0Q0bWw4bMAoIFzM9TqOx/Okh9ZNHkE7nT 8JWJpxlKl8kpCG1/0E2U9QrrObufb4NJV5dnorZ0LinBdAkzh/th60LmwWqUl/m+orCJ uz6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rDg8wfeH; 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 c19si4783714plo.278.2018.01.17.08.43.53; Wed, 17 Jan 2018 08:43: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=rDg8wfeH; 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 S932272AbeAQQnj (ORCPT + 28 others); Wed, 17 Jan 2018 11:43:39 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36662 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753715AbeAQQ3b (ORCPT ); Wed, 17 Jan 2018 11:29:31 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKw014790; Thu, 18 Jan 2018 01:28:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKw014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206510; bh=eqOkqCtxoVK2uGn9ADPn/eYRAT5VvVc8Mkd4icKgVVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rDg8wfeHZaJY4RSjJDa7T+89ebO5QYusrYfcyO4PPfv0tAVYl8eZW8MnhvUzbWEwx a0HFp9/FY/zLL170rizQfCugUWQHsYIN5kyP/QYXeeCOvbD3Ewd3d3coFlY/hXgdzS XTfe8mLnjTbOvPDjn5pn6CxL7M22GqLMcbwXNBJGFJyc/vQEGB7doOnSd1hL3mc7mV terkgA920Vv8LP1iEZ3iWBMpngqIsIhE80PFBuFXeeEmZ/chHYgcp9m5PAdOpneEMB 4ThgVLB+JLBy3tcEs/8IReF+eHl4ChOmI2XaGLiF0r052xoTvM3wdw9xpX3mjpTixL DM/MJwrDFUSDg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 12/16] mmc: tmio: support IP-builtin card detection logic Date: Thu, 18 Jan 2018 01:28:12 +0900 Message-Id: <1516206496-16612-13-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 A card detect GPIO is set up only for platforms with "cd-gpios" DT property or TMIO_MMC_USE_GPIO_CD flag. However, the driver core always uses mmc_gpio_get_cd, which just fails with -ENOSYS if ctx->cd_gpio is unset. The bit 5 of the status register provides the current signal level of the CD line. Allow to use it if the GPIO is unused. Signed-off-by: Masahiro Yamada --- Changes in v3: - split out GPIO CD Changes in v2: None drivers/mmc/host/tmio_mmc_core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- 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 f30ac69..b20d5c5 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1080,6 +1080,14 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) TMIO_STAT_WRPROTECT); } +static int tmio_mmc_get_cd(struct mmc_host *mmc) +{ + struct tmio_mmc_host *host = mmc_priv(mmc); + + return !!(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) & + TMIO_STAT_SIGSTATE); +} + static int tmio_multi_io_quirk(struct mmc_card *card, unsigned int direction, int blk_size) { @@ -1095,7 +1103,7 @@ 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, - .get_cd = mmc_gpio_get_cd, + .get_cd = tmio_mmc_get_cd, .enable_sdio_irq = tmio_mmc_enable_sdio_irq, .multi_io_quirk = tmio_multi_io_quirk, .hw_reset = tmio_mmc_hw_reset, @@ -1248,6 +1256,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) if (mmc_can_gpio_ro(mmc)) _host->ops.get_ro = mmc_gpio_get_ro; + if (mmc_can_gpio_cd(mmc)) + _host->ops.get_ro = mmc_gpio_get_cd; + _host->native_hotplug = !(mmc_can_gpio_cd(mmc) || mmc->caps & MMC_CAP_NEEDS_POLL || !mmc_card_is_removable(mmc)); From patchwork Wed Jan 17 16:28:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124864 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp108230lja; Wed, 17 Jan 2018 08:43:42 -0800 (PST) X-Google-Smtp-Source: ACJfBoug8Y1rC/TfmCNWTFxs7YxoSp3h94iU50ec282GLkITGia8COU/Rpq6FktK2yRRC4z5jRjn X-Received: by 10.98.242.77 with SMTP id y13mr13033019pfl.156.1516207421950; Wed, 17 Jan 2018 08:43:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207421; cv=none; d=google.com; s=arc-20160816; b=WYCSFPbQJtsl+QWP4KvWQ7dU21tF7Kil2ETvGVVMLU0hs9O+HpISiP6Xli3aSv0t+2 0mVltQrLB5D15QYoSVeNt7zD7U3sgTmWXYnhz2JZB14vR460o1MPAbnpu/UHhGTAq9XJ GUJgN1H6TOc8D96xIXYG1qFM8/cVxzSyNKwzXylJPjwQbgyuj+68zSbBnHbikZmA7ov7 AfbvAnmWArI8JgdPN0Xs5vGf0FXwgGi8vpvbKoTaatNMEwJt5XGMdEJDYn9coTG/KTu+ 5p4n3sr4xB9ip+u61UoKqoV/HOR1mXgB++CJFNyY2ULd9edboYoZmMmzl3VqiDrP9PDG KhIA== 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=6S1mqYtI8L2M0uD0p0SGl3YFaHBOIXEJ15OmOIXni5A=; b=HQO5T2JLcHYKQvmhq9QOvC52bzEJg7UMf4/uFoeHSmgzfk0xL3p6hbI32OynO3zBM9 DVfyt4tzVgG9mE0SQT6STcVCJU9BlK5fCkpI/iSvmJsxHx4aODw1TSzvg4BbmWSggjIq xTm5j7VXRkEKAj6MwRsz3pnZxEsHTsGZkMVM4ErW4s9blMCdKfqiyd/wbaC6wOoLH8Nl stFI3TwT1GJ802X+vCau3TK4DnJOdSO9dVF4dtyPXqXQsrjcIo3dgSClxcWo1CSIHcRm 2xoe7yW025vx/9FLgG247i3PJMNk4Cohf4A3vwVTuevx60KwBRb3z6hUarrcBU6IUKqp KwCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=asgRqcwu; 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 f5si4701255plj.125.2018.01.17.08.43.41; Wed, 17 Jan 2018 08:43: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=asgRqcwu; 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 S1754076AbeAQQnk (ORCPT + 28 others); Wed, 17 Jan 2018 11:43:40 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36669 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753778AbeAQQ3b (ORCPT ); Wed, 17 Jan 2018 11:29:31 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIL0014790; Thu, 18 Jan 2018 01:28:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIL0014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206512; bh=6S1mqYtI8L2M0uD0p0SGl3YFaHBOIXEJ15OmOIXni5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asgRqcwub+fBQ5z7PmUHsOzdZ/hrpMu3i7DqJ6kLq7ZYzcKF/qDH4pjyFpGxzzVQX 4005refgIP5hyd9A9BQrE4eLSxw9GwZgxvCpCbpI3i+1za/wLTZEzFMTY/JKbS1yWi enSMhxXmk8pF/2M9hBRz65EgntHKPgIdWzantTmN/K7p5D/GveaVodM3S88q+Dy02s hAEsxemWZTZkppo95HODSR7RIc5IQ1b0+chTGqFOAdJkgqJtgWyJYeO43pQFtmajDM p/fAUFoAMSk05O8+JC+vPNdp/oLEkLbRpya5dr/OaHbN4Cwya1GdOZE7ipB+0WJ4EI cHbPEHoyTLwzw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 14/16] mmc: tmio: move TMIO_MASK_{READOP, WRITEOP} handling to correct place Date: Thu, 18 Jan 2018 01:28:14 +0900 Message-Id: <1516206496-16612-15-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 As far as I tested the IP on UniPhier SoCs, TMIO_STAT_{RXRDY,TXRQ} are asserted for DMA mode as well as for PIO. I need to disable the those IRQs in dma_ops->start hook, otherwise the DMA transfer fails with the following error message: PIO IRQ in DMA mode! Renesas chips are the same cases since I see their dma_ops->start hooks explicitly clear TMIO_STAT_{RXRDY,TXRQ} (with nice comment!). If we do this sanity check in TMIO MMC core, RXRDY/TXRQ handling should be entirely moved to the core. tmio_mmc_cmd_irq() will be a suitable place to disable them. The probe function sets TMIO_MASK_{READOP,WRITEOP} but this is odd. /* 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 here whether DMA is used or not. Remove this pointless code. Signed-off-by: Masahiro Yamada --- Changes in v3: - Remove the first paragraph of git-log - Clean up renesas drivers too Changes in v2: - Newly added drivers/mmc/host/renesas_sdhi_internal_dmac.c | 6 ------ drivers/mmc/host/renesas_sdhi_sys_dmac.c | 4 ---- drivers/mmc/host/tmio_mmc_core.c | 20 ++++++++++---------- 3 files changed, 10 insertions(+), 20 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c index 0d1f95e..693ad49 100644 --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c @@ -145,7 +145,6 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host, u32 dtran_mode = DTRAN_MODE_BUS_WID_TH | DTRAN_MODE_ADDR_MODE; enum dma_data_direction dir; int ret; - u32 irq_mask; /* This DMAC cannot handle if sg_len is not 1 */ WARN_ON(host->sg_len > 1); @@ -157,11 +156,9 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host, if (data->flags & MMC_DATA_READ) { dtran_mode |= DTRAN_MODE_CH_NUM_CH1; dir = DMA_FROM_DEVICE; - irq_mask = TMIO_STAT_RXRDY; } else { dtran_mode |= DTRAN_MODE_CH_NUM_CH0; dir = DMA_TO_DEVICE; - irq_mask = TMIO_STAT_TXRQ; } ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len, dir); @@ -170,9 +167,6 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host, renesas_sdhi_internal_dmac_enable_dma(host, true); - /* disable PIO irqs to avoid "PIO IRQ in DMA mode!" */ - tmio_mmc_disable_mmc_irqs(host, irq_mask); - /* set dma parameters */ renesas_sdhi_internal_dmac_dm_write(host, DM_CM_DTRAN_MODE, dtran_mode); diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c index afdb66b..393df17 100644 --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c @@ -205,8 +205,6 @@ static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host) return; } - tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_RXRDY); - /* The only sg element can be unaligned, use our bounce buffer then */ if (!aligned) { sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length); @@ -280,8 +278,6 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host) return; } - tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_TXRQ); - /* The only sg element can be unaligned, use our bounce buffer then */ if (!aligned) { unsigned long flags; diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 0e3dc8c..731552a 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -621,15 +621,21 @@ 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); @@ -1287,12 +1293,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 Wed Jan 17 16:28:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124862 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp108139lja; Wed, 17 Jan 2018 08:43:21 -0800 (PST) X-Google-Smtp-Source: ACJfBovs2qMYLwnc4q5dIh8oNbvYl05PAyUpuR4SyYGvbmSTC1kh/xqXWju0q2lxQw8PQijgvfge X-Received: by 10.84.218.194 with SMTP id g2mr28021275plm.147.1516207401330; Wed, 17 Jan 2018 08:43:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207401; cv=none; d=google.com; s=arc-20160816; b=wFwcJ4TlM+XG2FPrbgJo+dYi6rjwWVLQVaYfX3q9crlyYb903JNxBcq2lMjJxpZwcs cUjl3bNWcQj7KdC6mQeFCoVAB1JZCNIQKmvEObIUhRr+zUGVhnibgrG9Nk2pvi9YdTWR EnJhjY5sLIjUTxnGPhV4xR0JklteYYS673BmH6Hdhc5lae/Z0HaNZBSNXVFHV94FIxmU 8f+bpcCfR67LWM2s8E3DDacCIb8A5jCf6QsY/hIvdj3eWQKhCYwTfc9n53fgsj0THElg 1vCbjo8d1FwXLhXI6Z8FlinrOH7zH7H5Ufi/QBazSC2Mg9awabcJWxnOxSYqIiDXJzV9 ZQEA== 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=LNiJLHYJVZ/J4SGc/4rEkIf4U/vWtxJJg3Uo3kjNZOw=; b=AefdyJ9Cf1L+VsIYMUvETAfQDODpARkkJZlAes6VxB+eHtj14pxXql2U6rT34rzntI aoo3bR0eP+DGlb1CO8RSA71L/AZCZ/VMQ7WwNZmgb7s+3kGrikoGLIC+HVXu80cIPe6D lJS0P7cgb4L2OVv8+RhkXPJpNMMeD/eAfhze2BgdlzfRzbxN7YnLcbeKl11Kzrk7HMfE wEoMyuxOZ18V7/JyJk5e6rk1rHD55uN2bUxg6WWmXvtdBN7bZIpv2hdpUdwDeEMbVXe5 NosQAd8d3JSSR4R4KxOjzPc6LTC7SL7HxNeMTdqtnvXqrLc6c/Vf1a6pC248L7KCi9CC hDmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Tq3gaccs; 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 s15si4153362pgf.99.2018.01.17.08.43.21; Wed, 17 Jan 2018 08:43: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=Tq3gaccs; 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 S1754443AbeAQQmd (ORCPT + 28 others); Wed, 17 Jan 2018 11:42:33 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36685 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753813AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIL1014790; Thu, 18 Jan 2018 01:28:32 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIL1014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206512; bh=LNiJLHYJVZ/J4SGc/4rEkIf4U/vWtxJJg3Uo3kjNZOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tq3gaccs7R1PfCxMYa762qdlVl+jEre+WWVO3efhgSBhPuztE3GXQjwdaNDMxrZFR 69TSQh4GHb5q5qbQZHUhgkfRyhMksqR2F+a5czrEYYqrIegQES0rJ+QNdJeb+0z1Pi kw0Y41/mzqA3mqcczwYXtc+ariRHGo0Qx0xQlYaQviOcua3A6u5vH3lvY3cSAII4N+ lw5uEtXENoXiwpBALsSWXomoEZwvZEVX28N2IMskBhXr9HTSnYO62P2ZANJ9B8OK8E hrRD70srvQHImcWtWfJQ6pQeBHRLNhgC9h7BsCm1H8Ln8oxp5EqwtJAigq6LZ5hLs1 yN1ZnhHezboNg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 15/16] mmc: tmio: clear force_pio flag before starting data transfer Date: Thu, 18 Jan 2018 01:28:15 +0900 Message-Id: <1516206496-16612-16-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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, force_pio is cleared when the driver exits. Then, it resulted in clearing it in multiple places since MMC drivers in general have multiple exit points. tmio_mmc_reset_work - bails out on timeout tmio_process_mrq - error out when it cannot send a command tmio_mmc_finish_request - successful exit This is error-prone since we may miss to cover all bail-out points. To simplify the code, the data structure should be initialized just before used since we have a single entrance. force_pio is only used for data transfer, so tmio_mmc_start_data() will be a suitable place to clear this flag. Signed-off-by: Masahiro Yamada --- Changes in v3: - newly added Changes in v2: None drivers/mmc/host/tmio_mmc_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 731552a..494f0b3 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -278,7 +278,6 @@ static void tmio_mmc_reset_work(struct work_struct *work) host->cmd = NULL; host->data = NULL; - host->force_pio = false; spin_unlock_irqrestore(&host->lock, flags); @@ -759,6 +758,7 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host, tmio_mmc_init_sg(host, data); host->data = data; + host->force_pio = false; /* Set transfer length / blocksize */ sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz); @@ -850,7 +850,6 @@ static void tmio_process_mrq(struct tmio_mmc_host *host, return; fail: - host->force_pio = false; host->mrq = NULL; mrq->cmd->error = ret; mmc_request_done(host->mmc, mrq); @@ -900,7 +899,6 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host) if (host->cmd != mrq->sbc) { host->cmd = NULL; host->data = NULL; - host->force_pio = false; host->mrq = NULL; } From patchwork Wed Jan 17 16:28:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124851 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp107490lja; Wed, 17 Jan 2018 08:41:24 -0800 (PST) X-Google-Smtp-Source: ACJfBovKuyqroSktqgUJliWmFZm3DmLnQ2lAT8GUzhhfaw2caLukoLP8sJmf5TsiWjn8iRICTbD9 X-Received: by 10.159.206.138 with SMTP id bg10mr9590335plb.162.1516207284365; Wed, 17 Jan 2018 08:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207284; cv=none; d=google.com; s=arc-20160816; b=KtD3z9N4ZYKasagyyXSBABz0ZPD2wDhvbPpwUkQX/bt3e/PG68iRgpG1xVNkpq9Ky3 vt9KSRKWbrfjFwFYVl/TSr+4EWQFRX9/HaOjVD7cVHsmnETlQ3X8WXReTShwwJXK01D5 h8gUvuLCJleu2pb735VwFeuztW4XVcF0RaOa2QuBSCtfIU/mXIRVeYBntr14SjWZ4bBU rS4bAFrENSrcdeerxaRzPyyJamEEm7d2bS1gdbNlCgwJD9n8R/fY2wORy+axp/Y+NwDg Ag11kK/w6fOTGmitD4Fy2IrKNKzOfcFTZnYwFAhOblNkOUkh1uE/qN6MO5ud8pzjKcIx 1z9g== 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=L9EulqWhq+y57VE20j/UDd9nxM56xbkQbD4kGgD7dUo=; b=d9BS3//nyp3YDYktxXLORESu+IFVVxcJGaIILyDNgsXKhj0hizGutEEB4JssvMbWPG 1wDOyH5/05fzU0IcJK20SFF7LWVUrUyiBqB2WmD+eC4Y8inRbJdC7FrANlY50QdlmMm+ ZZ2ko0dVpGbE+1du+7h2YLeqgEcJ+VaDvh9lKBYJTaRfgyFRFvHJ3ZtFp2uhYaazjzMz x4SQvvHvUyYIAZg9ZmIzGUweSYsuyeu3HuzcrHPPw0C4blzuKunKNgWAbyytS01YLQ5m jzg1GJFqiHU05CHQuXA2l8skJ8bxctp+RWkEtyC8rs1LywyUm2lAzKenynnaUt2MMubr kK7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FqVgNZ66; 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 z20si4777327pfj.118.2018.01.17.08.41.24; Wed, 17 Jan 2018 08:41:24 -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=FqVgNZ66; 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 S932198AbeAQQlW (ORCPT + 28 others); Wed, 17 Jan 2018 11:41:22 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36684 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753822AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIL2014790; Thu, 18 Jan 2018 01:28:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIL2014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206513; bh=L9EulqWhq+y57VE20j/UDd9nxM56xbkQbD4kGgD7dUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FqVgNZ66ZhNcAi8D/ubAj2OWK2p+Tznq1wPPbRzk5fvcW/aRZlwjStMjSkGZXSxFl bdBag39jG+dV/XRFTRlCVK64GOK759kyx8ZilYk9GTd7miJ7X37Pi20GbrYZ6UhsjH BLRaq47l2xMydLIyU3fBFtv7XJ/5g4+aca/SnErSNl9r9EcMUDLFwMa8SYyaAA6/oj Y0PUQ5NVDi5/aF3ueq6cRle8DYRx94W85BeGRmHUZlKagdcuSUAqeKvqUPs2ME2QuO E2bSAC+AA7NY/aBnuiQFYkM6HAYKdP1ETiWZG/Rh0ZfEB+fH0UWAlUEs3tFIxKSBYL 7ypmuQUdPtoGQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 16/16] mmc: tmio: remove useless TMIO_MASK_CMD handling in tmio_mmc_host_probe() Date: Thu, 18 Jan 2018 01:28:16 +0900 Message-Id: <1516206496-16612-17-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-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 v3: None 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 494f0b3..b75a51b 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1209,7 +1209,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) struct tmio_mmc_data *pdata = _host->pdata; struct mmc_host *mmc = _host->mmc; int ret; - u32 irq_mask = TMIO_MASK_CMD; /* * Check the sanity of mmc->f_min to prevent tmio_mmc_set_clock() from @@ -1291,8 +1290,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);