From patchwork Mon Apr 19 11:24:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12211539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35554C433ED for ; Mon, 19 Apr 2021 11:27:12 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01C4D601FD for ; Mon, 19 Apr 2021 11:27:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01C4D601FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Y6xmS/HzBH9HMeTtoaqjHUgakeeHZhnkrcyhfyINcmc=; b=WufnN54tcU7i+ZZXj5Be/bNEXS owhzk5J7gfaeP2gL0jdlA+DoejEWZwWJ5GkauskkMw/udc7uDij95sYuj9FBm6SzmHk6XWuO9Em3p UEdXu3w+STN+QArHSaa9o0Ur5qC9L/M2iy8ItIHQv/Kqi3DXO/f4gsqnp3N5RfWG8UDymhf699pFl ks976p8fr0XVefjORpq/dZzLfweN/iMRebUXVPX69yDKIQXuqjqG/IWyY2PD7dMUI2iicn+yPtj78 iGbY0T06rkQZw2alO1aucM1HWjwd7eWcDuhR9oIfWlNYxGrL7Xsqp0i2PUeA/sVeZ2SulUehF+9Kz Hav8yWtw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1o-009lX3-SW; Mon, 19 Apr 2021 11:25:21 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1b-009lRy-BI for linux-arm-kernel@desiato.infradead.org; Mon, 19 Apr 2021 11:25:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=Qbo5NJHGXIjJD78UG1nXO24ct5iyTOh7JolXREcTOxQ=; b=nNrq7UD+k8tb7Twt8iyhyZrO+h cTt566jWHNaR1V1PlES/mdz5NAAJBhx9Gv44wx6OUpiieQHA38DrJotRscX9P/LCWiXa5+zQ4kkkx FIqAP05zyHLitKd8HmD9TcP8PRBmUB/DcMFBIs8Sq5dB4xIoghggrPkjmy2GInAf1cO5R+f4EPElO p5rVRr8zp19dZBuGm9d7GWZal3nfpjvbkQO7s1cQVk/X3qJ4e1K7kPK3cTh5Fe5FwZ2J475cE61T1 vL858HLNyEox5aEKiGsspPBGVyv5qurBPoHI0bdp3qTMS13qm3VK+hVFxcl9+L2iLjqiuDKHiVbtY L9dvQHaA==; Received: from mga06.intel.com ([134.134.136.31]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1V-00BIye-Fs for linux-arm-kernel@lists.infradead.org; Mon, 19 Apr 2021 11:25:06 +0000 IronPort-SDR: Y7ZBhZAujuW1lgCQuOKCu9rEwBRG/uW6SFsT/RogVa0hMt7Y0tprawWl1aCHHxLGDw0rHCUqko Ut5t5YkFPbKQ== X-IronPort-AV: E=McAfee;i="6200,9189,9958"; a="256620819" X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="256620819" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 04:24:56 -0700 IronPort-SDR: 5OZIRQYIR9a6lghPfoytwhZsFRUVQY9MPv0LfTDo4TxoIEz4VD2QxJxV1Fu6f6vaXmR+9qp0Uk QUjXUkElZeCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="602113557" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 19 Apr 2021 04:24:52 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 699FF13C; Mon, 19 Apr 2021 14:25:10 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Ulf Hansson , Haibo Chen , Fabio Estevam , Yangbo Lu , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Cc: Rob Herring , Adrian Hunter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , Mark Brown Subject: [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Date: Mon, 19 Apr 2021 14:24:54 +0300 Message-Id: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210419_042501_586632_5B08C017 X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since it has been converted to use device property API, the function and field descriptions become outdated. Correct them. Fixes: 73a47a9bb3e2 ("mmc: core: Use device_property_read instead of of_property_read") Signed-off-by: Andy Shevchenko --- drivers/mmc/core/host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 9b89a91b6b47..ce030c5aa53c 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -209,8 +209,8 @@ mmc_of_parse_clk_phase(struct mmc_host *host, struct mmc_clk_phase_map *map) EXPORT_SYMBOL(mmc_of_parse_clk_phase); /** - * mmc_of_parse() - parse host's device-tree node - * @host: host whose node should be parsed. + * mmc_of_parse() - parse host's device properties + * @host: host whose properties should be parsed. * * To keep the rest of the MMC subsystem unaware of whether DT has been * used to to instantiate and configure this host instance or not, we From patchwork Mon Apr 19 11:24:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12211537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BFD9C433B4 for ; Mon, 19 Apr 2021 11:26:55 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EEDDB61157 for ; Mon, 19 Apr 2021 11:26:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEDDB61157 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cjB1r3NbxruOu9NIEAdp/Hkq/aQTw60A/OmeoO/i9TQ=; b=LqbFg41amVs9SC0YYxRLXZf+q 5rdRIXd1eiiwEGM2d0u2+XsT5z7d/anc5e5qX78zvs3v+ZhMb29X6DepCZjZBemnNNW90BS9zPvbD 7kpdOyFqzHAcegrFwarZ0Ls+T2bCfF7w58uc0t8+WZeLWAmOCGdRw0b9iig4uNciRfEOE8OYIwYS/ zBVR5B6fDlU4cApL5yGWffuBqU0GhJfbinZtG7fjV2aaPH9HCTnFaOHU7np85iflRdkYWfZ11/Gfh Eqvd53uuzD0DhWkgNhVGkEct5gcQ3LhmMkbpXTv+0+ql/SerQ6IFfMsmHwPBYtWGM1bGwuFiNeIk0 wgou4YvUw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1e-009lSN-4j; Mon, 19 Apr 2021 11:25:10 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1a-009lRv-SO for linux-arm-kernel@desiato.infradead.org; Mon, 19 Apr 2021 11:25:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=ABoK/9atX09aHXm+MdbgI8VDLicvFH+f7QqoP/PNZwI=; b=1uDLJp44AUB8ruEUgMSUx31MQA lxbKi1eS1K2pAi/+QlrmYOWySx2Uvw+BLcN+kQwqdfWhsMA785J8VxbVhcGIS709Zmh/LBenMntcJ c9A/no/KP0/lYPdg7jx9KZVEUUgV25suiC7Hehnpxpa9OwBfSCWHUVj9SlS+lN7aRCm/tyLin2qmW UHnRlVqYkhXu+FQKmTOsoOjE4tDMgSk2zmk1rRtFpMRvIH9OcpZBOY0uqYDEnpv+z2lUvulpCIfFt hZc0Sza7/zynN3GJv55iZR++g2vhozZPBRTJmiztF7MrWaSZc/zLTl0fPLPWn/FLyQWBADEbC7t29 WENdOG8A==; Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1Y-00BIzA-2X for linux-arm-kernel@lists.infradead.org; Mon, 19 Apr 2021 11:25:05 +0000 IronPort-SDR: +ZRig/HLDMQTT/w821X89qh3JJk/PVJKMg7ZHcCxT9DvN94CARoF9bOpMali1uQ6BPizVIsiOH 0Lp6tlp8BXDg== X-IronPort-AV: E=McAfee;i="6200,9189,9958"; a="192119674" X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="192119674" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 04:25:03 -0700 IronPort-SDR: YGDJhRQoWE10EToqctjMg+7N5oc+aMwwLz7ACQ8jsFiLYhNrHKdlyb5Ure/bbdGTFlYz9MP6qh JQbqYeVZ8qkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="390632587" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 19 Apr 2021 04:24:59 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E3B8E13C; Mon, 19 Apr 2021 14:25:16 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Ulf Hansson , Haibo Chen , Fabio Estevam , Yangbo Lu , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Cc: Rob Herring , Adrian Hunter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , Mark Brown Subject: [PATCH v1 2/6] mmc: core: Convert mmc_of_parse_voltage() to use device property API Date: Mon, 19 Apr 2021 14:24:55 +0300 Message-Id: <20210419112459.25241-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> References: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210419_042504_148483_CA1A33E8 X-CRM114-Status: GOOD ( 24.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org mmc_of_parse() for a few years has been using device property API. Convert mmc_of_parse_voltage() as well. At the same time switch users to new API. Signed-off-by: Andy Shevchenko --- drivers/mmc/core/host.c | 46 +++++++++++++++++++++--------- drivers/mmc/host/mmc_spi.c | 8 +++--- drivers/mmc/host/of_mmc_spi.c | 3 +- drivers/mmc/host/sdhci-esdhc-imx.c | 2 +- drivers/mmc/host/sdhci-of-esdhc.c | 2 +- include/linux/mmc/host.h | 2 +- 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index ce030c5aa53c..793c7425d0dd 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -379,44 +379,62 @@ EXPORT_SYMBOL(mmc_of_parse); /** * mmc_of_parse_voltage - return mask of supported voltages - * @np: The device node need to be parsed. + * @host: host whose properties should be parsed. * @mask: mask of voltages available for MMC/SD/SDIO * - * Parse the "voltage-ranges" DT property, returning zero if it is not + * Parse the "voltage-ranges" property, returning zero if it is not * found, negative errno if the voltage-range specification is invalid, * or one if the voltage-range is specified and successfully parsed. */ -int mmc_of_parse_voltage(struct device_node *np, u32 *mask) +int mmc_of_parse_voltage(struct mmc_host *host, u32 *mask) { - const u32 *voltage_ranges; + const char *prop = "voltage-ranges"; + struct device *dev = host->parent; + u32 *voltage_ranges; int num_ranges, i; + int ret; - voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges); - if (!voltage_ranges) { - pr_debug("%pOF: voltage-ranges unspecified\n", np); + if (!device_property_present(dev, prop)) { + dev_dbg(dev, "%s unspecified\n", prop); return 0; } - num_ranges = num_ranges / sizeof(*voltage_ranges) / 2; + + ret = device_property_count_u32(dev, prop); + if (ret < 0) + return ret; + + num_ranges = ret / 2; if (!num_ranges) { - pr_err("%pOF: voltage-ranges empty\n", np); + dev_err(dev, "%s empty\n", prop); return -EINVAL; } + voltage_ranges = kcalloc(2 * num_ranges, sizeof(*voltage_ranges), GFP_KERNEL); + if (!voltage_ranges) + return -ENOMEM; + + ret = device_property_read_u32_array(dev, prop, voltage_ranges, 2 * num_ranges); + if (ret) { + kfree(voltage_ranges); + return ret; + } + for (i = 0; i < num_ranges; i++) { const int j = i * 2; u32 ocr_mask; - ocr_mask = mmc_vddrange_to_ocrmask( - be32_to_cpu(voltage_ranges[j]), - be32_to_cpu(voltage_ranges[j + 1])); + ocr_mask = mmc_vddrange_to_ocrmask(voltage_ranges[j + 0], + voltage_ranges[j + 1]); if (!ocr_mask) { - pr_err("%pOF: voltage-range #%d is invalid\n", - np, i); + dev_err(dev, "range #%d in %s is invalid\n", i, prop); + kfree(voltage_ranges); return -EINVAL; } *mask |= ocr_mask; } + kfree(voltage_ranges); + return 1; } EXPORT_SYMBOL(mmc_of_parse_voltage); diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 02f4fd26e76a..9776a03a10f5 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c @@ -1397,6 +1397,8 @@ static int mmc_spi_probe(struct spi_device *spi) host->ones = ones; + dev_set_drvdata(&spi->dev, mmc); + /* Platform data is used to hook up things like card sensing * and power switching gpios. */ @@ -1413,8 +1415,6 @@ static int mmc_spi_probe(struct spi_device *spi) host->powerup_msecs = 250; } - dev_set_drvdata(&spi->dev, mmc); - /* preallocate dma buffers */ host->data = kmalloc(sizeof(*host->data), GFP_KERNEL); if (!host->data) @@ -1494,8 +1494,8 @@ static int mmc_spi_probe(struct spi_device *spi) fail_dma: kfree(host->data); fail_nobuf1: - mmc_free_host(mmc); mmc_spi_put_pdata(spi); + mmc_free_host(mmc); nomem: kfree(ones); return status; @@ -1518,8 +1518,8 @@ static int mmc_spi_remove(struct spi_device *spi) kfree(host->ones); spi->max_speed_hz = mmc->f_max; - mmc_free_host(mmc); mmc_spi_put_pdata(spi); + mmc_free_host(mmc); return 0; } diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index 3c4d950a4755..acd96ea399b8 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c @@ -54,6 +54,7 @@ static void of_mmc_spi_exit(struct device *dev, void *mmc) struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) { + struct mmc_host *mmc = dev_get_drvdata(&spi->dev); struct device *dev = &spi->dev; struct device_node *np = dev->of_node; struct of_mmc_spi *oms; @@ -65,7 +66,7 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) if (!oms) return NULL; - if (mmc_of_parse_voltage(np, &oms->pdata.ocr_mask) <= 0) + if (mmc_of_parse_voltage(mmc, &oms->pdata.ocr_mask) <= 0) goto err_ocr; oms->detect_irq = irq_of_parse_and_map(np, 0); diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index a20459744d21..f39d85e8ea6d 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1486,7 +1486,7 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, if (of_property_read_u32(np, "fsl,delay-line", &boarddata->delay_line)) boarddata->delay_line = 0; - mmc_of_parse_voltage(np, &host->ocr_mask); + mmc_of_parse_voltage(host->mmc, &host->ocr_mask); if (esdhc_is_usdhc(imx_data)) { imx_data->pins_100mhz = pinctrl_lookup_state(imx_data->pinctrl, diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index ab5ab969f711..a593b1fbd69e 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -1489,7 +1489,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) if (ret) goto err; - mmc_of_parse_voltage(np, &host->ocr_mask); + mmc_of_parse_voltage(host->mmc, &host->ocr_mask); ret = sdhci_add_host(host); if (ret) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 26a3c7bc29ae..ecd25a3b37f0 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -514,7 +514,7 @@ void mmc_free_host(struct mmc_host *); void mmc_of_parse_clk_phase(struct mmc_host *host, struct mmc_clk_phase_map *map); int mmc_of_parse(struct mmc_host *host); -int mmc_of_parse_voltage(struct device_node *np, u32 *mask); +int mmc_of_parse_voltage(struct mmc_host *host, u32 *mask); static inline void *mmc_priv(struct mmc_host *host) { From patchwork Mon Apr 19 11:24:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12211581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56146C433ED for ; Mon, 19 Apr 2021 11:27:51 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D4D9D61166 for ; Mon, 19 Apr 2021 11:27:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4D9D61166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jlNINrsP5oNpp0+Iw5dmdGU/QB19frt6VMX65HweBCg=; b=iza/zDqrLJ2ACVHq0vty/lYOj AbTwbLF61L0RqQDx8S8m2oj5gU2tPeBPByXJvUZHti/fs7GYo4EUm0aFgoqEZSIPTByLFH68iKJY9 SgaWZ7JT50HshaWQWguld+Oqe+spGCU3o4f1q12RL5zAnrGCzveEYN8FcMJcrzofLCSgi4WeRZdNr r3ofpv9ZC8LXtrtpdhmYAO1CK+je3t3+xObqk/3I9hirzKPfVLTjsR2l9Z5haTlZULc5z42Q81IIV p3aroQq5k1ehZQZ5tx3h9hZbc/qgAvVULXP4NOEe/trGwdhaHEn9WrJcGGmMOPh2q9D1KeDDAfBd9 KOqw4T3sA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYS2N-009ljS-J6; Mon, 19 Apr 2021 11:25:56 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1j-009lW7-BF for linux-arm-kernel@desiato.infradead.org; Mon, 19 Apr 2021 11:25:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=ShMbHR9FM6yAHoHdk1OQSYEuY76W/WBg6dCuXxgEjKE=; b=Mr1UB097w8hxkESn/suLIte80l wyaIr1lLSG/rTdjyMMSWP9ZApQJntKzPoI1ceFMNiMj697TfNRynBBniMB5x9IfNWI8xxFXBtalNc +e5WXP0DuebOppiQvAJGSFKzwnzq/lA5HWFMqHclKKtIVI+nWHp+MifXPrLBkkrY0uhqU6dHNaadt 1zGUaKcK6cEwsrB6Drw0sKXAiv688vrJVuFykratGmC/zJ+pL2MZknA5i7oaQg17Ths8We2pOx8UJ veqaZ6kl9qSRmTyMo68g0ApGM9Z2pGFeqBkcOjYEBEM9ahCHx+FVhc3WCDgj45eJvjkNcftiOPK/K icqMuDpw==; Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1b-00BJ01-I0 for linux-arm-kernel@lists.infradead.org; Mon, 19 Apr 2021 11:25:14 +0000 IronPort-SDR: xcEGJNzzaYtlXKrz4sju+xdKw76UCALWqgtMdmaPA8LjRwp/p7fxKthPjMDbnR67lmJBtsNFEe WPCIT5DHsNZQ== X-IronPort-AV: E=McAfee;i="6200,9189,9958"; a="194867413" X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="194867413" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 04:25:04 -0700 IronPort-SDR: reVk2Wkqo6o5Klxv3OkJlKBRcpNRK76gAEuV9YL/TIWPlSi1jMDGU+CiNDfJraMbZAd631vMnF xWuZyc5U0sRg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="613365712" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 19 Apr 2021 04:25:00 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5209D17E; Mon, 19 Apr 2021 14:25:18 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Ulf Hansson , Haibo Chen , Fabio Estevam , Yangbo Lu , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Cc: Rob Herring , Adrian Hunter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , Mark Brown Subject: [PATCH v1 3/6] mmc: mmc_spi: Set up polling even if voltage-ranges is not present Date: Mon, 19 Apr 2021 14:24:56 +0300 Message-Id: <20210419112459.25241-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> References: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210419_042507_622810_5479A526 X-CRM114-Status: GOOD ( 15.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When voltage-ranges property is not present the driver assumes that it is 3.3v (3.2v..3.4v). But at the same time it disallows polling. Fix that by dropping the comparison to 0 when no property is provided. While at it, mark voltage-ranges property optional as it was initially. Fixes: 9c43df57910b ("mmc_spi: Add support for OpenFirmware bindings") Signed-off-by: Andy Shevchenko --- Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt | 6 +++--- drivers/mmc/host/of_mmc_spi.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt b/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt index 75486cca8054..5e74db69f581 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt +++ b/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt @@ -5,11 +5,11 @@ by mmc.txt and the properties used by the mmc_spi driver. Required properties: - spi-max-frequency : maximum frequency for this device (Hz). -- voltage-ranges : two cells are required, first cell specifies minimum - slot voltage (mV), second cell specifies maximum slot voltage (mV). - Several ranges could be specified. Optional properties: +- voltage-ranges : two cells are required, first cell specifies minimum + slot voltage (mV), second cell specifies maximum slot voltage (mV). + Several ranges could be specified. If not provided, 3.2v..3.4v is assumed. - gpios : may specify GPIOs in this order: Card-Detect GPIO, Write-Protect GPIO. Note that this does not follow the binding from mmc.txt, for historical reasons. diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index acd96ea399b8..843ec3db891b 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c @@ -66,7 +66,7 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) if (!oms) return NULL; - if (mmc_of_parse_voltage(mmc, &oms->pdata.ocr_mask) <= 0) + if (mmc_of_parse_voltage(mmc, &oms->pdata.ocr_mask) < 0) goto err_ocr; oms->detect_irq = irq_of_parse_and_map(np, 0); From patchwork Mon Apr 19 11:24:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12211543 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90B99C433B4 for ; Mon, 19 Apr 2021 11:27:26 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D7646108B for ; Mon, 19 Apr 2021 11:27:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D7646108B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VyqdXAMU3sacYrbWENog9V4efjz3CRIC44MWA07n/A8=; b=il97gBMVN2XVEsyU9fEheFTGd 2XkjCezwVmad92+VXqH0aX+oFtHtZPHDyNjr5RjqloIWPBjIXoQwTniYPE/GNo9d36/cIhOo35qtd vLSH2sN+Re8SKzoUryXHTuhfBXLAwtooUFuPzet8h+ZkMMyQ0agKoc+Lw1ow8LGRWhrTiCjXp99Wt elIZDvZ/zSXLtgROu/g12m20F5xIt3mb4P6q+DC6GdKld3GHPtSqGuMIV8QaWRtgL3v92y6Q9z2Q+ GI8u+E0rIKTt2RmZ2Ukts97SB4G2f7jL1Gk5DEFiAeuYkqgxiZvRxJxQ694YZ6g4eU1zLXMEy5JLZ R8evfU8Sg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYS2C-009lgU-Fb; Mon, 19 Apr 2021 11:25:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1h-009lSt-04 for linux-arm-kernel@desiato.infradead.org; Mon, 19 Apr 2021 11:25:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=BGRkmmZrHqD5bGsinFfsqjXXdoGHNHoPBNbwaNWeXXs=; b=ae5xzOzGe/cZVN2hM/qe3WjFN2 W8nhcU6OaHNjrHTCceOiYershbCbPdFluo1pBHMfL2MQ32TLbC8BM3jOXv6iqkUl/Xl+GNC5LoyUP KUzO36+UqG5WsAy71yC6pWzG6EASFy+iXESHPpEvZXaQ0bj79TSMaFDOCV3TrL+fSZhWKYMpRQjvb 8b/VpYoVaAAMoMJ6uqAyquicjpQt2P7KKlcLc6VWsKU/EFxe6OaaoojvyRaMXU7VaFLFZoODP3LSa kaAlFrc067mQHSBmmL0Osfwvltwgf2NH2UA+bJ2SShvWkeT/3XbxdFy6sW3pSElQELGAJaZ2T7O/0 ACTqQAdA==; Received: from mga03.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1b-00BIzS-6c for linux-arm-kernel@lists.infradead.org; Mon, 19 Apr 2021 11:25:11 +0000 IronPort-SDR: xyYFcU3PpDbJTrQ3PO0dxYJsYpQ/q4AztMs3kMmfhqIMQx38s/3apAgMsKIocAuEW5trPbGjc9 lxEWv3Oi6eNQ== X-IronPort-AV: E=McAfee;i="6200,9189,9958"; a="195337216" X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="195337216" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 04:25:05 -0700 IronPort-SDR: 3SGx1v6CSuYIqnQ9Q/IBN1+ZLngsQIeyBqEi4sJv8Vu5Y6y0SKIACd+H/ZvzDlslq5Qk2eGkjo bmteP/tNAesw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="616565518" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 19 Apr 2021 04:25:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EB04F1A1; Mon, 19 Apr 2021 14:25:18 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Ulf Hansson , Haibo Chen , Fabio Estevam , Yangbo Lu , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Cc: Rob Herring , Adrian Hunter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , Mark Brown Subject: [PATCH v1 4/6] mmc: mmc_spi: Drop unused NO_IRQ definition Date: Mon, 19 Apr 2021 14:24:57 +0300 Message-Id: <20210419112459.25241-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> References: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210419_042507_298242_46923DAC X-CRM114-Status: GOOD ( 10.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org After the commit 073350f7b562 ("mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()") the NO_IRQ is not used anymore, drop it for good. Fixes: 073350f7b562 ("mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()") Signed-off-by: Andy Shevchenko --- drivers/mmc/host/of_mmc_spi.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index 843ec3db891b..0b038f5c392a 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c @@ -19,11 +19,6 @@ #include #include -/* For archs that don't support NO_IRQ (such as mips), provide a dummy value */ -#ifndef NO_IRQ -#define NO_IRQ 0 -#endif - MODULE_LICENSE("GPL"); struct of_mmc_spi { From patchwork Mon Apr 19 11:24:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12211583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA6B2C433B4 for ; Mon, 19 Apr 2021 11:27:55 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACC616108B for ; Mon, 19 Apr 2021 11:27:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACC616108B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ALWh4a06NhkL8nAmaPVEHYSCR2z3Nev70lp1+2tOsuQ=; b=eQNIaHXqadFGuP3JeQD3a11wO taap2SlhsXLJVbcCoET01jx9g7A7C+e6Le2ZtswhghAoBhbZA3Q+SfCJ+o6s0ooiB6TBE6nQ93eqN HbTYxg15qOqoAoxRI/TsKjf3Hrinz4uoavxlGC83Vl5StxQtxzA++Iy8ijaObOUIVv5z2BxUVUrcp vPn4KDtOY8k8lPUIS3ytYL8z1vMR1i37gHK4VuZmUX0MPkUdBOq6fnWxM6W71WY1grfMTXDPqKmeG 1Y2gGCq9m17lKgHHoTnmbcPpuX13qAlWPKq6ZlQP0rH/f9BdGqFUBg6KglhYIqPMYhhk39SgbWcHc 48d3sKHEA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYS2a-009lmQ-7p; Mon, 19 Apr 2021 11:26:08 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1k-009lWM-J5 for linux-arm-kernel@desiato.infradead.org; Mon, 19 Apr 2021 11:25:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=BJAoBKFLEPRqk0uaI8YYjk1n4Yp48t5hH+XWP2NP5nI=; b=BidymxEU8FH6svtm0WsbK1sL6F oDMO6/Jh9zhMPz+KRfI+4zug8FcUwtx1hrc0oeAEWv0OereSkIYsCJIezHYn4jr4r4sfFndfEdAAK ltZBbM73wFWy7YEnx3CilSV8fKhQOrfLu0mZNaR9XzNfG+IDw9Cj79fo14DvpkpHpwKsnbA0GESP7 CPLdd+SEL1LLK1uK4WQi8aRloyB6aB8InoZf8VD2QxRuFh0dABnmN6voWAlPEyk5zw+ez8zSsj1YU DGI4kO6t0aIMGtCse1fsA7ydmNNwkUgDkdwMvP2NmBKP34hdvSDZNcMTflSDt+qw9ZX/sihbGf2lS 1VB6QDOQ==; Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1i-00BJ01-62 for linux-arm-kernel@lists.infradead.org; Mon, 19 Apr 2021 11:25:15 +0000 IronPort-SDR: uO5RUrisuYy1pY+SIDZs8cbTwXeZlYrVBSm4PbRHSpP991VX8yX3GxtrqWmkeOObLyUfiSJtel rjgAZslr09oQ== X-IronPort-AV: E=McAfee;i="6200,9189,9958"; a="194867416" X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="194867416" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 04:25:06 -0700 IronPort-SDR: Ji0kWO+86DKcA/iebLwOxA9FA1uLhGHlOiR8QcUV7NllFz+EXDF3YSkzS2Hv1PA/7LwwinrkGM t91Cl3TpkWig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="454267724" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 19 Apr 2021 04:25:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8BE0A1FC; Mon, 19 Apr 2021 14:25:19 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Ulf Hansson , Haibo Chen , Fabio Estevam , Yangbo Lu , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Cc: Rob Herring , Adrian Hunter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , Mark Brown Subject: [PATCH v1 5/6] mmc: mmc_spi: Use already parsed IRQ Date: Mon, 19 Apr 2021 14:24:58 +0300 Message-Id: <20210419112459.25241-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> References: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210419_042514_258128_1DBFA4F2 X-CRM114-Status: GOOD ( 14.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org SPI core already parses and maps IRQ for us if provided. Use it instead of double parsing in mmc_spi_get_pdata(). Due to above, change condition, since SPI core can hold an error pointer as invalid IRQ. Signed-off-by: Andy Shevchenko --- drivers/mmc/host/of_mmc_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index 0b038f5c392a..009c3885f6ba 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c @@ -64,8 +64,8 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) if (mmc_of_parse_voltage(mmc, &oms->pdata.ocr_mask) < 0) goto err_ocr; - oms->detect_irq = irq_of_parse_and_map(np, 0); - if (oms->detect_irq != 0) { + oms->detect_irq = spi->irq; + if (oms->detect_irq > 0) { oms->pdata.init = of_mmc_spi_init; oms->pdata.exit = of_mmc_spi_exit; } else { From patchwork Mon Apr 19 11:24:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12211541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57792C433ED for ; Mon, 19 Apr 2021 11:27:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C2B3561157 for ; Mon, 19 Apr 2021 11:27:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2B3561157 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aS3ap/U1CUW6UJ0GQql9Hd6viR3uTI23QUcrWGax/p4=; b=a68kxGVwyewkevssC71QATWyP 38mPe/Fbd3cTwVz7e2WoOyJVoviQVi+W+YSlgNY3stWZSV8WAq8fbyk2kL6PHQlnLQuT77N4UHgoi Z4e7WZgiag4L6fm545ruFmfLObK90QdkvUPxLA+wap8a1xpasfrxsM9GaCPryGy2LkoLYPkcIoM/t HgeUljk4bZR5r9Ii45/UcREABPUURXW90oAlAF3luCHbOXZxeohkYELakGBQ/R9dMEsQch0E1AMfE ox8dvrfbBv9+/D2Vbg3OpV3dKQ82NC6WDbHhIhbeL3Xo+n9vL96b/bP7bTFQDn/ClaIoqIhJ6QrTn IBuO5cw1g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYS21-009lcY-AE; Mon, 19 Apr 2021 11:25:34 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1g-009lSr-OP for linux-arm-kernel@desiato.infradead.org; Mon, 19 Apr 2021 11:25:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=89K8z2mkOLb2X/LCPcmq+yTKyeyw04Unn9j8IS3hmBg=; b=ij72XgTTWVkS7n2xktnZ3jKzMc mN3GBLZJSLJPHHes1NHlptBRVExDy8ZPTMpx1338sLr8nZjNuNUE3nzAboJ2u5C2u3ic1oaZVQmYS 3U2RCi+YD8fuHPyHvZFaNaCmA2n16nIsLaOTlvZKmDHIKlw76TSaFIo1qnmZwIbrmTGzukatXQgsU EkOgIE/giMysERqrUscP+xfVaAh6XdSwXnBF9mvr6xu2v+r6P9iot+SiM1G+HjZA392pP+EzJeZKA C5+fZnEwqlpmOuu5xX5+wuMU3wNJNAQxH0kM6uz6U9b7iaHjNe9aiv+dfpKtTvYu8IR2UR7JstH/N ZWN1aEkg==; Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYS1a-00BIzA-V0 for linux-arm-kernel@lists.infradead.org; Mon, 19 Apr 2021 11:25:11 +0000 IronPort-SDR: KWc6WOAJI6dVCUFy1esEowdWlOYvIQ4BxyfeyRKqboXPLTGxwLwgu5PvTxIgXQCkNc6SZTbdZT 0VBeH0hexBkg== X-IronPort-AV: E=McAfee;i="6200,9189,9958"; a="192119686" X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="192119686" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 04:25:06 -0700 IronPort-SDR: EmRQL1vW1CXPQXX7Ep5JqVxyjxNTf+NHB5aERjWSoOjAFGTYYnA8wVJBSzlK7ZZZK60cL4u5kf 1qLryOMjfKdw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="422657726" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 19 Apr 2021 04:25:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1E7BC2B8; Mon, 19 Apr 2021 14:25:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Ulf Hansson , Haibo Chen , Fabio Estevam , Yangbo Lu , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Cc: Rob Herring , Adrian Hunter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , Mark Brown Subject: [PATCH v1 6/6] mmc: mmc_spi: Make of_mmc_spi.c resource provider agnostic Date: Mon, 19 Apr 2021 14:24:59 +0300 Message-Id: <20210419112459.25241-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> References: <20210419112459.25241-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210419_042507_036565_94BBEEE6 X-CRM114-Status: GOOD ( 14.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to use the same driver on non-OF platforms, make of_mmc_spi.c resource provider agnostic. Signed-off-by: Andy Shevchenko --- drivers/mmc/host/Makefile | 2 -- drivers/mmc/host/of_mmc_spi.c | 6 ++---- include/linux/spi/mmc_spi.h | 9 --------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index 6df5c4774260..14004cc09aaa 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -34,9 +34,7 @@ obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o obj-$(CONFIG_MMC_MVSDIO) += mvsdio.o obj-$(CONFIG_MMC_DAVINCI) += davinci_mmc.o obj-$(CONFIG_MMC_SPI) += mmc_spi.o -ifeq ($(CONFIG_OF),y) obj-$(CONFIG_MMC_SPI) += of_mmc_spi.o -endif obj-$(CONFIG_MMC_S3C) += s3cmci.o obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index 009c3885f6ba..9d480a05f655 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c @@ -51,10 +51,9 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) { struct mmc_host *mmc = dev_get_drvdata(&spi->dev); struct device *dev = &spi->dev; - struct device_node *np = dev->of_node; struct of_mmc_spi *oms; - if (dev->platform_data || !np) + if (dev->platform_data || !dev_fwnode(dev)) return dev->platform_data; oms = kzalloc(sizeof(*oms), GFP_KERNEL); @@ -83,10 +82,9 @@ EXPORT_SYMBOL(mmc_spi_get_pdata); void mmc_spi_put_pdata(struct spi_device *spi) { struct device *dev = &spi->dev; - struct device_node *np = dev->of_node; struct of_mmc_spi *oms = to_of_mmc_spi(dev); - if (!dev->platform_data || !np) + if (!dev->platform_data || !dev_fwnode(dev)) return; kfree(oms); diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index 778ae8eb1f3e..9ad9a06e488d 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h @@ -35,16 +35,7 @@ struct mmc_spi_platform_data { void (*setpower)(struct device *, unsigned int maskval); }; -#ifdef CONFIG_OF extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi); extern void mmc_spi_put_pdata(struct spi_device *spi); -#else -static inline struct mmc_spi_platform_data * -mmc_spi_get_pdata(struct spi_device *spi) -{ - return spi->dev.platform_data; -} -static inline void mmc_spi_put_pdata(struct spi_device *spi) {} -#endif /* CONFIG_OF */ #endif /* __LINUX_SPI_MMC_SPI_H */