From patchwork Mon Jan 8 15:44:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 123729 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2881953qgn; Mon, 8 Jan 2018 07:44:33 -0800 (PST) X-Google-Smtp-Source: ACJfBotZ4lQ3JVEK5IMHPES73BOBoYdtgHzgR/d0rbmpFWGBSwjNT+ihZdO228M29T6QgFRDju4f X-Received: by 10.99.173.79 with SMTP id y15mr9742763pgo.444.1515426273466; Mon, 08 Jan 2018 07:44:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515426273; cv=none; d=google.com; s=arc-20160816; b=wPa9aaqufSIz2iZE3c5IGKZAIMw+PfZgtMGI7Qpg8BJ41DlPEC3W+8Z7ZcT0w2O0s7 f5qTBChomx0f6kB0v7ljlEo7pXm2TevB4ZZ2tdVm19YkQvmMletIwvvc613nW1PRh6KB POhnVPu8/RPYmhUwcXBk2w1lGv0sqPStJ0SQTA0nvnuyrDLUlWyaQX4hmY3a7bqeGHLu j28M0aw13yC6b/ihVLkC4izVp9TnXfvra2V6ww5NjbCAxGWTSUi0EvM8WqCEEg2skNRk j/ge5V8OLhIA4Z2uODtHK5k3qkG2BIIMedlTB2JSsnD08GTLaOSZEZu+v4ws+OEuCEvf 2l9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=DdW50onXK+5tybb998DowEEOYBVCXSIHiFVcbtR3uf4=; b=IdQLT7aEv6mn57SZqQHDhIoInVvxIKTPjm3EJuZ5L6lDcAmbNnQwmAaZx/tUGLtotp lih8PYNUSHCCvE/FHPxf0YD0pnrsfe1Ana7ygCdYJSHRneTHnr1o8z3v6fRTGj6LRc/X h9X/TFCiXhP2hwemRVNNXCI7HKTmzyjqG2d96hB8dsqrob3a0gXDZePUtdKcFOK9CLaD S4YAuQ8ByCMjJYvRd/aygfHnEhR6c2LCo+DSGjtuvchsoJnde/Wj7Qr47ivfxcX0z2+B wg7QAnBWAa2fhxzXBbG+Vc2BJwrV783CVdnouapBVeSBt/ligF8DzLff3gNBztotj6N/ GKBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LZpMdBK4; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si7644406pgn.9.2018.01.08.07.44.33; Mon, 08 Jan 2018 07:44:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LZpMdBK4; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934208AbeAHPob (ORCPT + 6 others); Mon, 8 Jan 2018 10:44:31 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34362 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932282AbeAHPo2 (ORCPT ); Mon, 8 Jan 2018 10:44:28 -0500 Received: by mail-wm0-f65.google.com with SMTP id y82so16342400wmg.1 for ; Mon, 08 Jan 2018 07:44:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=em5g42yelh3dx1WBMWgQob0cc/nYuFmnfnndJn5Hptw=; b=LZpMdBK4DMJ2/FG7JdvFB9iyyMbSmZWkFXEb+SjMSa00dcKzmxmiLlFit1kugEPlgg /yaMm3hfbTmS2Mzm+pAFRCSA0oCHs5PHc9mTU94vzVuQohBd8GGapCuhCoHRWvRb00M0 4N7M7vmud603rjGO+P5ggLnW++du561nZFQFA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=em5g42yelh3dx1WBMWgQob0cc/nYuFmnfnndJn5Hptw=; b=n2GUCf9cPCxbxPmTCRiNOEnAJ7u4TLtpjWfIXCWzms/Pc1QGq990TWQ2HQAQwRpiTW i24jC+peeTCV0bJorT+6ybOLi3EF7a+HhnO+gT5PAmniZADwChYP7/dfZ/Zw5fwuGXAK 8Wve2EU/47KJtwQs9Mk1+1Dm/wyQ2tQNAm1r5tT47i2+kRCJRowQT616b11+M+PzxerY uqklZy4hJIHmz4Hl0sNy4pE99Xwg6QKgG3VAKzz5zBBn0obQ4d8Y6+Me7RY/sTVX+8gM J2jVWYs3a/UMKGN/AQBK4WfjpU+My12tbjGsZ44ZCmfIx77N35ocXWIwmITW5wx9qGcg xTjA== X-Gm-Message-State: AKGB3mI5qDsquETNOjjiT5MHqNJK12gLHFw0XYpV8ffGiplIpMHnEBg3 9aIPNl0/Tc8gssiyGR/oLi0JCND1B3o= X-Received: by 10.28.146.16 with SMTP id u16mr9765928wmd.124.1515426266358; Mon, 08 Jan 2018 07:44:26 -0800 (PST) Received: from localhost.localdomain ([154.144.231.40]) by smtp.gmail.com with ESMTPSA id o2sm10017417wmf.27.2018.01.08.07.44.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 07:44:25 -0800 (PST) From: Ard Biesheuvel To: linux-mmc@vger.kernel.org Cc: adrian.hunter@intel.com, ulf.hansson@linaro.org, Ard Biesheuvel Subject: [PATCH v2] mmc: sdhci_f_sdh30: add ACPI support Date: Mon, 8 Jan 2018 15:44:19 +0000 Message-Id: <20180108154419.2821-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The Fujitsu SDH30 SDHCI controller may be described as a SCX0002 ACPI device on ACPI platforms incorporating the Socionext SynQuacer SoC. Given that mmc_of_parse() has already been made ACPI/DT agnostic, making the SDH30 driver ACPI capable is actually rather simple: all we need to do is make the call to sdhci_get_of_property() [which does not set any properties we care about] and the clock handling dependent on whether we are dealing with a DT device, and exposing the ACPI id via the platform_driver struct and the module metadata. Signed-off-by: Ard Biesheuvel --- v2: make OF optional now that ACPI is supported drop dev_of_node() check when disabling the clocks - those routines tolerate NULL pointers so there's no need drivers/mmc/host/Kconfig | 2 +- drivers/mmc/host/sdhci_f_sdh30.c | 52 +++++++++++++------- 2 files changed, 35 insertions(+), 19 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Adrian Hunter diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 567028c9219a..07ed947ed10b 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -320,7 +320,7 @@ config MMC_SDHCI_BCM_KONA config MMC_SDHCI_F_SDH30 tristate "SDHCI support for Fujitsu Semiconductor F_SDH30" depends on MMC_SDHCI_PLTFM - depends on OF + depends on OF || ACPI help This selects the Secure Digital Host Controller Interface (SDHCI) Needed by some Fujitsu SoC for MMC / SD / SDIO support. diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c index 04ca0d33a521..485f7591fae4 100644 --- a/drivers/mmc/host/sdhci_f_sdh30.c +++ b/drivers/mmc/host/sdhci_f_sdh30.c @@ -10,9 +10,11 @@ * the Free Software Foundation, version 2 of the License. */ +#include #include #include #include +#include #include #include @@ -146,7 +148,6 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev) platform_set_drvdata(pdev, host); - sdhci_get_of_property(pdev); host->hw_name = "f_sdh30"; host->ops = &sdhci_f_sdh30_ops; host->irq = irq; @@ -158,25 +159,29 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev) goto err; } - priv->clk_iface = devm_clk_get(&pdev->dev, "iface"); - if (IS_ERR(priv->clk_iface)) { - ret = PTR_ERR(priv->clk_iface); - goto err; - } + if (dev_of_node(dev)) { + sdhci_get_of_property(pdev); - ret = clk_prepare_enable(priv->clk_iface); - if (ret) - goto err; + priv->clk_iface = devm_clk_get(&pdev->dev, "iface"); + if (IS_ERR(priv->clk_iface)) { + ret = PTR_ERR(priv->clk_iface); + goto err; + } - priv->clk = devm_clk_get(&pdev->dev, "core"); - if (IS_ERR(priv->clk)) { - ret = PTR_ERR(priv->clk); - goto err_clk; - } + ret = clk_prepare_enable(priv->clk_iface); + if (ret) + goto err; - ret = clk_prepare_enable(priv->clk); - if (ret) - goto err_clk; + priv->clk = devm_clk_get(&pdev->dev, "core"); + if (IS_ERR(priv->clk)) { + ret = PTR_ERR(priv->clk); + goto err_clk; + } + + ret = clk_prepare_enable(priv->clk); + if (ret) + goto err_clk; + } /* init vendor specific regs */ ctrl = sdhci_readw(host, F_SDH30_AHB_CONFIG); @@ -226,16 +231,27 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF static const struct of_device_id f_sdh30_dt_ids[] = { { .compatible = "fujitsu,mb86s70-sdhci-3.0" }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, f_sdh30_dt_ids); +#endif + +#ifdef CONFIG_ACPI +static const struct acpi_device_id f_sdh30_acpi_ids[] = { + { "SCX0002" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(acpi, f_sdh30_acpi_ids); +#endif static struct platform_driver sdhci_f_sdh30_driver = { .driver = { .name = "f_sdh30", - .of_match_table = f_sdh30_dt_ids, + .of_match_table = of_match_ptr(f_sdh30_dt_ids), + .acpi_match_table = ACPI_PTR(f_sdh30_acpi_ids), .pm = &sdhci_pltfm_pmops, }, .probe = sdhci_f_sdh30_probe,