Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / clk / socfpga / clk.h
blobd80115fbdd6a00ba109eaf4acda233fd776e7493
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (c) 2013, Steffen Trumtrar <s.trumtrar@pengutronix.de>
5 * based on drivers/clk/tegra/clk.h
6 */
8 #ifndef __SOCFPGA_CLK_H
9 #define __SOCFPGA_CLK_H
11 #include <linux/clk-provider.h>
13 /* Clock Manager offsets */
14 #define CLKMGR_CTRL 0x0
15 #define CLKMGR_BYPASS 0x4
16 #define CLKMGR_DBCTRL 0x10
17 #define CLKMGR_L4SRC 0x70
18 #define CLKMGR_PERPLL_SRC 0xAC
20 #define SOCFPGA_MAX_PARENTS 5
22 #define streq(a, b) (strcmp((a), (b)) == 0)
23 #define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
24 ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))
26 #define SYSMGR_SDMMC_CTRL_SET_AS10(smplsel, drvsel) \
27 ((((smplsel) & 0x7) << 4) | (((drvsel) & 0x7) << 0))
29 extern void __iomem *clk_mgr_base_addr;
30 extern void __iomem *clk_mgr_a10_base_addr;
32 void __init socfpga_pll_init(struct device_node *node);
33 void __init socfpga_periph_init(struct device_node *node);
34 void __init socfpga_gate_init(struct device_node *node);
35 void socfpga_a10_pll_init(struct device_node *node);
36 void socfpga_a10_periph_init(struct device_node *node);
37 void socfpga_a10_gate_init(struct device_node *node);
39 struct socfpga_pll {
40 struct clk_gate hw;
43 struct socfpga_gate_clk {
44 struct clk_gate hw;
45 char *parent_name;
46 u32 fixed_div;
47 void __iomem *div_reg;
48 void __iomem *bypass_reg;
49 struct regmap *sys_mgr_base_addr;
50 u32 width; /* only valid if div_reg != 0 */
51 u32 shift; /* only valid if div_reg != 0 */
52 u32 bypass_shift; /* only valid if bypass_reg != 0 */
53 u32 clk_phase[2];
56 struct socfpga_periph_clk {
57 struct clk_gate hw;
58 char *parent_name;
59 u32 fixed_div;
60 void __iomem *div_reg;
61 void __iomem *bypass_reg;
62 u32 width; /* only valid if div_reg != 0 */
63 u32 shift; /* only valid if div_reg != 0 */
64 u32 bypass_shift; /* only valid if bypass_reg != 0 */
67 #endif /* SOCFPGA_CLK_H */