Lines Matching +full:sun8i +full:- +full:a23 +full:- +full:apb0 +full:- +full:gates +full:- +full:clk
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Author: Boris BREZILLON <boris.brezillon@free-electrons.com>
7 * Allwinner A31 APB0 clock gates driver
10 #include <linux/clk-provider.h>
31 { .compatible = "allwinner,sun6i-a31-apb0-gates-clk", .data = &sun6i_a31_apb0_gates },
32 { .compatible = "allwinner,sun8i-a23-apb0-gates-clk", .data = &sun8i_a23_apb0_gates },
38 struct device_node *np = pdev->dev.of_node; in sun6i_a31_apb0_gates_clk_probe()
49 return -ENODEV; in sun6i_a31_apb0_gates_clk_probe()
51 data = of_device_get_match_data(&pdev->dev); in sun6i_a31_apb0_gates_clk_probe()
53 return -ENODEV; in sun6i_a31_apb0_gates_clk_probe()
61 return -EINVAL; in sun6i_a31_apb0_gates_clk_probe()
63 clk_data = devm_kzalloc(&pdev->dev, sizeof(struct clk_onecell_data), in sun6i_a31_apb0_gates_clk_probe()
66 return -ENOMEM; in sun6i_a31_apb0_gates_clk_probe()
68 /* Worst-case size approximation and memory allocation */ in sun6i_a31_apb0_gates_clk_probe()
69 ngates = find_last_bit(data->mask, SUN6I_APB0_GATES_MAX_SIZE); in sun6i_a31_apb0_gates_clk_probe()
70 clk_data->clks = devm_kcalloc(&pdev->dev, (ngates + 1), in sun6i_a31_apb0_gates_clk_probe()
71 sizeof(struct clk *), GFP_KERNEL); in sun6i_a31_apb0_gates_clk_probe()
72 if (!clk_data->clks) in sun6i_a31_apb0_gates_clk_probe()
73 return -ENOMEM; in sun6i_a31_apb0_gates_clk_probe()
75 for_each_set_bit(i, data->mask, SUN6I_APB0_GATES_MAX_SIZE) { in sun6i_a31_apb0_gates_clk_probe()
76 of_property_read_string_index(np, "clock-output-names", in sun6i_a31_apb0_gates_clk_probe()
79 clk_data->clks[i] = clk_register_gate(&pdev->dev, clk_name, in sun6i_a31_apb0_gates_clk_probe()
82 WARN_ON(IS_ERR(clk_data->clks[i])); in sun6i_a31_apb0_gates_clk_probe()
87 clk_data->clk_num = ngates + 1; in sun6i_a31_apb0_gates_clk_probe()
94 .name = "sun6i-a31-apb0-gates-clk",