Lines Matching +full:sun9i +full:- +full:a80 +full:- +full:usb +full:- +full:clks

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2013-2015 Emilio López
9 #include <linux/clk-provider.h>
13 #include <linux/reset-controller.h>
19 * sunxi_usb_reset... - reset bits in usb clk registers handling
38 clk_prepare_enable(data->clk); in sunxi_usb_reset_assert()
39 spin_lock_irqsave(data->lock, flags); in sunxi_usb_reset_assert()
41 reg = readl(data->reg); in sunxi_usb_reset_assert()
42 writel(reg & ~BIT(id), data->reg); in sunxi_usb_reset_assert()
44 spin_unlock_irqrestore(data->lock, flags); in sunxi_usb_reset_assert()
45 clk_disable_unprepare(data->clk); in sunxi_usb_reset_assert()
59 clk_prepare_enable(data->clk); in sunxi_usb_reset_deassert()
60 spin_lock_irqsave(data->lock, flags); in sunxi_usb_reset_deassert()
62 reg = readl(data->reg); in sunxi_usb_reset_deassert()
63 writel(reg | BIT(id), data->reg); in sunxi_usb_reset_deassert()
65 spin_unlock_irqrestore(data->lock, flags); in sunxi_usb_reset_deassert()
66 clk_disable_unprepare(data->clk); in sunxi_usb_reset_deassert()
86 * sunxi_usb_clk_setup() - Setup function for usb gate clocks
112 /* Worst-case size approximation and memory allocation */ in sunxi_usb_clk_setup()
113 qty = find_last_bit((unsigned long *)&data->clk_mask, in sunxi_usb_clk_setup()
120 clk_data->clks = kcalloc(qty + 1, sizeof(struct clk *), GFP_KERNEL); in sunxi_usb_clk_setup()
121 if (!clk_data->clks) { in sunxi_usb_clk_setup()
126 for_each_set_bit(i, (unsigned long *)&data->clk_mask, in sunxi_usb_clk_setup()
128 of_property_read_string_index(node, "clock-output-names", in sunxi_usb_clk_setup()
130 clk_data->clks[i] = clk_register_gate(NULL, clk_name, in sunxi_usb_clk_setup()
133 WARN_ON(IS_ERR(clk_data->clks[i])); in sunxi_usb_clk_setup()
139 clk_data->clk_num = i; in sunxi_usb_clk_setup()
143 /* Register a reset controller for usb with reset bits */ in sunxi_usb_clk_setup()
144 if (data->reset_mask == 0) in sunxi_usb_clk_setup()
151 if (data->reset_needs_clk) { in sunxi_usb_clk_setup()
152 reset_data->clk = of_clk_get(node, 0); in sunxi_usb_clk_setup()
153 if (IS_ERR(reset_data->clk)) { in sunxi_usb_clk_setup()
160 reset_data->reg = reg; in sunxi_usb_clk_setup()
161 reset_data->lock = lock; in sunxi_usb_clk_setup()
162 reset_data->rcdev.nr_resets = __fls(data->reset_mask) + 1; in sunxi_usb_clk_setup()
163 reset_data->rcdev.ops = &sunxi_usb_reset_ops; in sunxi_usb_clk_setup()
164 reset_data->rcdev.of_node = node; in sunxi_usb_clk_setup()
165 reset_controller_register(&reset_data->rcdev); in sunxi_usb_clk_setup()
179 CLK_OF_DECLARE(sun4i_a10_usb, "allwinner,sun4i-a10-usb-clk", sun4i_a10_usb_setup);
190 CLK_OF_DECLARE(sun5i_a13_usb, "allwinner,sun5i-a13-usb-clk", sun5i_a13_usb_setup);
201 CLK_OF_DECLARE(sun6i_a31_usb, "allwinner,sun6i-a31-usb-clk", sun6i_a31_usb_setup);
212 CLK_OF_DECLARE(sun8i_a23_usb, "allwinner,sun8i-a23-usb-clk", sun8i_a23_usb_setup);
224 CLK_OF_DECLARE(sun8i_h3_usb, "allwinner,sun8i-h3-usb-clk", sun8i_h3_usb_setup);
238 CLK_OF_DECLARE(sun9i_a80_usb_mod, "allwinner,sun9i-a80-usb-mod-clk", sun9i_a80_usb_mod_setup);
252 CLK_OF_DECLARE(sun9i_a80_usb_phy, "allwinner,sun9i-a80-usb-phy-clk", sun9i_a80_usb_phy_setup);