xref: /linux/drivers/clk/qcom/gxclkctl-kaanapali.c (revision fc2d791a43d3880496d1c729b8bd74d2c19cb4e7)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4  */
5 
6 #include <linux/clk-provider.h>
7 #include <linux/mod_devicetable.h>
8 #include <linux/module.h>
9 #include <linux/platform_device.h>
10 #include <linux/regmap.h>
11 
12 #include <dt-bindings/clock/qcom,kaanapali-gxclkctl.h>
13 
14 #include "common.h"
15 #include "gdsc.h"
16 
17 enum {
18 	DT_BI_TCXO,
19 };
20 
21 static struct gdsc gx_clkctl_gx_gdsc = {
22 	.gdscr = 0x4024,
23 	.en_rest_wait_val = 0x2,
24 	.en_few_wait_val = 0x2,
25 	.clk_dis_wait_val = 0xf,
26 	.pd = {
27 		.name = "gx_clkctl_gx_gdsc",
28 		.power_on = gdsc_gx_do_nothing_enable,
29 	},
30 	.pwrsts = PWRSTS_OFF_ON,
31 	.flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE,
32 };
33 
34 static struct gdsc *gx_clkctl_gdscs[] = {
35 	[GX_CLKCTL_GX_GDSC] = &gx_clkctl_gx_gdsc,
36 };
37 
38 static const struct regmap_config gx_clkctl_regmap_config = {
39 	.reg_bits = 32,
40 	.reg_stride = 4,
41 	.val_bits = 32,
42 	.max_register = 0x4038,
43 	.fast_io = true,
44 };
45 
46 static const struct qcom_cc_desc gx_clkctl_kaanapali_desc = {
47 	.config = &gx_clkctl_regmap_config,
48 	.gdscs = gx_clkctl_gdscs,
49 	.num_gdscs = ARRAY_SIZE(gx_clkctl_gdscs),
50 	.use_rpm = true,
51 };
52 
53 static const struct of_device_id gx_clkctl_kaanapali_match_table[] = {
54 	{ .compatible = "qcom,glymur-gxclkctl" },
55 	{ .compatible = "qcom,kaanapali-gxclkctl" },
56 	{ .compatible = "qcom,sm8750-gxclkctl" },
57 	{ }
58 };
59 MODULE_DEVICE_TABLE(of, gx_clkctl_kaanapali_match_table);
60 
61 static int gx_clkctl_kaanapali_probe(struct platform_device *pdev)
62 {
63 	return qcom_cc_probe(pdev, &gx_clkctl_kaanapali_desc);
64 }
65 
66 static struct platform_driver gx_clkctl_kaanapali_driver = {
67 	.probe = gx_clkctl_kaanapali_probe,
68 	.driver = {
69 		.name = "gxclkctl-kaanapali",
70 		.of_match_table = gx_clkctl_kaanapali_match_table,
71 	},
72 };
73 
74 module_platform_driver(gx_clkctl_kaanapali_driver);
75 
76 MODULE_DESCRIPTION("QTI GXCLKCTL Kaanapali Driver");
77 MODULE_LICENSE("GPL");
78