diff options
author | Chen-Yu Tsai <wens@csie.org> | 2015-01-27 20:54:06 +0100 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2015-02-23 09:25:54 +0100 |
commit | 6089ef19c9dadaf0e3378f75eca65af861cd3974 (patch) | |
tree | 0ad1a6f758611cc7e9387ee324c49cf6c04ba52f /drivers/clk/sunxi/clk-sunxi.c | |
parent | Linux 4.0-rc1 (diff) | |
download | linux-6089ef19c9dadaf0e3378f75eca65af861cd3974.tar.xz linux-6089ef19c9dadaf0e3378f75eca65af861cd3974.zip |
clk: sunxi: Move USB clocks to separate file
The USB clocks originally shared code with the gates clocks, but had
additional reset controllers. Move these to a separate file. This will
allow us to add new support for slightly different USB clocks, such as
on the A80, without affecting gates clocks, and also facilitate the
migration of gates clocks to a generic solution.
This also cleans up the USB clocks code slightly, such as adding
newlines, getting rid of the unused clkdev call, using a simple
u32 instead of BITMAP for the clock masks, using BIT() macro to
declare the clock bitmasks, and using of_io_request_and_map() to
get the I/O address.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/clk/sunxi/clk-sunxi.c')
-rw-r--r-- | drivers/clk/sunxi/clk-sunxi.c | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c index 379324eb5486..b6f28ac4f9d5 100644 --- a/drivers/clk/sunxi/clk-sunxi.c +++ b/drivers/clk/sunxi/clk-sunxi.c @@ -838,59 +838,6 @@ static void __init sunxi_divider_clk_setup(struct device_node *node, /** - * sunxi_gates_reset... - reset bits in leaf gate clk registers handling - */ - -struct gates_reset_data { - void __iomem *reg; - spinlock_t *lock; - struct reset_controller_dev rcdev; -}; - -static int sunxi_gates_reset_assert(struct reset_controller_dev *rcdev, - unsigned long id) -{ - struct gates_reset_data *data = container_of(rcdev, - struct gates_reset_data, - rcdev); - unsigned long flags; - u32 reg; - - spin_lock_irqsave(data->lock, flags); - - reg = readl(data->reg); - writel(reg & ~BIT(id), data->reg); - - spin_unlock_irqrestore(data->lock, flags); - - return 0; -} - -static int sunxi_gates_reset_deassert(struct reset_controller_dev *rcdev, - unsigned long id) -{ - struct gates_reset_data *data = container_of(rcdev, - struct gates_reset_data, - rcdev); - unsigned long flags; - u32 reg; - - spin_lock_irqsave(data->lock, flags); - - reg = readl(data->reg); - writel(reg | BIT(id), data->reg); - - spin_unlock_irqrestore(data->lock, flags); - - return 0; -} - -static struct reset_control_ops sunxi_gates_reset_ops = { - .assert = sunxi_gates_reset_assert, - .deassert = sunxi_gates_reset_deassert, -}; - -/** * sunxi_gates_clk_setup() - Setup function for leaf gates on clocks */ @@ -898,7 +845,6 @@ static struct reset_control_ops sunxi_gates_reset_ops = { struct gates_data { DECLARE_BITMAP(mask, SUNXI_GATES_MAX_SIZE); - u32 reset_mask; }; static const struct gates_data sun4i_axi_gates_data __initconst = { @@ -997,26 +943,10 @@ static const struct gates_data sun8i_a23_apb2_gates_data __initconst = { .mask = {0x1F0007}, }; -static const struct gates_data sun4i_a10_usb_gates_data __initconst = { - .mask = {0x1C0}, - .reset_mask = 0x07, -}; - -static const struct gates_data sun5i_a13_usb_gates_data __initconst = { - .mask = {0x140}, - .reset_mask = 0x03, -}; - -static const struct gates_data sun6i_a31_usb_gates_data __initconst = { - .mask = { BIT(18) | BIT(17) | BIT(16) | BIT(10) | BIT(9) | BIT(8) }, - .reset_mask = BIT(2) | BIT(1) | BIT(0), -}; - static void __init sunxi_gates_clk_setup(struct device_node *node, struct gates_data *data) { struct clk_onecell_data *clk_data; - struct gates_reset_data *reset_data; const char *clk_parent; const char *clk_name; void __iomem *reg; @@ -1057,21 +987,6 @@ static void __init sunxi_gates_clk_setup(struct device_node *node, clk_data->clk_num = i; of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); - - /* Register a reset controler for gates with reset bits */ - if (data->reset_mask == 0) - return; - - reset_data = kzalloc(sizeof(*reset_data), GFP_KERNEL); - if (!reset_data) - return; - - reset_data->reg = reg; - reset_data->lock = &clk_lock; - reset_data->rcdev.nr_resets = __fls(data->reset_mask) + 1; - reset_data->rcdev.ops = &sunxi_gates_reset_ops; - reset_data->rcdev.of_node = node; - reset_controller_register(&reset_data->rcdev); } @@ -1324,9 +1239,6 @@ static const struct of_device_id clk_gates_match[] __initconst = { {.compatible = "allwinner,sun9i-a80-apb1-gates-clk", .data = &sun9i_a80_apb1_gates_data,}, {.compatible = "allwinner,sun6i-a31-apb2-gates-clk", .data = &sun6i_a31_apb2_gates_data,}, {.compatible = "allwinner,sun8i-a23-apb2-gates-clk", .data = &sun8i_a23_apb2_gates_data,}, - {.compatible = "allwinner,sun4i-a10-usb-clk", .data = &sun4i_a10_usb_gates_data,}, - {.compatible = "allwinner,sun5i-a13-usb-clk", .data = &sun5i_a13_usb_gates_data,}, - {.compatible = "allwinner,sun6i-a31-usb-clk", .data = &sun6i_a31_usb_gates_data,}, {} }; |