aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/clock_data.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-07-26 18:34:28 -0400
committerPaul Walmsley <paul@pwsan.com>2010-07-26 18:34:28 -0400
commitfb2fc9204f8ce060d239ab41f09cf6fc6de5ad4b (patch)
tree925c6e8ce2ea6bb997cf71238c06e5f51bfe8ceb /arch/arm/mach-omap1/clock_data.c
parent936305a96ce1611093ad7a5591a62f9d7142be7c (diff)
OMAP1: clock: some cleanup
Convert most of the magic numbers in mach-omap1/clock_data.c to use macros. Clean up a few comments to conform with Documentation/CodingStyle. Mark the current clkops_uart as being OMAP16xx-only, and add some comments to indicate that it does not belong there, for future cleanup. This patch should not cause any functional changes. Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap1/clock_data.c')
-rw-r--r--arch/arm/mach-omap1/clock_data.c129
1 files changed, 103 insertions, 26 deletions
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index aa8558adbf1..ca4bd862033 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -8,6 +8,10 @@
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
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 *
12 * To do:
13 * - Clocks that are only available on some chips should be marked with the
14 * chips that they are present on.
11 */ 15 */
12 16
13#include <linux/kernel.h> 17#include <linux/kernel.h>
@@ -23,9 +27,49 @@
23 27
24#include "clock.h" 28#include "clock.h"
25 29
26/*------------------------------------------------------------------------ 30/* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
31#define IDL_CLKOUT_ARM_SHIFT 12
32#define IDLTIM_ARM_SHIFT 9
33#define IDLAPI_ARM_SHIFT 8
34#define IDLIF_ARM_SHIFT 6
35#define IDLLB_ARM_SHIFT 4 /* undocumented? */
36#define OMAP1510_IDLLCD_ARM_SHIFT 3 /* undocumented? */
37#define IDLPER_ARM_SHIFT 2
38#define IDLXORP_ARM_SHIFT 1
39#define IDLWDT_ARM_SHIFT 0
40
41/* Some MOD_CONF_CTRL_0 bit shifts - used in struct clk.enable_bit */
42#define CONF_MOD_UART3_CLK_MODE_R 31
43#define CONF_MOD_UART2_CLK_MODE_R 30
44#define CONF_MOD_UART1_CLK_MODE_R 29
45#define CONF_MOD_MMC_SD_CLK_REQ_R 23
46#define CONF_MOD_MCBSP3_AUXON 20
47
48/* Some MOD_CONF_CTRL_1 bit shifts - used in struct clk.enable_bit */
49#define CONF_MOD_SOSSI_CLK_EN_R 16
50
51/* Some OTG_SYSCON_2-specific bit fields */
52#define OTG_SYSCON_2_UHOST_EN_SHIFT 8
53
54/* Some SOFT_REQ_REG bit fields - used in struct clk.enable_bit */
55#define SOFT_MMC2_DPLL_REQ_SHIFT 13
56#define SOFT_MMC_DPLL_REQ_SHIFT 12
57#define SOFT_UART3_DPLL_REQ_SHIFT 11
58#define SOFT_UART2_DPLL_REQ_SHIFT 10
59#define SOFT_UART1_DPLL_REQ_SHIFT 9
60#define SOFT_USB_OTG_DPLL_REQ_SHIFT 8
61#define SOFT_CAM_DPLL_REQ_SHIFT 7
62#define SOFT_COM_MCKO_REQ_SHIFT 6
63#define SOFT_PERIPH_REQ_SHIFT 5 /* sys_ck gate for UART2 ? */
64#define USB_REQ_EN_SHIFT 4
65#define SOFT_USB_REQ_SHIFT 3 /* sys_ck gate for USB host? */
66#define SOFT_SDW_REQ_SHIFT 2 /* sys_ck gate for Bluetooth? */
67#define SOFT_COM_REQ_SHIFT 1 /* sys_ck gate for com proc? */
68#define SOFT_DPLL_REQ_SHIFT 0
69
70/*
27 * Omap1 clocks 71 * Omap1 clocks
28 *-------------------------------------------------------------------------*/ 72 */
29 73
30static struct clk ck_ref = { 74static struct clk ck_ref = {
31 .name = "ck_ref", 75 .name = "ck_ref",
@@ -54,7 +98,7 @@ static struct arm_idlect1_clk ck_dpll1out = {
54 .enable_bit = EN_CKOUT_ARM, 98 .enable_bit = EN_CKOUT_ARM,
55 .recalc = &followparent_recalc, 99 .recalc = &followparent_recalc,
56 }, 100 },
57 .idlect_shift = 12, 101 .idlect_shift = IDL_CLKOUT_ARM_SHIFT,
58}; 102};
59 103
60static struct clk sossi_ck = { 104static struct clk sossi_ck = {
@@ -63,7 +107,7 @@ static struct clk sossi_ck = {
63 .parent = &ck_dpll1out.clk, 107 .parent = &ck_dpll1out.clk,
64 .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT, 108 .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
65 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1), 109 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
66 .enable_bit = 16, 110 .enable_bit = CONF_MOD_SOSSI_CLK_EN_R,
67 .recalc = &omap1_sossi_recalc, 111 .recalc = &omap1_sossi_recalc,
68 .set_rate = &omap1_set_sossi_rate, 112 .set_rate = &omap1_set_sossi_rate,
69}; 113};
@@ -91,7 +135,7 @@ static struct arm_idlect1_clk armper_ck = {
91 .round_rate = omap1_clk_round_rate_ckctl_arm, 135 .round_rate = omap1_clk_round_rate_ckctl_arm,
92 .set_rate = omap1_clk_set_rate_ckctl_arm, 136 .set_rate = omap1_clk_set_rate_ckctl_arm,
93 }, 137 },
94 .idlect_shift = 2, 138 .idlect_shift = IDLPER_ARM_SHIFT,
95}; 139};
96 140
97/* 141/*
@@ -118,7 +162,7 @@ static struct arm_idlect1_clk armxor_ck = {
118 .enable_bit = EN_XORPCK, 162 .enable_bit = EN_XORPCK,
119 .recalc = &followparent_recalc, 163 .recalc = &followparent_recalc,
120 }, 164 },
121 .idlect_shift = 1, 165 .idlect_shift = IDLXORP_ARM_SHIFT,
122}; 166};
123 167
124static struct arm_idlect1_clk armtim_ck = { 168static struct arm_idlect1_clk armtim_ck = {
@@ -131,7 +175,7 @@ static struct arm_idlect1_clk armtim_ck = {
131 .enable_bit = EN_TIMCK, 175 .enable_bit = EN_TIMCK,
132 .recalc = &followparent_recalc, 176 .recalc = &followparent_recalc,
133 }, 177 },
134 .idlect_shift = 9, 178 .idlect_shift = IDLTIM_ARM_SHIFT,
135}; 179};
136 180
137static struct arm_idlect1_clk armwdt_ck = { 181static struct arm_idlect1_clk armwdt_ck = {
@@ -145,7 +189,7 @@ static struct arm_idlect1_clk armwdt_ck = {
145 .fixed_div = 14, 189 .fixed_div = 14,
146 .recalc = &omap_fixed_divisor_recalc, 190 .recalc = &omap_fixed_divisor_recalc,
147 }, 191 },
148 .idlect_shift = 0, 192 .idlect_shift = IDLWDT_ARM_SHIFT,
149}; 193};
150 194
151static struct clk arminth_ck16xx = { 195static struct clk arminth_ck16xx = {
@@ -212,7 +256,6 @@ static struct clk dsptim_ck = {
212 .recalc = &followparent_recalc, 256 .recalc = &followparent_recalc,
213}; 257};
214 258
215/* Tie ARM_IDLECT1:IDLIF_ARM to this logical clock structure */
216static struct arm_idlect1_clk tc_ck = { 259static struct arm_idlect1_clk tc_ck = {
217 .clk = { 260 .clk = {
218 .name = "tc_ck", 261 .name = "tc_ck",
@@ -224,7 +267,7 @@ static struct arm_idlect1_clk tc_ck = {
224 .round_rate = omap1_clk_round_rate_ckctl_arm, 267 .round_rate = omap1_clk_round_rate_ckctl_arm,
225 .set_rate = omap1_clk_set_rate_ckctl_arm, 268 .set_rate = omap1_clk_set_rate_ckctl_arm,
226 }, 269 },
227 .idlect_shift = 6, 270 .idlect_shift = IDLIF_ARM_SHIFT,
228}; 271};
229 272
230static struct clk arminth_ck1510 = { 273static struct clk arminth_ck1510 = {
@@ -304,7 +347,7 @@ static struct arm_idlect1_clk api_ck = {
304 .enable_bit = EN_APICK, 347 .enable_bit = EN_APICK,
305 .recalc = &followparent_recalc, 348 .recalc = &followparent_recalc,
306 }, 349 },
307 .idlect_shift = 8, 350 .idlect_shift = IDLAPI_ARM_SHIFT,
308}; 351};
309 352
310static struct arm_idlect1_clk lb_ck = { 353static struct arm_idlect1_clk lb_ck = {
@@ -317,7 +360,7 @@ static struct arm_idlect1_clk lb_ck = {
317 .enable_bit = EN_LBCK, 360 .enable_bit = EN_LBCK,
318 .recalc = &followparent_recalc, 361 .recalc = &followparent_recalc,
319 }, 362 },
320 .idlect_shift = 4, 363 .idlect_shift = IDLLB_ARM_SHIFT,
321}; 364};
322 365
323static struct clk rhea1_ck = { 366static struct clk rhea1_ck = {
@@ -359,9 +402,15 @@ static struct arm_idlect1_clk lcd_ck_1510 = {
359 .round_rate = omap1_clk_round_rate_ckctl_arm, 402 .round_rate = omap1_clk_round_rate_ckctl_arm,
360 .set_rate = omap1_clk_set_rate_ckctl_arm, 403 .set_rate = omap1_clk_set_rate_ckctl_arm,
361 }, 404 },
362 .idlect_shift = 3, 405 .idlect_shift = OMAP1510_IDLLCD_ARM_SHIFT,
363}; 406};
364 407
408/*
409 * XXX The enable_bit here is misused - it simply switches between 12MHz
410 * and 48MHz. Reimplement with clksel.
411 *
412 * XXX does this need SYSC register handling?
413 */
365static struct clk uart1_1510 = { 414static struct clk uart1_1510 = {
366 .name = "uart1_ck", 415 .name = "uart1_ck",
367 .ops = &clkops_null, 416 .ops = &clkops_null,
@@ -370,25 +419,37 @@ static struct clk uart1_1510 = {
370 .rate = 12000000, 419 .rate = 12000000,
371 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 420 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
372 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), 421 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
373 .enable_bit = 29, /* Chooses between 12MHz and 48MHz */ 422 .enable_bit = CONF_MOD_UART1_CLK_MODE_R,
374 .set_rate = &omap1_set_uart_rate, 423 .set_rate = &omap1_set_uart_rate,
375 .recalc = &omap1_uart_recalc, 424 .recalc = &omap1_uart_recalc,
376}; 425};
377 426
427/*
428 * XXX The enable_bit here is misused - it simply switches between 12MHz
429 * and 48MHz. Reimplement with clksel.
430 *
431 * XXX SYSC register handling does not belong in the clock framework
432 */
378static struct uart_clk uart1_16xx = { 433static struct uart_clk uart1_16xx = {
379 .clk = { 434 .clk = {
380 .name = "uart1_ck", 435 .name = "uart1_ck",
381 .ops = &clkops_uart, 436 .ops = &clkops_uart_16xx,
382 /* Direct from ULPD, no real parent */ 437 /* Direct from ULPD, no real parent */
383 .parent = &armper_ck.clk, 438 .parent = &armper_ck.clk,
384 .rate = 48000000, 439 .rate = 48000000,
385 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 440 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
386 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), 441 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
387 .enable_bit = 29, 442 .enable_bit = CONF_MOD_UART1_CLK_MODE_R,
388 }, 443 },
389 .sysc_addr = 0xfffb0054, 444 .sysc_addr = 0xfffb0054,
390}; 445};
391 446
447/*
448 * XXX The enable_bit here is misused - it simply switches between 12MHz
449 * and 48MHz. Reimplement with clksel.
450 *
451 * XXX does this need SYSC register handling?
452 */
392static struct clk uart2_ck = { 453static struct clk uart2_ck = {
393 .name = "uart2_ck", 454 .name = "uart2_ck",
394 .ops = &clkops_null, 455 .ops = &clkops_null,
@@ -397,11 +458,17 @@ static struct clk uart2_ck = {
397 .rate = 12000000, 458 .rate = 12000000,
398 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 459 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
399 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), 460 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
400 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */ 461 .enable_bit = CONF_MOD_UART2_CLK_MODE_R,
401 .set_rate = &omap1_set_uart_rate, 462 .set_rate = &omap1_set_uart_rate,
402 .recalc = &omap1_uart_recalc, 463 .recalc = &omap1_uart_recalc,
403}; 464};
404 465
466/*
467 * XXX The enable_bit here is misused - it simply switches between 12MHz
468 * and 48MHz. Reimplement with clksel.
469 *
470 * XXX does this need SYSC register handling?
471 */
405static struct clk uart3_1510 = { 472static struct clk uart3_1510 = {
406 .name = "uart3_ck", 473 .name = "uart3_ck",
407 .ops = &clkops_null, 474 .ops = &clkops_null,
@@ -410,21 +477,27 @@ static struct clk uart3_1510 = {
410 .rate = 12000000, 477 .rate = 12000000,
411 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 478 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
412 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), 479 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
413 .enable_bit = 31, /* Chooses between 12MHz and 48MHz */ 480 .enable_bit = CONF_MOD_UART3_CLK_MODE_R,
414 .set_rate = &omap1_set_uart_rate, 481 .set_rate = &omap1_set_uart_rate,
415 .recalc = &omap1_uart_recalc, 482 .recalc = &omap1_uart_recalc,
416}; 483};
417 484
485/*
486 * XXX The enable_bit here is misused - it simply switches between 12MHz
487 * and 48MHz. Reimplement with clksel.
488 *
489 * XXX SYSC register handling does not belong in the clock framework
490 */
418static struct uart_clk uart3_16xx = { 491static struct uart_clk uart3_16xx = {
419 .clk = { 492 .clk = {
420 .name = "uart3_ck", 493 .name = "uart3_ck",
421 .ops = &clkops_uart, 494 .ops = &clkops_uart_16xx,
422 /* Direct from ULPD, no real parent */ 495 /* Direct from ULPD, no real parent */
423 .parent = &armper_ck.clk, 496 .parent = &armper_ck.clk,
424 .rate = 48000000, 497 .rate = 48000000,
425 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 498 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
426 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), 499 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
427 .enable_bit = 31, 500 .enable_bit = CONF_MOD_UART3_CLK_MODE_R,
428 }, 501 },
429 .sysc_addr = 0xfffb9854, 502 .sysc_addr = 0xfffb9854,
430}; 503};
@@ -457,7 +530,7 @@ static struct clk usb_hhc_ck16xx = {
457 /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */ 530 /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
458 .flags = ENABLE_REG_32BIT, 531 .flags = ENABLE_REG_32BIT,
459 .enable_reg = OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */ 532 .enable_reg = OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */
460 .enable_bit = 8 /* UHOST_EN */, 533 .enable_bit = OTG_SYSCON_2_UHOST_EN_SHIFT
461}; 534};
462 535
463static struct clk usb_dc_ck = { 536static struct clk usb_dc_ck = {
@@ -466,7 +539,7 @@ static struct clk usb_dc_ck = {
466 /* Direct from ULPD, no parent */ 539 /* Direct from ULPD, no parent */
467 .rate = 48000000, 540 .rate = 48000000,
468 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), 541 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
469 .enable_bit = 4, 542 .enable_bit = USB_REQ_EN_SHIFT,
470}; 543};
471 544
472static struct clk usb_dc_ck7xx = { 545static struct clk usb_dc_ck7xx = {
@@ -475,7 +548,7 @@ static struct clk usb_dc_ck7xx = {
475 /* Direct from ULPD, no parent */ 548 /* Direct from ULPD, no parent */
476 .rate = 48000000, 549 .rate = 48000000,
477 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), 550 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
478 .enable_bit = 8, 551 .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT,
479}; 552};
480 553
481static struct clk mclk_1510 = { 554static struct clk mclk_1510 = {
@@ -484,7 +557,7 @@ static struct clk mclk_1510 = {
484 /* Direct from ULPD, no parent. May be enabled by ext hardware. */ 557 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
485 .rate = 12000000, 558 .rate = 12000000,
486 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), 559 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
487 .enable_bit = 6, 560 .enable_bit = SOFT_COM_MCKO_REQ_SHIFT,
488}; 561};
489 562
490static struct clk mclk_16xx = { 563static struct clk mclk_16xx = {
@@ -524,9 +597,13 @@ static struct clk mmc1_ck = {
524 .rate = 48000000, 597 .rate = 48000000,
525 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 598 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
526 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), 599 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
527 .enable_bit = 23, 600 .enable_bit = CONF_MOD_MMC_SD_CLK_REQ_R,
528}; 601};
529 602
603/*
604 * XXX MOD_CONF_CTRL_0 bit 20 is defined in the 1510 TRM as
605 * CONF_MOD_MCBSP3_AUXON ??
606 */
530static struct clk mmc2_ck = { 607static struct clk mmc2_ck = {
531 .name = "mmc2_ck", 608 .name = "mmc2_ck",
532 .ops = &clkops_generic, 609 .ops = &clkops_generic,
@@ -546,7 +623,7 @@ static struct clk mmc3_ck = {
546 .rate = 48000000, 623 .rate = 48000000,
547 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 624 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
548 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), 625 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
549 .enable_bit = 12, 626 .enable_bit = SOFT_MMC_DPLL_REQ_SHIFT,
550}; 627};
551 628
552static struct clk virtual_ck_mpu = { 629static struct clk virtual_ck_mpu = {