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