xref: /openbmc/linux/drivers/clk/x86/clk-lpss-atom.c (revision cf0a9565)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Intel Low Power Subsystem clocks.
4  *
5  * Copyright (C) 2013, Intel Corporation
6  * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
7  *	    Heikki Krogerus <heikki.krogerus@linux.intel.com>
8  */
9 
10 #include <linux/clk-provider.h>
11 #include <linux/err.h>
12 #include <linux/module.h>
13 #include <linux/platform_data/x86/clk-lpss.h>
14 #include <linux/platform_device.h>
15 
lpss_atom_clk_probe(struct platform_device * pdev)16 static int lpss_atom_clk_probe(struct platform_device *pdev)
17 {
18 	struct lpss_clk_data *drvdata;
19 	struct clk *clk;
20 
21 	drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
22 	if (!drvdata)
23 		return -ENOMEM;
24 
25 	/* LPSS free running clock */
26 	drvdata->name = "lpss_clk";
27 	clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL,
28 				      0, 100000000);
29 	if (IS_ERR(clk))
30 		return PTR_ERR(clk);
31 
32 	drvdata->clk = clk;
33 	platform_set_drvdata(pdev, drvdata);
34 	return 0;
35 }
36 
37 static struct platform_driver lpss_atom_clk_driver = {
38 	.driver = {
39 		.name = "clk-lpss-atom",
40 	},
41 	.probe = lpss_atom_clk_probe,
42 };
43 
lpss_atom_clk_init(void)44 int __init lpss_atom_clk_init(void)
45 {
46 	return platform_driver_register(&lpss_atom_clk_driver);
47 }
48