kpss-xcc.c (8bb5e7f4dcd9b9ef22a3ea25c9066a8a968f12dd) | kpss-xcc.c (c3db5128e80e1437cb08d0d41aeb7163004897e7) |
---|---|
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 | 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 |
15static const char *aux_parents[] = { 16 "pll8_vote", 17 "pxo", | 15static const struct clk_parent_data aux_parents[] = { 16 { .fw_name = "pll8_vote", .name = "pll8_vote" }, 17 { .fw_name = "pxo", .name = "pxo_board" }, |
18}; 19 20static const u32 aux_parent_map[] = { 21 3, 22 0, 23}; 24 25static 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}; 30MODULE_DEVICE_TABLE(of, kpss_xcc_match_table); 31 32static int kpss_xcc_driver_probe(struct platform_device *pdev) 33{ 34 const struct of_device_id *id; | 18}; 19 20static const u32 aux_parent_map[] = { 21 3, 22 0, 23}; 24 25static 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}; 30MODULE_DEVICE_TABLE(of, kpss_xcc_match_table); 31 32static int kpss_xcc_driver_probe(struct platform_device *pdev) 33{ 34 const struct of_device_id *id; |
35 struct clk *clk; | |
36 void __iomem *base; | 35 void __iomem *base; |
36 struct clk_hw *hw; |
|
37 const char *name; 38 39 id = of_match_device(kpss_xcc_match_table, &pdev->dev); 40 if (!id) 41 return -ENODEV; 42 43 base = devm_platform_ioremap_resource(pdev, 0); 44 if (IS_ERR(base)) --- 5 unchanged lines hidden (view full) --- 50 0, &name)) 51 return -ENODEV; 52 base += 0x14; 53 } else { 54 name = "acpu_l2_aux"; 55 base += 0x28; 56 } 57 | 37 const char *name; 38 39 id = of_match_device(kpss_xcc_match_table, &pdev->dev); 40 if (!id) 41 return -ENODEV; 42 43 base = devm_platform_ioremap_resource(pdev, 0); 44 if (IS_ERR(base)) --- 5 unchanged lines hidden (view full) --- 50 0, &name)) 51 return -ENODEV; 52 base += 0x14; 53 } else { 54 name = "acpu_l2_aux"; 55 base += 0x28; 56 } 57 |
58 clk = clk_register_mux_table(&pdev->dev, name, aux_parents, 59 ARRAY_SIZE(aux_parents), 0, base, 0, 0x3, 60 0, aux_parent_map, NULL); | 58 hw = devm_clk_hw_register_mux_parent_data_table(&pdev->dev, name, aux_parents, 59 ARRAY_SIZE(aux_parents), 0, 60 base, 0, 0x3, 61 0, aux_parent_map, NULL); |
61 | 62 |
62 platform_set_drvdata(pdev, clk); 63 64 return PTR_ERR_OR_ZERO(clk); | 63 return PTR_ERR_OR_ZERO(hw); |
65} 66 | 64} 65 |
67static int kpss_xcc_driver_remove(struct platform_device *pdev) 68{ 69 clk_unregister_mux(platform_get_drvdata(pdev)); 70 return 0; 71} 72 | |
73static struct platform_driver kpss_xcc_driver = { 74 .probe = kpss_xcc_driver_probe, | 66static struct platform_driver kpss_xcc_driver = { 67 .probe = kpss_xcc_driver_probe, |
75 .remove = kpss_xcc_driver_remove, | |
76 .driver = { 77 .name = "kpss-xcc", 78 .of_match_table = kpss_xcc_match_table, 79 }, 80}; 81module_platform_driver(kpss_xcc_driver); 82 83MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver"); 84MODULE_LICENSE("GPL v2"); 85MODULE_ALIAS("platform:kpss-xcc"); | 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"); |