]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/cpufreq/mt8173-cpufreq.c
Merge tag 'xtensa-20170507' of git://github.com/jcmvbkbc/linux-xtensa
[karo-tx-linux.git] / drivers / cpufreq / mt8173-cpufreq.c
index ab25b1235a5eadc32cbc7cf904e11665e786f878..fd1886faf33abcfbd1bc1fe22a36a4dfa92e8865 100644 (file)
@@ -573,14 +573,33 @@ static struct platform_driver mt8173_cpufreq_platdrv = {
        .probe          = mt8173_cpufreq_probe,
 };
 
-static int mt8173_cpufreq_driver_init(void)
+/* List of machines supported by this driver */
+static const struct of_device_id mt8173_cpufreq_machines[] __initconst = {
+       { .compatible = "mediatek,mt817x", },
+       { .compatible = "mediatek,mt8173", },
+       { .compatible = "mediatek,mt8176", },
+
+       { }
+};
+
+static int __init mt8173_cpufreq_driver_init(void)
 {
+       struct device_node *np;
+       const struct of_device_id *match;
        struct platform_device *pdev;
        int err;
 
-       if (!of_machine_is_compatible("mediatek,mt8173"))
+       np = of_find_node_by_path("/");
+       if (!np)
                return -ENODEV;
 
+       match = of_match_node(mt8173_cpufreq_machines, np);
+       of_node_put(np);
+       if (!match) {
+               pr_warn("Machine is not compatible with mt8173-cpufreq\n");
+               return -ENODEV;
+       }
+
        err = platform_driver_register(&mt8173_cpufreq_platdrv);
        if (err)
                return err;