aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-02-23 00:09:12 -0500
committerPaul Walmsley <paul@pwsan.com>2010-02-24 14:15:03 -0500
commit93340a22943f3169de7d359ea14cd618114da6f6 (patch)
treee9736b9fb4e9f2fdd31491b2b7a5b3dfe60ed453 /arch/arm
parent7356f0b26b3176610b4de439e8c7bfe10c797347 (diff)
OMAP2/3/4 clock: fix DPLL multiplier value errors; also copyrights, includes, documentation
The maximum DPLL multiplier (M) values for OMAP2xxx and OMAP3xxx are one increment higher than they should be. See for example the OMAP242x TRM Rev X Section 5.10.6 "Clock Generator Registers" and the OMAP36xx TRM Rev C Table 3-202 "CM_CLKSEL1_PLL". Programming a 0 into the DPLL's M register bitfield is valid for OMAP2/3 and indicates that the DPLL should enter MN-bypass mode. Also, increase the minimum multiplier (M) value for the DPLL rate rounding code from 1 to 2, to ensure that it does not inadvertently put the DPLL into bypass. Note that the register documentation in the OMAP2xxx and OMAP3xxx TRMs does not make clear that the actual DPLL divider value (the "N") is the content of the appropriate register bitfield for the N value, _plus one_. (In other words, an N register bitfield of 0 indicates a DPLL divider value of 1.) This is only clearly documented in the OMAP4430 TRM, in, for example, OMAP4430 TRM Rev A Table 3-1167 "CM_CLKSEL_DPLL_USB". While here, update copyrights, add kerneldoc for struct dpll_data, drop the unused struct dpll_data.max_tolerance field, remove some unnecessary #includes in DPLL-related code, and replace the #include of <linux/module.h> with <linux/list.h>, which is what was really needed. The OMAP4 clock autogenerator script has been updated accordingly. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Benoît Cousson <b-cousson@ti.com> Cc: Rajendra Nayak <rnayak@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c2
-rw-r--r--arch/arm/mach-omap2/clock2xxx_data.c6
-rw-r--r--arch/arm/mach-omap2/clock34xx_data.c8
-rw-r--r--arch/arm/mach-omap2/clock44xx.h7
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c4
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h64
7 files changed, 67 insertions, 26 deletions
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 9eee0e67d5d6..6ce512e902c6 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -29,7 +29,7 @@
29#include "cm-regbits-34xx.h" 29#include "cm-regbits-34xx.h"
30 30
31/* DPLL rate rounding: minimum DPLL multiplier, divider values */ 31/* DPLL rate rounding: minimum DPLL multiplier, divider values */
32#define DPLL_MIN_MULTIPLIER 1 32#define DPLL_MIN_MULTIPLIER 2
33#define DPLL_MIN_DIVIDER 1 33#define DPLL_MIN_DIVIDER 1
34 34
35/* Possible error results from _dpll_test_mult */ 35/* Possible error results from _dpll_test_mult */
diff --git a/arch/arm/mach-omap2/clock2xxx_data.c b/arch/arm/mach-omap2/clock2xxx_data.c
index 52c7a6c2d9e0..f20a4b2bc6fc 100644
--- a/arch/arm/mach-omap2/clock2xxx_data.c
+++ b/arch/arm/mach-omap2/clock2xxx_data.c
@@ -2,7 +2,7 @@
2 * linux/arch/arm/mach-omap2/clock2xxx_data.c 2 * linux/arch/arm/mach-omap2/clock2xxx_data.c
3 * 3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc. 4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2009 Nokia Corporation 5 * Copyright (C) 2004-2010 Nokia Corporation
6 * 6 *
7 * Contacts: 7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com> 8 * Richard Woodruff <r-woodruff2@ti.com>
@@ -13,9 +13,9 @@
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15
16#include <linux/module.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/list.h>
19 19
20#include <plat/clkdev_omap.h> 20#include <plat/clkdev_omap.h>
21 21
@@ -107,7 +107,7 @@ static struct dpll_data dpll_dd = {
107 .clk_ref = &sys_ck, 107 .clk_ref = &sys_ck,
108 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 108 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
109 .enable_mask = OMAP24XX_EN_DPLL_MASK, 109 .enable_mask = OMAP24XX_EN_DPLL_MASK,
110 .max_multiplier = 1024, 110 .max_multiplier = 1023,
111 .min_divider = 1, 111 .min_divider = 1,
112 .max_divider = 16, 112 .max_divider = 16,
113 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE 113 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
diff --git a/arch/arm/mach-omap2/clock34xx_data.c b/arch/arm/mach-omap2/clock34xx_data.c
index da71ef17cb11..94f603b16c5e 100644
--- a/arch/arm/mach-omap2/clock34xx_data.c
+++ b/arch/arm/mach-omap2/clock34xx_data.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * OMAP3 clock data 2 * OMAP3 clock data
3 * 3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc. 4 * Copyright (C) 2007-2010 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2010 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander 8 * With many device clock fixes by Kevin Hilman and Jouni Högander
@@ -16,9 +16,9 @@
16 * to be requested from drivers directly. 16 * to be requested from drivers directly.
17 */ 17 */
18 18
19#include <linux/module.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/list.h>
22 22
23#include <plat/control.h> 23#include <plat/control.h>
24#include <plat/clkdev_omap.h> 24#include <plat/clkdev_omap.h>
@@ -37,7 +37,7 @@
37#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR 37#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
38 38
39/* Maximum DPLL multiplier, divider values for OMAP3 */ 39/* Maximum DPLL multiplier, divider values for OMAP3 */
40#define OMAP3_MAX_DPLL_MULT 2048 40#define OMAP3_MAX_DPLL_MULT 2047
41#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095 41#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095
42#define OMAP3_MAX_DPLL_DIV 128 42#define OMAP3_MAX_DPLL_DIV 128
43 43
diff --git a/arch/arm/mach-omap2/clock44xx.h b/arch/arm/mach-omap2/clock44xx.h
index efe849416aac..0c739726703d 100644
--- a/arch/arm/mach-omap2/clock44xx.h
+++ b/arch/arm/mach-omap2/clock44xx.h
@@ -2,12 +2,17 @@
2 * OMAP4 clock function prototypes and macros 2 * OMAP4 clock function prototypes and macros
3 * 3 *
4 * Copyright (C) 2009 Texas Instruments, Inc. 4 * Copyright (C) 2009 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
5 */ 6 */
6 7
7#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_44XX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_44XX_H
8#define __ARCH_ARM_MACH_OMAP2_CLOCK_44XX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK_44XX_H
9 10
10#define OMAP4430_MAX_DPLL_MULT 2048 11/*
12 * XXX Missing values for the OMAP4 DPLL_USB
13 * XXX Missing min_multiplier values for all OMAP4 DPLLs
14 */
15#define OMAP4430_MAX_DPLL_MULT 2047
11#define OMAP4430_MAX_DPLL_DIV 128 16#define OMAP4430_MAX_DPLL_DIV 128
12 17
13int omap4xxx_clk_init(void); 18int omap4xxx_clk_init(void);
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 8d8b57340950..1abfefff703b 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -20,7 +20,7 @@
20 */ 20 */
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/module.h> 23#include <linux/list.h>
24#include <linux/clk.h> 24#include <linux/clk.h>
25 25
26#include <plat/control.h> 26#include <plat/control.h>
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 417c3caa05db..b32ccd954a1b 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -18,7 +18,6 @@
18 * published by the Free Software Foundation. 18 * published by the Free Software Foundation.
19 */ 19 */
20 20
21#include <linux/module.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <linux/device.h> 22#include <linux/device.h>
24#include <linux/list.h> 23#include <linux/list.h>
@@ -26,13 +25,10 @@
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/clk.h> 26#include <linux/clk.h>
28#include <linux/io.h> 27#include <linux/io.h>
29#include <linux/limits.h>
30#include <linux/bitops.h> 28#include <linux/bitops.h>
31 29
32#include <plat/cpu.h> 30#include <plat/cpu.h>
33#include <plat/clock.h> 31#include <plat/clock.h>
34#include <plat/sram.h>
35#include <asm/div64.h>
36#include <asm/clkdev.h> 32#include <asm/clkdev.h>
37 33
38#include "clock.h" 34#include "clock.h"
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index 63a233490d6d..52f097b1e4d6 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/clock.h 2 * OMAP clock: data structure definitions, function prototypes, shared macros
3 * 3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation 4 * Copyright (C) 2004-2005, 2008-2010 Nokia Corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc 6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -41,9 +41,49 @@ struct clksel {
41 const struct clksel_rate *rates; 41 const struct clksel_rate *rates;
42}; 42};
43 43
44/* 44/**
45 * A new flag called flag has been added which indicates what is the 45 * struct dpll_data - DPLL registers and integration data
46 * type of dpll (like j_type, no_dco_sel) 46 * @mult_div1_reg: register containing the DPLL M and N bitfields
47 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
48 * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
49 * @clk_bypass: struct clk pointer to the clock's bypass clock input
50 * @clk_ref: struct clk pointer to the clock's reference clock input
51 * @control_reg: register containing the DPLL mode bitfield
52 * @enable_mask: mask of the DPLL mode bitfield in @control_reg
53 * @rate_tolerance: maximum variance allowed from target rate (in Hz)
54 * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
55 * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
56 * @max_multiplier: maximum valid non-bypass multiplier value (actual)
57 * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
58 * @min_divider: minimum valid non-bypass divider value (actual)
59 * @max_divider: maximum valid non-bypass divider value (actual)
60 * @modes: possible values of @enable_mask
61 * @autoidle_reg: register containing the DPLL autoidle mode bitfield
62 * @idlest_reg: register containing the DPLL idle status bitfield
63 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
64 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
65 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
66 * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
67 * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
68 * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
69 * @flags: DPLL type/features (see below)
70 *
71 * Possible values for @flags:
72 * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
73 * NO_DCO_SEL: don't program DCO (only for some J-type DPLLs)
74
75 * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
76 *
77 * XXX Some DPLLs have multiple bypass inputs, so it's not technically
78 * correct to only have one @clk_bypass pointer.
79 *
80 * XXX @rate_tolerance should probably be deprecated - currently there
81 * don't seem to be any usecases for DPLL rounding that is not exact.
82 *
83 * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
84 * @last_rounded_n) should be separated from the runtime-fixed fields
85 * and placed into a differenct structure, so that the runtime-fixed data
86 * can be placed into read-only space.
47 */ 87 */
48struct dpll_data { 88struct dpll_data {
49 void __iomem *mult_div1_reg; 89 void __iomem *mult_div1_reg;
@@ -56,13 +96,12 @@ struct dpll_data {
56 unsigned int rate_tolerance; 96 unsigned int rate_tolerance;
57 unsigned long last_rounded_rate; 97 unsigned long last_rounded_rate;
58 u16 last_rounded_m; 98 u16 last_rounded_m;
99 u16 max_multiplier;
59 u8 last_rounded_n; 100 u8 last_rounded_n;
60 u8 min_divider; 101 u8 min_divider;
61 u8 max_divider; 102 u8 max_divider;
62 u32 max_tolerance;
63 u16 max_multiplier;
64#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
65 u8 modes; 103 u8 modes;
104#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
66 void __iomem *autoidle_reg; 105 void __iomem *autoidle_reg;
67 void __iomem *idlest_reg; 106 void __iomem *idlest_reg;
68 u32 autoidle_mask; 107 u32 autoidle_mask;
@@ -152,6 +191,7 @@ extern const struct clkops clkops_null;
152#define RATE_FIXED (1 << 1) /* Fixed clock rate */ 191#define RATE_FIXED (1 << 1) /* Fixed clock rate */
153/* bits 2-4 are free */ 192/* bits 2-4 are free */
154#define ENABLE_REG_32BIT (1 << 5) /* Use 32-bit access */ 193#define ENABLE_REG_32BIT (1 << 5) /* Use 32-bit access */
194/* bit 6 is free */
155#define CLOCK_IDLE_CONTROL (1 << 7) 195#define CLOCK_IDLE_CONTROL (1 << 7)
156#define CLOCK_NO_IDLE_PARENT (1 << 8) 196#define CLOCK_NO_IDLE_PARENT (1 << 8)
157#define DELAYED_APP (1 << 9) /* Delay application of clock */ 197#define DELAYED_APP (1 << 9) /* Delay application of clock */
@@ -160,14 +200,14 @@ extern const struct clkops clkops_null;
160#define INVERT_ENABLE (1 << 12) /* 0 enables, 1 disables */ 200#define INVERT_ENABLE (1 << 12) /* 0 enables, 1 disables */
161#define CLOCK_IN_OMAP4430 (1 << 13) 201#define CLOCK_IN_OMAP4430 (1 << 13)
162#define ALWAYS_ENABLED (1 << 14) 202#define ALWAYS_ENABLED (1 << 14)
163/* bits 13-31 are currently free */ 203/* bits 15-31 are currently free */
164 204
165/* Clksel_rate flags */ 205/* Clksel_rate flags */
166#define DEFAULT_RATE (1 << 0) 206#define DEFAULT_RATE (1 << 0)
167#define RATE_IN_242X (1 << 1) 207#define RATE_IN_242X (1 << 1)
168#define RATE_IN_243X (1 << 2) 208#define RATE_IN_243X (1 << 2)
169#define RATE_IN_343X (1 << 3) /* rates common to all 343X */ 209#define RATE_IN_343X (1 << 3) /* rates common to all 343X */
170#define RATE_IN_3430ES2 (1 << 4) /* 3430ES2 rates only */ 210#define RATE_IN_3430ES2 (1 << 4) /* 3430ES2 rates only */
171#define RATE_IN_36XX (1 << 5) 211#define RATE_IN_36XX (1 << 5)
172#define RATE_IN_4430 (1 << 6) 212#define RATE_IN_4430 (1 << 6)
173 213