1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2018, The Linux Foundation. All rights reserved.
4 #include <linux/kernel.h>
5 #include <linux/init.h>
6 #include <linux/module.h>
7 #include <linux/platform_device.h>
11 #include <linux/of_device.h>
12 #include <linux/clk.h>
13 #include <linux/clk-provider.h>
15 static const char *aux_parents
[] = {
20 static unsigned int aux_parent_map
[] = {
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" },
30 MODULE_DEVICE_TABLE(of
, kpss_xcc_match_table
);
32 static int kpss_xcc_driver_probe(struct platform_device
*pdev
)
34 const struct of_device_id
*id
;
40 id
= of_match_device(kpss_xcc_match_table
, &pdev
->dev
);
44 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
45 base
= devm_ioremap_resource(&pdev
->dev
, res
);
50 if (of_property_read_string_index(pdev
->dev
.of_node
,
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
);
64 platform_set_drvdata(pdev
, clk
);
66 return PTR_ERR_OR_ZERO(clk
);
69 static int kpss_xcc_driver_remove(struct platform_device
*pdev
)
71 clk_unregister_mux(platform_get_drvdata(pdev
));
75 static struct platform_driver kpss_xcc_driver
= {
76 .probe
= kpss_xcc_driver_probe
,
77 .remove
= kpss_xcc_driver_remove
,
80 .of_match_table
= kpss_xcc_match_table
,
83 module_platform_driver(kpss_xcc_driver
);
85 MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver");
86 MODULE_LICENSE("GPL v2");
87 MODULE_ALIAS("platform:kpss-xcc");