blob: aa9d0bb98f8b8bd0e6713503bbe2c05266a2b2b2 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Mika Westerberg701190f2013-01-18 13:46:00 +00002/*
Mika Westerbergf6272172013-05-13 12:42:44 +00003 * Intel Low Power Subsystem clocks.
Mika Westerberg701190f2013-01-18 13:46:00 +00004 *
5 * Copyright (C) 2013, Intel Corporation
6 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
7 * Heikki Krogerus <heikki.krogerus@linux.intel.com>
Mika Westerberg701190f2013-01-18 13:46:00 +00008 */
9
Mika Westerberg701190f2013-01-18 13:46:00 +000010#include <linux/clk-provider.h>
11#include <linux/err.h>
12#include <linux/module.h>
Andy Shevchenkoa9443a62019-02-18 22:34:15 +030013#include <linux/platform_data/x86/clk-lpss.h>
Mika Westerberg701190f2013-01-18 13:46:00 +000014#include <linux/platform_device.h>
15
Andy Shevchenkocf0a9562021-07-22 22:34:50 +030016static int lpss_atom_clk_probe(struct platform_device *pdev)
Mika Westerberg701190f2013-01-18 13:46:00 +000017{
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030018 struct lpss_clk_data *drvdata;
Mika Westerberg701190f2013-01-18 13:46:00 +000019 struct clk *clk;
20
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030021 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
22 if (!drvdata)
23 return -ENOMEM;
24
Mika Westerberg701190f2013-01-18 13:46:00 +000025 /* LPSS free running clock */
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030026 drvdata->name = "lpss_clk";
27 clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL,
Stephen Boyd553b4852016-03-01 11:00:06 -080028 0, 100000000);
Mika Westerberg701190f2013-01-18 13:46:00 +000029 if (IS_ERR(clk))
30 return PTR_ERR(clk);
31
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030032 drvdata->clk = clk;
33 platform_set_drvdata(pdev, drvdata);
Mika Westerberg701190f2013-01-18 13:46:00 +000034 return 0;
35}
36
Andy Shevchenkocf0a9562021-07-22 22:34:50 +030037static struct platform_driver lpss_atom_clk_driver = {
Mika Westerberg701190f2013-01-18 13:46:00 +000038 .driver = {
Andy Shevchenkocf0a9562021-07-22 22:34:50 +030039 .name = "clk-lpss-atom",
Mika Westerberg701190f2013-01-18 13:46:00 +000040 },
Andy Shevchenkocf0a9562021-07-22 22:34:50 +030041 .probe = lpss_atom_clk_probe,
Mika Westerberg701190f2013-01-18 13:46:00 +000042};
43
Andy Shevchenkocf0a9562021-07-22 22:34:50 +030044int __init lpss_atom_clk_init(void)
Mika Westerberg701190f2013-01-18 13:46:00 +000045{
Andy Shevchenkocf0a9562021-07-22 22:34:50 +030046 return platform_driver_register(&lpss_atom_clk_driver);
Mika Westerberg701190f2013-01-18 13:46:00 +000047}