13fde0e16SJolly Shah /* SPDX-License-Identifier: GPL-2.0 */ 23fde0e16SJolly Shah /* 33fde0e16SJolly Shah * Copyright (C) 2016-2018 Xilinx 43fde0e16SJolly Shah */ 53fde0e16SJolly Shah 63fde0e16SJolly Shah #ifndef __LINUX_CLK_ZYNQMP_H_ 73fde0e16SJolly Shah #define __LINUX_CLK_ZYNQMP_H_ 83fde0e16SJolly Shah 93fde0e16SJolly Shah #include <linux/spinlock.h> 103fde0e16SJolly Shah 113fde0e16SJolly Shah #include <linux/firmware/xlnx-zynqmp.h> 123fde0e16SJolly Shah 13*610a5d83SRajan Vaja /* Common Flags */ 14*610a5d83SRajan Vaja /* must be gated across rate change */ 15*610a5d83SRajan Vaja #define ZYNQMP_CLK_SET_RATE_GATE BIT(0) 16*610a5d83SRajan Vaja /* must be gated across re-parent */ 17*610a5d83SRajan Vaja #define ZYNQMP_CLK_SET_PARENT_GATE BIT(1) 18*610a5d83SRajan Vaja /* propagate rate change up one level */ 19*610a5d83SRajan Vaja #define ZYNQMP_CLK_SET_RATE_PARENT BIT(2) 20*610a5d83SRajan Vaja /* do not gate even if unused */ 21*610a5d83SRajan Vaja #define ZYNQMP_CLK_IGNORE_UNUSED BIT(3) 22*610a5d83SRajan Vaja /* don't re-parent on rate change */ 23*610a5d83SRajan Vaja #define ZYNQMP_CLK_SET_RATE_NO_REPARENT BIT(7) 24*610a5d83SRajan Vaja /* do not gate, ever */ 25*610a5d83SRajan Vaja #define ZYNQMP_CLK_IS_CRITICAL BIT(11) 26*610a5d83SRajan Vaja 273fde0e16SJolly Shah enum topology_type { 283fde0e16SJolly Shah TYPE_INVALID, 293fde0e16SJolly Shah TYPE_MUX, 303fde0e16SJolly Shah TYPE_PLL, 313fde0e16SJolly Shah TYPE_FIXEDFACTOR, 323fde0e16SJolly Shah TYPE_DIV1, 333fde0e16SJolly Shah TYPE_DIV2, 343fde0e16SJolly Shah TYPE_GATE, 353fde0e16SJolly Shah }; 363fde0e16SJolly Shah 373fde0e16SJolly Shah /** 383fde0e16SJolly Shah * struct clock_topology - Clock topology 393fde0e16SJolly Shah * @type: Type of topology 403fde0e16SJolly Shah * @flag: Topology flags 413fde0e16SJolly Shah * @type_flag: Topology type specific flag 423fde0e16SJolly Shah */ 433fde0e16SJolly Shah struct clock_topology { 443fde0e16SJolly Shah u32 type; 453fde0e16SJolly Shah u32 flag; 463fde0e16SJolly Shah u32 type_flag; 47e605fa9cSRajan Vaja u8 custom_type_flag; 483fde0e16SJolly Shah }; 493fde0e16SJolly Shah 50*610a5d83SRajan Vaja unsigned long zynqmp_clk_map_common_ccf_flags(const u32 zynqmp_flag); 51*610a5d83SRajan Vaja 523fde0e16SJolly Shah struct clk_hw *zynqmp_clk_register_pll(const char *name, u32 clk_id, 533fde0e16SJolly Shah const char * const *parents, 543fde0e16SJolly Shah u8 num_parents, 553fde0e16SJolly Shah const struct clock_topology *nodes); 563fde0e16SJolly Shah 573fde0e16SJolly Shah struct clk_hw *zynqmp_clk_register_gate(const char *name, u32 clk_id, 583fde0e16SJolly Shah const char * const *parents, 593fde0e16SJolly Shah u8 num_parents, 603fde0e16SJolly Shah const struct clock_topology *nodes); 613fde0e16SJolly Shah 623fde0e16SJolly Shah struct clk_hw *zynqmp_clk_register_divider(const char *name, 633fde0e16SJolly Shah u32 clk_id, 643fde0e16SJolly Shah const char * const *parents, 653fde0e16SJolly Shah u8 num_parents, 663fde0e16SJolly Shah const struct clock_topology *nodes); 673fde0e16SJolly Shah 683fde0e16SJolly Shah struct clk_hw *zynqmp_clk_register_mux(const char *name, u32 clk_id, 693fde0e16SJolly Shah const char * const *parents, 703fde0e16SJolly Shah u8 num_parents, 713fde0e16SJolly Shah const struct clock_topology *nodes); 723fde0e16SJolly Shah 733fde0e16SJolly Shah struct clk_hw *zynqmp_clk_register_fixed_factor(const char *name, 743fde0e16SJolly Shah u32 clk_id, 753fde0e16SJolly Shah const char * const *parents, 763fde0e16SJolly Shah u8 num_parents, 773fde0e16SJolly Shah const struct clock_topology *nodes); 783fde0e16SJolly Shah 793fde0e16SJolly Shah #endif 80