^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright 2013-2015 Emilio López
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Emilio López <emilio@elopez.com.ar>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/clk-provider.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/of_address.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/reset-controller.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * sunxi_usb_reset... - reset bits in usb clk registers handling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct usb_reset_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) void __iomem *reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) spinlock_t *lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct clk *clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct reset_controller_dev rcdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static int sunxi_usb_reset_assert(struct reset_controller_dev *rcdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned long id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct usb_reset_data *data = container_of(rcdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct usb_reset_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) rcdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u32 reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) clk_prepare_enable(data->clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) spin_lock_irqsave(data->lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) reg = readl(data->reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) writel(reg & ~BIT(id), data->reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) spin_unlock_irqrestore(data->lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) clk_disable_unprepare(data->clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static int sunxi_usb_reset_deassert(struct reset_controller_dev *rcdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) unsigned long id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct usb_reset_data *data = container_of(rcdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct usb_reset_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) rcdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) u32 reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) clk_prepare_enable(data->clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) spin_lock_irqsave(data->lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) reg = readl(data->reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) writel(reg | BIT(id), data->reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) spin_unlock_irqrestore(data->lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) clk_disable_unprepare(data->clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static const struct reset_control_ops sunxi_usb_reset_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .assert = sunxi_usb_reset_assert,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .deassert = sunxi_usb_reset_deassert,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * sunxi_usb_clk_setup() - Setup function for usb gate clocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define SUNXI_USB_MAX_SIZE 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) struct usb_clk_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) u32 clk_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) u32 reset_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) bool reset_needs_clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static void __init sunxi_usb_clk_setup(struct device_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) const struct usb_clk_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) spinlock_t *lock)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct clk_onecell_data *clk_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) struct usb_reset_data *reset_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) const char *clk_parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) const char *clk_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) void __iomem *reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) int qty;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) int i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) int j = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) reg = of_io_request_and_map(node, 0, of_node_full_name(node));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) if (IS_ERR(reg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) clk_parent = of_clk_get_parent_name(node, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) if (!clk_parent)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) /* Worst-case size approximation and memory allocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) qty = find_last_bit((unsigned long *)&data->clk_mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) SUNXI_USB_MAX_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) if (!clk_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) clk_data->clks = kcalloc(qty + 1, sizeof(struct clk *), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) if (!clk_data->clks) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) kfree(clk_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) for_each_set_bit(i, (unsigned long *)&data->clk_mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) SUNXI_USB_MAX_SIZE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) of_property_read_string_index(node, "clock-output-names",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) j, &clk_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) clk_data->clks[i] = clk_register_gate(NULL, clk_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) clk_parent, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) reg, i, 0, lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) WARN_ON(IS_ERR(clk_data->clks[i]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) j++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /* Adjust to the real max */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) clk_data->clk_num = i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) /* Register a reset controller for usb with reset bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) if (data->reset_mask == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) reset_data = kzalloc(sizeof(*reset_data), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) if (!reset_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) if (data->reset_needs_clk) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) reset_data->clk = of_clk_get(node, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) if (IS_ERR(reset_data->clk)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) pr_err("Could not get clock for reset controls\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) kfree(reset_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) reset_data->reg = reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) reset_data->lock = lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) reset_data->rcdev.nr_resets = __fls(data->reset_mask) + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) reset_data->rcdev.ops = &sunxi_usb_reset_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) reset_data->rcdev.of_node = node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) reset_controller_register(&reset_data->rcdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static const struct usb_clk_data sun4i_a10_usb_clk_data __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) .clk_mask = BIT(8) | BIT(7) | BIT(6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) .reset_mask = BIT(2) | BIT(1) | BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static DEFINE_SPINLOCK(sun4i_a10_usb_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) static void __init sun4i_a10_usb_setup(struct device_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) sunxi_usb_clk_setup(node, &sun4i_a10_usb_clk_data, &sun4i_a10_usb_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) CLK_OF_DECLARE(sun4i_a10_usb, "allwinner,sun4i-a10-usb-clk", sun4i_a10_usb_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static const struct usb_clk_data sun5i_a13_usb_clk_data __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) .clk_mask = BIT(8) | BIT(6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) .reset_mask = BIT(1) | BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static void __init sun5i_a13_usb_setup(struct device_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) sunxi_usb_clk_setup(node, &sun5i_a13_usb_clk_data, &sun4i_a10_usb_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) CLK_OF_DECLARE(sun5i_a13_usb, "allwinner,sun5i-a13-usb-clk", sun5i_a13_usb_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) static const struct usb_clk_data sun6i_a31_usb_clk_data __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) .clk_mask = BIT(18) | BIT(17) | BIT(16) | BIT(10) | BIT(9) | BIT(8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) .reset_mask = BIT(2) | BIT(1) | BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static void __init sun6i_a31_usb_setup(struct device_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) sunxi_usb_clk_setup(node, &sun6i_a31_usb_clk_data, &sun4i_a10_usb_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) CLK_OF_DECLARE(sun6i_a31_usb, "allwinner,sun6i-a31-usb-clk", sun6i_a31_usb_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) static const struct usb_clk_data sun8i_a23_usb_clk_data __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) .clk_mask = BIT(16) | BIT(11) | BIT(10) | BIT(9) | BIT(8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) .reset_mask = BIT(2) | BIT(1) | BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) static void __init sun8i_a23_usb_setup(struct device_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) sunxi_usb_clk_setup(node, &sun8i_a23_usb_clk_data, &sun4i_a10_usb_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) CLK_OF_DECLARE(sun8i_a23_usb, "allwinner,sun8i-a23-usb-clk", sun8i_a23_usb_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static const struct usb_clk_data sun8i_h3_usb_clk_data __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) .clk_mask = BIT(19) | BIT(18) | BIT(17) | BIT(16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) BIT(11) | BIT(10) | BIT(9) | BIT(8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) .reset_mask = BIT(3) | BIT(2) | BIT(1) | BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) static void __init sun8i_h3_usb_setup(struct device_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) sunxi_usb_clk_setup(node, &sun8i_h3_usb_clk_data, &sun4i_a10_usb_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) CLK_OF_DECLARE(sun8i_h3_usb, "allwinner,sun8i-h3-usb-clk", sun8i_h3_usb_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static const struct usb_clk_data sun9i_a80_usb_mod_data __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) .clk_mask = BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2) | BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) .reset_mask = BIT(19) | BIT(18) | BIT(17),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) .reset_needs_clk = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) static DEFINE_SPINLOCK(a80_usb_mod_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) static void __init sun9i_a80_usb_mod_setup(struct device_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) sunxi_usb_clk_setup(node, &sun9i_a80_usb_mod_data, &a80_usb_mod_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) CLK_OF_DECLARE(sun9i_a80_usb_mod, "allwinner,sun9i-a80-usb-mod-clk", sun9i_a80_usb_mod_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static const struct usb_clk_data sun9i_a80_usb_phy_data __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) .clk_mask = BIT(10) | BIT(5) | BIT(4) | BIT(3) | BIT(2) | BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) .reset_mask = BIT(21) | BIT(20) | BIT(19) | BIT(18) | BIT(17),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .reset_needs_clk = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) static DEFINE_SPINLOCK(a80_usb_phy_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) static void __init sun9i_a80_usb_phy_setup(struct device_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) sunxi_usb_clk_setup(node, &sun9i_a80_usb_phy_data, &a80_usb_phy_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) CLK_OF_DECLARE(sun9i_a80_usb_phy, "allwinner,sun9i-a80-usb-phy-clk", sun9i_a80_usb_phy_setup);