From patchwork Wed Dec 27 18:14:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 122813 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2496319qgn; Wed, 27 Dec 2017 10:14:33 -0800 (PST) X-Google-Smtp-Source: ACJfBouSabISs3UDUuxN4/RSrGAVNmTKElpZ8vT6SupBS4Okuqtc/k9IcI0lrJKTjQMVaC9yf+Kf X-Received: by 10.84.133.132 with SMTP id f4mr30026272plf.413.1514398473066; Wed, 27 Dec 2017 10:14:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514398473; cv=none; d=google.com; s=arc-20160816; b=R4w/6Fr+KkVSlSOG+OEbpoddVIQzqUWqqj3zSBTIJxsgNKdq3cUQkZ41H9g7n0jHLn zbr5uTnA9mtbH7SH2BNDqmGCNpZjTmJk6D4XB/4T7BMgdPtxKmQIHEr2XGGbC2TmpQLY Kq2A+5VEBMxMpEHyjJw8Zsvg/jP0PTFs1hxMZn6UEF9We7JFKyhJgjM9KdmJzd8W3Fyj Otk401+ioEPyvFbuX+qoDQGRVcNjG1O9y+9QcEBMkkS4U+eaw97SCzCSJrHh2fJ+Hxjm QGTq6ajm7FWv/+R0pe996Y2aVWK9mftYxQAhyYJ9eplbYbVvbibr2l1gRUZPrVHz4ph7 eknw== 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=nWelh0BPH5BptoLvkyJzUP1kMnRcelAGVt8iSaG9wlE=; b=wbBmISIsnMoax+qmsLPnVrDoFCFeJBsA85qtt2mdLoeOJ/4fVAeAZ+M6a0DGh+hsOm 0fsf1r+/B+hoM4xSz4KT4Dx6o9m4lSpx1R2d9cpjN2JYoJuKAVJdf+dTc8wnQOiV3YKn WDvtWMhL1Bg3cLhfUFFPEQAvLQX6xcBQ15IMjcZ3hRu9CgCMGOZd8+ggTM2Oa5DMdyn8 EwYoAIjKkgOGFsaZUshhMnuQc5TCf9C6qJtNH1Xtq9rTVqHXnzM7Ag1ZUfOmHF+u2Q2A Ee/8YT/DsCLY/Xt58gMAsSJwYLocXUTSJpfB815oSPas7vbrCypC/2g33aZKPw0xqBdt iEAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=U0ugNnWw; 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 61si24945623plz.327.2017.12.27.10.14.32; Wed, 27 Dec 2017 10:14: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=U0ugNnWw; 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 S1752121AbdL0SOb (ORCPT + 6 others); Wed, 27 Dec 2017 13:14:31 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:40418 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752036AbdL0SOa (ORCPT ); Wed, 27 Dec 2017 13:14:30 -0500 Received: by mail-wr0-f196.google.com with SMTP id p17so13638972wre.7 for ; Wed, 27 Dec 2017 10:14:30 -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=HcWAZhKAkOgYPTIuIPeDU8ZDWnzMfJCzg/bcq5jkCfI=; b=U0ugNnWwEofL5sxjlrgbkVxhlIf6uop3MNXsR7lw/wwf1GSSoBNY6hiFtHkBt0DqDl gX2OFfMd6jHhd5leKQE0FEnRTICPCUlg28RTWYl/UloVi86YKwuccgjN7xG2DPpV47s/ 2KiuxOvJphrZQ/AUoQHkKFzDVzgZnO85MsZb4= 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=HcWAZhKAkOgYPTIuIPeDU8ZDWnzMfJCzg/bcq5jkCfI=; b=Fweqs7zW9pbSem4nIbe55jDXq2bpTvlagsczyZbDUwvETdeov7VdTjyPs7X6h5qvzn 0eg5aJChmh5/LtbQ44boy/9DFBCvAthrk0n8aF7olJ/2iktQe0fx3cKtp5Kr6FL9UTvo Xyu5vf+CRc6k9tcCaHZbkEtk21TIMWwwsCeTLz9ooO9VktA+mrGwi3kMLvboVwGXf2ij 0yJ4tPVA3acZzH5N3ItzuucyqqMNRHxfCyDBQexRzos3XNH3xoGSHPRoUnRBOIy8cy9h XUb+K8BLcba0aVcTfw14f1bfMVPVoLE8T8F/hg7pkDtZZnJ9LCd/rupvew+uZ7m7pSFn dxdA== X-Gm-Message-State: AKGB3mL9MzDvEX7QZwaSAkaoWXgi4C0SRhaq/yu6TThf3N7ob6IYlnea a+RPS4d3DRoKzmCoOIeXgWd/jzJ1UU8= X-Received: by 10.223.135.104 with SMTP id 37mr21187581wrz.182.1514398469187; Wed, 27 Dec 2017 10:14:29 -0800 (PST) Received: from localhost.localdomain ([105.137.110.132]) by smtp.gmail.com with ESMTPSA id v78sm9072111wmv.27.2017.12.27.10.14.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Dec 2017 10:14:28 -0800 (PST) From: Ard Biesheuvel To: linux-mmc@vger.kernel.org, ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: Ard Biesheuvel Subject: [PATCH] mmc: sdhci_f_sdh30: add ACPI support Date: Wed, 27 Dec 2017 18:14:20 +0000 Message-Id: <20171227181420.6230-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 --- drivers/mmc/host/sdhci_f_sdh30.c | 53 +++++++++++++------- 1 file changed, 34 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 diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c index 04ca0d33a521..102321a9ea34 100644 --- a/drivers/mmc/host/sdhci_f_sdh30.c +++ b/drivers/mmc/host/sdhci_f_sdh30.c @@ -10,6 +10,7 @@ * the Free Software Foundation, version 2 of the License. */ +#include #include #include #include @@ -146,7 +147,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 +158,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); @@ -217,8 +221,10 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev) sdhci_remove_host(host, readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); - clk_disable_unprepare(priv->clk_iface); - clk_disable_unprepare(priv->clk); + if (dev_of_node(priv->dev)) { + clk_disable_unprepare(priv->clk_iface); + clk_disable_unprepare(priv->clk); + } sdhci_free_host(host); platform_set_drvdata(pdev, NULL); @@ -232,10 +238,19 @@ static const struct of_device_id f_sdh30_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, f_sdh30_dt_ids); +#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, + .acpi_match_table = ACPI_PTR(f_sdh30_acpi_ids), .pm = &sdhci_pltfm_pmops, }, .probe = sdhci_f_sdh30_probe,