summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/clkctrl-imx233.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx233/clkctrl-imx233.h')
-rw-r--r--firmware/target/arm/imx233/clkctrl-imx233.h76
1 files changed, 21 insertions, 55 deletions
diff --git a/firmware/target/arm/imx233/clkctrl-imx233.h b/firmware/target/arm/imx233/clkctrl-imx233.h
index a15adb367e..ddd8bc9221 100644
--- a/firmware/target/arm/imx233/clkctrl-imx233.h
+++ b/firmware/target/arm/imx233/clkctrl-imx233.h
@@ -50,67 +50,33 @@ enum imx233_clock_t
50 CLK_XTAL, /* freq */ 50 CLK_XTAL, /* freq */
51 CLK_EMI, /* freq, div, frac, bypass */ 51 CLK_EMI, /* freq, div, frac, bypass */
52 CLK_XBUS, /* freq, div */ 52 CLK_XBUS, /* freq, div */
53 CLK_FILT, /* enable */
54 CLK_DRI, /* enable */
55 CLK_PWM, /* enable */
56 CLK_TIMROT, /* enable */
57 CLK_UART, /* enable */
53}; 58};
54 59
55enum imx233_xtal_clk_t 60void imx233_clkctrl_init(void);
56{
57 XTAL_FILT = 1 << 30,
58 XTAL_DRI = 1 << 28,
59 XTAL_TIMROT = 1 << 26,
60 XTAM_PWM = 1 << 29,
61};
62
63/* Auto-Slow monitoring */
64enum imx233_as_monitor_t
65{
66 AS_NONE = 0, /* Do not monitor any activity */
67 AS_CPU_INSTR = 1 << 21, /* Monitor CPU instruction access to AHB */
68 AS_CPU_DATA = 1 << 22, /* Monitor CPU data access to AHB */
69 AS_TRAFFIC = 1 << 23, /* Monitor AHB master activity */
70 AS_TRAFFIC_JAM = 1 << 24, /* Monitor AHB masters (>=3) activity */
71 AS_APBXDMA = 1 << 25, /* Monitor APBX DMA activity */
72 AS_APBHDMA = 1 << 26, /* Monitor APBH DMA activity */
73 AS_PXP = 1 << 27, /* Monitor PXP activity */
74 AS_DCP = 1 << 28, /* Monitor DCP activity */
75 AS_ALL = 0xff << 21, /* Monitor all activity */
76};
77
78enum imx233_as_div_t
79{
80 AS_DIV_1 = 0,
81 AS_DIV_2 = 1,
82 AS_DIV_4 = 2,
83 AS_DIV_8 = 3,
84 AS_DIV_16 = 4,
85 AS_DIV_32 = 5
86};
87
88/* can use a mask of clocks */
89void imx233_clkctrl_enable_xtal(enum imx233_xtal_clk_t xtal_clk, bool enable);
90void imx233_clkctrl_is_xtal_enabled(enum imx233_xtal_clk_t xtal_clk, bool enable);
91/* only use it for non-fractional clocks (ie not for IO) */ 61/* only use it for non-fractional clocks (ie not for IO) */
92void imx233_clkctrl_enable_clock(enum imx233_clock_t clk, bool enable); 62void imx233_clkctrl_enable(enum imx233_clock_t clk, bool enable);
93bool imx233_clkctrl_is_clock_enabled(enum imx233_clock_t cl); 63bool imx233_clkctrl_is_enabled(enum imx233_clock_t cl);
94void imx233_clkctrl_set_clock_divisor(enum imx233_clock_t clk, int div); 64void imx233_clkctrl_set_div(enum imx233_clock_t clk, int div);
95int imx233_clkctrl_get_clock_divisor(enum imx233_clock_t clk); 65int imx233_clkctrl_get_div(enum imx233_clock_t clk);
96/* call with fracdiv=0 to disable it */ 66/* call with fracdiv=0 to disable it */
97void imx233_clkctrl_set_fractional_divisor(enum imx233_clock_t clk, int fracdiv); 67void imx233_clkctrl_set_frac_div(enum imx233_clock_t clk, int fracdiv);
98/* 0 means fractional dividor disable */ 68/* 0 means fractional dividor disable */
99int imx233_clkctrl_get_fractional_divisor(enum imx233_clock_t clk); 69int imx233_clkctrl_get_frac_div(enum imx233_clock_t clk);
100void imx233_clkctrl_set_bypass_pll(enum imx233_clock_t clk, bool bypass); 70void imx233_clkctrl_set_bypass(enum imx233_clock_t clk, bool bypass);
101bool imx233_clkctrl_get_bypass_pll(enum imx233_clock_t clk); 71bool imx233_clkctrl_get_bypass(enum imx233_clock_t clk);
102void imx233_clkctrl_enable_usb_pll(bool enable); 72void imx233_clkctrl_enable_usb(bool enable);
103bool imx233_clkctrl_is_usb_pll_enabled(void); 73bool imx233_clkctrl_is_usb_enabled(void);
104unsigned imx233_clkctrl_get_clock_freq(enum imx233_clock_t clk); 74/* returns frequency in KHz */
105 75unsigned imx233_clkctrl_get_freq(enum imx233_clock_t clk);
106bool imx233_clkctrl_is_emi_sync_enabled(void); 76/* auto-slow stuff */
107 77void imx233_clkctrl_set_auto_slow_div(unsigned div);
108void imx233_clkctrl_set_auto_slow_divisor(enum imx233_as_div_t div); 78unsigned imx233_clkctrl_get_auto_slow_div(void);
109enum imx233_as_div_t imx233_clkctrl_get_auto_slow_divisor(void);
110void imx233_clkctrl_enable_auto_slow(bool enable); 79void imx233_clkctrl_enable_auto_slow(bool enable);
111bool imx233_clkctrl_is_auto_slow_enabled(void); 80bool imx233_clkctrl_is_auto_slow_enabled(void);
112/* can use a mask of clocks */
113void imx233_clkctrl_enable_auto_slow_monitor(enum imx233_as_monitor_t monitor, bool enable);
114bool imx233_clkctrl_is_auto_slow_monitor_enabled(enum imx233_as_monitor_t monitor);
115 81
116#endif /* CLKCTRL_IMX233_H */ 82#endif /* CLKCTRL_IMX233_H */