summaryrefslogtreecommitdiff
path: root/drivers/clk/qcom/gxclkctl-kaanapali.c
blob: 7b0af0ba1e685dc92507325936adfa2c97439ad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
 */

#include <linux/clk-provider.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>

#include <dt-bindings/clock/qcom,kaanapali-gxclkctl.h>

#include "common.h"
#include "gdsc.h"

enum {
	DT_BI_TCXO,
};

static struct gdsc gx_clkctl_gx_gdsc = {
	.gdscr = 0x4024,
	.en_rest_wait_val = 0x2,
	.en_few_wait_val = 0x2,
	.clk_dis_wait_val = 0xf,
	.pd = {
		.name = "gx_clkctl_gx_gdsc",
		.power_on = gdsc_gx_do_nothing_enable,
	},
	.pwrsts = PWRSTS_OFF_ON,
	.flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE,
};

static struct gdsc *gx_clkctl_gdscs[] = {
	[GX_CLKCTL_GX_GDSC] = &gx_clkctl_gx_gdsc,
};

static const struct regmap_config gx_clkctl_regmap_config = {
	.reg_bits = 32,
	.reg_stride = 4,
	.val_bits = 32,
	.max_register = 0x4038,
	.fast_io = true,
};

static const struct qcom_cc_desc gx_clkctl_kaanapali_desc = {
	.config = &gx_clkctl_regmap_config,
	.gdscs = gx_clkctl_gdscs,
	.num_gdscs = ARRAY_SIZE(gx_clkctl_gdscs),
	.use_rpm = true,
};

static const struct of_device_id gx_clkctl_kaanapali_match_table[] = {
	{ .compatible = "qcom,glymur-gxclkctl" },
	{ .compatible = "qcom,kaanapali-gxclkctl" },
	{ .compatible = "qcom,milos-gxclkctl" },
	{ .compatible = "qcom,sm8750-gxclkctl" },
	{ }
};
MODULE_DEVICE_TABLE(of, gx_clkctl_kaanapali_match_table);

static int gx_clkctl_kaanapali_probe(struct platform_device *pdev)
{
	return qcom_cc_probe(pdev, &gx_clkctl_kaanapali_desc);
}

static struct platform_driver gx_clkctl_kaanapali_driver = {
	.probe = gx_clkctl_kaanapali_probe,
	.driver = {
		.name = "gxclkctl-kaanapali",
		.of_match_table = gx_clkctl_kaanapali_match_table,
	},
};

module_platform_driver(gx_clkctl_kaanapali_driver);

MODULE_DESCRIPTION("QTI GXCLKCTL Kaanapali Driver");
MODULE_LICENSE("GPL");