Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: aspeed: Move structures to header

They will be reused by the ast2600 driver.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://lkml.kernel.org/r/20190825141848.17346-2-joel@jms.id.au
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Joel Stanley and committed by
Stephen Boyd
c1c4942e ebd5f82d

+85 -64
+3 -64
drivers/clk/clk-aspeed.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 + // Copyright IBM Corp 2 3 3 4 #define pr_fmt(fmt) "clk-aspeed: " fmt 4 5 5 - #include <linux/clk-provider.h> 6 6 #include <linux/mfd/syscon.h> 7 7 #include <linux/of_address.h> 8 8 #include <linux/of_device.h> 9 9 #include <linux/platform_device.h> 10 10 #include <linux/regmap.h> 11 - #include <linux/reset-controller.h> 12 11 #include <linux/slab.h> 13 - #include <linux/spinlock.h> 14 12 15 13 #include <dt-bindings/clock/aspeed-clock.h> 14 + 15 + #include "clk-aspeed.h" 16 16 17 17 #define ASPEED_NUM_CLKS 36 18 18 ··· 41 41 static struct clk_hw_onecell_data *aspeed_clk_data; 42 42 43 43 static void __iomem *scu_base; 44 - 45 - /** 46 - * struct aspeed_gate_data - Aspeed gated clocks 47 - * @clock_idx: bit used to gate this clock in the clock register 48 - * @reset_idx: bit used to reset this IP in the reset register. -1 if no 49 - * reset is required when enabling the clock 50 - * @name: the clock name 51 - * @parent_name: the name of the parent clock 52 - * @flags: standard clock framework flags 53 - */ 54 - struct aspeed_gate_data { 55 - u8 clock_idx; 56 - s8 reset_idx; 57 - const char *name; 58 - const char *parent_name; 59 - unsigned long flags; 60 - }; 61 - 62 - /** 63 - * struct aspeed_clk_gate - Aspeed specific clk_gate structure 64 - * @hw: handle between common and hardware-specific interfaces 65 - * @reg: register controlling gate 66 - * @clock_idx: bit used to gate this clock in the clock register 67 - * @reset_idx: bit used to reset this IP in the reset register. -1 if no 68 - * reset is required when enabling the clock 69 - * @flags: hardware-specific flags 70 - * @lock: register lock 71 - * 72 - * Some of the clocks in the Aspeed SoC must be put in reset before enabling. 73 - * This modified version of clk_gate allows an optional reset bit to be 74 - * specified. 75 - */ 76 - struct aspeed_clk_gate { 77 - struct clk_hw hw; 78 - struct regmap *map; 79 - u8 clock_idx; 80 - s8 reset_idx; 81 - u8 flags; 82 - spinlock_t *lock; 83 - }; 84 - 85 - #define to_aspeed_clk_gate(_hw) container_of(_hw, struct aspeed_clk_gate, hw) 86 44 87 45 /* TODO: ask Aspeed about the actual parent data */ 88 46 static const struct aspeed_gate_data aspeed_gates[] = { ··· 166 208 mult, div); 167 209 } 168 210 169 - struct aspeed_clk_soc_data { 170 - const struct clk_div_table *div_table; 171 - const struct clk_div_table *eclk_div_table; 172 - const struct clk_div_table *mac_div_table; 173 - struct clk_hw *(*calc_pll)(const char *name, u32 val); 174 - }; 175 - 176 211 static const struct aspeed_clk_soc_data ast2500_data = { 177 212 .div_table = ast2500_div_table, 178 213 .eclk_div_table = ast2500_eclk_div_table, ··· 265 314 .disable = aspeed_clk_disable, 266 315 .is_enabled = aspeed_clk_is_enabled, 267 316 }; 268 - 269 - /** 270 - * struct aspeed_reset - Aspeed reset controller 271 - * @map: regmap to access the containing system controller 272 - * @rcdev: reset controller device 273 - */ 274 - struct aspeed_reset { 275 - struct regmap *map; 276 - struct reset_controller_dev rcdev; 277 - }; 278 - 279 - #define to_aspeed_reset(p) container_of((p), struct aspeed_reset, rcdev) 280 317 281 318 static const u8 aspeed_resets[] = { 282 319 /* SCU04 resets */
+82
drivers/clk/clk-aspeed.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + /* 3 + * Structures used by ASPEED clock drivers 4 + * 5 + * Copyright 2019 IBM Corp. 6 + */ 7 + 8 + #include <linux/clk-provider.h> 9 + #include <linux/kernel.h> 10 + #include <linux/reset-controller.h> 11 + #include <linux/spinlock.h> 12 + 13 + struct clk_div_table; 14 + struct regmap; 15 + 16 + /** 17 + * struct aspeed_gate_data - Aspeed gated clocks 18 + * @clock_idx: bit used to gate this clock in the clock register 19 + * @reset_idx: bit used to reset this IP in the reset register. -1 if no 20 + * reset is required when enabling the clock 21 + * @name: the clock name 22 + * @parent_name: the name of the parent clock 23 + * @flags: standard clock framework flags 24 + */ 25 + struct aspeed_gate_data { 26 + u8 clock_idx; 27 + s8 reset_idx; 28 + const char *name; 29 + const char *parent_name; 30 + unsigned long flags; 31 + }; 32 + 33 + /** 34 + * struct aspeed_clk_gate - Aspeed specific clk_gate structure 35 + * @hw: handle between common and hardware-specific interfaces 36 + * @reg: register controlling gate 37 + * @clock_idx: bit used to gate this clock in the clock register 38 + * @reset_idx: bit used to reset this IP in the reset register. -1 if no 39 + * reset is required when enabling the clock 40 + * @flags: hardware-specific flags 41 + * @lock: register lock 42 + * 43 + * Some of the clocks in the Aspeed SoC must be put in reset before enabling. 44 + * This modified version of clk_gate allows an optional reset bit to be 45 + * specified. 46 + */ 47 + struct aspeed_clk_gate { 48 + struct clk_hw hw; 49 + struct regmap *map; 50 + u8 clock_idx; 51 + s8 reset_idx; 52 + u8 flags; 53 + spinlock_t *lock; 54 + }; 55 + 56 + #define to_aspeed_clk_gate(_hw) container_of(_hw, struct aspeed_clk_gate, hw) 57 + 58 + /** 59 + * struct aspeed_reset - Aspeed reset controller 60 + * @map: regmap to access the containing system controller 61 + * @rcdev: reset controller device 62 + */ 63 + struct aspeed_reset { 64 + struct regmap *map; 65 + struct reset_controller_dev rcdev; 66 + }; 67 + 68 + #define to_aspeed_reset(p) container_of((p), struct aspeed_reset, rcdev) 69 + 70 + /** 71 + * struct aspeed_clk_soc_data - Aspeed SoC specific divisor information 72 + * @div_table: Common divider lookup table 73 + * @eclk_div_table: Divider lookup table for ECLK 74 + * @mac_div_table: Divider lookup table for MAC (Ethernet) clocks 75 + * @calc_pll: Callback to maculate common PLL settings 76 + */ 77 + struct aspeed_clk_soc_data { 78 + const struct clk_div_table *div_table; 79 + const struct clk_div_table *eclk_div_table; 80 + const struct clk_div_table *mac_div_table; 81 + struct clk_hw *(*calc_pll)(const char *name, u32 val); 82 + };