Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-omap2/clock.c |
| 3 | * |
Tony Lindgren | a16e970 | 2008-03-18 11:56:39 +0200 | [diff] [blame] | 4 | * Copyright (C) 2005-2008 Texas Instruments, Inc. |
Paul Walmsley | 8c34974 | 2010-02-22 22:09:24 -0700 | [diff] [blame] | 5 | * Copyright (C) 2004-2010 Nokia Corporation |
Tony Lindgren | a16e970 | 2008-03-18 11:56:39 +0200 | [diff] [blame] | 6 | * |
| 7 | * Contacts: |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 8 | * Richard Woodruff <r-woodruff2@ti.com> |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 9 | * Paul Walmsley |
| 10 | * |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License version 2 as |
| 13 | * published by the Free Software Foundation. |
| 14 | */ |
| 15 | #undef DEBUG |
| 16 | |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 17 | #include <linux/kernel.h> |
Paul Walmsley | 1fe9be8 | 2012-09-27 10:33:33 -0600 | [diff] [blame] | 18 | #include <linux/export.h> |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 19 | #include <linux/list.h> |
| 20 | #include <linux/errno.h> |
Paul Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 21 | #include <linux/err.h> |
| 22 | #include <linux/delay.h> |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 23 | #include <linux/clk-provider.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 24 | #include <linux/io.h> |
Russell King | fbd3bdb | 2008-09-06 12:13:59 +0100 | [diff] [blame] | 25 | #include <linux/bitops.h> |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 26 | #include <linux/regmap.h> |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 27 | #include <linux/of_address.h> |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 28 | #include <linux/bootmem.h> |
Jean Pihet | 5e7c58d | 2011-03-03 11:25:43 +0100 | [diff] [blame] | 29 | #include <asm/cpu.h> |
Tony Lindgren | dbc0416 | 2012-08-31 10:59:07 -0700 | [diff] [blame] | 30 | |
Tony Lindgren | dbc0416 | 2012-08-31 10:59:07 -0700 | [diff] [blame] | 31 | #include <trace/events/power.h> |
| 32 | |
| 33 | #include "soc.h" |
| 34 | #include "clockdomain.h" |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 35 | #include "clock.h" |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 36 | #include "cm.h" |
Paul Walmsley | ff4ae5d | 2012-10-21 01:01:11 -0600 | [diff] [blame] | 37 | #include "cm2xxx.h" |
| 38 | #include "cm3xxx.h" |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 39 | #include "cm-regbits-24xx.h" |
| 40 | #include "cm-regbits-34xx.h" |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 41 | #include "common.h" |
| 42 | |
| 43 | /* |
| 44 | * MAX_MODULE_ENABLE_WAIT: maximum of number of microseconds to wait |
| 45 | * for a module to indicate that it is no longer in idle |
| 46 | */ |
| 47 | #define MAX_MODULE_ENABLE_WAIT 100000 |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 48 | |
Afzal Mohammed | 9954119 | 2011-12-13 10:46:43 -0800 | [diff] [blame] | 49 | u16 cpu_mask; |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 50 | |
Tero Kristo | a24886e | 2014-07-02 11:47:40 +0300 | [diff] [blame] | 51 | /* DPLL valid Fint frequency band limits - from 34xx TRM Section 4.7.6.2 */ |
| 52 | #define OMAP3430_DPLL_FINT_BAND1_MIN 750000 |
| 53 | #define OMAP3430_DPLL_FINT_BAND1_MAX 2100000 |
| 54 | #define OMAP3430_DPLL_FINT_BAND2_MIN 7500000 |
| 55 | #define OMAP3430_DPLL_FINT_BAND2_MAX 21000000 |
| 56 | |
| 57 | /* |
| 58 | * DPLL valid Fint frequency range for OMAP36xx and OMAP4xxx. |
| 59 | * From device data manual section 4.3 "DPLL and DLL Specifications". |
| 60 | */ |
| 61 | #define OMAP3PLUS_DPLL_FINT_MIN 32000 |
| 62 | #define OMAP3PLUS_DPLL_FINT_MAX 52000000 |
| 63 | |
Tero Kristo | 8111e01 | 2014-07-02 11:47:39 +0300 | [diff] [blame] | 64 | /* |
Paul Walmsley | 12706c5 | 2011-07-10 05:57:06 -0600 | [diff] [blame] | 65 | * clkdm_control: if true, then when a clock is enabled in the |
| 66 | * hardware, its clockdomain will first be enabled; and when a clock |
| 67 | * is disabled in the hardware, its clockdomain will be disabled |
| 68 | * afterwards. |
| 69 | */ |
| 70 | static bool clkdm_control = true; |
| 71 | |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 72 | struct clk_iomap { |
| 73 | struct regmap *regmap; |
| 74 | void __iomem *mem; |
| 75 | }; |
| 76 | |
| 77 | static struct clk_iomap *clk_memmaps[CLK_MAX_MEMMAPS]; |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 78 | |
| 79 | static void clk_memmap_writel(u32 val, void __iomem *reg) |
| 80 | { |
| 81 | struct clk_omap_reg *r = (struct clk_omap_reg *)® |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 82 | struct clk_iomap *io = clk_memmaps[r->index]; |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 83 | |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 84 | if (io->regmap) |
| 85 | regmap_write(io->regmap, r->offset, val); |
| 86 | else |
| 87 | writel_relaxed(val, io->mem + r->offset); |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | static u32 clk_memmap_readl(void __iomem *reg) |
| 91 | { |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 92 | u32 val; |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 93 | struct clk_omap_reg *r = (struct clk_omap_reg *)® |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 94 | struct clk_iomap *io = clk_memmaps[r->index]; |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 95 | |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 96 | if (io->regmap) |
| 97 | regmap_read(io->regmap, r->offset, &val); |
| 98 | else |
| 99 | val = readl_relaxed(io->mem + r->offset); |
| 100 | |
| 101 | return val; |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 102 | } |
Tero Kristo | 3ada6b10 | 2013-10-22 11:47:08 +0300 | [diff] [blame] | 103 | |
| 104 | void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg) |
| 105 | { |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 106 | if (WARN_ON_ONCE(!(clk->flags & MEMMAP_ADDRESSING))) |
Tero Kristo | 3ada6b10 | 2013-10-22 11:47:08 +0300 | [diff] [blame] | 107 | writel_relaxed(val, reg); |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 108 | else |
| 109 | clk_memmap_writel(val, reg); |
Tero Kristo | 3ada6b10 | 2013-10-22 11:47:08 +0300 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg) |
| 113 | { |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 114 | if (WARN_ON_ONCE(!(clk->flags & MEMMAP_ADDRESSING))) |
| 115 | return readl_relaxed(reg); |
| 116 | else |
| 117 | return clk_memmap_readl(reg); |
| 118 | } |
Tero Kristo | 3ada6b10 | 2013-10-22 11:47:08 +0300 | [diff] [blame] | 119 | |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 120 | static struct ti_clk_ll_ops omap_clk_ll_ops = { |
| 121 | .clk_readl = clk_memmap_readl, |
| 122 | .clk_writel = clk_memmap_writel, |
Tero Kristo | 9a356d6 | 2015-03-03 11:14:31 +0200 | [diff] [blame^] | 123 | .clkdm_clk_enable = clkdm_clk_enable, |
| 124 | .clkdm_clk_disable = clkdm_clk_disable, |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 125 | }; |
Tero Kristo | 3ada6b10 | 2013-10-22 11:47:08 +0300 | [diff] [blame] | 126 | |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 127 | /** |
| 128 | * omap2_clk_provider_init - initialize a clock provider |
| 129 | * @match_table: DT device table to match for devices to init |
| 130 | * @np: device node pointer for the this clock provider |
| 131 | * @index: index for the clock provider |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 132 | + @syscon: syscon regmap pointer |
| 133 | * @mem: iomem pointer for the clock provider memory area, only used if |
| 134 | * syscon is not provided |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 135 | * |
| 136 | * Initializes a clock provider module (CM/PRM etc.), registering |
| 137 | * the memory mapping at specified index and initializing the |
| 138 | * low level driver infrastructure. Returns 0 in success. |
| 139 | */ |
| 140 | int __init omap2_clk_provider_init(struct device_node *np, int index, |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 141 | struct regmap *syscon, void __iomem *mem) |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 142 | { |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 143 | struct clk_iomap *io; |
| 144 | |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 145 | ti_clk_ll_ops = &omap_clk_ll_ops; |
| 146 | |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 147 | io = kzalloc(sizeof(*io), GFP_KERNEL); |
| 148 | |
| 149 | io->regmap = syscon; |
| 150 | io->mem = mem; |
| 151 | |
| 152 | clk_memmaps[index] = io; |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 153 | |
| 154 | ti_dt_clk_init_provider(np, index); |
| 155 | |
| 156 | return 0; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * omap2_clk_legacy_provider_init - initialize a legacy clock provider |
| 161 | * @index: index for the clock provider |
| 162 | * @mem: iomem pointer for the clock provider memory area |
| 163 | * |
| 164 | * Initializes a legacy clock provider memory mapping. |
| 165 | */ |
| 166 | void __init omap2_clk_legacy_provider_init(int index, void __iomem *mem) |
| 167 | { |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 168 | struct clk_iomap *io; |
| 169 | |
Tero Kristo | 9f029b1 | 2014-10-22 15:15:36 +0300 | [diff] [blame] | 170 | ti_clk_ll_ops = &omap_clk_ll_ops; |
| 171 | |
Tero Kristo | 80cbb22 | 2015-02-06 16:00:32 +0200 | [diff] [blame] | 172 | io = memblock_virt_alloc(sizeof(*io), 0); |
| 173 | |
| 174 | io->mem = mem; |
| 175 | |
| 176 | clk_memmaps[index] = io; |
Tero Kristo | 3ada6b10 | 2013-10-22 11:47:08 +0300 | [diff] [blame] | 177 | } |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 178 | |
| 179 | /* |
Paul Walmsley | 30962d9 | 2010-02-22 22:09:38 -0700 | [diff] [blame] | 180 | * OMAP2+ specific clock functions |
| 181 | */ |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 182 | |
Paul Walmsley | 4b1f76e | 2010-01-26 20:13:04 -0700 | [diff] [blame] | 183 | /* Private functions */ |
| 184 | |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 185 | |
| 186 | /** |
| 187 | * _wait_idlest_generic - wait for a module to leave the idle state |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 188 | * @clk: module clock to wait for (needed for register offsets) |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 189 | * @reg: virtual address of module IDLEST register |
| 190 | * @mask: value to mask against to determine if the module is active |
| 191 | * @idlest: idle state indicator (0 or 1) for the clock |
| 192 | * @name: name of the clock (for printk) |
| 193 | * |
| 194 | * Wait for a module to leave idle, where its idle-status register is |
| 195 | * not inside the CM module. Returns 1 if the module left idle |
| 196 | * promptly, or 0 if the module did not leave idle before the timeout |
| 197 | * elapsed. XXX Deprecated - should be moved into drivers for the |
| 198 | * individual IP block that the IDLEST register exists in. |
| 199 | */ |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 200 | static int _wait_idlest_generic(struct clk_hw_omap *clk, void __iomem *reg, |
| 201 | u32 mask, u8 idlest, const char *name) |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 202 | { |
| 203 | int i = 0, ena = 0; |
| 204 | |
| 205 | ena = (idlest) ? 0 : mask; |
| 206 | |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 207 | omap_test_timeout(((omap2_clk_readl(clk, reg) & mask) == ena), |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 208 | MAX_MODULE_ENABLE_WAIT, i); |
| 209 | |
| 210 | if (i < MAX_MODULE_ENABLE_WAIT) |
| 211 | pr_debug("omap clock: module associated with clock %s ready after %d loops\n", |
| 212 | name, i); |
| 213 | else |
| 214 | pr_err("omap clock: module associated with clock %s didn't enable in %d tries\n", |
| 215 | name, MAX_MODULE_ENABLE_WAIT); |
| 216 | |
| 217 | return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0; |
| 218 | }; |
| 219 | |
Paul Walmsley | 4b1f76e | 2010-01-26 20:13:04 -0700 | [diff] [blame] | 220 | /** |
| 221 | * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE |
| 222 | * @clk: struct clk * belonging to the module |
| 223 | * |
| 224 | * If the necessary clocks for the OMAP hardware IP block that |
| 225 | * corresponds to clock @clk are enabled, then wait for the module to |
| 226 | * indicate readiness (i.e., to leave IDLE). This code does not |
| 227 | * belong in the clock code and will be moved in the medium term to |
| 228 | * module-dependent code. No return value. |
| 229 | */ |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 230 | static void _omap2_module_wait_ready(struct clk_hw_omap *clk) |
Paul Walmsley | 4b1f76e | 2010-01-26 20:13:04 -0700 | [diff] [blame] | 231 | { |
| 232 | void __iomem *companion_reg, *idlest_reg; |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 233 | u8 other_bit, idlest_bit, idlest_val, idlest_reg_id; |
| 234 | s16 prcm_mod; |
| 235 | int r; |
Paul Walmsley | 4b1f76e | 2010-01-26 20:13:04 -0700 | [diff] [blame] | 236 | |
| 237 | /* Not all modules have multiple clocks that their IDLEST depends on */ |
| 238 | if (clk->ops->find_companion) { |
| 239 | clk->ops->find_companion(clk, &companion_reg, &other_bit); |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 240 | if (!(omap2_clk_readl(clk, companion_reg) & (1 << other_bit))) |
Paul Walmsley | 4b1f76e | 2010-01-26 20:13:04 -0700 | [diff] [blame] | 241 | return; |
| 242 | } |
| 243 | |
Ranjith Lohithakshan | 419cc97 | 2010-02-24 12:05:54 -0700 | [diff] [blame] | 244 | clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 245 | r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id); |
| 246 | if (r) { |
| 247 | /* IDLEST register not in the CM module */ |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 248 | _wait_idlest_generic(clk, idlest_reg, (1 << idlest_bit), |
| 249 | idlest_val, __clk_get_name(clk->hw.clk)); |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 250 | } else { |
Tero Kristo | 021b6ff | 2014-10-27 08:39:23 -0700 | [diff] [blame] | 251 | omap_cm_wait_module_ready(0, prcm_mod, idlest_reg_id, |
| 252 | idlest_bit); |
Paul Walmsley | c4ceedc | 2012-10-29 20:56:29 -0600 | [diff] [blame] | 253 | }; |
Paul Walmsley | 4b1f76e | 2010-01-26 20:13:04 -0700 | [diff] [blame] | 254 | } |
| 255 | |
Paul Walmsley | 4b1f76e | 2010-01-26 20:13:04 -0700 | [diff] [blame] | 256 | /* Public functions */ |
| 257 | |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 258 | /** |
Paul Walmsley | 333943b | 2008-08-19 11:08:45 +0300 | [diff] [blame] | 259 | * omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk |
| 260 | * @clk: OMAP clock struct ptr to use |
| 261 | * |
| 262 | * Convert a clockdomain name stored in a struct clk 'clk' into a |
| 263 | * clockdomain pointer, and save it into the struct clk. Intended to be |
| 264 | * called during clk_register(). No return value. |
| 265 | */ |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 266 | void omap2_init_clk_clkdm(struct clk_hw *hw) |
| 267 | { |
| 268 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); |
Paul Walmsley | 333943b | 2008-08-19 11:08:45 +0300 | [diff] [blame] | 269 | struct clockdomain *clkdm; |
Rajendra Nayak | 5dcc3b9 | 2012-09-22 02:24:17 -0600 | [diff] [blame] | 270 | const char *clk_name; |
Paul Walmsley | 333943b | 2008-08-19 11:08:45 +0300 | [diff] [blame] | 271 | |
| 272 | if (!clk->clkdm_name) |
| 273 | return; |
| 274 | |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 275 | clk_name = __clk_get_name(hw->clk); |
Rajendra Nayak | 5dcc3b9 | 2012-09-22 02:24:17 -0600 | [diff] [blame] | 276 | |
Paul Walmsley | 333943b | 2008-08-19 11:08:45 +0300 | [diff] [blame] | 277 | clkdm = clkdm_lookup(clk->clkdm_name); |
| 278 | if (clkdm) { |
| 279 | pr_debug("clock: associated clk %s to clkdm %s\n", |
Rajendra Nayak | 5dcc3b9 | 2012-09-22 02:24:17 -0600 | [diff] [blame] | 280 | clk_name, clk->clkdm_name); |
Paul Walmsley | 333943b | 2008-08-19 11:08:45 +0300 | [diff] [blame] | 281 | clk->clkdm = clkdm; |
| 282 | } else { |
Paul Walmsley | 7852ec0 | 2012-07-26 00:54:26 -0600 | [diff] [blame] | 283 | pr_debug("clock: could not associate clk %s to clkdm %s\n", |
Rajendra Nayak | 5dcc3b9 | 2012-09-22 02:24:17 -0600 | [diff] [blame] | 284 | clk_name, clk->clkdm_name); |
Paul Walmsley | 333943b | 2008-08-19 11:08:45 +0300 | [diff] [blame] | 285 | } |
| 286 | } |
| 287 | |
| 288 | /** |
Paul Walmsley | 12706c5 | 2011-07-10 05:57:06 -0600 | [diff] [blame] | 289 | * omap2_clk_disable_clkdm_control - disable clkdm control on clk enable/disable |
| 290 | * |
| 291 | * Prevent the OMAP clock code from calling into the clockdomain code |
| 292 | * when a hardware clock in that clockdomain is enabled or disabled. |
| 293 | * Intended to be called at init time from omap*_clk_init(). No |
| 294 | * return value. |
| 295 | */ |
| 296 | void __init omap2_clk_disable_clkdm_control(void) |
| 297 | { |
| 298 | clkdm_control = false; |
| 299 | } |
| 300 | |
| 301 | /** |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 302 | * omap2_clk_dflt_find_companion - find companion clock to @clk |
| 303 | * @clk: struct clk * to find the companion clock of |
| 304 | * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in |
| 305 | * @other_bit: u8 ** to return the companion clock bit shift in |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 306 | * |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 307 | * Note: We don't need special code here for INVERT_ENABLE for the |
| 308 | * time being since INVERT_ENABLE only applies to clocks enabled by |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 309 | * CM_CLKEN_PLL |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 310 | * |
| 311 | * Convert CM_ICLKEN* <-> CM_FCLKEN*. This conversion assumes it's |
| 312 | * just a matter of XORing the bits. |
| 313 | * |
| 314 | * Some clocks don't have companion clocks. For example, modules with |
| 315 | * only an interface clock (such as MAILBOXES) don't have a companion |
| 316 | * clock. Right now, this code relies on the hardware exporting a bit |
| 317 | * in the correct companion register that indicates that the |
| 318 | * nonexistent 'companion clock' is active. Future patches will |
| 319 | * associate this type of code with per-module data structures to |
| 320 | * avoid this issue, and remove the casts. No return value. |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 321 | */ |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 322 | void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk, |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 323 | void __iomem **other_reg, u8 *other_bit) |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 324 | { |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 325 | u32 r; |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 326 | |
Russell King | c1168dc3 | 2008-11-04 21:24:00 +0000 | [diff] [blame] | 327 | /* |
| 328 | * Convert CM_ICLKEN* <-> CM_FCLKEN*. This conversion assumes |
| 329 | * it's just a matter of XORing the bits. |
| 330 | */ |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 331 | r = ((__force u32)clk->enable_reg ^ (CM_FCLKEN ^ CM_ICLKEN)); |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 332 | |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 333 | *other_reg = (__force void __iomem *)r; |
| 334 | *other_bit = clk->enable_bit; |
Paul Walmsley | 543d937 | 2008-03-18 10:22:06 +0200 | [diff] [blame] | 335 | } |
| 336 | |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 337 | /** |
| 338 | * omap2_clk_dflt_find_idlest - find CM_IDLEST reg va, bit shift for @clk |
| 339 | * @clk: struct clk * to find IDLEST info for |
| 340 | * @idlest_reg: void __iomem ** to return the CM_IDLEST va in |
Ranjith Lohithakshan | 419cc97 | 2010-02-24 12:05:54 -0700 | [diff] [blame] | 341 | * @idlest_bit: u8 * to return the CM_IDLEST bit shift in |
| 342 | * @idlest_val: u8 * to return the idle status indicator |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 343 | * |
| 344 | * Return the CM_IDLEST register address and bit shift corresponding |
| 345 | * to the module that "owns" this clock. This default code assumes |
| 346 | * that the CM_IDLEST bit shift is the CM_*CLKEN bit shift, and that |
| 347 | * the IDLEST register address ID corresponds to the CM_*CLKEN |
| 348 | * register address ID (e.g., that CM_FCLKEN2 corresponds to |
| 349 | * CM_IDLEST2). This is not true for all modules. No return value. |
| 350 | */ |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 351 | void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk, |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 352 | void __iomem **idlest_reg, u8 *idlest_bit, u8 *idlest_val) |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 353 | { |
| 354 | u32 r; |
| 355 | |
| 356 | r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); |
| 357 | *idlest_reg = (__force void __iomem *)r; |
| 358 | *idlest_bit = clk->enable_bit; |
Ranjith Lohithakshan | 419cc97 | 2010-02-24 12:05:54 -0700 | [diff] [blame] | 359 | |
| 360 | /* |
| 361 | * 24xx uses 0 to indicate not ready, and 1 to indicate ready. |
| 362 | * 34xx reverses this, just to keep us on our toes |
| 363 | * AM35xx uses both, depending on the module. |
| 364 | */ |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 365 | *idlest_val = ti_clk_get_features()->cm_idlest_val; |
Paul Walmsley | 72350b2 | 2009-07-24 19:44:03 -0600 | [diff] [blame] | 366 | } |
| 367 | |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 368 | /** |
| 369 | * omap2_dflt_clk_enable - enable a clock in the hardware |
| 370 | * @hw: struct clk_hw * of the clock to enable |
| 371 | * |
| 372 | * Enable the clock @hw in the hardware. We first call into the OMAP |
| 373 | * clockdomain code to "enable" the corresponding clockdomain if this |
| 374 | * is the first enabled user of the clockdomain. Then program the |
| 375 | * hardware to enable the clock. Then wait for the IP block that uses |
| 376 | * this clock to leave idle (if applicable). Returns the error value |
| 377 | * from clkdm_clk_enable() if it terminated with an error, or -EINVAL |
| 378 | * if @hw has a null clock enable_reg, or zero upon success. |
| 379 | */ |
| 380 | int omap2_dflt_clk_enable(struct clk_hw *hw) |
| 381 | { |
| 382 | struct clk_hw_omap *clk; |
| 383 | u32 v; |
| 384 | int ret = 0; |
| 385 | |
| 386 | clk = to_clk_hw_omap(hw); |
| 387 | |
| 388 | if (clkdm_control && clk->clkdm) { |
| 389 | ret = clkdm_clk_enable(clk->clkdm, hw->clk); |
| 390 | if (ret) { |
| 391 | WARN(1, "%s: could not enable %s's clockdomain %s: %d\n", |
| 392 | __func__, __clk_get_name(hw->clk), |
| 393 | clk->clkdm->name, ret); |
| 394 | return ret; |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | if (unlikely(clk->enable_reg == NULL)) { |
| 399 | pr_err("%s: %s missing enable_reg\n", __func__, |
| 400 | __clk_get_name(hw->clk)); |
| 401 | ret = -EINVAL; |
| 402 | goto err; |
| 403 | } |
| 404 | |
| 405 | /* FIXME should not have INVERT_ENABLE bit here */ |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 406 | v = omap2_clk_readl(clk, clk->enable_reg); |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 407 | if (clk->flags & INVERT_ENABLE) |
| 408 | v &= ~(1 << clk->enable_bit); |
| 409 | else |
| 410 | v |= (1 << clk->enable_bit); |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 411 | omap2_clk_writel(v, clk, clk->enable_reg); |
| 412 | v = omap2_clk_readl(clk, clk->enable_reg); /* OCP barrier */ |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 413 | |
| 414 | if (clk->ops && clk->ops->find_idlest) |
| 415 | _omap2_module_wait_ready(clk); |
| 416 | |
| 417 | return 0; |
| 418 | |
| 419 | err: |
| 420 | if (clkdm_control && clk->clkdm) |
| 421 | clkdm_clk_disable(clk->clkdm, hw->clk); |
| 422 | return ret; |
| 423 | } |
| 424 | |
| 425 | /** |
| 426 | * omap2_dflt_clk_disable - disable a clock in the hardware |
| 427 | * @hw: struct clk_hw * of the clock to disable |
| 428 | * |
| 429 | * Disable the clock @hw in the hardware, and call into the OMAP |
| 430 | * clockdomain code to "disable" the corresponding clockdomain if all |
| 431 | * clocks/hwmods in that clockdomain are now disabled. No return |
| 432 | * value. |
| 433 | */ |
| 434 | void omap2_dflt_clk_disable(struct clk_hw *hw) |
| 435 | { |
| 436 | struct clk_hw_omap *clk; |
| 437 | u32 v; |
| 438 | |
| 439 | clk = to_clk_hw_omap(hw); |
| 440 | if (!clk->enable_reg) { |
| 441 | /* |
| 442 | * 'independent' here refers to a clock which is not |
| 443 | * controlled by its parent. |
| 444 | */ |
| 445 | pr_err("%s: independent clock %s has no enable_reg\n", |
| 446 | __func__, __clk_get_name(hw->clk)); |
| 447 | return; |
| 448 | } |
| 449 | |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 450 | v = omap2_clk_readl(clk, clk->enable_reg); |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 451 | if (clk->flags & INVERT_ENABLE) |
| 452 | v |= (1 << clk->enable_bit); |
| 453 | else |
| 454 | v &= ~(1 << clk->enable_bit); |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 455 | omap2_clk_writel(v, clk, clk->enable_reg); |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 456 | /* No OCP barrier needed here since it is a disable operation */ |
| 457 | |
| 458 | if (clkdm_control && clk->clkdm) |
| 459 | clkdm_clk_disable(clk->clkdm, hw->clk); |
| 460 | } |
| 461 | |
| 462 | /** |
| 463 | * omap2_clkops_enable_clkdm - increment usecount on clkdm of @hw |
| 464 | * @hw: struct clk_hw * of the clock being enabled |
| 465 | * |
| 466 | * Increment the usecount of the clockdomain of the clock pointed to |
| 467 | * by @hw; if the usecount is 1, the clockdomain will be "enabled." |
| 468 | * Only needed for clocks that don't use omap2_dflt_clk_enable() as |
| 469 | * their enable function pointer. Passes along the return value of |
| 470 | * clkdm_clk_enable(), -EINVAL if @hw is not associated with a |
| 471 | * clockdomain, or 0 if clock framework-based clockdomain control is |
| 472 | * not implemented. |
| 473 | */ |
| 474 | int omap2_clkops_enable_clkdm(struct clk_hw *hw) |
| 475 | { |
| 476 | struct clk_hw_omap *clk; |
| 477 | int ret = 0; |
| 478 | |
| 479 | clk = to_clk_hw_omap(hw); |
| 480 | |
| 481 | if (unlikely(!clk->clkdm)) { |
| 482 | pr_err("%s: %s: no clkdm set ?!\n", __func__, |
| 483 | __clk_get_name(hw->clk)); |
| 484 | return -EINVAL; |
| 485 | } |
| 486 | |
| 487 | if (unlikely(clk->enable_reg)) |
| 488 | pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__, |
| 489 | __clk_get_name(hw->clk)); |
| 490 | |
| 491 | if (!clkdm_control) { |
| 492 | pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n", |
| 493 | __func__, __clk_get_name(hw->clk)); |
| 494 | return 0; |
| 495 | } |
| 496 | |
| 497 | ret = clkdm_clk_enable(clk->clkdm, hw->clk); |
| 498 | WARN(ret, "%s: could not enable %s's clockdomain %s: %d\n", |
| 499 | __func__, __clk_get_name(hw->clk), clk->clkdm->name, ret); |
| 500 | |
| 501 | return ret; |
| 502 | } |
| 503 | |
| 504 | /** |
| 505 | * omap2_clkops_disable_clkdm - decrement usecount on clkdm of @hw |
| 506 | * @hw: struct clk_hw * of the clock being disabled |
| 507 | * |
| 508 | * Decrement the usecount of the clockdomain of the clock pointed to |
| 509 | * by @hw; if the usecount is 0, the clockdomain will be "disabled." |
| 510 | * Only needed for clocks that don't use omap2_dflt_clk_disable() as their |
| 511 | * disable function pointer. No return value. |
| 512 | */ |
| 513 | void omap2_clkops_disable_clkdm(struct clk_hw *hw) |
| 514 | { |
| 515 | struct clk_hw_omap *clk; |
| 516 | |
| 517 | clk = to_clk_hw_omap(hw); |
| 518 | |
| 519 | if (unlikely(!clk->clkdm)) { |
| 520 | pr_err("%s: %s: no clkdm set ?!\n", __func__, |
| 521 | __clk_get_name(hw->clk)); |
| 522 | return; |
| 523 | } |
| 524 | |
| 525 | if (unlikely(clk->enable_reg)) |
| 526 | pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__, |
| 527 | __clk_get_name(hw->clk)); |
| 528 | |
| 529 | if (!clkdm_control) { |
| 530 | pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n", |
| 531 | __func__, __clk_get_name(hw->clk)); |
| 532 | return; |
| 533 | } |
| 534 | |
| 535 | clkdm_clk_disable(clk->clkdm, hw->clk); |
| 536 | } |
| 537 | |
| 538 | /** |
| 539 | * omap2_dflt_clk_is_enabled - is clock enabled in the hardware? |
| 540 | * @hw: struct clk_hw * to check |
| 541 | * |
| 542 | * Return 1 if the clock represented by @hw is enabled in the |
| 543 | * hardware, or 0 otherwise. Intended for use in the struct |
| 544 | * clk_ops.is_enabled function pointer. |
| 545 | */ |
| 546 | int omap2_dflt_clk_is_enabled(struct clk_hw *hw) |
| 547 | { |
| 548 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); |
| 549 | u32 v; |
| 550 | |
Tero Kristo | 519ab8b | 2013-10-22 11:49:58 +0300 | [diff] [blame] | 551 | v = omap2_clk_readl(clk, clk->enable_reg); |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 552 | |
| 553 | if (clk->flags & INVERT_ENABLE) |
| 554 | v ^= BIT(clk->enable_bit); |
| 555 | |
| 556 | v &= BIT(clk->enable_bit); |
| 557 | |
| 558 | return v ? 1 : 0; |
| 559 | } |
| 560 | |
| 561 | static int __initdata mpurate; |
| 562 | |
| 563 | /* |
| 564 | * By default we use the rate set by the bootloader. |
| 565 | * You can override this with mpurate= cmdline option. |
| 566 | */ |
| 567 | static int __init omap_clk_setup(char *str) |
| 568 | { |
| 569 | get_option(&str, &mpurate); |
| 570 | |
| 571 | if (!mpurate) |
| 572 | return 1; |
| 573 | |
| 574 | if (mpurate < 1000) |
| 575 | mpurate *= 1000000; |
| 576 | |
| 577 | return 1; |
| 578 | } |
| 579 | __setup("mpurate=", omap_clk_setup); |
| 580 | |
| 581 | const struct clk_hw_omap_ops clkhwops_wait = { |
| 582 | .find_idlest = omap2_clk_dflt_find_idlest, |
| 583 | .find_companion = omap2_clk_dflt_find_companion, |
| 584 | }; |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 585 | |
Paul Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 586 | /** |
Paul Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 587 | * omap2_clk_print_new_rates - print summary of current clock tree rates |
| 588 | * @hfclkin_ck_name: clk name for the off-chip HF oscillator |
| 589 | * @core_ck_name: clk name for the on-chip CORE_CLK |
| 590 | * @mpu_ck_name: clk name for the ARM MPU clock |
| 591 | * |
| 592 | * Prints a short message to the console with the HFCLKIN oscillator |
| 593 | * rate, the rate of the CORE clock, and the rate of the ARM MPU clock. |
| 594 | * Called by the boot-time MPU rate switching code. XXX This is intended |
| 595 | * to be handled by the OPP layer code in the near future and should be |
| 596 | * removed from the clock code. No return value. |
| 597 | */ |
| 598 | void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name, |
| 599 | const char *core_ck_name, |
| 600 | const char *mpu_ck_name) |
| 601 | { |
| 602 | struct clk *hfclkin_ck, *core_ck, *mpu_ck; |
| 603 | unsigned long hfclkin_rate; |
| 604 | |
| 605 | mpu_ck = clk_get(NULL, mpu_ck_name); |
| 606 | if (WARN(IS_ERR(mpu_ck), "clock: failed to get %s.\n", mpu_ck_name)) |
| 607 | return; |
| 608 | |
| 609 | core_ck = clk_get(NULL, core_ck_name); |
| 610 | if (WARN(IS_ERR(core_ck), "clock: failed to get %s.\n", core_ck_name)) |
| 611 | return; |
| 612 | |
| 613 | hfclkin_ck = clk_get(NULL, hfclkin_ck_name); |
| 614 | if (WARN(IS_ERR(hfclkin_ck), "Failed to get %s.\n", hfclkin_ck_name)) |
| 615 | return; |
| 616 | |
| 617 | hfclkin_rate = clk_get_rate(hfclkin_ck); |
| 618 | |
Paul Walmsley | 7852ec0 | 2012-07-26 00:54:26 -0600 | [diff] [blame] | 619 | pr_info("Switched to new clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n", |
| 620 | (hfclkin_rate / 1000000), ((hfclkin_rate / 100000) % 10), |
Paul Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 621 | (clk_get_rate(core_ck) / 1000000), |
| 622 | (clk_get_rate(mpu_ck) / 1000000)); |
| 623 | } |
Tero Kristo | 8111e01 | 2014-07-02 11:47:39 +0300 | [diff] [blame] | 624 | |
| 625 | /** |
| 626 | * ti_clk_init_features - init clock features struct for the SoC |
| 627 | * |
| 628 | * Initializes the clock features struct based on the SoC type. |
| 629 | */ |
| 630 | void __init ti_clk_init_features(void) |
| 631 | { |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 632 | struct ti_clk_features features = { 0 }; |
Tero Kristo | a24886e | 2014-07-02 11:47:40 +0300 | [diff] [blame] | 633 | /* Fint setup for DPLLs */ |
| 634 | if (cpu_is_omap3430()) { |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 635 | features.fint_min = OMAP3430_DPLL_FINT_BAND1_MIN; |
| 636 | features.fint_max = OMAP3430_DPLL_FINT_BAND2_MAX; |
| 637 | features.fint_band1_max = OMAP3430_DPLL_FINT_BAND1_MAX; |
| 638 | features.fint_band2_min = OMAP3430_DPLL_FINT_BAND2_MIN; |
Tero Kristo | a24886e | 2014-07-02 11:47:40 +0300 | [diff] [blame] | 639 | } else { |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 640 | features.fint_min = OMAP3PLUS_DPLL_FINT_MIN; |
| 641 | features.fint_max = OMAP3PLUS_DPLL_FINT_MAX; |
Tero Kristo | a24886e | 2014-07-02 11:47:40 +0300 | [diff] [blame] | 642 | } |
Tero Kristo | 512d91c | 2014-07-02 11:47:42 +0300 | [diff] [blame] | 643 | |
| 644 | /* Bypass value setup for DPLLs */ |
| 645 | if (cpu_is_omap24xx()) { |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 646 | features.dpll_bypass_vals |= |
Tero Kristo | 512d91c | 2014-07-02 11:47:42 +0300 | [diff] [blame] | 647 | (1 << OMAP2XXX_EN_DPLL_LPBYPASS) | |
| 648 | (1 << OMAP2XXX_EN_DPLL_FRBYPASS); |
| 649 | } else if (cpu_is_omap34xx()) { |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 650 | features.dpll_bypass_vals |= |
Tero Kristo | 512d91c | 2014-07-02 11:47:42 +0300 | [diff] [blame] | 651 | (1 << OMAP3XXX_EN_DPLL_LPBYPASS) | |
| 652 | (1 << OMAP3XXX_EN_DPLL_FRBYPASS); |
| 653 | } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx() || |
| 654 | soc_is_omap54xx() || soc_is_dra7xx()) { |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 655 | features.dpll_bypass_vals |= |
Tero Kristo | 512d91c | 2014-07-02 11:47:42 +0300 | [diff] [blame] | 656 | (1 << OMAP4XXX_EN_DPLL_LPBYPASS) | |
| 657 | (1 << OMAP4XXX_EN_DPLL_FRBYPASS) | |
| 658 | (1 << OMAP4XXX_EN_DPLL_MNBYPASS); |
| 659 | } |
Tero Kristo | 2337c5b | 2014-07-02 11:47:43 +0300 | [diff] [blame] | 660 | |
| 661 | /* Jitter correction only available on OMAP343X */ |
| 662 | if (cpu_is_omap343x()) |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 663 | features.flags |= TI_CLK_DPLL_HAS_FREQSEL; |
Tero Kristo | 066edb2 | 2014-07-02 11:47:44 +0300 | [diff] [blame] | 664 | |
| 665 | /* Idlest value for interface clocks. |
| 666 | * 24xx uses 0 to indicate not ready, and 1 to indicate ready. |
| 667 | * 34xx reverses this, just to keep us on our toes |
| 668 | * AM35xx uses both, depending on the module. |
| 669 | */ |
| 670 | if (cpu_is_omap24xx()) |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 671 | features.cm_idlest_val = OMAP24XX_CM_IDLEST_VAL; |
Tero Kristo | 066edb2 | 2014-07-02 11:47:44 +0300 | [diff] [blame] | 672 | else if (cpu_is_omap34xx()) |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 673 | features.cm_idlest_val = OMAP34XX_CM_IDLEST_VAL; |
Tero Kristo | f0d2f68 | 2014-10-03 16:57:10 +0300 | [diff] [blame] | 674 | |
| 675 | /* On OMAP3430 ES1.0, DPLL4 can't be re-programmed */ |
| 676 | if (omap_rev() == OMAP3430_REV_ES1_0) |
Tero Kristo | f3b19aa | 2015-02-27 17:54:14 +0200 | [diff] [blame] | 677 | features.flags |= TI_CLK_DPLL4_DENY_REPROGRAM; |
| 678 | |
| 679 | ti_clk_setup_features(&features); |
Tero Kristo | 8111e01 | 2014-07-02 11:47:39 +0300 | [diff] [blame] | 680 | } |