2019-05-29 17:18:02 +03:00
/* SPDX-License-Identifier: GPL-2.0-only */
2014-01-06 20:27:37 +04:00
/*
* Copyright ( c ) 2013 , Steffen Trumtrar < s . trumtrar @ pengutronix . de >
*
* based on drivers / clk / tegra / clk . h
*/
# ifndef __SOCFPGA_CLK_H
# define __SOCFPGA_CLK_H
# include <linux/clk-provider.h>
/* Clock Manager offsets */
# define CLKMGR_CTRL 0x0
# define CLKMGR_BYPASS 0x4
2015-07-25 06:30:18 +03:00
# define CLKMGR_DBCTRL 0x10
2014-01-06 20:27:37 +04:00
# define CLKMGR_L4SRC 0x70
# define CLKMGR_PERPLL_SRC 0xAC
2015-05-20 06:22:41 +03:00
# define SOCFPGA_MAX_PARENTS 5
2014-01-06 20:27:37 +04:00
2015-05-20 06:22:41 +03:00
# define streq(a, b) (strcmp((a), (b)) == 0)
# define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
( ( ( ( smplsel ) & 0x7 ) < < 3 ) | ( ( ( drvsel ) & 0x7 ) < < 0 ) )
2017-06-08 17:18:39 +03:00
# define SYSMGR_SDMMC_CTRL_SET_AS10(smplsel, drvsel) \
( ( ( ( smplsel ) & 0x7 ) < < 4 ) | ( ( ( drvsel ) & 0x7 ) < < 0 ) )
2014-01-06 20:27:37 +04:00
extern void __iomem * clk_mgr_base_addr ;
2015-05-20 06:22:42 +03:00
extern void __iomem * clk_mgr_a10_base_addr ;
2014-01-06 20:27:37 +04:00
void __init socfpga_pll_init ( struct device_node * node ) ;
void __init socfpga_periph_init ( struct device_node * node ) ;
void __init socfpga_gate_init ( struct device_node * node ) ;
2015-05-20 06:22:42 +03:00
void socfpga_a10_pll_init ( struct device_node * node ) ;
void socfpga_a10_periph_init ( struct device_node * node ) ;
void socfpga_a10_gate_init ( struct device_node * node ) ;
2014-01-06 20:27:37 +04:00
struct socfpga_pll {
struct clk_gate hw ;
} ;
struct socfpga_gate_clk {
struct clk_gate hw ;
char * parent_name ;
u32 fixed_div ;
void __iomem * div_reg ;
2018-03-21 17:20:12 +03:00
void __iomem * bypass_reg ;
2015-05-20 06:22:42 +03:00
struct regmap * sys_mgr_base_addr ;
2014-01-06 20:27:37 +04:00
u32 width ; /* only valid if div_reg != 0 */
u32 shift ; /* only valid if div_reg != 0 */
2018-03-21 17:20:12 +03:00
u32 bypass_shift ; /* only valid if bypass_reg != 0 */
2014-01-06 20:27:37 +04:00
} ;
struct socfpga_periph_clk {
struct clk_gate hw ;
char * parent_name ;
u32 fixed_div ;
2014-05-12 21:27:22 +04:00
void __iomem * div_reg ;
2018-03-21 17:20:12 +03:00
void __iomem * bypass_reg ;
2014-05-12 21:27:22 +04:00
u32 width ; /* only valid if div_reg != 0 */
u32 shift ; /* only valid if div_reg != 0 */
2018-03-21 17:20:12 +03:00
u32 bypass_shift ; /* only valid if bypass_reg != 0 */
2014-01-06 20:27:37 +04:00
} ;
# endif /* SOCFPGA_CLK_H */