Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci_f_sdh30: add ACPI support

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 <ard.biesheuvel@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Ard Biesheuvel and committed by
Ulf Hansson
90e1d8cc 3602785b

+37 -21
+1 -1
drivers/mmc/host/Kconfig
··· 321 321 config MMC_SDHCI_F_SDH30 322 322 tristate "SDHCI support for Fujitsu Semiconductor F_SDH30" 323 323 depends on MMC_SDHCI_PLTFM 324 - depends on OF 324 + depends on OF || ACPI 325 325 help 326 326 This selects the Secure Digital Host Controller Interface (SDHCI) 327 327 Needed by some Fujitsu SoC for MMC / SD / SDIO support.
+36 -20
drivers/mmc/host/sdhci_f_sdh30.c
··· 10 10 * the Free Software Foundation, version 2 of the License. 11 11 */ 12 12 13 + #include <linux/acpi.h> 13 14 #include <linux/err.h> 14 15 #include <linux/delay.h> 15 16 #include <linux/module.h> 17 + #include <linux/of.h> 16 18 #include <linux/property.h> 17 19 #include <linux/clk.h> 18 20 ··· 148 146 149 147 platform_set_drvdata(pdev, host); 150 148 151 - sdhci_get_of_property(pdev); 152 149 host->hw_name = "f_sdh30"; 153 150 host->ops = &sdhci_f_sdh30_ops; 154 151 host->irq = irq; ··· 159 158 goto err; 160 159 } 161 160 162 - priv->clk_iface = devm_clk_get(&pdev->dev, "iface"); 163 - if (IS_ERR(priv->clk_iface)) { 164 - ret = PTR_ERR(priv->clk_iface); 165 - goto err; 161 + if (dev_of_node(dev)) { 162 + sdhci_get_of_property(pdev); 163 + 164 + priv->clk_iface = devm_clk_get(&pdev->dev, "iface"); 165 + if (IS_ERR(priv->clk_iface)) { 166 + ret = PTR_ERR(priv->clk_iface); 167 + goto err; 168 + } 169 + 170 + ret = clk_prepare_enable(priv->clk_iface); 171 + if (ret) 172 + goto err; 173 + 174 + priv->clk = devm_clk_get(&pdev->dev, "core"); 175 + if (IS_ERR(priv->clk)) { 176 + ret = PTR_ERR(priv->clk); 177 + goto err_clk; 178 + } 179 + 180 + ret = clk_prepare_enable(priv->clk); 181 + if (ret) 182 + goto err_clk; 166 183 } 167 - 168 - ret = clk_prepare_enable(priv->clk_iface); 169 - if (ret) 170 - goto err; 171 - 172 - priv->clk = devm_clk_get(&pdev->dev, "core"); 173 - if (IS_ERR(priv->clk)) { 174 - ret = PTR_ERR(priv->clk); 175 - goto err_clk; 176 - } 177 - 178 - ret = clk_prepare_enable(priv->clk); 179 - if (ret) 180 - goto err_clk; 181 184 182 185 /* init vendor specific regs */ 183 186 ctrl = sdhci_readw(host, F_SDH30_AHB_CONFIG); ··· 231 226 return 0; 232 227 } 233 228 229 + #ifdef CONFIG_OF 234 230 static const struct of_device_id f_sdh30_dt_ids[] = { 235 231 { .compatible = "fujitsu,mb86s70-sdhci-3.0" }, 236 232 { /* sentinel */ } 237 233 }; 238 234 MODULE_DEVICE_TABLE(of, f_sdh30_dt_ids); 235 + #endif 236 + 237 + #ifdef CONFIG_ACPI 238 + static const struct acpi_device_id f_sdh30_acpi_ids[] = { 239 + { "SCX0002" }, 240 + { /* sentinel */ } 241 + }; 242 + MODULE_DEVICE_TABLE(acpi, f_sdh30_acpi_ids); 243 + #endif 239 244 240 245 static struct platform_driver sdhci_f_sdh30_driver = { 241 246 .driver = { 242 247 .name = "f_sdh30", 243 - .of_match_table = f_sdh30_dt_ids, 248 + .of_match_table = of_match_ptr(f_sdh30_dt_ids), 249 + .acpi_match_table = ACPI_PTR(f_sdh30_acpi_ids), 244 250 .pm = &sdhci_pltfm_pmops, 245 251 }, 246 252 .probe = sdhci_f_sdh30_probe,