0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H
0011 #define __ARCH_ARM_MACH_OMAP1_CLOCK_H
0012
0013 #include <linux/clk.h>
0014 #include <linux/clkdev.h>
0015 #include <linux/clk-provider.h>
0016
0017 struct module;
0018 struct omap1_clk;
0019
0020 struct omap_clk {
0021 u16 cpu;
0022 struct clk_lookup lk;
0023 };
0024
0025 #define CLK(dev, con, ck, cp) \
0026 { \
0027 .cpu = cp, \
0028 .lk = { \
0029 .dev_id = dev, \
0030 .con_id = con, \
0031 .clk_hw = ck, \
0032 }, \
0033 }
0034
0035
0036 #define CK_310 (1 << 0)
0037 #define CK_7XX (1 << 1)
0038 #define CK_1510 (1 << 2)
0039 #define CK_16XX (1 << 3)
0040 #define CK_1710 (1 << 4)
0041
0042
0043
0044
0045
0046
0047
0048 struct clkops {
0049 int (*enable)(struct omap1_clk *clk);
0050 void (*disable)(struct omap1_clk *clk);
0051 };
0052
0053
0054
0055
0056
0057
0058 #define ENABLE_REG_32BIT (1 << 0)
0059 #define CLOCK_IDLE_CONTROL (1 << 1)
0060 #define CLOCK_NO_IDLE_PARENT (1 << 2)
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 struct omap1_clk {
0078 struct clk_hw hw;
0079 const struct clkops *ops;
0080 unsigned long rate;
0081 void __iomem *enable_reg;
0082 unsigned long (*recalc)(struct omap1_clk *clk, unsigned long rate);
0083 int (*set_rate)(struct omap1_clk *clk, unsigned long rate,
0084 unsigned long p_rate);
0085 long (*round_rate)(struct omap1_clk *clk, unsigned long rate,
0086 unsigned long *p_rate);
0087 int (*init)(struct omap1_clk *clk);
0088 u8 enable_bit;
0089 u8 fixed_div;
0090 u8 flags;
0091 u8 rate_offset;
0092 };
0093 #define to_omap1_clk(_hw) container_of(_hw, struct omap1_clk, hw)
0094
0095 void propagate_rate(struct omap1_clk *clk);
0096 unsigned long followparent_recalc(struct omap1_clk *clk, unsigned long p_rate);
0097 unsigned long omap_fixed_divisor_recalc(struct omap1_clk *clk, unsigned long p_rate);
0098
0099 extern struct omap1_clk dummy_ck;
0100
0101 int omap1_clk_init(void);
0102 void omap1_clk_late_init(void);
0103 unsigned long omap1_ckctl_recalc(struct omap1_clk *clk, unsigned long p_rate);
0104 long omap1_round_sossi_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate);
0105 int omap1_set_sossi_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate);
0106 unsigned long omap1_sossi_recalc(struct omap1_clk *clk, unsigned long p_rate);
0107 unsigned long omap1_ckctl_recalc_dsp_domain(struct omap1_clk *clk, unsigned long p_rate);
0108 int omap1_clk_set_rate_dsp_domain(struct omap1_clk *clk, unsigned long rate,
0109 unsigned long p_rate);
0110 long omap1_round_uart_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate);
0111 int omap1_set_uart_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate);
0112 unsigned long omap1_uart_recalc(struct omap1_clk *clk, unsigned long p_rate);
0113 int omap1_set_ext_clk_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate);
0114 long omap1_round_ext_clk_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate);
0115 int omap1_init_ext_clk(struct omap1_clk *clk);
0116 int omap1_select_table_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate);
0117 long omap1_round_to_table_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate);
0118 int omap1_clk_set_rate_ckctl_arm(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate);
0119 long omap1_clk_round_rate_ckctl_arm(struct omap1_clk *clk, unsigned long rate,
0120 unsigned long *p_rate);
0121
0122 struct uart_clk {
0123 struct omap1_clk clk;
0124 unsigned long sysc_addr;
0125 };
0126
0127
0128 struct arm_idlect1_clk {
0129 struct omap1_clk clk;
0130 unsigned long no_idle_count;
0131 __u8 idlect_shift;
0132 };
0133
0134
0135 #define CKCTL_PERDIV_OFFSET 0
0136 #define CKCTL_LCDDIV_OFFSET 2
0137 #define CKCTL_ARMDIV_OFFSET 4
0138 #define CKCTL_DSPDIV_OFFSET 6
0139 #define CKCTL_TCDIV_OFFSET 8
0140 #define CKCTL_DSPMMUDIV_OFFSET 10
0141
0142 #define EN_DSPCK 13
0143
0144
0145 #define CKCTL_DSPPERDIV_OFFSET 0
0146
0147
0148 #define EN_WDTCK 0
0149 #define EN_XORPCK 1
0150 #define EN_PERCK 2
0151 #define EN_LCDCK 3
0152 #define EN_LBCK 4
0153
0154 #define EN_APICK 6
0155 #define EN_TIMCK 7
0156 #define DMACK_REQ 8
0157 #define EN_GPIOCK 9
0158
0159 #define EN_CKOUT_ARM 11
0160
0161
0162 #define EN_OCPI_CK 0
0163 #define EN_TC1_CK 2
0164 #define EN_TC2_CK 4
0165
0166
0167 #define EN_DSPTIMCK 5
0168
0169
0170 #define SDW_MCLK_INV_BIT 2
0171 #define USB_MCLK_EN_BIT 4
0172 #define USB_HOST_HHC_UHOST_EN 9
0173 #define SWD_ULPD_PLL_CLK_REQ 1
0174 #define COM_ULPD_PLL_CLK_REQ 1
0175 #define SWD_CLK_DIV_CTRL_SEL 0xfffe0874
0176 #define COM_CLK_DIV_CTRL_SEL 0xfffe0878
0177 #define SOFT_REQ_REG 0xfffe0834
0178 #define SOFT_REQ_REG2 0xfffe0880
0179
0180 extern __u32 arm_idlect1_mask;
0181 extern struct omap1_clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
0182
0183 extern const struct clkops clkops_dspck;
0184 extern const struct clkops clkops_uart_16xx;
0185 extern const struct clkops clkops_generic;
0186
0187
0188 extern u32 cpu_mask;
0189
0190 extern const struct clk_ops omap1_clk_null_ops;
0191 extern const struct clk_ops omap1_clk_gate_ops;
0192 extern const struct clk_ops omap1_clk_rate_ops;
0193 extern const struct clk_ops omap1_clk_full_ops;
0194
0195 #endif