aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh Bhat <naresh.bhat@linaro.org>2013-12-09 16:56:47 +0530
committerGraeme Gregory <graeme.gregory@linaro.org>2014-06-03 09:24:37 +0100
commit24e582f1ff985049ba90ea1aa7d7952c3ae1677d (patch)
tree38e72bb251216c7522a6a0085483005157fecfad
parent47fc59a29884a5a5b8c7a2477452c048b171f5b5 (diff)
downloadleg-kernel-24e582f1ff985049ba90ea1aa7d7952c3ae1677d.tar.gz
Driver / clk: add platform driver for fixed clock
Add platform driver for fixed clock which makes the initialization of fixed clock visible and for easy understand. TODO: maybe introduce a fixed-clock.c and its corresponding Kconfig is better. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Reviewed-by: Naresh Bhat <naresh.bhat@linaro.org>
-rw-r--r--drivers/clk/clk-fixed-rate.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c
index 0fc56ab6e844..321d3bbebe62 100644
--- a/drivers/clk/clk-fixed-rate.c
+++ b/drivers/clk/clk-fixed-rate.c
@@ -15,6 +15,7 @@
#include <linux/io.h>
#include <linux/err.h>
#include <linux/of.h>
+#include <linux/platform_device.h>
/*
* DOC: basic fixed-rate clock that cannot gate
@@ -133,5 +134,39 @@ void of_fixed_clk_setup(struct device_node *node)
of_clk_add_provider(node, of_clk_src_simple_get, clk);
}
EXPORT_SYMBOL_GPL(of_fixed_clk_setup);
-CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup);
#endif
+
+static int fixed_clk_probe(struct platform_device *pdev)
+{
+ if (pdev->dev.of_node)
+ of_fixed_clk_setup(pdev->dev.of_node);
+ else
+ return -ENODEV;
+
+ return 0;
+}
+
+static const struct of_device_id fixed_clk_match[] = {
+ { .compatible = "fixed-clock" },
+ {}
+};
+
+static struct platform_driver fixed_clk_driver = {
+ .driver = {
+ .name = "fixed-clk",
+ .owner = THIS_MODULE,
+ .of_match_table = fixed_clk_match,
+ },
+ .probe = fixed_clk_probe,
+};
+
+static int __init fixed_clk_init(void)
+{
+ return platform_driver_register(&fixed_clk_driver);
+}
+
+/**
+ * fixed clock will used for AMBA bus, UART and etc, so it should be
+ * initialized early enough.
+ */
+postcore_initcall(fixed_clk_init);