Lines Matching +full:sun8i +full:- +full:a23 +full:- +full:apb0 +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()
50 return -ENODEV; in sun6i_a31_apb0_gates_clk_probe()
52 data = of_device_get_match_data(&pdev->dev); in sun6i_a31_apb0_gates_clk_probe()
54 return -ENODEV; in sun6i_a31_apb0_gates_clk_probe()
57 reg = devm_ioremap_resource(&pdev->dev, r); in sun6i_a31_apb0_gates_clk_probe()
63 return -EINVAL; in sun6i_a31_apb0_gates_clk_probe()
65 clk_data = devm_kzalloc(&pdev->dev, sizeof(struct clk_onecell_data), in sun6i_a31_apb0_gates_clk_probe()
68 return -ENOMEM; in sun6i_a31_apb0_gates_clk_probe()
70 /* Worst-case size approximation and memory allocation */ in sun6i_a31_apb0_gates_clk_probe()
71 ngates = find_last_bit(data->mask, SUN6I_APB0_GATES_MAX_SIZE); in sun6i_a31_apb0_gates_clk_probe()
72 clk_data->clks = devm_kcalloc(&pdev->dev, (ngates + 1), in sun6i_a31_apb0_gates_clk_probe()
73 sizeof(struct clk *), GFP_KERNEL); in sun6i_a31_apb0_gates_clk_probe()
74 if (!clk_data->clks) in sun6i_a31_apb0_gates_clk_probe()
75 return -ENOMEM; in sun6i_a31_apb0_gates_clk_probe()
77 for_each_set_bit(i, data->mask, SUN6I_APB0_GATES_MAX_SIZE) { in sun6i_a31_apb0_gates_clk_probe()
78 of_property_read_string_index(np, "clock-output-names", in sun6i_a31_apb0_gates_clk_probe()
81 clk_data->clks[i] = clk_register_gate(&pdev->dev, clk_name, in sun6i_a31_apb0_gates_clk_probe()
84 WARN_ON(IS_ERR(clk_data->clks[i])); in sun6i_a31_apb0_gates_clk_probe()
89 clk_data->clk_num = ngates + 1; in sun6i_a31_apb0_gates_clk_probe()
96 .name = "sun6i-a31-apb0-gates-clk",