diff options
| -rw-r--r-- | drivers/clk/qcom/Kconfig | 8 | ||||
| -rw-r--r-- | drivers/clk/qcom/Makefile | 1 | ||||
| -rw-r--r-- | drivers/clk/qcom/kpss-xcc.c | 87 |
3 files changed, 96 insertions, 0 deletions
diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 93f1342f1949..bed7ef4f51a2 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig | |||
| @@ -284,3 +284,11 @@ config QCOM_HFPLL | |||
| 284 | Support for the high-frequency PLLs present on Qualcomm devices. | 284 | Support for the high-frequency PLLs present on Qualcomm devices. |
| 285 | Say Y if you want to support CPU frequency scaling on devices | 285 | Say Y if you want to support CPU frequency scaling on devices |
| 286 | such as MSM8974, APQ8084, etc. | 286 | such as MSM8974, APQ8084, etc. |
| 287 | |||
| 288 | config KPSS_XCC | ||
| 289 | tristate "KPSS Clock Controller" | ||
| 290 | depends on COMMON_CLK_QCOM | ||
| 291 | help | ||
| 292 | Support for the Krait ACC and GCC clock controllers. Say Y | ||
| 293 | if you want to support CPU frequency scaling on devices such | ||
| 294 | as MSM8960, APQ8064, etc. | ||
diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile index 506c4cfd775f..92310ee33e9e 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile | |||
| @@ -45,4 +45,5 @@ obj-$(CONFIG_SDM_DISPCC_845) += dispcc-sdm845.o | |||
| 45 | obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o | 45 | obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o |
| 46 | obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o | 46 | obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o |
| 47 | obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o | 47 | obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o |
| 48 | obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o | ||
| 48 | obj-$(CONFIG_QCOM_HFPLL) += hfpll.o | 49 | obj-$(CONFIG_QCOM_HFPLL) += hfpll.o |
diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c new file mode 100644 index 000000000000..8590b5edd19d --- /dev/null +++ b/drivers/clk/qcom/kpss-xcc.c | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | // Copyright (c) 2018, The Linux Foundation. All rights reserved. | ||
| 3 | |||
| 4 | #include <linux/kernel.h> | ||
| 5 | #include <linux/init.h> | ||
| 6 | #include <linux/module.h> | ||
| 7 | #include <linux/platform_device.h> | ||
| 8 | #include <linux/err.h> | ||
| 9 | #include <linux/io.h> | ||
| 10 | #include <linux/of.h> | ||
| 11 | #include <linux/of_device.h> | ||
| 12 | #include <linux/clk.h> | ||
| 13 | #include <linux/clk-provider.h> | ||
| 14 | |||
| 15 | static const char *aux_parents[] = { | ||
| 16 | "pll8_vote", | ||
| 17 | "pxo", | ||
| 18 | }; | ||
| 19 | |||
| 20 | static unsigned int aux_parent_map[] = { | ||
| 21 | 3, | ||
| 22 | 0, | ||
| 23 | }; | ||
| 24 | |||
| 25 | static const struct of_device_id kpss_xcc_match_table[] = { | ||
| 26 | { .compatible = "qcom,kpss-acc-v1", .data = (void *)1UL }, | ||
| 27 | { .compatible = "qcom,kpss-gcc" }, | ||
| 28 | {} | ||
| 29 | }; | ||
| 30 | MODULE_DEVICE_TABLE(of, kpss_xcc_match_table); | ||
| 31 | |||
| 32 | static int kpss_xcc_driver_probe(struct platform_device *pdev) | ||
| 33 | { | ||
| 34 | const struct of_device_id *id; | ||
| 35 | struct clk *clk; | ||
| 36 | struct resource *res; | ||
| 37 | void __iomem *base; | ||
| 38 | const char *name; | ||
| 39 | |||
| 40 | id = of_match_device(kpss_xcc_match_table, &pdev->dev); | ||
| 41 | if (!id) | ||
| 42 | return -ENODEV; | ||
| 43 | |||
| 44 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 45 | base = devm_ioremap_resource(&pdev->dev, res); | ||
| 46 | if (IS_ERR(base)) | ||
| 47 | return PTR_ERR(base); | ||
| 48 | |||
| 49 | if (id->data) { | ||
| 50 | if (of_property_read_string_index(pdev->dev.of_node, | ||
| 51 | "clock-output-names", | ||
| 52 | 0, &name)) | ||
| 53 | return -ENODEV; | ||
| 54 | base += 0x14; | ||
| 55 | } else { | ||
| 56 | name = "acpu_l2_aux"; | ||
| 57 | base += 0x28; | ||
| 58 | } | ||
| 59 | |||
| 60 | clk = clk_register_mux_table(&pdev->dev, name, aux_parents, | ||
| 61 | ARRAY_SIZE(aux_parents), 0, base, 0, 0x3, | ||
| 62 | 0, aux_parent_map, NULL); | ||
| 63 | |||
| 64 | platform_set_drvdata(pdev, clk); | ||
| 65 | |||
| 66 | return PTR_ERR_OR_ZERO(clk); | ||
| 67 | } | ||
| 68 | |||
| 69 | static int kpss_xcc_driver_remove(struct platform_device *pdev) | ||
| 70 | { | ||
| 71 | clk_unregister_mux(platform_get_drvdata(pdev)); | ||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | |||
| 75 | static struct platform_driver kpss_xcc_driver = { | ||
| 76 | .probe = kpss_xcc_driver_probe, | ||
| 77 | .remove = kpss_xcc_driver_remove, | ||
| 78 | .driver = { | ||
| 79 | .name = "kpss-xcc", | ||
| 80 | .of_match_table = kpss_xcc_match_table, | ||
| 81 | }, | ||
| 82 | }; | ||
| 83 | module_platform_driver(kpss_xcc_driver); | ||
| 84 | |||
| 85 | MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver"); | ||
| 86 | MODULE_LICENSE("GPL v2"); | ||
| 87 | MODULE_ALIAS("platform:kpss-xcc"); | ||
