kpss-xcc.c (29583dfcd2dd72c766422bd05c16f06c6b1fb356) kpss-xcc.c (09be1a39e685d8c5edd471fd1cac9a8f8280d2de)
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>

--- 17 unchanged lines hidden (view full) ---

26 { .compatible = "qcom,kpss-acc-v1", .data = (void *)1UL },
27 { .compatible = "qcom,kpss-gcc" },
28 {}
29};
30MODULE_DEVICE_TABLE(of, kpss_xcc_match_table);
31
32static int kpss_xcc_driver_probe(struct platform_device *pdev)
33{
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>

--- 17 unchanged lines hidden (view full) ---

26 { .compatible = "qcom,kpss-acc-v1", .data = (void *)1UL },
27 { .compatible = "qcom,kpss-gcc" },
28 {}
29};
30MODULE_DEVICE_TABLE(of, kpss_xcc_match_table);
31
32static int kpss_xcc_driver_probe(struct platform_device *pdev)
33{
34 struct device *dev = &pdev->dev;
34 const struct of_device_id *id;
35 void __iomem *base;
36 struct clk_hw *hw;
37 const char *name;
38
35 const struct of_device_id *id;
36 void __iomem *base;
37 struct clk_hw *hw;
38 const char *name;
39
39 id = of_match_device(kpss_xcc_match_table, &pdev->dev);
40 id = of_match_device(kpss_xcc_match_table, dev);
40 if (!id)
41 return -ENODEV;
42
43 base = devm_platform_ioremap_resource(pdev, 0);
44 if (IS_ERR(base))
45 return PTR_ERR(base);
46
47 if (id->data) {
41 if (!id)
42 return -ENODEV;
43
44 base = devm_platform_ioremap_resource(pdev, 0);
45 if (IS_ERR(base))
46 return PTR_ERR(base);
47
48 if (id->data) {
48 if (of_property_read_string_index(pdev->dev.of_node,
49 if (of_property_read_string_index(dev->of_node,
49 "clock-output-names",
50 0, &name))
51 return -ENODEV;
52 base += 0x14;
53 } else {
54 name = "acpu_l2_aux";
55 base += 0x28;
56 }
57
50 "clock-output-names",
51 0, &name))
52 return -ENODEV;
53 base += 0x14;
54 } else {
55 name = "acpu_l2_aux";
56 base += 0x28;
57 }
58
58 hw = devm_clk_hw_register_mux_parent_data_table(&pdev->dev, name, aux_parents,
59 hw = devm_clk_hw_register_mux_parent_data_table(dev, name, aux_parents,
59 ARRAY_SIZE(aux_parents), 0,
60 base, 0, 0x3,
61 0, aux_parent_map, NULL);
60 ARRAY_SIZE(aux_parents), 0,
61 base, 0, 0x3,
62 0, aux_parent_map, NULL);
63 if (IS_ERR(hw))
64 return PTR_ERR(hw);
62
65
63 return PTR_ERR_OR_ZERO(hw);
66 of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get, hw);
67
68 return 0;
64}
65
66static struct platform_driver kpss_xcc_driver = {
67 .probe = kpss_xcc_driver_probe,
68 .driver = {
69 .name = "kpss-xcc",
70 .of_match_table = kpss_xcc_match_table,
71 },
72};
73module_platform_driver(kpss_xcc_driver);
74
75MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver");
76MODULE_LICENSE("GPL v2");
77MODULE_ALIAS("platform:kpss-xcc");
69}
70
71static struct platform_driver kpss_xcc_driver = {
72 .probe = kpss_xcc_driver_probe,
73 .driver = {
74 .name = "kpss-xcc",
75 .of_match_table = kpss_xcc_match_table,
76 },
77};
78module_platform_driver(kpss_xcc_driver);
79
80MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver");
81MODULE_LICENSE("GPL v2");
82MODULE_ALIAS("platform:kpss-xcc");